Skip to main content

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)

    1. Cleaning
  • Remove URLs, emojis, and control characters

  • Handle mixed-script text safely

  • Preserve readable content and line structure

    1. Unicode & Canonical Normalization
  • Unicode normalization (NFC)

  • Removal of invisible Unicode characters

  • Canonical punctuation spacing

  • Whitespace normalization

  • Ethiopic question mark (แง โ†’ ?)

    1. Linguistic Normalization (Optional)

Directional, order-preserving mappings only:

  • แˆ -family โ†’ แˆฐ-family

  • แŒธ-family โ†’ แ€-family

  • แŠ€-family โ†’ แˆ€-family

  • โŒ No vowel collapsing

  • โŒ No morphological changes

  • โŒ No phonetic normalization

    1. Tokenization
  • Sentence segmentation

  • Word tokenization

  • Ethiopic and ASCII punctuation aware

    1. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tigrinya_nlp-0.1.0.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tigrinya_nlp-0.1.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

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

Hashes for tigrinya_nlp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c90a0376cc083159e61e969599ab7838f5df1f21115a68a500f59e8dc4fe317e
MD5 3ff7049992fbe696459ad82c19d6202c
BLAKE2b-256 4a3542ebf620813d82ef4bb87b5ffce3a53895f14960e6384949cc25834336c4

See more details on using hashes here.

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

Hashes for tigrinya_nlp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad059429babee13235e43c955f37531e073341ebd1b444bb93c574203814a191
MD5 610bc6663547cf8be2f5c6a69436507e
BLAKE2b-256 9fe13bbf77f7c007e8c182ad86b2ec100a4d95b018ad7fafb5c1f2d6d360d06b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page