Linguistically-informed NLP toolkit for the Wolof language
Project description
Wolof NLP Toolkit
Wolof is a Niger–Congo language spoken by over 18 million people across Senegal, Gambia, and Mauritania, yet it remains largely unsupported by mainstream NLP libraries such as spaCy and NLTK. This toolkit addresses that gap by providing Wolof-aware processing that accounts for the language’s complex tense–aspect–mood (TAM) system, agglutinative morphology, and pervasive code-switching with French and Arabic.
Features
- Tokenization with two modes: word-level and morpheme-level
- Language detection for Wolof, French, and Arabic loanwords
- Orthography normalization (informal → CLAD standard)
- Morphological analysis with derivational suffix recognition
- POS tagging with Wolof-specific tagset
- Named Entity Recognition with Senegalese gazetteers
- Sentiment analysis with negation and intensifier handling
- Interlinear glossing following Leipzig conventions
Installation
pip install wolof-nlp
Or install from source:
git clone https://github.com/maimouna-mbacke/wolof-nlp.git
cd wolof-nlp
pip install -e .
Quick Start
from wolof_nlp import WolofTokenizer, tokenize, morphemes, normalize, analyze_morphology
# Tokenization with language detection
tokenizer = WolofTokenizer(normalize=True, detect_language=True)
tokens = tokenizer.tokenize("Dafa trop neex")
for tok in tokens:
print(f"{tok.text}: {tok.language.name}")
# Dafa: WOLOF
# trop: FRENCH
# neex: WOLOF
# Two tokenization modes
tokenize("Damay dem") # ['Damay', 'dem'] - word level
morphemes("Damay dem") # ['da', 'ma', 'y', 'dem'] - morpheme level
# Orthography normalization
normalize("dieuradieuf") # → 'jërëjëf'
# Morphological analysis
analyze_morphology("bindkat") # → [bind:ROOT, kat:NOMINALIZATION]
Applications
from wolof_nlp.applications import tag, extract_entities, analyze_sentiment, gloss
# POS Tagging
tag("Xale bi dafa lekk")
# [('Xale', 'NOUN'), ('bi', 'DET'), ('dafa', 'TAM'), ('lekk', 'VERB')]
# Named Entity Recognition
extract_entities("Abdou dem na Dakar")
# [NamedEntity('Abdou', 'PER'), NamedEntity('Dakar', 'LOC')]
# Sentiment Analysis (negation-aware)
result = analyze_sentiment("Dafa neex lool")
print(result.sentiment) # POSITIVE
# Interlinear Glossing
gloss("Xale bi mungi fo").to_string()
Evaluation
Tokenizer performance on 542 annotated sentences:
| System | Precision | Recall | F1 | Exact Match |
|---|---|---|---|---|
| Wolof NLP | 95.9% | 94.9% | 95.4% | 83.4% |
| Regex baseline | 80.1% | 83.1% | 81.5% | 57.7% |
| Whitespace | 56.6% | 38.8% | 46.0% | 1.5% |
See evaluation details.
Documentation
- Notebooks
- 01_quickstart.ipynb - Core functionality
- 02_applications.ipynb - NLP applications
- 03_evaluation.ipynb - Evaluation on gold standard
- API Reference: docs/api/
- Linguistics: docs/linguistics/
Project Structure
wolof-nlp/
├── src/wolof_nlp/
│ ├── core/ # Tokenizer, normalizer
│ ├── morphology/ # Morphological analyzer
│ ├── applications/ # POS, NER, sentiment, glosser
│ ├── lexicon/ # Dictionary, collocations
│ ├── semantics/ # Noun classes, spatial, temporal
│ └── syntax/ # Sentence parser, clause analyzer
├── data/
│ └── gold_standard.json
├── notebooks/
├── tests/
└── docs/
Contributing
Contributions are welcome! See CONTRIBUTING.md for guidelines.
License
MIT License - see LICENSE for details.
Author
Maimouna MBACKE - GitHub
Acknowledgments
- Wolof linguistic resources from Ka (1994), McLaughlin, Robert
- CLAD orthography standard
- Senegalese YouTube corpus for gold standard data
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 wolof_nlp-0.1.0.tar.gz.
File metadata
- Download URL: wolof_nlp-0.1.0.tar.gz
- Upload date:
- Size: 83.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f6ba12936ad6915c2a470b0d1429ad9d305bed81fd102064843ae31b7d7825e
|
|
| MD5 |
e4c16273a20e8aa81c9a6c604209d5cd
|
|
| BLAKE2b-256 |
fcdc35e41b29c07fe942125ee7e80aae0f6c235fe6d648ed373226a6b10281e5
|
File details
Details for the file wolof_nlp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wolof_nlp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 50.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
011849c21185df2b9e0758ce801ea645d183b8e5d9f06eb264fb6a21665550fd
|
|
| MD5 |
0cb873c2620c3e1a85bf5d3880ec23b6
|
|
| BLAKE2b-256 |
1c62de8e3a9932313e32793a864da653391e828ac170c3467866145775714ca6
|