clafrica
Python library for the Clafrica keyboard input method — converts ASCII shortcut sequences into Nufi (Fe'éfě'e) Unicode characters.
Install
pip install clafrica
Quick start
from clafrica import apply_mapping, finalize_input
apply_mapping("af1 e2 n*") # → "ɑ̀ é ŋ"
apply_mapping("eu3 af5") # → "ə̄ ɑ̂"
finalize_input("eu3") # → "ə̄"
API
apply_mapping(text)
Converts all Clafrica shortcuts in text to Unicode, preserving whitespace.
from clafrica import apply_mapping
apply_mapping("af1 e2 n*") # → "ɑ̀ é ŋ"
apply_mapping("uu1 o*2") # → "ʉ̀ ɔ́"
apply_mapping("N* O*") # → "Ŋ Ɔ"
apply_mapping("eu3 af5") # → "ə̄ ɑ̂"
Live-typing mode — pass preserve_ambiguous_trailing=True to leave the last
token untouched while the user may still extend it:
apply_mapping("af", preserve_ambiguous_trailing=True) # → "af" (could become af1, af2…)
apply_mapping("af1") # → "ɑ̀"
finalize_input(text)
Like apply_mapping but also resolves any trailing ambiguous shortcut —
use this when the user confirms input (e.g. presses Enter or Space).
from clafrica import finalize_input
finalize_input("eu3") # → "ə̄"
finalize_input("af1") # → "ɑ̀"
finalize_input("n*") # → "ŋ"
ClafricaEngine — advanced use
Instantiate the engine directly for a custom mapping or extra entries.
from clafrica import ClafricaEngine
# Add project-specific shortcuts on top of the default table
engine = ClafricaEngine(extra={"nkap": "ŋkɑ̄p"})
engine.apply_mapping("nkap e2") # → "ŋkɑ̄p é"
engine.finalize_input("eu3") # → "ə̄"
engine.lookup("af1") # → "ɑ̀"
engine.lookup("xyz") # → None
# Fully custom table (replaces the default)
engine = ClafricaEngine(mapping={"a1": "à", "e1": "è"})
Shortcut reference
| Shortcut | Output | Notes |
|---|---|---|
af |
ɑ |
open-a |
eu |
ə |
schwa |
ai |
ε |
epsilon |
o* |
ɔ |
open-o |
uu |
ʉ |
u-bar |
u- |
ʉ |
u-bar (alternative) |
n* |
ŋ |
eng |
N* |
Ŋ |
Eng (uppercase) |
b* |
ɓ |
implosive b |
d* |
ɗ |
implosive d |
*n |
ɲ |
palatal n |
a1 a2 a3 |
à á ā |
low / mid / high tone |
a5 a7 |
â ǎ |
rising / falling tone |
af1 af2 af3 |
ɑ̀ ɑ́ ɑ̄ |
open-a tones |
eu1 eu2 eu3 |
ə̀ ə́ ə̄ |
schwa tones |
ai1 ai2 ai3 |
ɛ̀ έ ɛ̄ |
epsilon tones |
o*1 o*2 o*3 |
ɔ̀ ɔ́ ɔ̄ |
open-o tones |
uu1 uu2 uu3 |
ʉ̀ ʉ́ ʉ̄ |
u-bar tones |
Tone digits: 1 = low, 2 = mid, 3 = high, 5 = rising, 7 = falling.
Phrase shortcuts (space-terminated)
These require a trailing space to trigger:
| Type | Output |
|---|---|
af |
ɑ |
eu |
ə |
ai |
ε |
uu |
ʉ |
Notes
- ASCII-only shortcuts are matched case-insensitively (
AF1=af1). - Unicode shortcuts (e.g.
à2,ɑ́1) are case-sensitive. - The mapping table is the canonical one used by the Nufi Android and Windows keyboards.
License
MIT
Metadata
Release files for clafrica 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| clafrica-1.0.1.tar.gz | 9.5 kB | Without provenance | Details for clafrica-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| clafrica-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for clafrica-1.0.1-py3-none-any.whl |
Total release size: 17.5 kB
Release files / clafrica-1.0.1.tar.gz
| Download URL | clafrica-1.0.1.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
36a4fc350feb92975985d4f9aae1ebf98119bbcbe23e0f0c0fc90b770ea826c2
|
|
BLAKE2b-256 checksum How to use checksums |
81d7be14016e9db1893431b0150fa3fa9af31db6ec56f7748e9b8c3ef9051b5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / clafrica-1.0.1-py3-none-any.whl
| Download URL | clafrica-1.0.1-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
073f39c1c360911106eb621cc621c54179ac16ffc733935811df61bd1028d9e2
|
|
BLAKE2b-256 checksum How to use checksums |
a435e849b29ea9b820dbb6763ca8bca31f145d1907e7a563e7b4fe4e0c34a868
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Security for clafrica 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.