【发布时间】:2020-11-05 12:06:36
【问题描述】:
通过Texthero计算TF-IDF有什么区别:
import texthero as hero
s = pd.Series(["Sentence one", "Sentence two"])
hero.tfidf(s, return_feature_names=True)
0 [0.5797386715376657, 0.8148024746671689, 0.0]
1 [0.5797386715376657, 0.0, 0.8148024746671689]
['Sentence', 'one', 'two'])
还有来自 sklearn 的 TD-IDF?鉴于这些例句,我希望 sklearn 的结果。
from sklearn.feature_extraction.text import TfidfVectorizer
...
Sentence one two
0 0.0 0.346574 0.000000
1 0.0 0.000000 0.346574
【问题讨论】:
标签: python tf-idf tfidfvectorizer