diff options
author | cedricbonhomme <devnull@localhost> | 2010-02-27 01:01:31 +0100 |
---|---|---|
committer | cedricbonhomme <devnull@localhost> | 2010-02-27 01:01:31 +0100 |
commit | 96737318bee587d1803f6899dfe8166239d48819 (patch) | |
tree | 2956ad9d683b8fc4702d41cde8f7465b8f15ee31 /utils.py | |
parent | Better HTML output. (diff) | |
download | newspipe-96737318bee587d1803f6899dfe8166239d48819.tar.gz newspipe-96737318bee587d1803f6899dfe8166239d48819.tar.bz2 newspipe-96737318bee587d1803f6899dfe8166239d48819.zip |
Minor enhancement.
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -26,8 +26,8 @@ def remove_html_tags(data): def top_words(dic_articles, n=10): """ + Return the n most frequent words in a list. """ - N = 10 words = {} articles_content = "" for rss_feed_id in dic_articles.keys(): @@ -40,7 +40,7 @@ def top_words(dic_articles, n=10): for word in words_gen: words[word] += 1 top_words = sorted(words.iteritems(), - key=lambda(word, count): (-count, word))[:N] + key=lambda(word, count): (-count, word))[:n] return top_words def create_histogram(words, file_name="./var/histogram.png"): @@ -161,4 +161,4 @@ def load_feed(): c.close() return (articles, feeds) - return (articles, feeds)
\ No newline at end of file + return (articles, feeds) |