In this post, I am going to talk about the relations in WordNet (https://wordnet.princeton.edu) and how you can use these in a Python project. WordNet is a database of English words with different relations between the words.
Take a look at the next four sentences.
- “She went home and had pasta.”
- “Then she cleaned the kitchen and sat on the sofa.”
- “A little while later, she got up from the couch.”
- “She walked to her bed and in a few minutes she was snoring loudly.”
In Natural Language Processing, we try to use computer programs to find the meaning of sentences. In the above four sentences, with the help of WordNet, a computer program will be able to identify the following –
- “pasta” is a type of dish.
- “kitchen” is a part of “home”.
- “sofa” is the same thing as “couch”.
- “snoring” implies “sleeping”.
Let’s get started with using WordNet in Python. It is included as a part of the NLTK (http://www.nltk.org/) corpus. To use it, we need to import it first.
>>> from nltk.corpus import wordnet as wn