2009-11-25 37 views
1

假設我給你一個網址......你能分析這些文字並吐出該網頁的「關鍵詞」嗎? (除了使用元標籤)有什麼好的網頁摘要?

是否有良好的開源摘要? (最好的Python)

回答

2

一個簡單的文本摘要裝置:http://pythonwise.blogspot.com/2008/01/simple-text-summarizer.html

算法:

1. For each word, calculate it's frequency in the document 
2. For each sentence in the document 
     score(sentence) = sum([freq(word) for word in sentence]) 
3. Print X top sentences such that their size < MAX_SUMMARY_SIZE 
+0

這樣做的問題是,像「它」,「和」等常用詞會得到優先考慮。一個更好的想法是使用相對頻率的概念,在這個概念中,你得到一個單詞的頻率,並用一個表示常規文本出現頻率的值來劃分它。 – 2009-12-04 00:09:38