Have a script for getting italian synonyms from Wordnet like this:
from nltk.corpus import wordnet as wn
it_lemmas = wn.lemmas("problema", lang="ita")
hypernyms = it_lemmas[0].synset().hypernyms()
print(hypernyms[0].lemmas(lang="ita"))
When I do the looping I get message that list indices must be integers or slices, not Lemma
How should I do the looping to get not only one value ([0]) but all the values in this dictionary (the amount can be different) and print them all?
from nltk.corpus import wordnet as wn
it_lemmas = wn.lemmas("problema", lang="ita")
for i in range(len(it_lemmas)):
hypernyms = it_lemmas[i].synset().hypernyms()
for i in range(len(hypernyms)):
syn = hypernyms[i].lemmas(lang="ita")
print (syn)