What is WordNet?
WordNet is a huge lexical database for the English Language. There are 155,287 words and 117,659 synonym sets included in the WordNet.
The synonymous words that express the same concept are present as groupings called synsets (set of synonyms) in WordNet.
Installing and Importing WordNet
WordNet can be downloaded from the NLTK library in python.
import nltk
nltk.download('wordnet')

from nltk.corpus import wordnet as wn
Let’s explore the synsets.
For example, if I take any word such as “Dog,” the synsets will have similar words to the word “Dog.”
syn = wn.synsets('dog')
print(syn)
[Synset('dog.n.01'), Synset('frump.n.01'), Synset('dog.n.03'), Synset('cad.n.01'), Synset('frank.n.02'), Synset('pawl.n.01'), Synset('andiron.n.01'), Synset('chase.v.01')]
print(syn[0].name())
dog.n.01
The above representation signifies that the entry is for the word ‘dog,’ which is a noun ‘n,’ and the entry number is 01.
print(syn[0].definition())
a member of the genus Canis (probably descended from the common wolf) that has been domesticated by man since prehistoric times; occurs in many breeds
print(syn[0].examples())
['the dog barked all night']




