Skip to content

Commit

Permalink
fix: #85
Browse files Browse the repository at this point in the history
  • Loading branch information
severinsimmler committed Nov 29, 2018
1 parent 9c856fb commit 408d709
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions application/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ def get_stopwords(data, corpus):
"""
logging.info("Fetching stopwords...")
if "stopwords" in data:
_, stopwords = load_textfile(data["stopwords"])
stopwords = cophi.model.Document(stopwords).tokens
stopwords = cophi.model.Document(data["stopwords"]).tokens
else:
stopwords = corpus.mfw(data["mfw"])
return stopwords
Expand All @@ -152,7 +151,9 @@ def get_data(corpus, topics, iterations, stopwords, mfw):
"topics": int(flask.request.form["topics"]),
"iterations": int(flask.request.form["iterations"])}
if flask.request.files.get("stopwords", None):
data["stopwords"] = flask.request.files["stopwords"]
textfile = flask.request.files["stopwords"]
_, stopwords = load_textfile(textfile)
data["stopwords"] = stopwords
else:
data["mfw"] = int(flask.request.form["mfw"])
return data
Expand Down Expand Up @@ -262,4 +263,4 @@ def wrapper():
q.put(target(*args))
t = threading.Thread(target=wrapper)
t.start()
return q
return q

0 comments on commit 408d709

Please sign in to comment.