SinSpell: Sinhala Spell Checker
- SinSpell is a morphology-aware, rule-based spell checker for Sinhala that integrates Hunspell dictionaries with explicit affix and lexical rules.
- It employs a finite-state auto-correction module tuned by corpus analysis to address non-word and vowel-modifier errors frequently found in official texts.
- Evaluations report a 98.2% true negative rate in error detection, outperforming alternatives like Microsoft Word and Subasa in handling Sinhala orthography.
SinSpell is a comprehensive spelling checker for the Sinhala language, designed as a morphology-aware, rule-based system built on Hunspell and supplemented by a finite-state auto-correction module. It identifies possible spelling errors, suggests corrections, and automatically fixes a limited class of evident errors. The system was developed to address the absence of an open-source Sinhala spell checker with acceptable lexical and morphological coverage, and it is positioned as reusable infrastructure not only for word processing but also for Sinhala NLP applications such as ASR, TTS, machine translation, OCR, and text entry environments (Liyanapathirana et al., 2021).
1. Historical setting and design rationale
SinSpell emerged in a setting where Sinhala, although spoken by more than 16 million people and described as morphologically rich, had limited practical spell-checking support. At the time the project began in 2020, the most relevant Sinhala systems were Microsoft Word’s Sinhala extension, the online Subasa system, and an older Hunspell Sinhala dictionary by Laknath. The project was motivated by the judgment that neither of the first two had acceptable accuracy when the work started, while the older Hunspell resource was outdated and incompatible with current LibreOffice. The authors explicitly state that SinSpell is still the only open source Sinhala spelling checker (Liyanapathirana et al., 2021).
The design choice was intentionally rule-based rather than neural. The authors argue that Sinhala spelling is relatively regular and that sufficient labelled spelling-corrected data for supervised or deep learning methods would have been difficult to obtain. This led to an architecture centered on verified lexical resources, morphological classes, and explicit orthographic rules, rather than on contextual sequence models. In that sense, SinSpell belongs to the tradition of high-precision lexicon-and-rule spell checkers for morphologically rich languages, with practical coverage and deployability prioritized over context-sensitive real-word correction.
A central premise of the project is that a flat dictionary is inadequate for Sinhala. Valid forms frequently arise through inflection or derivation, so a usable spell checker must model roots and allowable affixation. The system therefore combines lexical coverage with morphological licensing: a token is accepted not merely because it has been memorized as a full form, but because it can be generated from a valid root and a compatible affix pattern.
2. System architecture and linguistic resource construction
The paper describes SinSpell through two main components: a spelling error detector and suggestion generator, and an auto spelling-corrector. In operational terms, the processing flow is input text, error detection, suggestion generation, auto-correction, and output text. The core technologies are a rule-based Hunspell system for detection and suggestion generation, and a finite-state transducer-based subsystem for auto-correction (Liyanapathirana et al., 2021).
Hunspell provides the main checker through its standard pair of resources: a dictionary file containing stems or root forms, and an affix file containing prefix and suffix rules. SinSpell extends that framework with Sinhala-specific lexical resources, morphological class information, replacement rules, and tuned suggestion behavior. The lexical inventory was compiled from several sources, including the Language Technology Research Laboratory at UCSC, the Concise Sinhala Dictionary, government documents, official documents, news reports, web crawlers, and other sources. The authors state that these words were verified.
The lexical resource is organized by grammatical category. Adjectives and adverbs were compiled from corpora and dictionary sources, POS-tagged, and manually expanded with valid suffix inventories. Nouns and verbs were reused from the SinMorphy project, whose .lexc resources encode stems, suffixes, and syntactic tags. One explicit morphological fact given in the paper is that Sinhala nouns were categorized into 26 classes. Python scripts were written to extract stems and suffixes from SinMorphy and convert them into Hunspell dictionary and affix files. For verbs, the authors derived the past stem from the present stem by script and completed the rest of the conversion manually. Pronouns and particles were also extracted and manually cleaned, and some proper nouns, such as city names, were added (Liyanapathirana et al., 2021).
Prefix handling is treated as a constrained special case rather than a productive general mechanism. The paper states that many Sinhala prefixes, especially with nouns and verbs, do not fall neatly into classes, so prefixed words are generally listed separately instead of being generated compositionally. One negative-forming verbal prefix is an explicit exception and was modeled productively. This arrangement reflects a broader pattern in SinSpell: morphology is represented to the extent that it supports reliable acceptance and suggestion behavior, but the system avoids rule formalizations that would overgenerate.
3. Orthography, error analysis, and detection model
A distinctive contribution of the work is its corpus-based analysis of Sinhala spelling errors. The authors used many government documents, including annual reports, circulars, official letters, and gazettes, for which both the original and professionally corrected versions were available. These document pairs were aligned with Hunalign, and Python scripts were used to identify the changes introduced by the correctors, producing erroneous-string and corrected-string pairs. This error inventory was then analyzed qualitatively and used as engineering input for suggestion generation and auto-correction (Liyanapathirana et al., 2021).
The paper identifies deletion, insertion, substitution, and word separation as core categories, and treats vowel length as a separate type because of its frequency. The abstract states that the most common errors were in vowel length and similar sounding letters. Errors due to incorrect typing and encoding were also found. These findings define the orthographic profile that SinSpell targets: not only ordinary edit errors, but Sinhala-specific confusions involving vowel modifiers, similar-sounding letters, and spacing.
Detection itself is conservative and lexicon-driven. Hunspell marks a token as correct if it appears in the dictionary or can be derived from a listed root plus legal affixation according to the affix file. Otherwise it is marked as incorrect. The paper is explicit that SinSpell detects only non-word errors. It does not attempt to identify contextually wrong but dictionary-valid words, so its detection model is morphological and lexical rather than contextual.
This constraint is fundamental to the system’s scope. A form that is orthographically licit under the lexicon and affix rules passes the checker even if it is inappropriate in context. The authors acknowledge this as a limitation and explicitly identify real-word correction as outside the current design.
4. Suggestion generation and Sinhala-specific correction rules
Suggestion generation begins with Hunspell’s built-in edit-distance-based mechanism, but SinSpell adds Sinhala-specific tuning based on the corpus analysis. Two enhancements are emphasized. The first uses TRY characters to prioritize common vowel-modifier confusions. Because vowel modifiers are frequently misused in Sinhala, the relevant characters were included as TRY characters so that candidates involving these substitutions would rise in the suggestion list. The second uses replacement rules for frequently confused letter pairs, allowing Hunspell to prioritize corrections when the misspelling differs from a correct word only by one of those confusions (Liyanapathirana et al., 2021).
The replacement inventory includes several bidirectional pairs that the paper presents as common Sinhala confusions: න ↔ ණ, ල ↔ ළ, ට ↔ ඨ, ශ ↔ ෂ, ච ↔ ඡ, ඊ ↔ ඉ, බ ↔ භ, ප ↔ ඵ, and ද ↔ ධ. The paper also states that replacement rules were added for murthaja letters, mahaprana letters, and rakaransaya. Together, these rules operationalize the observation that many Sinhala spelling mistakes are linguistically systematic rather than random edits.
The ranking strategy remains heuristic rather than probabilistic. The paper does not introduce a learned reranker, corpus-frequency model, or contextual language-model score. Instead, candidates are generated and prioritized through Hunspell’s edit-distance machinery, TRY ordering, and replacement-rule heuristics, while morphological legality is enforced by the custom dictionary and affix files. This makes SinSpell transparent and linguistically interpretable, but also confines it to non-contextual correction.
The auto-correction module is deliberately separate and narrower in scope. Its purpose is to fix words that are judged very unlikely to be correct and very likely to have a single intended correction. The target domain is explicitly government documents. Rules were obtained from the Sinhala guide of the Department of Official Languages and from the error pairs identified in corpus analysis. Each rule is represented as an incorrect:correct mapping. The module handles full-word errors, prefix errors, suffix errors, and word separation errors, and is implemented as a finite-state system in Foma and Lexc. Rather than ranking alternatives, it rewrites only a small set of highly reliable cases (Liyanapathirana et al., 2021).
5. Implementation, deployment, evaluation, and limitations
SinSpell was deployed in two forms. One is a LibreOffice extension built according to LibreOffice documentation, which makes the checker directly available in a standard office environment. The other is a website implemented mainly with JavaScript, NodeJS, HTML, and Bootstrap, using the same dictionary and affix resources for error detection and suggestion generation. The paper gives the web endpoint as https://nlp-tools.uom.lk/SinSpell/ (Liyanapathirana et al., 2021).
The comparative evaluation used a test set drawn from annual reports, official letters, newspaper articles, magazine articles, and Wikipedia. The set contained 2374 words in total, of which 457 were incorrect and 1917 were correct. A Sinhala professional evaluated the outputs of SinSpell, Subasa, and Microsoft Word. For correct-word detection, all three systems identified most correct words, but Microsoft Word had the best vocabulary coverage and recognized more correct words than SinSpell. For incorrect-word detection, Subasa performed very poorly, whereas SinSpell gave the best performance and had the lowest number of false negatives. The paper’s discussion interprets the true negative rate for incorrect-word detection as 98.2% for SinSpell, compared with 91.9% for Microsoft Word and 24.0% for Subasa (Liyanapathirana et al., 2021).
Suggestion quality was evaluated on 100 incorrect words using first suggestion accuracy and mean reciprocal rank. Although the OCR-preserved table values are misaligned in the supplied extraction, the paper’s discussion states that SinSpell performs best for first suggestion accuracy and is comparable with Microsoft Word in MRR. This is a notable result because the system’s overall architecture is conservative and rule-based rather than contextual.
The paper also identifies clear limitations. SinSpell handles only non-word errors and does not perform real-word or contextual error correction. Vocabulary coverage is still incomplete, which is why Microsoft Word recognized more correct words in evaluation. The auto-corrector has only a small set of rules. Prefix handling is incomplete because many Sinhala prefixes do not fit productive class-based modeling. More generally, the system’s rule-based scope suits regular spelling and morphology, but not context-sensitive lexical disambiguation.
6. Position within spell-checking research
SinSpell occupies a specific place in the spell-checking landscape: it is a morphology-aware, rule-based checker optimized for a low-resource language with limited annotated correction data. That design sharply distinguishes it from contextual neural systems that treat spelling correction as token-level sequence labeling or masked infilling. For example, the nested RNN model for English spelling correction combines character-level orthography with sentence-level context in an end-to-end model and explicitly targets both non-word and real-word errors (Li et al., 2018). NeuSpell similarly frames contextual spelling correction as sentence-level token prediction and shows that realistic synthetic noising and richer contextual representations substantially improve correction quality (Jayanthi et al., 2020). For Tibetan, TiSpell goes further by treating spelling correction as a multi-level problem, separating local character repair from higher-level syllable recovery through a semi-masked architecture (Liu et al., 12 May 2025).
SinSpell’s contrast with such systems is instructive. It does not learn from sentence context, does not model real-word errors, and does not use a probabilistic reranker. Instead, it encodes linguistic regularities directly in lexical classes, affix rules, TRY ordering, and replacement pairs. This suggests that SinSpell is best understood not as a predecessor of end-to-end neural correction, but as a high-coverage infrastructure layer for Sinhala orthography: a deployable checker that formalizes valid roots, suffixes, restricted prefixes, and common confusion patterns.
At the same time, SinSpell’s own future-work discussion points toward the directions explored by broader spell-correction research. The paper proposes expanding the vocabulary, improving the auto-corrector by identifying more errors and error patterns, and potentially using deep learning for real-word error correction (Liyanapathirana et al., 2021). A plausible implication is that a future Sinhala checker could preserve SinSpell’s verified lexicon and morphology-aware acceptance rules while adding contextual ranking or contextual correction modules of the type seen in BERT-based hybrid systems and neural contextual spell checkers (Naziri et al., 2024). In that sense, SinSpell can be viewed as both a practical end-user tool and a linguistic substrate on which more context-sensitive Sinhala correction systems could be built.