Three concepts not to be confused
- Stem: what remains after cutting prefixes and suffixes with rules; it may not be a real word. “والمكتبات” → “مكتب”.
- Lemma: the form of the dictionary entry. For a verb, the bare third-person past (“كَتَبَ”), and for a noun the singular (“مَكْتَبَة” for “مكتبات”).
- Root: the bare original letters shared by a derivational family: “ك ت ب” for كتب, كاتب, مكتوب, مكتبة, كتيبة.
In English the stem is usually close to the lemma, but in Arabic the distance between the three is large because of non-concatenative morphology.
Stemming in English: the Porter algorithm
The Porter algorithm (1980) is the best-known English stemmer. It represents a word as [C](VC)^m[V], where C is a run of consonants, V a run of vowels, and m the word's "measure". It then applies five stages of conditional rules, such as:
SSES → SS(caresses ← caress)(m>0) ATIONAL → ATE(relational ← relate)(m>1) EMENT → ∅(replacement ← replac)
The condition on m prevents over-stemming short words.
Light stemming for Arabic: Light10
Larkey and colleagues proposed a family of light stemmers for Arabic information retrieval, the best known being Light10:
- Normalization (remove diacritics, unify alef forms, ى → ي, ة → ه).
- Remove «و» at the start of the word if 3 or more letters remain.
- Remove compound definite-article prefixes if 2 or more letters remain: ال، وال، بال، كال، فال، لل.
- Remove suffixes from the left, in order, if 2 or more letters remain: ها، ان، ات، ون، ين، يه، ية، ه، ة، ي.
Example: «والمكتبات» → (remove «وال») «مكتبات» → (remove «ات») «مكتب».
Light10 does not try to reach the root, so it keeps «مكتب» distinct from «كاتب» and «كتيبة». Larkey's experiments showed it outperforms root extraction in information retrieval on the TREC Arabic collection.
Root extraction: ISRI and the Khoja stemmer
The Khoja stemmer (Khoja & Garside, 1999) removes the longest prefix and suffix, matches the remainder against a list of patterns, then checks the resulting root against a root dictionary. Its accuracy is good, but it depends on a dictionary and fails on loanwords and proper names.
The ISRI stemmer (Taghva et al., 2005) works without a root dictionary:
- Normalization and diacritic removal.
- Remove three-letter then two-letter prefixes (كال، بال، ولل، ال، لل…) and suffixes (كما، كن، هم، هن، ات، ون…).
- Remove the initial «و».
- Match patterns by word length (4 to 7 letters), e.g. if the word follows the pattern «مفعول» or «فاعل», take the letters corresponding to ف ع ل.
- If no pattern matches, the stem is returned after suffix removal, so the output is a "stem", not a root.
NLTK implements this algorithm in nltk.stem.isri.ISRIStemmer, and the lab's implementation matches it on the reference test set.
Evaluating stemmers
A stemmer is evaluated with two opposing measures:
- Over-stemming: merging words with different meanings into one stem. “كاتب” and “كتيبة” via “كتب”: an error when searching for writers.
- Under-stemming: failing to merge words from the same origin. “قال” and “يقول” stay separate under light stemming because the verb is hollow.
In information retrieval, the final effect is measured with precision and recall: over-stemming raises recall and lowers precision, and under-stemming does the opposite.
Context-based methods
Rule-based stemming does not see context, so “كتب” may be the plural of “كتاب” (lemma: كِتاب) or a verb (lemma: كَتَبَ). Correct lemmatization needs full morphological analysis with disambiguation, as in MADAMIRA, CAMeL Tools and Farasa, which we will see in the next lesson.
Try it: in the Morphology & Stemming module, type “والمكتبات يكتبون مكتوب استقبال قال” and compare the outputs of Light10 and ISRI, noting where each one got it right and where it over-stemmed or under-stemmed.
