-1
私は別のコンピュータ上で私NLTKのPythonプログラムを実行し、それが正常に動作しますが、私のコンピュータ上で、私はこれらのエラーを取得しています:私は、Pythonを使用しています両方のコンピュータ上ではIndexError:範囲エラーのうち、文字列のインデックス
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
2.7.13およびPycharm Community Editionを参照してください。
原因は何でしょうか?ありがとう!
エラーからかなりクリア。 'word [-1] == word [-2]'変数worldには2つ以下の要素があります。 –
私は正確な言葉が何であるか知りませんが、その言葉はただ一つの文字しかないと聞きます –