我一直在使用Ruby Classifier library來classify privacy policies。我得出的結論是,這個庫中內置的簡單的單詞袋方法是不夠的。爲了提高我的分類準確度,我想除了單詞之外還要訓練n-gram的分類器。在ngrams上訓練樸素貝葉斯分類器
我想知道是否有一個庫用於預處理文檔以獲得相關n-gram(並正確處理標點符號)。一個想法是,我可以預處理的文件和飼料僞的n-gram與Ruby的分類,如:
wordone_wordtwo_wordthree
或者,也許有更好的方式來這樣做,比如有一個圖書館從getgo構建的基於ngram的樸素貝葉斯分類。如果他們完成了這項工作,我很樂於使用Ruby以外的其他語言(如果需要的話,Python似乎是一個很好的候選人)。
很棒的答案+1 – Yavar 2012-04-09 20:39:41
與許多Ruby相比,NLTK看起來很棒。 Python獲勝了,謝謝! – babonk 2012-04-09 21:49:47
@babonk我的榮幸。我發現nltk是一個使用和令人難以置信的強大的快樂,希望你有它的樂趣:D – 2012-04-09 21:50:43