Gensimのフレーズを使用して文中のバイグラムを次のように取得しようとしています。それは「ニューヨーク」として「新しい」、「ニューヨーク」をキャッチしていてもGensimを使用してフレーズを抽出する際のエラー
from gensim.models import Phrases
from gensim.models.phrases import Phraser
documents = ["the mayor of new york was there", "machine learning can be useful sometimes","new york mayor was present"]
sentence_stream = [doc.split(" ") for doc in documents]
#print(sentence_stream)
bigram = Phrases(sentence_stream, min_count=1, threshold=2, delimiter=b' ')
bigram_phraser = Phraser(bigram)
for sent in sentence_stream:
tokens_ = bigram_phraser[sent]
print(tokens_)
、それは彼らができたexample shown in Gensim Websiteで、
しかし、「機械学習」として学習、「機械」をキャッチしていません「機械」という言葉を「機械学習」として「学習」する。
それはおそらくあなたのthreshold
を下回っている
これは本当に素晴らしい答えです。 –