1
次のようにtf-idfを計算しています。tf-idf(Gensim)を使用してコーパス内で最も重要な単語を取得する
texts=['human interface computer',
'survey user computer system response time',
'eps user interface system',
'system human system eps',
'user response time']
dictionary = corpora.Dictionary(texts)
corpus = [dictionary.doc2bow(text) for text in texts]
tfidf = models.TfidfModel(corpus)
corpus_tfidf = tfidf[corpus]
analyzedDocument = namedtuple('AnalyzedDocument', 'word tfidf_score')
d=[]
for doc in corpus_tfidf:
for id, value in doc:
word = dictionary.get(id)
score = value
d.append(analyzedDocument(word, score))
はしかし、今、私は最高のidf
値を持っている単語を使用して、私のコーパスの中で最も重要な3の単語を識別します。私にそれをする方法を教えてください?次のように