Spaces:
Sleeping
Sleeping
Bug fix WN
Browse files
app.py
CHANGED
@@ -147,8 +147,11 @@ if st.session_state.is_helpful['ask'] == True:
|
|
147 |
ask_if_helped()
|
148 |
|
149 |
# JS
|
150 |
-
def postproc_wn(related_words):
|
151 |
-
|
|
|
|
|
|
|
152 |
related_words = [word.replace("_", " ") for word in related_words]
|
153 |
|
154 |
return related_words
|
@@ -163,7 +166,8 @@ def get_available_cues(target):
|
|
163 |
synset_target = wn.synsets(target, pos=wn.NOUN)[0]
|
164 |
|
165 |
if wn.synonyms(target):
|
166 |
-
available_cues['
|
|
|
167 |
|
168 |
if synset_target.hypernyms():
|
169 |
available_cues['Hypernyms'] = postproc_wn(synset_target.hypernyms())
|
|
|
147 |
ask_if_helped()
|
148 |
|
149 |
# JS
|
150 |
+
def postproc_wn(related_words, syns=False):
|
151 |
+
if syns:
|
152 |
+
related_words = [word.split('.')[0] if word[0] != "." else word.split('.')[1] for word in related_words]
|
153 |
+
else:
|
154 |
+
related_words = [word.name().split('.')[0] if word.name()[0] != "." else word.name().split('.')[1] for word in related_words]
|
155 |
related_words = [word.replace("_", " ") for word in related_words]
|
156 |
|
157 |
return related_words
|
|
|
166 |
synset_target = wn.synsets(target, pos=wn.NOUN)[0]
|
167 |
|
168 |
if wn.synonyms(target):
|
169 |
+
available_cues['synonyms'] = postproc_wn(wn.synonyms(target)[0], syns=True)
|
170 |
+
#available_cues['Synonyms'] = [word.split('.')[0] if word[0] != "." else word.split('.')[1] for word in wn.synonyms(target)[0]]
|
171 |
|
172 |
if synset_target.hypernyms():
|
173 |
available_cues['Hypernyms'] = postproc_wn(synset_target.hypernyms())
|