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
955640cd
Commit
955640cd
authored
Apr 19, 2021
by
Jim Hoekstra
👋🏻
Browse files
Merge branch 'issue/MSX-39' into 'develop'
issue MSX-39 See merge request
!14
parents
776190ca
66817694
Changes
3
Show whitespace changes
Inline
Side-by-side
dash_app/graph.py
View file @
955640cd
...
...
@@ -85,6 +85,7 @@ class Graph:
elements
=
elements
,
userZoomingEnabled
=
False
,
userPanningEnabled
=
False
,
maxZoom
=
2.0
,
stylesheet
=
[
{
'selector'
:
'[is_base_node > 0.5]'
,
...
...
dash_app/index.py
View file @
955640cd
import
os
from
dash_app.app
import
app
from
dash_app.layout
import
layout
import
dash_app.callbacks
app
.
layout
=
layout
...
...
dash_app/words.py
View file @
955640cd
...
...
@@ -6,12 +6,12 @@ class AssociatedWords:
def
__init__
(
self
):
print
(
"
\n
Word2Vec model is loading. This can take a couple of minutes."
)
#
self.model = api.load('glove-twitter-200')
#
print(" Word2Vec model is ready. Enjoy!!!\n")
self
.
model
=
api
.
load
(
'glove-twitter-200'
)
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)
gensim_result
=
[(
'apple'
,
1.0
),
(
'banana'
,
1.0
),
(
'strawberry'
,
1.0
)]
gensim_result
=
self
.
model
.
most_similar
(
word
,
topn
=
top_n
)
#
gensim_result = [('apple', 1.0), ('banana', 1.0), ('strawberry', 1.0)]
words
=
self
.
filter_results
(
gensim_result
,
word
)
return
words
...
...
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