Closed AmitMY closed 3 days ago
Hi @AmitMY, sorry for the delayed response. When you accessed the OMW website, you found the synset 02934451-n, which has lemmas in French. In the Python code, you search for 02960501-n, which does not. Note that not all synsets have lemmas in all wordnets.
Closing this as there is no follow-up, no open questions, and the report does not show any bug.
I accessed https://compling.upol.cz/ntumc/cgi-bin/wn-gridx.cgi?gridmode=grid&synset=02934451-n And saw that there are translations, for example in French.
I then tried to get it via code:
nltk.download("wordnet") nltk.download("omw-1.4") nltk.download("extended_omw")
Get the synset using its ID
synset = wn.synset_from_pos_and_offset('n', 2960501)
List all available languages in OMW
languages = wn.langs()
Get translations in all languages
translations = {} for lang in languages: lemmas = synset.lemmas(lang=lang) if lemmas: # If there are lemmas for this language translations[lang] = [lemma.name() for lemma in lemmas]
Print translations
for lang, words in translations.items(): print(f"{lang}: {' / '.join(words)}")