aboutsummaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
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