我正在localhost上用nltk运行python脚本。我的代码是:
#!C:\Users\fname lname\AppData\Local\Programs\Python\Python37-32\python.exe
print("Content-type: text/plain\n")
print("Single Quotes")
print("checkkk")
from nltk.tokenize import sent_tokenize, word_tokenize
EXAMPLE_TEXT = "Hello Mr. Smith, how are you doing today? The weather is great, and Python is awesome. The sky is pinkish-blue. You shouldn't eat cardboard."
print(sent_tokenize(EXAMPLE_TEXT))
输出如下:
Single Quotes
checkkk
Content-type: text/plain
Single Quotes
checkkk
问题是:它没有考虑在这一行之后导入nltk和代码。请帮忙。你知道吗
检查是否已下载
nltk.sent_tokenize()
所需的数据文件。使用
nltk.download('punkt')
下载它们。你知道吗相关问题 更多 >
编程相关推荐