aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r
diff options
context:
space:
mode:
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r--pyaggr3g470r/duplicate.py (renamed from pyaggr3g470r/compare.py)6
-rw-r--r--pyaggr3g470r/views.py4
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'])
bgstack15