Sub topic 6
Word Forms: Inflection, Derivation, Stems, and Lemmas
This chapter assumes you know basic Python, regular expressions, and grammar terms such as noun, verb, adjective, plural, and tense. It also assumes you have seen an NLP task such as search or text classification.
A single vocabulary item can appear in many forms. For example, walk, walks, walked, and walking are different word forms, but they are closely related. NLP systems often need to decide whether these forms should be treated as the same or as different items.
Inflection: different forms of the same word
Inflection changes a word to express grammatical information. It usually does not create a new dictionary entry or change the word's basic meaning.
Examples include:
cat→catsfor numberwalk→walkedfor tenserun→runningfor aspect or tensesmall→smallerfor comparisongo→wentfor tense, using an irregular form
The forms cat and cats belong to the same general vocabulary item. Their meanings differ in number, but both refer to the noun cat. Likewise, walk, walks, and walked are forms of the verb walk.
Inflection can use regular endings, spelling changes, or entirely different forms. A normaliser must therefore handle more than simple suffix removal if it needs accurate grammatical base forms.
Derivation: creating a related word
Derivation creates a new word by adding an affix, changing the word's meaning, or changing its grammatical category.
Examples include:
happy→unhappyteach→teacherkind→kindnessmodern→modernisenation→national
The relationship between derived words is often useful, but derived words are not always interchangeable. A teacher is a person, while teach is an action. A search system might want these words to match, but a grammar-aware system may need to keep them separate.
The boundary between inflection and derivation is language-dependent. English has relatively limited inflection compared with languages that mark case, gender, or agreement on many words.
Stems and lemmas
A stem is the form left after a stemming algorithm removes or changes word endings. A stem does not need to be a valid word. For example, a stemmer might reduce:
| Word form | Possible stem |
|---|---|
| `studies` | `studi` |
| `running` | `run` |
| `relational` | `relat` |
A lemma is the dictionary or citation form of a word. Typical English lemmas are:
cats→catwalked→walkbetter→goodin some linguistic analysesrunning→runwhen it is a verb
A lemma should normally be a valid word. Finding it often requires a dictionary and information about the word's grammatical role.
Why the distinction matters
Stemming is usually fast and simple. It applies rules to word endings, so it works without a complete dictionary. However, it can produce strange results and may confuse unrelated words.
Lemmatisation uses lexical knowledge. It can return meaningful base forms, but it needs more resources and often requires a part-of-speech tag. A part-of-speech tag identifies a word's grammatical category, such as noun, verb, or adjective.
Consider meeting:
- As a noun, its lemma may be
meeting. - As a verb, its lemma may be
meet.
The surrounding sentence helps determine which analysis is correct.
from collections import defaultdict
forms = ["cat", "cats", "walk", "walked", "walking", "teacher"]
# This simple mapping illustrates known lemmas.
lemma_map = {
"cat": "cat",
"cats": "cat",
"walk": "walk",
"walked": "walk",
"walking": "walk",
"teacher": "teacher",
}
groups = defaultdict(list)
for form in forms:
groups[lemma_map[form]].append(form)
for lemma, word_forms in groups.items():
print(f"{lemma}: {', '.join(word_forms)}")This mapping is deliberately small. A real lemmatiser must handle spelling changes, irregular forms, ambiguity, and many languages.
Choosing the representation
Use a stem when speed and broad matching matter more than linguistic accuracy. Use a lemma when readable base forms, grammar, or precise analysis matter. Keep original word forms when distinctions such as tense, number, or derivation carry useful information.
For example, a basic search engine might match connect, connected, and connecting. A sentiment classifier might keep better and best distinct because their forms can carry different signals. A grammar application usually needs lemmas together with part-of-speech tags.
Exercise
Is unhappy an inflected form of happy, a derived word, or a stem?
Show answer
It is a derived word. The prefix un- changes the meaning of happy; it does not express grammatical number or tense.