Python | Lemmatization with TextBlob
Lemmatization is the process of grouping together the different inflected forms of a word so they can be analysed as a single item. Lemmatization is similar to stemming but it brings context to the words. So it links words with similar meaning to one word.
Text preprocessing includes both Stemming as well as Lemmatization. Many times people find these two terms confusing. Some treat these two as same. Actually, lemmatization is preferred over Stemming because lemmatization does morphological analysis of the words.
Applications of lemmatization are:
- Used in comprehensive retrieval systems like search engines.
- Used in compact indexing.
Examples of lemmatization : -> rocks : rock -> corpora : corpus -> better : good
One major difference with stemming is that lemmatize takes a part of speech parameter, “pos” If not supplied, the default is “noun.”
Below is the implementation of lemmatization words using TextBlob:
# from textblob lib import Word method from textblob import Word # create a Word object. u = Word("rocks") # apply lemmatization. print("rocks :", u.lemmatize()) # create a Word object. v = Word("corpora") # apply lemmatization. print("corpora :", v.lemmatize()) # create a Word object. w = Word("better") # apply lemmatization with # parameter "a", "a" denotes adjective. print("better :", w.lemmatize("a")) |
Output :
rocks : rock corpora : corpus better : good
Recommended Posts:
- Python | Tokenize text using TextBlob
- Python | Lemmatization with NLTK
- Python | Part of Speech Tagging using TextBlob
- Python | PoS Tagging and Lemmatization using spaCy
- Important differences between Python 2.x and Python 3.x with examples
- Python | Merge Python key values to list
- Reading Python File-Like Objects from C | Python
- Python | Add Logging to Python Libraries
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | Add Logging to a Python Script
- Python | Sort Python Dictionaries by Key or Value
- JavaScript vs Python : Can Python Overtop JavaScript by 2020?
- SHA in Python
- bin() in Python
- Python Set | pop()
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



