ValueError on Vectors.most_similar #10465
Replies: 2 comments 2 replies
-
Ok, found the "culprit" - I'm using en_core_web_sm that has
switching to a different model, such as en_core_web_md the error is gone |
Beta Was this translation helpful? Give feedback.
-
Coming back to my "original" problem, I have written a simple script, to find word "synonims" from numpy import asarray
from spacy import load # @UnresolvedImport
nlp = load('en_core_web_md')
words = ['cinema']
keyss, _, scoress = nlp.vocab.vectors.most_similar(asarray([nlp(word).vector
for word in words]),
n=10)
for word, keys, scores in zip(words, keyss, scoress):
strings = [nlp.vocab.strings[key] for key in keys]
print(f'word={word!r}')
for string, score in zip(strings, scores):
print(f'\tstring={string!r}, score={score!r}') this snippet "works" - as in extract something. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi.
I'm trying to understand if it's possible to use spacy to find synonyms. I found that I could use
Vectors.most_similar
, but I'm having troubles with even a basic code.This snippet is basically the example I found on the most_similar documentation, but if I run it, it ends with this error:
can you help me understanding what I'm doing "wrong"?
Beta Was this translation helpful? Give feedback.
All reactions