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

Ecommerce product reviews - Pairwise ranking and sentiment analysis
This project analyzes a dataset containing ecommerce product reviews. The goal is to use machine learning models to perform sentiment analysis on product reviews and rank them based on relevance. Reviews play a key role in product recommendation systems.

Predict Churn for a Telecom company using Logistic Regression
Machine Learning Project in R- Predict the customer churn of telecom sector and find out the key drivers that lead to churn. Learn how the logistic regression model using R can be used to identify the customer churn in telecom dataset.

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.

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.

Demand prediction of driver availability using multistep time series analysis
In this supervised learning machine learning project, you will predict the availability of a driver in a specific area by using multi step time series analysis.

Forecast Inventory demand using historical sales data in R
In this machine learning project, you will develop a machine learning model to accurately forecast inventory demand based on historical sales data.

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.

Predict Employee Computer Access Needs in Python
Data Science Project in Python- Given his or her job role, predict employee access needs using amazon employee database.

Human Activity Recognition Using Multiclass Classification in Python
In this human activity recognition project, we use multiclass classification machine learning techniques to analyse fitness dataset from a smartphone tracker.

German Credit Dataset Analysis to Classify Loan Applications
In this data science project, you will work with German credit dataset using classification techniques like Decision Tree, Neural Networks etc to classify loan applications using R.