Lightweight Tigrinya text preprocessing: normalization, cleaning, tokenization, and stopwords.
Project description
Tigrinya-NLP
A lightweight, conservative preprocessing toolkit for Tigrinya (Geสฝez script) text.
Tigrinya-NLP provides carefully designed utilities for cleaning, normalization, tokenization, and stopword handling of Tigrinya text. The library prioritizes linguistic safety, transparency, and reproducibility, making it suitable for downstream NLP tasks without introducing aggressive or opaque transformations.
โจ Design Principles
This project is guided by the following principles:
-
Conservative by default
-
No stemming, lemmatization, or morphological rewriting unless explicitly enabled.
-
Script-aware, not model-driven
-
Handles Ethiopic punctuation, spacing, and Unicode normalization correctly.
-
Explicit normalization choices
-
All linguistic mappings are documented, directional, and reversible in intent.
-
Tool, not dataset
-
This library does not ship corpora or lexicons; it documents how to validate against external resources.
-
Low dependency footprint
-
Pure Python, no Java, no native extensions, no heavy NLP frameworks.
๐ฆ Features (v1)
-
- Cleaning
-
Remove URLs, emojis, and control characters
-
Handle mixed-script text safely
-
Preserve readable content and line structure
-
- Unicode & Canonical Normalization
-
Unicode normalization (NFC)
-
Removal of invisible Unicode characters
-
Canonical punctuation spacing
-
Whitespace normalization
-
Ethiopic question mark (แง โ ?)
-
- Linguistic Normalization (Optional)
Directional, order-preserving mappings only:
-
แ -family โ แฐ-family
-
แธ-family โ แ-family
-
แ-family โ แ-family
-
โ No vowel collapsing
-
โ No morphological changes
-
โ No phonetic normalization
-
- Tokenization
-
Sentence segmentation
-
Word tokenization
-
Ethiopic and ASCII punctuation aware
-
- Stopword Handling (Optional)
-
Curated Tigrinya stopword list
-
User-extensible
-
Applied only when explicitly requested
๐ซ Explicitly Out of Scope (v1)
To maintain safety and correctness, the following are not included in this version:
-
โ Stemming
-
โ Lemmatization
-
โ Spell correction
-
โ Morphological analysis
-
โ Language modeling
-
โ Dataset redistribution
These may be explored in future versions.
๐ง Why Conservative Processing?
Tigrinya is a morphologically rich, low-resource language. Aggressive normalization (stemming, lemmatization) can:
-
Destroy semantic distinctions
-
Break proper nouns and loanwords
-
Introduce irreversible errors
This library therefore focuses on safe preprocessing layers that improve consistency without changing meaning.
๐ Project Structure
tigrinya-nlp/
โ
โโโ src/
โ โโโ tigrinya_nlp/
โ โโโ __init__.py
โ โโโ cleaning.py
โ โโโ normalization.py
โ โโโ tokenization.py
โ โโโ stopwords.py
โ
โโโ tests/
โ โโโ test_imports.py
โ โโโ test_normalization.py
โ โโโ test_tokenization.py
โ โโโ test_cleaning.py
โ
โโโ tools/
โ โโโ datasets/
โ โโโ wiktionary/
โ โโโ SOURCES.md
โ โโโ CHECKLIST.md
โ โโโ validation_notes.md
โ
โโโ README.md
โโโ pyproject.toml
โโโ .gitignore
๐ Installation
pip install tigrinya-nlp
or for development:
pip install -e .
๐ Usage Examples
Normalize text (conservative)
from tigrinya_nlp import normalize
text = "แ แฅ แง แฃแ"
print(normalize(text))
Linguistic normalization
normalize(text, mode="linguistic")
Cleaning
from tigrinya_nlp import clean
cleaned = clean("Visit https://example.com แฐแฅ ๐")
Tokenization
from tigrinya_nlp import sentences, words
sentences(text)
words(text)
Stopword removal
from tigrinya_nlp import remove_stopwords
remove_stopwords(words(text))
๐งช Testing
pytest
All public APIs are covered by tests to ensure stability across versions.
๐ Dataset & Validation Philosophy
This project does not ship datasets.
Instead, it documents:
-
How to obtain external linguistic resources (e.g., Wiktionary via Kaikki)
-
How to manually and reproducibly validate preprocessing behavior
-
How to sanity-check normalization and tokenization decisions
See:
tools/datasets/wiktionary/
This approach ensures:
-
Reproducibility
-
Licensing safety
-
Research credibility
๐ License
MIT License
This repository documents how to access external linguistic resources but does not redistribute them. External resources (e.g., Wiktionary) are governed by their own licenses (typically CC BY-SA).
๐งญ Roadmap (Future Work)
Potential future phases:
-
Optional conservative stemmer (rule-gated)
-
Spell-checking utilities
-
Evaluation scripts
-
Dataset adapters (user-side)
-
CLI tools
All future features will maintain the conservative, transparent design philosophy.
๐ค Author
Developed as part of a research-oriented effort to improve tooling for under-resourced languages, with an emphasis on correctness, safety, and long-term extensibility.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tigrinya_nlp-0.1.0.tar.gz.
File metadata
- Download URL: tigrinya_nlp-0.1.0.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c90a0376cc083159e61e969599ab7838f5df1f21115a68a500f59e8dc4fe317e
|
|
| MD5 |
3ff7049992fbe696459ad82c19d6202c
|
|
| BLAKE2b-256 |
4a3542ebf620813d82ef4bb87b5ffce3a53895f14960e6384949cc25834336c4
|
File details
Details for the file tigrinya_nlp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tigrinya_nlp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad059429babee13235e43c955f37531e073341ebd1b444bb93c574203814a191
|
|
| MD5 |
610bc6663547cf8be2f5c6a69436507e
|
|
| BLAKE2b-256 |
9fe13bbf77f7c007e8c182ad86b2ec100a4d95b018ad7fafb5c1f2d6d360d06b
|