YAKE

YAKE stands for Yet Another Keyword Extractor and it is an unsupervised approach for automatic keyword extraction by leveraging text features. To implement YAKE we will use the yake library. This library can be installed using the following command.

pip install yake

Following is the Python implementation of keyphrases extraction using the Yake library.

Python3




# Importing libraries
from wordcloud import WordCloud
import matplotlib.pyplot as plt
import yake
  
# Initializing the YAKE instance
yake_kw = yake.KeywordExtractor()
  
# Input text
input_text = '''
NLP stands for Natural Language Processing.
It is the branch of Artificial Intelligence that gives the ability to machine understand 
and process human languages. Human languages can be in the form of text or audio format.
Natural Language Processing started in 1950 When Alan Mathison Turing published 
an article in the name Computing Machinery and Intelligence. 
It is based on Artificial intelligence. It talks about automatic interpretation and 
generation of natural language.
As the technology evolved, different approaches have come to deal with NLP tasks.
'''
  
# Extracting keywords
KeyWords = yake_kw.extract_keywords(input_text)
  
# Displaying the keywords
print(KeyWords)
  
# Extracting keywords
keywords = [kw for kw, _ in KeyWords]
  
# Generate WordCloud
wordcloud = WordCloud().generate(' '.join(keywords))
  
# Display the WordCloud
plt.figure(figsize=(10, 10))
plt.imshow(wordcloud, interpolation='bilinear')
plt.axis('off')
plt.show()


Output:

[('Natural Language Processing', 0.02100249013859125), ('Language Processing', 0.04163335302639552), 
('Natural Language', 0.048148820863336377), ('Artificial Intelligence', 0.06657427591685054),
('Alan Mathison Turing', 0.06812525384060124), ('Language Processing started', 0.07604425290902747),
('human languages', 0.08215351904804695), ('NLP stands', 0.09173112596477705),
('Language', 0.10178153594306494), ('process human languages', 0.11865807800247614),
('Processing', 0.12586811799925435), ('Intelligence', 0.12825620909446891),
('Natural', 0.13778435888897436), ('Alan Mathison', 0.15153101048626974),
('Mathison Turing', 0.15153101048626974), ('Computing Machinery', 0.15153101048626974),
('Mathison Turing published', 0.15160281730925312), ('languages', 0.1526723039145974),
('Artificial', 0.15269328890550202), ('NLP', 0.18058428305612767)]

Keyword Extraction using YAKE

Keyphrase Extraction in NLP

In this article, we will learn how to perform key phrase and keyword extraction from text using natural language techniques. We will first discuss about keyphrase and keyword extraction and then look into its implementation in Python. We would be using some of the popular libraries including spacy, yake, and rake-nltk.

Similar Reads

Keyword Extraction

Keyphrase or keyword extraction in NLP is a text analysis technique that extracts important words and phrases from the input text. These key phrases can be used in a variety of tasks, including information retrieval, document summarization, and content categorization. This task is performed in two stages:...

RAKE

RAKE stands for Rapid Automatic Keyword Extraction and it is a frequency-based key phrase extractor. To implement RAKE we will use rake-nltk library. This library can be installed by using the following command....

YAKE

...

spaCy

YAKE stands for Yet Another Keyword Extractor and it is an unsupervised approach for automatic keyword extraction by leveraging text features. To implement YAKE we will use the yake library. This library can be installed using the following command....