Beginner level · Module 4: Tokenization and Text Normalization · Lesson 3 of 3
Normalising Spelling Variation
How to handle informal spellings, abbreviations and mixed languages common in local messages, using normalisation dictionaries and careful, documented rules.
In this lesson you will
- Build a normalisation dictionary for common variants
- Explain the risks of over-normalising local-language text
Key concepts
spelling variationabbreviationscode-switchingnormalisation dictionaryorthography
The lesson
Informal messages use abbreviations ('pls', 'plz', 'u', 'tmrw') and variant spellings. Juba Arabic written in Latin script has no single standard spelling, so the same word may be written several ways. Messages also switch between English, Juba Arabic and other languages within one sentence (code-switching).
A normalisation dictionary maps variants to one form: {'pls': 'please', 'plz': 'please', 'tmrw': 'tomorrow'}. It should be built from the real data, by counting variants, and checked by speakers of the language.
Over-normalising is risky. Two spellings may be two different words, and choosing a 'standard' form for a language involves people and communities, not only programmers. Record every rule, its source and who checked it.
Step by step
- Find the 30 most frequent tokens that are not dictionary English words.
- Group variants of the same word and confirm them with a speaker where possible.
- Write a normalisation dictionary and apply it.
- Record who checked each entry.
Normalising varied spellings in mixed-language messages
A composite, illustrative case: an enquiry classifier struggled with Juba Arabic written in Latin script until spelling variants were grouped with speakers' help and measured separately.
Context
A fictional training centre in Juba built an enquiry classifier on English messages. About a fifth of real incoming messages mixed English with Juba Arabic written in Latin script, with no standard spelling: the same word appeared in several spellings that differed in vowels and doubled letters.
Challenge
On mixed-language messages the classifier's accuracy was far lower than on English ones, but the overall figure hid this. Many Juba Arabic words were unique spellings that appeared once, so the model could not learn from them.
What they did
- Separated the test set by language and reported accuracy for English and mixed messages separately.
- Listed the most frequent non-English tokens and asked two speakers to group spellings that are the same word, recording disagreements rather than forcing a choice.
- Built a documented normalisation dictionary from the agreed groups and applied it before vectorisation.
- Added character n-gram features (CountVectorizer(analyzer='char_wb', ngram_range=(2, 4))), which share information between similar spellings.
- Sent every low-confidence mixed-language message to a staff member who reads Juba Arabic.
Results
- The gap between English and mixed-language accuracy narrowed, and it was now measured and reported instead of hidden.
- The centre began a small, consent-based collection of labelled mixed-language messages to extend the test set.
Lessons for your own work
- Always report results by language; overall accuracy hides poor performance on low-resource text.
- Spelling normalisation must be agreed with speakers and documented, because choosing a standard is not only a technical decision.
- Character n-grams and human review are practical ways to cope with variation while proper data is collected.
Practice activity
Build and document a normalisation dictionary of at least 15 entries for the project's informal messages.
Expected result: A checked dictionary that reduces variant spellings without merging different words.
Check your understanding
-
What is code-switching?
Show answer
Switching between languages within a message or conversation.
-
Why should speakers check a normalisation dictionary?
Show answer
Only speakers can confirm whether two spellings are the same word.
Further learning
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.