Glossary
Lemmatization
Lemmatization is the process of reducing a word to its dictionary form, its lemma, using vocabulary and grammar, so that “ran”, “running” and “runs” are all treated as “run”.
Lemmatization is a text normalisation technique that converts each word to its lemma, the form you would look up in a dictionary. It uses a vocabulary and the word’s grammatical role to decide what that form is, so “was” becomes “be”, “geese” becomes “goose” and “better” becomes “good” when it is used as an adjective. Search engines, text analytics tools and natural language processing pipelines use lemmatization so that different inflections of the same word are counted, matched and analysed as one term, while keeping the output as real, readable words.
How lemmatization works
A lemmatizer needs two things that a simple suffix stripper does not: a lexicon and context. The lexicon lists word forms and their lemmas, including irregular ones, along with rules for regular inflection. The context is the word’s part of speech, which comes from a part-of-speech tagger that runs first. The same surface form can have different lemmas depending on its role. “Saw” is the past tense of “see” in “I saw the report”, and a noun in “a saw and a hammer”. “Meeting” is a verb form of “meet” in “we are meeting at ten” and a noun in its own right in “the meeting ran long”.
A typical pipeline runs in this order. Text is split into tokens during tokenization, each token is tagged with its part of speech, and the lemmatizer looks up each token and tag pair in its lexicon or applies the matching morphological rule. Open-source libraries such as spaCy, Stanza and NLTK’s WordNet lemmatizer follow this pattern for English, and spaCy and Stanza ship models for dozens of other languages. For languages with rich inflection, the lemmatizer often relies on a full morphological analyser that understands case, number, gender and tense.
A worked example helps. Take the sentence “The analysts were reviewing contracts that had expired”. A lemmatizer with part-of-speech tags returns “the analyst be review contract that have expire”. Each output is a real English word, and each inflected form has been reduced to the form a dictionary would list. A query such as “review expired contract” can now match on “review”, “expire” and “contract” even though none of those words appears in the original sentence in that exact form.
Lemmatizers make mistakes, and most of them come from the tagger rather than the lexicon. If “leaves” is tagged as a verb in a sentence about autumn, it becomes “leave” instead of “leaf”. Short queries make this worse, because a two-word search gives the tagger almost no context to work with, so a query and a document can be lemmatized differently even when they use the same word. Unknown words are another source of error: product names, slang and new technical terms are often missing from the lexicon and pass through unchanged. Production systems usually accept these errors, measure them on real data, and add custom lexicon entries for the terms that matter most to their domain.
Lemmatization vs stemming
Stemming is the faster, rule-based alternative. It strips common suffixes without knowing what the word means, so it is quick and needs no model, but it misses irregular forms and can produce stems that are not words, such as “relat” for “relational”. Lemmatization is slower and depends on the quality of its tagger and lexicon, but it handles irregular forms and keeps the output readable.
Aspect | Lemmatization | Stemming |
|---|---|---|
Output | Dictionary word (“study”) | Stem, often not a word (“studi”) |
Uses part of speech | Yes | No |
Irregular forms (“was”, “geese”) | Handled | Usually missed |
Speed | Slower, needs a tagger and lexicon | Very fast, rule-based |
Language coverage | Depends on available models | Broad for European languages via Snowball |
Common home | NLP pipelines, analytics, some search fields | Full-text search indexing |
Neither is strictly better. Stemming is the usual default in full-text search engines because it runs at indexing speed on billions of tokens and its errors rarely hurt ranking much. Lemmatization earns its cost where the normalised words are read by people, fed into further analysis, or used in languages where suffix rules break down.
Why lemmatization matters in search
In keyword search, every token is matched exactly against an inverted index. Without normalisation, “child” and “children” are separate entries, and a query for one misses documents that use the other. Lemmatization collapses them into one posting list, which raises recall. Because it avoids the aggressive merges that stemmers sometimes make, it tends to cost less precision than an aggressive stemmer, which matters in domains such as law and medicine where “organ” and “organisation” must stay apart. Precision and recall are the measures to watch when you compare the two on your own queries.
Language matters more than anything else. English has relatively little inflection, so a good stemmer gets close to a lemmatizer’s quality for search. Finnish, Turkish, Hungarian, Arabic and Polish build many forms from one root through case endings, possessive suffixes and other affixes. In these languages a Finnish noun can have well over a dozen case forms, and suffix rules either miss many of them or merge words that should stay apart. Lemmatization or full morphological analysis is usually the better choice there. Some Lucene-based engines support dictionary-based normalisation through Hunspell dictionaries for this reason.
Lemmatization also interacts with scoring. Ranking functions such as BM25 and TF-IDF count term frequency per document. If “run”, “ran” and “running” are counted as one lemma, a document that discusses running in all three forms scores as strongly on the concept as one that repeats a single form. That is usually what users expect from a search box.
Lemmatization beyond search
Much of the use of lemmatization sits outside search ranking. In text analytics, it keeps counts and topic models clean: a word cloud or frequency table that lists “decide”, “decided” and “decision” separately is harder to read than one that groups the verbs. In named entity recognition and relation extraction, lemmas make it easier to write patterns that catch “acquired”, “acquires” and “will acquire” with one rule. In data normalization for analytics or a knowledge graph, lemmatized labels reduce duplicate nodes that differ only by inflection.
It also shows up in agent memory and entity resolution. When an agent stores facts such as “prefers early meetings” and later “preferred an early meeting slot”, a system that compares facts needs some way to see that these say the same thing. Older pipelines did this with lemmatization and string matching. Current memory systems more often compare meaning with embeddings and models, which covers lemmatization’s job along with synonyms and paraphrase.
Lemmatization in the era of embeddings and LLMs
Large language models and embedding models do not lemmatize their input. They split text into subword units with schemes such as byte-pair encoding and learn from training data that “ran” and “run” are closely related. Semantic search built on these models handles most inflection without a separate normalisation step, and lemmatizing text before embedding it usually hurts, because it strips grammatical signals the model would otherwise use.
Lemmatization still has a place alongside them. In hybrid search, the keyword retriever benefits from normalisation while the vector retriever handles meaning, and the two result lists are merged with a method such as reciprocal rank fusion. Lemmatized keyword fields are also easier to debug than vectors: you can see exactly why a document matched. For a side-by-side view of the two retrieval styles, see semantic search vs keyword search and dense vs sparse retrieval.
When to use lemmatization
Use lemmatization when the normalised text will be read, when you are working in a highly inflected language, or when precision matters enough that stemming’s false merges are a problem. Use stemming when you need speed at large scale, are indexing mostly English text, and can tolerate some over-matching. Skip both for fields that hold names, product codes, error codes or identifiers, since normalising them breaks exact lookups, and keep a raw copy of any field you do normalise so exact phrase queries still work.
Measure the change before you commit to it. A golden dataset of real queries with labelled relevant documents lets you compare search relevance with stemming, with lemmatization and with neither. Check recall at k for the cut-off your agent or interface uses, because a normalisation change that helps the tenth result may not matter if only the top three are ever shown.
How Exabase handles word forms
Exabase handles word variation without asking you to build or tune a text analysis chain. Deep Search runs every text query as a hybrid of semantic search and typo-tolerant keyword matching, so inflected forms are matched through meaning while exact names and codes still score on the keyword side. Wrap a phrase in double quotes to force an exact match. Files, notes and bookmarks stored as Resources are indexed automatically, and results come back as sub-document chunks with page numbers or timestamps.
If you need lemmatized text for your own analytics, such as topic counts or rule-based extraction, Extract gives you clean text chunks from PDFs, web pages, audio and video, and you can run your lemmatizer of choice on that output. Exabase is the substrate here: the linguistic processing and any analysis built on it stay in your code. The extraction guide and the searching resources guide cover both sides, and the post on when keyword beats semantic looks at where exact matching still wins. Teams comparing search engines can start with Exabase vs Typesense or Typesense vs Meilisearch.
Frequently asked questions
What is lemmatization in simple terms?
Lemmatization turns each word into its dictionary form. “Was” becomes “be”, “children” becomes “child” and “studying” becomes “study”, so text that uses different forms of the same word can be searched and counted together.
What is the difference between lemmatization and stemming?
Lemmatization uses a dictionary and the word’s part of speech to return a real base word, while stemming chops suffixes by rule and can leave a fragment such as “studi”. Lemmatization handles irregular forms better; stemming is faster.
Is lemmatization better than stemming for search?
Lemmatization is usually more precise, but not always better overall. For large English corpora a stemmer is often good enough and much faster, while for highly inflected languages or precision-sensitive domains lemmatization tends to win. Test both against real queries.
Which libraries do lemmatization?
spaCy, Stanza and NLTK are the most common open-source options. spaCy and Stanza include part-of-speech tagging and support many languages; NLTK’s WordNet lemmatizer covers English and needs the part of speech passed in.
Do LLMs and embeddings need lemmatized input?
No. Language models and embedding models learn word relationships from training data and work best on natural text. Lemmatizing input before embedding usually removes useful grammatical information.
Does lemmatization work for every language?
It works for any language that has a lexicon and a tagger, and quality depends on those resources. Major European and Asian languages are well covered by spaCy and Stanza; less widely spoken languages may have limited or no models.
Do I need to lemmatize text before storing it in Exabase?
No. Deep Search combines semantic and typo-tolerant keyword matching on every text query and indexes content automatically, so you store text as it is. Run your own lemmatizer only if you need normalised words for separate analysis.
Related pages: stemming, tokenization, fuzzy search, full-text search, named entity recognition, entity resolution, Algolia alternatives, knowledge bases, file extraction