gensimを用いてtfidfをしています
wordは形態素解析した単語のリストです
python
1gensim_dictionary = corpora.Dictionary(word) 2corpus = [gensim_dictionary.doc2bow(sentence) for sentence in word] 3tfidf_model = models.TfidfModel(corpus) 4corpus_tfidf = tfidf_model[corpus] 5for i in corpus_tfidf: 6 print(i)
このようにするともちろん実行結果がprintされてくるのですが
tfidfした結果が
(id, tfidfの値)
のようになります
idではなく、もともとの入力した単語のままにできないのですか?
それか、idを単語にもどすコマンドのようなものがあれば
教えていただけるとありがたいです。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/07/28 05:16
2017/07/28 05:47
2017/07/28 05:49
2017/07/28 05:52
2017/07/28 05:53
2017/07/28 05:56
2017/07/28 06:07
2017/07/28 06:10
2017/07/28 06:15
2017/07/28 06:17
2017/07/28 06:18