NLTK 是否实现了 TF-IDF?
Does NLTK have TF-IDF implemented?
scikit-learn
和 gensim
中有 TF-IDF 实现。
有简单的实现Simple implementation of N-Gram, tf-idf and Cosine similarity in Python
为了避免重新发明轮子,
- NLTK中真的没有TF-IDF吗?
- 是否有我们可以操纵的子包来在 NLTK 中实现 TF-IDF?如果有怎么办?
在这篇博文中,它说 NLTK 没有它。 这是真的吗? http://www.bogotobogo.com/python/NLTK/tf_idf_with_scikit-learn_NLTK.php
NLTK TextCollection class 有一种计算术语 tf-idf 的方法。文档是 here, and the source is here。但是,它显示 "may be slow to load",因此使用 scikit-learn 可能更可取。
我想,有足够的证据可以断定 NLTK 中不存在 TF-IDF:
Unfortunately, calculating tf-idf is not available in NLTK so we'll
use another data analysis library, scikit-learn
更重要的是,源代码不包含任何与 TF-IDF tfidf (or tf-idf). Exceptions are NLTK-contrib, which contains map-reduce implementation 相关的内容。
related question 中提到了几个 tf-idf 库。
已经找到的函数
scikit-learn
和 gensim
中有 TF-IDF 实现。
有简单的实现Simple implementation of N-Gram, tf-idf and Cosine similarity in Python
为了避免重新发明轮子,
- NLTK中真的没有TF-IDF吗?
- 是否有我们可以操纵的子包来在 NLTK 中实现 TF-IDF?如果有怎么办?
在这篇博文中,它说 NLTK 没有它。 这是真的吗? http://www.bogotobogo.com/python/NLTK/tf_idf_with_scikit-learn_NLTK.php
NLTK TextCollection class 有一种计算术语 tf-idf 的方法。文档是 here, and the source is here。但是,它显示 "may be slow to load",因此使用 scikit-learn 可能更可取。
我想,有足够的证据可以断定 NLTK 中不存在 TF-IDF:
Unfortunately, calculating tf-idf is not available in NLTK so we'll use another data analysis library, scikit-learn
更重要的是,源代码不包含任何与 TF-IDF tfidf (or tf-idf). Exceptions are NLTK-contrib, which contains map-reduce implementation 相关的内容。
related question 中提到了几个 tf-idf 库。
已经找到的函数