我試圖確定一組政府文件中的重要條款。生成術語頻率是沒有問題的。tf-idf使用來自Google的單數頻率數據
對於文檔頻率,我希望使用Peter Norvig發佈的handy Python scripts and accompanying data在他的「美麗數據」一章中,其中包括來自Web的龐大數據集中的unigrams頻率。
我的TF-IDF的理解,但問題在於,「文檔頻率」是指含有一個詞的文檔數量,總詞是這個詞,而不是數量這就是我們從弱勢族羣得到腳本。我仍然可以將這些數據用於粗略的tf-idf操作嗎?
下面是一些樣本數據:
word tf global frequency
china 1684 0.000121447
the 352385 0.022573582
economy 6602 0.0000451130774123
and 160794 0.012681757
iran 2779 0.0000231482902018
romney 1159 0.000000678497795593
廣發簡單地將TF賦予「了」得分高於「經濟」,這是不對的。是否有一些我錯過的基本數學,也許?
有趣的問題。據我的理解:你所說的「gf」事實上已經是相反的了,對吧?所以,當你說'用'gf'來劃分'tf'_時,你實際上是用'gf'_表示_multiplying'tf',對吧? – jogojapan
我不相信gf是相反的。 「The」構成巨型語料庫所有單詞的2.2%,而「and」爲1.2%,「china」爲0.012%。 –
哦,所以你已經將全局計數除以總字數來獲得'gf'。那麼應該給出合理的結果(儘管這種劃分當然是不必要的,因爲它唯一做的是引入一個常數因子)。實際上,從桌子上用'gf'分開'tf' '和'爲15,610,504,而'經濟'爲146,343,374。這有什麼不好? – jogojapan