diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-11-28 19:06:14 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-11-28 19:06:14 +0100 |
commit | cb35a9b23a855b75ea7c429b44f320a4ab9c29f3 (patch) | |
tree | 0a7d9c3e63e5a8849476c6011fd98222e78c6513 /pyaggr3g470r | |
parent | Updated README.rst and vagrant bootstrap file. (diff) | |
download | newspipe-cb35a9b23a855b75ea7c429b44f320a4ab9c29f3.tar.gz newspipe-cb35a9b23a855b75ea7c429b44f320a4ab9c29f3.tar.bz2 newspipe-cb35a9b23a855b75ea7c429b44f320a4ab9c29f3.zip |
Misc fixes for the installation/uage of scipy/numpy/nltk.
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r-- | pyaggr3g470r/duplicate.py (renamed from pyaggr3g470r/compare.py) | 6 | ||||
-rw-r--r-- | pyaggr3g470r/views.py | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/pyaggr3g470r/compare.py b/pyaggr3g470r/duplicate.py index 80f3d694..6220a3cb 100644 --- a/pyaggr3g470r/compare.py +++ b/pyaggr3g470r/duplicate.py @@ -37,7 +37,11 @@ def compare_documents(feed): """ Compare a list of documents by pair. """ - nltk.download("punkt") + downloaded = nltk.download("punkt") + if not downloaded: + # Ubuntu packaged version still uses old URL + dl = nltk.downloader.Downloader("https://nltk.github.com/nltk_data/") + dl.download("punkt") duplicates = [] for pair in itertools.combinations(feed.articles, 2): try: diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py index c9acec2d..c6c7b5b3 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -42,7 +42,7 @@ from sqlalchemy.exc import IntegrityError from werkzeug import generate_password_hash import conf -from pyaggr3g470r import utils, notifications, export, compare +from pyaggr3g470r import utils, notifications, export, duplicate from pyaggr3g470r import app, db, allowed_file, babel from pyaggr3g470r.models import User, Feed, Article, Role from pyaggr3g470r.decorators import feed_access_required @@ -484,7 +484,7 @@ def duplicates(feed_id=None): """ feed = Feed.query.filter(Feed.user_id == g.user.id, Feed.id == feed_id).first() duplicates = [] - duplicates = compare.compare_documents(feed) + duplicates = duplicate.compare_documents(feed) return render_template('duplicates.html', duplicates=duplicates) @app.route('/index_database', methods=['GET']) |