I made a list of synonyms of the word 'good' and I even told the program not to append a word, if it is already in the list. Unfortunately, I still have dublicates. This is my code:
import nltk
from nltk.corpus import wordnet
synonyms = []
for syn in wordnet.synsets("good"):
    for l in syn.lemmas():
        if str(l) not in synonyms:
            synonyms.append(l.name())
print(synonyms)
And the output is the following
['good', 'good', 'goodness', 'good', 'goodness', 'commodity', 'trade_good', 
'good', 'good', 'full', 'good', 'good', 'estimable', 'good', 'honorable', 
'respectable', 'beneficial', 'good', 'good', 'good', 'just', 'upright', 
'adept', 'expert', 'good', 'practiced', 'proficient', 'skillful', 'skilful',
 'good', 'dear', 'good', 'near', 'dependable', 'good', 'safe', 'secure', 
'good', 'right', 'ripe', 'good', 'well', 'effective', 'good', 'in_effect', 
'in_force', 'good', 'good', 'serious', 'good', 'sound', 'good', 'salutary', 
'good', 'honest', 'good', 'undecomposed', 'unspoiled', 'unspoilt', 'good', 
'well', 'good', 'thoroughly', 'soundly', 'good']
Does somebody know why this is happening?
 
     
     
     
    