Python句子使用NLTK分割

时间:2016-08-02 17:42:17

标签: python nltk tokenize

我正在努力将段落分成句子。

我用谷歌搜索,发现nltk在分裂句子时效果很好,但我发现了一个问题。

import nltk

sent_detector = nltk.data.load('tokenizers/punkt/english.pickle') 
summary = 'George Stanley McGovern (July 19, 1922 – October 21, 2012) was an American historian, author, U.S. Representative, U.S. Senator, and the Democratic Party presidential nominee in the 1972 presidential election.'
summary = (sent_detector.tokenize(summary))

结果应该只是一句话。但是,它会返回两个句子。

  

[' George Stanley McGovern(1922年7月19日\ x96,2012年10月21日)是美国历史学家,作家,美国代表,美国,参议员和民主党总统在1972年的总统大选中被提名。']

0 个答案:

没有答案