【发布时间】:2016-03-10 07:44:18
【问题描述】:
如何用单个句号替换多个句号,以便 NLTK 句子标记器可以将它们区分为 2 个不同的句子
例如
a = "the food was good...what about the bread huh..Awesome"
如果我使用
nltk.sent_tokenize(a)
它给了我
['the food was good...what about the bread huh..Awesome']
但我想要的是
['the food was good.', 'what about the bread huh.', 'Awesome']
我该怎么做?
【问题讨论】:
-
您是否检查过省略号几乎总是在您的语料库中结束一个句子?因为情况并非总是如此:“这……很有趣”。