我在另一台计算机上运行nltk python程序,它运行得很好,但是在我的计算机上,我遇到了以下错误:
Connected to pydev debugger (build 163.10154.50)
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.3.2\helpers\pydev\pydevd.py", line 1596, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.3.2\helpers\pydev\pydevd.py", line 974, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "D:/Text Mining/Text mining-20161123T063352Z/Text mining/SentAnal/SentimentAnalysis.py", line 151, in <module>
analyze()
File "D:/Text Mining/Text mining-20161123T063352Z/Text mining/SentAnal/SentimentAnalysis.py", line 135, in analyze
negativeFeatures, positiveFeatures = process_categories()
File "D:/Text Mining/Text mining-20161123T063352Z/Text mining/SentAnal/SentimentAnalysis.py", line 119, in process_categories
words = stem_words(words)
File "D:/Text Mining/Text mining-20161123T063352Z/Text mining/SentAnal/SentimentAnalysis.py", line 37, in stem_words
words2.append(porter.stem(word))
File "C:\Python27\lib\site-packages\nltk\stem\porter.py", line 665, in stem
stem = self._step1b(stem)
File "C:\Python27\lib\site-packages\nltk\stem\porter.py", line 376, in _step1b
lambda stem: (self._measure(stem) == 1 and
File "C:\Python27\lib\site-packages\nltk\stem\porter.py", line 258, in _apply_rule_list
if suffix == '*d' and self._ends_double_consonant(word):
File "C:\Python27\lib\site-packages\nltk\stem\porter.py", line 214, in _ends_double_consonant
word[-1] == word[-2] and
IndexError: string index out of range
Process finished with exit code 1
在这两台计算机上,我都在使用python2.7.13和Pycharm社区版。在
原因是什么?谢谢!在
两台机器上处理的数据不同。数据集中可能有一个单词在你的机器上只有一个字母。在
相关问题 更多 >
编程相关推荐