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
對象中單詞的詞頻?