8 mentioned that some words return +8000 words when querying for synonyms. This is because some lemmata return None as a value when queried for their synset. These words are then mapped to None in the lemma2synset dictionary, which causes the inverse dictionary synset2lemma to return a whole bunch of garbage lemmata when querying None.
This PR fixes that issue by checking whether the synset_id of a lemma is None before creating a mapping. The mapping dictionaries are also changed from defaultdict to dict, as this can still cause None things to be added to the mapping dictionary.
8 mentioned that some words return +8000 words when querying for synonyms. This is because some lemmata return
None
as a value when queried for their synset. These words are then mapped toNone
in thelemma2synset
dictionary, which causes the inverse dictionarysynset2lemma
to return a whole bunch of garbage lemmata when queryingNone
.This PR fixes that issue by checking whether the
synset_id
of a lemma isNone
before creating a mapping. The mapping dictionaries are also changed fromdefaultdict
todict
, as this can still causeNone
things to be added to the mapping dictionary.