【发布时间】:2019-04-08 18:16:51
【问题描述】:
我是 NLP 的新手。我正在尝试在 python 3.7 上使用 nlp 标记句子。所以我使用了以下代码
import nltk
text4="This is the first sentence.A gallon of milk in the U.S. cost
$2.99.Is this the third sentence?Yes,it is!"
x=nltk.sent_tokenize(text4)
x[0]
我原以为 x[0] 会返回第一句话,但我得到了
Out[4]: 'This is the first sentence.A gallon of milk in the U.S. cost $2.99.Is this the third sentence?Yes,it is!'
我做错了吗?
【问题讨论】:
-
标点符号之间没有空格,因此它们不是有效句子