0
NLTK
を使用してストップワードを削除しようとしています。 4行目に構文エラーがありますが、最初の3行は正常に動作しています。python3のデータセットでストップワードを実行中にエラーが発生しました
File "<stdin>", line 1
print [i for i in senten
^
SyntaxError: invalid syntax
マイコード:
from nltk.corpus import stopwords
stop = stopwords.words('english')
sentence = "this is a foo bar sentence"
print [i for i in sentence.split() if i not in stop]