gensim.corpora.Dictionary是否保存了术语频率?gensim.corpora.Dictionary是否有保存频率的频率?
从gensim.corpora.Dictionary
,它可能得到的话文档频率(即怎么一个特定的词出现在许多文件):
from nltk.corpus import brown
from gensim.corpora import Dictionary
documents = brown.sents()
brown_dict = Dictionary(documents)
# The 100th word in the dictionary: 'these'
print('The word "' + brown_dict[100] + '" appears in', brown_dict.dfs[100],'documents')
[出]:
The word "these" appears in 1213 documents
而且有filter_n_most_frequent(remove_n)
函数可以删除第n个最常用的标记:
filter_n_most_frequent(remove_n)
过滤掉出现在文档中的'remove_n'最常见的标记。修剪后,缩小词ID中的空白。
注意:由于间隙缩小,在调用此函数之前和之后,同一个单词可能会有不同的单词ID!
filter_n_most_frequent
函数是根据文档频率还是词频删除第n个最频繁的函数?
如果是后者,是否有某种方法可以访问gensim.corpora.Dictionary
对象中单词的词频?