aboutsummaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2010-02-27 01:01:31 +0100
committercedricbonhomme <devnull@localhost>2010-02-27 01:01:31 +0100
commit96737318bee587d1803f6899dfe8166239d48819 (patch)
tree2956ad9d683b8fc4702d41cde8f7465b8f15ee31 /utils.py
parentBetter HTML output. (diff)
downloadnewspipe-96737318bee587d1803f6899dfe8166239d48819.tar.gz
newspipe-96737318bee587d1803f6899dfe8166239d48819.tar.bz2
newspipe-96737318bee587d1803f6899dfe8166239d48819.zip
Minor enhancement.
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/utils.py b/utils.py
index 4289a7ee..e2294446 100644
--- a/utils.py
+++ b/utils.py
@@ -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)
bgstack15