aboutsummaryrefslogtreecommitdiff
path: root/pyAggr3g470r.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2010-09-08 23:32:05 +0200
committercedricbonhomme <devnull@localhost>2010-09-08 23:32:05 +0200
commit2a5e7b5e92cc1f5015b029055e85806c10f85308 (patch)
treefd0d304eeb4914ba32f49b8260cdd61cc84c6d97 /pyAggr3g470r.py
parentImprovement of the description of articles page. (diff)
downloadnewspipe-2a5e7b5e92cc1f5015b029055e85806c10f85308.tar.gz
newspipe-2a5e7b5e92cc1f5015b029055e85806c10f85308.tar.bz2
newspipe-2a5e7b5e92cc1f5015b029055e85806c10f85308.zip
Articles are now stored in the Python blist high performance data-structure. if blist module not present, simple lists are used.
Diffstat (limited to 'pyAggr3g470r.py')
-rwxr-xr-xpyAggr3g470r.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py
index 7666c819..b5169268 100755
--- a/pyAggr3g470r.py
+++ b/pyAggr3g470r.py
@@ -234,15 +234,10 @@ class Root:
self.top_words = utils.top_words(self.articles, n=50, size=int(word_size))
html += "<h1>Statistics</h1>\n<br />\n"
if "oice" not in utils.IMPORT_ERROR:
- nb_french = 0
- nb_english = 0
+ counter = Counter()
for rss_feed_id in self.articles.keys():
for article in self.articles[rss_feed_id]:
- if article[6] == 'french':
- nb_french += 1
- elif article[6] == 'english':
- nb_english += 1
- nb_other = self.nb_articles - nb_french - nb_english
+ counter[article[6]] += 1
html += "Minimum size of a word: "
html += """<form method=get action="/management/"><select name="word_size">\n"""
@@ -262,9 +257,9 @@ class Root:
html += """<a href="http://pypi.python.org/pypi/oice.langdet/">oice.langdet</a>"""
else:
html += "<ul>\n"
- for language in ['english', 'french', 'other']:
+ for language in ['english', 'french']:
html += """\t<li>%s articles in <a href="/language/%s">%s</a></li>\n""" % \
- (locals()["nb_"+language], language, language)
+ (counter[language], language, language)
html += "</ul>\n<br />"
html += "<hr />\n"
bgstack15