Ich versuche, Wordnet als Thesarus zu verwenden, also habe ich eine Liste von Wörtern und ich muss für jedes Wort seine Synonyme sammeln. Ich habe versucht, dieseSuche die Synonyme für Wörter in Wordnet
from nltk.corpus import wordnet as wn
for i,j in enumerate(wn.synsets('dog')):
print (j.lemma_names)
Dieser Code die folgende Ausgabe
<bound method Synset.lemma_names of Synset('dog.n.01')>
<bound method Synset.lemma_names of Synset('frump.n.01')>
<bound method Synset.lemma_names of Synset('dog.n.03')>
<bound method Synset.lemma_names of Synset('cad.n.01')>
<bound method Synset.lemma_names of Synset('frank.n.02')>
<bound method Synset.lemma_names of Synset('pawl.n.01')>
<bound method Synset.lemma_names of Synset('andiron.n.01')>
<bound method Synset.lemma_names of Synset('chase.v.01')>
Aber ich will gibt nur die Synonyme in einer Liste sammeln, so wird der Ausgang sein wie diese
[ 'frump' , 'cad', 'frank', 'Klinke', 'andiron', 'chase']
Was passiert, wenn Sie die letzte Zeile 'print (j.lemma_names)' in 'print (j.lemma_names())' ändern? – davedwards