tool I can use to determine the most common words...
... so something with reasonable accuracy is good enough.
我建議先嚐試使用UNIX文本工具。 從coursera Natural Language Processing當然Word Tokenization課程,YouTube鏈接是here。一個簡單的教程here。
爲此,我們使用tr,uniq和sort。如果您之前使用過unix文本工具,則此處爲完整命令。
tr -sc 'A-Z' 'a-z' < *.txt | tr -sc 'A-Za-z' '\n' | sort | uniq -c | sort -n -r
否則下面是對每個部分的解釋。
tr -sc 'A-Za-z' '\n' < filename.txt
該命令以filename.txt改變每個單詞,基本上你在每個單詞之後添加新行。
tr -sc 'A-Za-z' '\n' < *.txt
與上面相同,但是您的目錄中的所有txt文件。
tr -sc 'A-Za-z' '\n' < *.txt | sort
管你的命令進行排序。首先將從很多「一」字開始。
tr -sc 'A-Za-z' '\n' < *.txt | sort | uniq -c
將結果排序到uniq命令並對其進行計數。
tr -sc 'A-Za-z' '\n' < *.txt | sort | uniq -c | sort -n -r
再次管理你的命令,以查看最常用的,最常用的單詞。
問題就在這裏: '和', '與' 計數兩次
tr -sc 'A-Z' 'a-z' < *.txt | tr -sc 'A-Za-z' '\n' | sort | uniq -c | sort -n -r
或
tr '[:upper:]' '[:lower:]' < *.txt | tr -sc 'A-Za-z' '\n' | sort | uniq -c | sort -n -r
改變所有你的話再次小寫和相同的管道。這會讓你在你的文件中最常用的單詞。
我的視頻系列演示瞭如何使用RapidMiner(FOSS,GUI)來做到這一點:http://vancouverdata.blogspot.ca/2010/11/text-analytics-with-rapidminer-loading.html – 2013-03-25 19:09:48
'R'是一個這是一個很好的工具。如果你可以發佈一個Q樣本數據和你想要的結果的片段,那麼你可能會得到一些代碼來幫助你。使用'[r] [text-mining]'搜索SO,您可能會發現可以輕鬆適應您的用例的代碼。 – Ben 2013-03-27 07:00:45