0
NLTKで実際に非常に簡単に解決できる問題があります。私は私の問題の解決策を見つけましたが、そこに彼らはNLTK使用しないでください。NLTK Python 3を使って特定のBigramを見つける
how can I count the specific bigram words?
それはNLTK機能でそれを行うことは可能ですか?私はfood_low.txt
から単語がcleaned2.txt
に表示される頻度を数えています
food = open("food_low.txt")
lines = food.read().split(',')[:-1]
raw = wordlists.words("cleaned2.txt")
fdist = nltk.FreqDist(w.lower() for w in raw)
with io.open('nltk1.txt', 'w', encoding="utf-8") as h:
for m in lines:
if fdist[m] > 0:
print(m + ':', fdist[m], end=' ', file = h)
:
は、ここに私のコードです。私の問題は、food_low.txt
にいくつかのバイグラムの言葉があり、数えられていないことです。どのようにしてバイグラムを数えることができますか?