May-24-2017, 09:49 AM
You check against an empty list. It evaluates to False:
In [1]: bool([]) Out[1]: FalseSo you can just:
try: if noun[-2:] == "st": poss_verb = noun.lower() + "eln" if gn.synsets(poss_verb, pos='v'): poss_verb = noun.lower() + "ern" if gn.synsets(poss_verb, pos='v'): poss_verb = noun.lower().replace('u', 'ü') + "eln" if gn.synsets(poss_verb, pos='v'): poss_verb = noun.lower().replace('a', 'ä') + "igen" return poss_verb except: return None