Search code examples
pythonwordnet

Antonyms within a sentence Wordnet


I have a corpus and am looking to find whether there is an antonymy relationship within each sentence, using Wordnet.

Does anyone have a clue whether looking for antonyms in Wordnet is at all possible? Thank you!


Solution

  • Antonyms apply at a lemma level, not at a synset level. (According to documentation and this issue in the nltk google code project.) Using an example from the latter link:

    >>> wordnet.synset('light.a.01').antonyms()
    []
    >>> wordnet.lemma('light.a.01.light').antonyms()
    [Lemma('heavy.a.01.heavy')]