How to get hypernyms and hyponyms for a particular word?
MACHINE LEARNING RECIPES DATA CLEANING PYTHON DATA MUNGING PANDAS CHEATSHEET     ALL TAGS

How to get hypernyms and hyponyms for a particular word?

How to get hypernyms and hyponyms for a particular word?

This recipe helps you get hypernyms and hyponyms for a particular word

0

Recipe Objective

How to get hypernyms and hyponyms for a particular word?

As we have discussed earlier only about Wordnet, now lets understand about hypernyms and hyponyms.

hypernym is a term whose meaning includes the meaning of other words, its a broad superordinate label that applies to many other members of set. It describes the more broad terms or we can say that more abstract terms.

for e.g hypernym of labrador, german sheperd is dog.

hyponym is a term which is more specialised and specific word, it is a hierarchical relationship which may consist of a number of levels. These are the more specific term. for e.g. dog is a hyponym of animal.

Step 1 - Import the necessary libraries

from nltk.corpus import wordnet

Step 2 - Take a sample word in sysnsets

My_sysn = wordnet.synsets("Plane")[0]

Step 3 - Print the sysnset name

print("Print just the name:", My_sysn.name())
Print just the name: airplane.n.01

Step 4 - Print hypernym and hyponym

print("The Hypernym for the word is:",My_sysn.hypernyms(),'\n') print("The Hyponyms for the word is:",My_sysn.hyponyms())
The Hypernym for the word is: [Synset('heavier-than-air_craft.n.01')] 

The Hyponyms for the word is: [Synset('airliner.n.01'), Synset('amphibian.n.02'), Synset('biplane.n.01'), Synset('bomber.n.01'), Synset('delta_wing.n.01'), Synset('fighter.n.02'), Synset('hangar_queen.n.01'), Synset('jet.n.01'), Synset('monoplane.n.01'), Synset('multiengine_airplane.n.01'), Synset('propeller_plane.n.01'), Synset('reconnaissance_plane.n.01'), Synset('seaplane.n.01'), Synset('ski-plane.n.01'), Synset('tanker_plane.n.01')]

Relevant Projects

Natural language processing Chatbot application using NLTK for text classification
In this NLP AI application, we build the core conversational engine for a chatbot. We use the popular NLTK text classification library to achieve this.

Credit Card Fraud Detection as a Classification Problem
In this data science project, we will predict the credit card fraud in the transactional dataset using some of the predictive models.

Predict Macro Economic Trends using Kaggle Financial Dataset
In this machine learning project, you will uncover the predictive value in an uncertain world by using various artificial intelligence, machine learning, advanced regression and feature transformation techniques.

Resume parsing with Machine learning - NLP with Python OCR and Spacy
In this machine learning resume parser example we use the popular Spacy NLP python library for OCR and text classification.

Sequence Classification with LSTM RNN in Python with Keras
In this project, we are going to work on Sequence to Sequence Prediction using IMDB Movie Review Dataset​ using Keras in Python.

Build an Image Classifier for Plant Species Identification
In this machine learning project, we will use binary leaf images and extracted features, including shape, margin, and texture to accurately identify plant species using different benchmark classification techniques.

PySpark Tutorial - Learn to use Apache Spark with Python
PySpark Project-Get a handle on using Python with Spark through this hands-on data processing spark python tutorial.

Customer Market Basket Analysis using Apriori and Fpgrowth algorithms
In this data science project, you will learn how to perform market basket analysis with the application of Apriori and FP growth algorithms based on the concept of association rule learning.

Data Science Project-TalkingData AdTracking Fraud Detection
Machine Learning Project in R-Detect fraudulent click traffic for mobile app ads using R data science programming language.

Machine Learning project for Retail Price Optimization
In this machine learning pricing project, we implement a retail price optimization algorithm using regression trees. This is one of the first steps to building a dynamic pricing model.