Lemmatization vs. Stemming: Understanding NLP Methods

Written by Coursera Staff • Updated on

What are lemmatization and stemming? Let’s consider each NLP method in detail to understand the algorithm methodology, strengths and weaknesses, and how to choose the right one for your requirements.

[Featured Image] A woman explains to her colleague the difference between lemmatization and stemming.

Natural language processing (NLP) is a type of technology within artificial intelligence (AI) that uses various techniques to interpret human language and respond in a meaningful way. Within NLP, lemmatization and stemming are fundamental methods for text analysis, helping deep learning methods recognize words and process them for analysis. In this article, we will explore each method, the differences between them, and the pros and cons associated with each.

What is natural language processing?

NLP is a complex field that combines computer science, artificial intelligence, and linguistics. NLP algorithms enable computers to communicate with humans using human language in a conversational way. By analyzing and processing natural language data, NLP systems can extract insights, automate text functions, and respond to user input and requests.

Computers need to know how to break down and process text when extracting language data. Two of these methods are lemmatization and stemming, each focusing on different aspects of natural language and how to recognize the root meaning of words.

Both methods help reduce the dimensionality of large bodies of text and make it easier for machines to group related words. However, stemming takes a simpler approach that’s more prone to errors, while lemmatization is more computationally intensive yet may return more accurate results.

What is stemming?

This simple form of word reduction focuses on removing word endings (suffixes) to obtain a base form, often resulting in non-dictionary words. As a method, though less precise than lemmatization, stemming is quick and efficient when processing large volumes of text.

Stemming algorithms work by having a defined set of suffixes and a required word length. If the word is a reasonable length, the stemming algorithm will scan the word for one of the predefined suffixes (such as “-ed” or “-ing”) and remove the suffix to return the root of the word. Having a required word length helps to prevent errors in this method, such as shortening “fish” to “f.” This method is highly efficient and helps computers process written text in an organized way.

If you choose stemming, your algorithm will return stems such as:

  • “Walk,” “walking,” and “walks” will become “walk.”

  • “Write,” “written,” and “writer” would become “writ.”

  • “Requirement” and “require” would become “requir.”

Advantages of stemming

  • Speed and efficiency: Stemming algorithms are generally faster as they follow simple rule-based approaches.

  • Simplicity: The algorithms for stemming use simple heuristic rules, so they are less complex to implement and understand than other methods.

  • Improved search performance: In search engines and information retrieval systems, stemming helps connect different word forms, potentially increasing the breadth of search results.

Disadvantages of stemming

  • Over-stemming and under-stemming: Stemming can often be imprecise, leading to over-stemming (where words are overly reduced and unrelated words are conflated) and under-stemming (where related words don’t appear related).

  • Language limitations: The effectiveness of a stemming algorithm reduces if words appear in irregular formats (i.e., irregular conjugated forms).

What is lemmatization?

Lemmatization goes beyond truncating words and analyzes the context of the sentence, considering the word's use in the larger text and its inflected form. After determining the word's context, the lemmatization algorithm returns the word's base form (lemma) from a dictionary reference.

This technique effectively handles different grammatical categories and tenses, providing a more accurate language representation. For example:

  • “Saw” would return as “see” or “saw” depending on the context of the word (i.e., whether it is a noun or verb in the sentence).

  • “Ponies” would return “pony.”

  • “Requirement” and “required” would return separate words.

Advantages of lemmatization

  • Accuracy and contextual understanding: Lemmatization is more accurate as it considers words' context and the morphological analysis. It can distinguish between different word uses based on its part of speech.

  • Reduced ambiguity: By converting words to their dictionary form, lemmatization reduces ambiguity and enhances the clarity of text analysis.

  • Language and grammar compliance: Lemmatization adheres more closely to the grammar and vocabulary of the target language, leading to linguistically meaningful outputs.

Disadvantages of lemmatization

  • Computational complexity: Lemmatization algorithms are more complex and computationally intensive than stemming. They require more processing power and time.

  • Dependency on language resources: Lemmatization depends on extensive language-specific resources like dictionaries and morphological analyzers, making it less flexible for use with certain languages, such as Arabic.

Choosing between stemming vs. lemmatization

When deciding between lemmatization and stemming, consider the type of output you want from your text and the strengths and limitations of each method. Lemmatization is a more resource-intensive process because it requires comprehensive linguistic knowledge. Stemming is a simpler and faster method. While lemmatization provides high accuracy and context relevance, stemming offers greater speed, so it is up to you to determine your priority.

You can see the differences between stemming and lemmatization in the output. For example, let’s say your text has the words “sung,” “sang,” “sings,” “singer” and “singing.” Stemming would recognize only three of the five words as a conjugation of “sing” and return “sing” for “sings,” “singer,” and “singing.” Because “sung” and “sang” do not have a recognized suffix, they wouldn’t appear in the same category as the others.

Lemmatization, conversely, would recognize the irregular conjugation of the words and output the root word “sing” for all five words.

Another example would be words that share the same stem but have different meanings. For example, “requirement” and “requires” mean different things, but stemming algorithms would return “requir” for both. Lemmatization algorithms would recognize them in context and return each word separately. 

Consider the precision of your desired output or whether you are just looking for the root of the word to choose the most suitable method.

Learn more about NLP on Coursera.

You can continue to learn about natural language processing techniques with exciting and comprehensive courses on Coursera. If you want to build a comprehensive foundation and explore broad applications of NLP, you could begin with the Natural Language Processing Specialization offered by DeepLearning.AI. This Specialization covers different computational methods and models to explore different techniques within NLP.

Keep reading

Updated on
Written by:

Editorial Team

Coursera’s editorial team is comprised of highly experienced professional editors, writers, and fact...

This content has been made available for informational purposes only. Learners are advised to conduct additional research to ensure that courses and other credentials pursued meet their personal, professional, and financial goals.