Synsets for a word in WordNet NLP

Aparna Mishra
1 min readOct 27, 2021

Wordnet is a dictionary or lexical database i.e. it’s a special type of dictionary designed for natural language processing. It helps us in finding synonym , word relevancy etc. It is also used for sentiment analysis, text summarization etc.

What are Synsets? A simple definition is a group of synonym are synsets.

Wordnet can be imported from nltk using below snippet:

import nltk 
from nltk.corpus import wordnet

We can look for a word in wordnet using below snippet:

#creating a variable 'word'
word = 'Enter the word you want to look for!!'
#looking for the word using synsets() function
syn = wordnet.synsets(word)[0]

Below are two examples for better understanding.

Example 1:

import nltk 
from nltk.corpus import wordnet
word = 'Business'
syn = wordnet.synsets(word)[0]
print('synset name:', syn.name())
print('lemmatized :', syn.lemmas())
print('definition :', syn.definition())
print('example :', syn.examples())

Output:

synset name: business.n.01lemmatized : [Lemma('business.n.01.business'), Lemma('business.n.01.concern'), Lemma('business.n.01.business_concern'), Lemma('business.n.01.business_organization'), Lemma('business.n.01.business_organisation')]definition : a commercial or industrial enterprise and the people who constitute itexample : ["he bought his brother's business", 'a small mom-and-pop business', 'a racially integrated business concern']

Example 2:

word = 'Leadership'
syn = wordnet.synsets(word)[0]
print('name :', syn.name())
print('lemmas :', syn.lemmas())
print('definition :', syn.definition())
print('examples :', syn.examples())

Output:

name : leadership.n.01lemmas : [Lemma('leadership.n.01.leadership'), Lemma('leadership.n.01.leading')]definition : the activity of leadingexamples : ['his leadership inspired the team']

Hope this was helpful!!!

--

--