Home>

I'm writing code that prints synonyms for words:

from nltk.corpus import wordnet
synonyms= []
for syn in wordnet.synsets("hi"):
    for lm in syn.lemmas():
             synonyms.append(lm.name())
print(set(synonyms))

But, this code displays synonyms only for English words, but how to make it output for Russian words as well?

I think that I will not be mistaken if I say that there are 2 ways. 1) Find a lib that does it, 2) Write such a lib yourself

Namerek2022-01-30 06:21:39

Solution "on the forehead". Download a dictionary of synonyms, drive it into the database and pull them out of the database, taking into account morphology and context.

Zombotron2022-01-30 08:34:45

try pypi.org/project/PyDictionary

Акмаль2022-01-30 08:56:30