This repository hosts the official pretrained model checkpoints, vocabularies, and statistical datasets for the sinlib library—a comprehensive Sinhala NLP toolkit.
Model Card
By Ransaka Ravihara, published under mit, revision 0ba9e053fee8.
This repository hosts the official pretrained model checkpoints, vocabularies, and statistical datasets for the sinlib library—a comprehensive Sinhala NLP toolkit. This repository contains the following files loaded dynamically by sinlib.spellcheck.TypoDetector: bigrudetector.pt: A bidirectional GRU sequence labeling model (BiGRUSequenceLabeler) trained to detect spelling errors and character substitutions at the akshara level. bigrucorrector.pt: A sequence-to-sequence bidirectional GRU encoder-decoder model with Attention (BiGRUSeq2Seq) that performs generative character/akshara corrections. aksharavocab.json: Vocabulary mappings mapping Sinhala phonological units (aksharas) and basic…
Read Ransaka Ravihara's full model card
sinlib: Pretrained Sinhala NLP and Spellchecking Models
This repository hosts the official pretrained model checkpoints, vocabularies, and statistical datasets for the sinlib library—a comprehensive Sinhala NLP toolkit.
Models & Artifacts Hosted
This repository contains the following files loaded dynamically by sinlib.spellcheck.TypoDetector:
bigru_detector.pt: A bidirectional GRU sequence labeling model (BiGRUSequenceLabeler) trained to detect spelling errors and character substitutions at the akshara level.bigru_corrector.pt: A sequence-to-sequence bidirectional GRU encoder-decoder model with Attention (BiGRUSeq2Seq) that performs generative character/akshara corrections.akshara_vocab.json: Vocabulary mappings mapping Sinhala phonological units (aksharas) and basic punctuation to token IDs for the neural models.akshara_ngram.json: Stored counts and vocabularies used by the statistical Trigram model (AksharaNGram) for likelihood evaluation.news_unigrams.json&news_bigrams.json: Pre-calculated unigram and bigram word-level frequencies extracted from Sinhala news corpora, used for context-aware candidate re-ranking (Stupid Backoff).dictionary.npy: The canonical baseline dictionary containing ~61K valid Sinhala words.ngram_probs.npy: N-gram probabilities used by the defaultPreTrainedTokenizerfallback checks.
Additional models, configuration files, and vocabulary resources required by the sinlib package are also included in this repository.
Intended Use
These weights are designed to be loaded directly through the sinlib Python package.
Installation
pip install sinlib
Example Inference (Spellcheck)
from sinlib.spellcheck import TypoDetector
# Automatically downloads and caches the model files from this HF repository
detector = TypoDetector.from_pretrained("Ransaka/sinlib")
# Run spellcheck (with punctuation preservation & unicode normalization)
sentence = "කොළඹ වරායේ සිට බස්නහිර දෙසින් නාවික සැතපුම් 17ක් පමණ දුරන්."
corrected = detector(sentence)
print(corrected)
# Output: "කොළඹ වරායේ සිට බස්නාහිර දෙසින් නාවික සැතපුම් 17ක් පමණ දුරින්."
Typo Detection Fallback
If PyTorch is not installed in the target environment, sinlib falls back automatically to the statistical N-Gram model (akshara_ngram.json) to perform spelling checks.
# Check word suspicion level
is_typo = detector.is_word_suspicious("පසලට") # True
For more details, usage examples, and API references, please refer to the official documentation:
https://sinlib.readthedocs.io/en/latest/
Identity and Version
- Repository
- Ransaka/sinlib
- Publisher
- Ransaka Ravihara
- Task
- Not stated by the source
- Modality
- Other
- Library
- Not stated by the source
- Parameters
- Not stated by the source
- Languages
- si
- Revision
- 0ba9e053fee892b2906afc2aadc776f165c78dca
- First published
- 2025-03-23
- Last updated
- 2026-08-01
Files and Weights
14 files, 22.3 MB in total. The weights are 2 files totalling 1.9 MB in pt.
Every file
| File | Type | Size | SHA-256 |
|---|---|---|---|
| bigru_corrector.pt | Weights | 1.3 MB | a282a85086a9 |
| bigru_detector.pt | Weights | 651.9 KB | fceec7b26ef4 |
| akshara_vocab.json | Configuration | 9.6 KB | — |
| char_map.json | Configuration | 15.3 KB | — |
| config.json | Configuration | 260 B | — |
| news_bigrams.json | Configuration | 10.7 MB | 66d325835c7f |
| news_unigrams.json | Configuration | 3.1 MB | — |
| README.md | Documentation | 3.1 KB | — |
| dictionary.npy | Other | 5.7 MB | 24d74fb6669b |
| fonts/NotoSansSinhala-Regular.ttf | Other | 243.5 KB | 33a77b6965e5 |
| ngram_probs.npy | Other | 582.6 KB | 804c4fefbf5d |
| sinhala_chars_with_special_chars.txt | Other | 384 B | — |
| .gitattributes | Repository | 1.7 KB | — |
| vocab.json | Tokenizer | 13.9 KB | — |
License and Download
- License
- mit
- Access
- Open weights, no gate
- Download size
- 1.9 MB
Released by Ransaka Ravihara through its official repository on Hugging Face. Read the license.
Memory Requirements
| Precision | Weights in memory |
|---|---|
| As published | 1.9 MB |
Weights only, from the published parameter count; the key-value cache and runtime add to this.
Questions About sinlib
Can I use sinlib commercially?
Yes. sinlib is released under MIT License. The MIT License is a short permissive license. It permits commercial use, modification and redistribution, provided the copyright notice and permission notice are included.