フィーチャセットという名前の変数があります。印刷されるとき、値は次のようになります。IndexError:配列の範囲外のインデックスをリストします
>>> featuresets[:2]
[({'contains2(left)': True, 'contains2(this)': True, 'contains2(now)': True, 'contains2(with)': True, 'contains1(now)': False, 'contains2(name)': True, 'contains2(gay)': True, 'contains2(im)': True}, 'Statement'), ({'contains2(p)': True, 'contains1(:)': False, 'contains2(:)': True}, 'Emotion')]
ラベル(クラス変数)をPythonの配列にフィルタリングする必要があります。
ここで私は
referenceSets=[]
testSets=[]
for i, (features, label) in enumerate(featuresets):
referenceSets[i].append(label)
predicted = classifier.classify(features)
testSets[i].append(label)
を書かれているが、私はエラーを取得していたコードは、
Traceback (most recent call last):
File "<pyshell#37>", line 2, in <module>
referenceSets[i].append(label)
IndexError: list index out of range
は、誰かがここに私の問題が何であるかを言及してくださいすることができます。