Commit
·
4599208
1
Parent(s):
984ad29
Update app.py
Browse files
app.py
CHANGED
@@ -59,10 +59,15 @@ if form_button:
|
|
59 |
else:
|
60 |
model = load_w2v('models/stihi_ru_word2vec.bin')
|
61 |
|
|
|
|
|
|
|
|
|
|
|
62 |
output = get_collocates_for_word_type(model=model,
|
63 |
word=target_word,
|
64 |
target_pos=target_word_pos,
|
65 |
topn=collocate_number,
|
66 |
restrict_vocab=restrict_vocab)
|
67 |
-
|
68 |
st.write(output)
|
|
|
59 |
else:
|
60 |
model = load_w2v('models/stihi_ru_word2vec.bin')
|
61 |
|
62 |
+
try:
|
63 |
+
restrict_vocab = int(restrict_vocab.strip())
|
64 |
+
except ValueError:
|
65 |
+
restrict_vocab = None
|
66 |
+
|
67 |
output = get_collocates_for_word_type(model=model,
|
68 |
word=target_word,
|
69 |
target_pos=target_word_pos,
|
70 |
topn=collocate_number,
|
71 |
restrict_vocab=restrict_vocab)
|
72 |
+
|
73 |
st.write(output)
|