Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FoodInformatics
msx-tool
Commits
fb98378d
Commit
fb98378d
authored
May 06, 2021
by
Jim Hoekstra
👋🏻
Browse files
word is made lowercase before it is fed to the word2vec model
parent
955640cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
dash_app/words.py
View file @
fb98378d
...
...
@@ -10,9 +10,10 @@ class AssociatedWords:
print
(
" Word2Vec model is ready. Enjoy!!!
\n
"
)
def
get_associated_words
(
self
,
word
,
top_n
=
10
):
gensim_result
=
self
.
model
.
most_similar
(
word
,
topn
=
top_n
)
lowercase_word
=
word
.
lower
()
gensim_result
=
self
.
model
.
most_similar
(
lowercase_word
,
topn
=
top_n
)
# gensim_result = [('apple', 1.0), ('banana', 1.0), ('strawberry', 1.0)]
words
=
self
.
filter_results
(
gensim_result
,
word
)
words
=
self
.
filter_results
(
gensim_result
,
lowercase_
word
)
return
words
def
filter_results
(
self
,
gensim_result
,
base_word
):
...
...
scripts/run_debug_server.py
View file @
fb98378d
...
...
@@ -2,4 +2,4 @@ from dash_app.index import app
if
__name__
==
'__main__'
:
app
.
run_server
(
debug
=
Tru
e
)
app
.
run_server
(
debug
=
Fals
e
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment