Skip to main content

Tokenizer library for Afaan Oromo supporting Unigram, BPE, and WordPiece algorithms.

Project description

Afaan Oromo Tokenizer

Afaan_oromo_tokenizer is a linguistically informed and computationally efficient tokenizer for Afaan Oromo, one of the most widely spoken low-resource languages in Africa.


  • While tokenizers exist for major languages (English, Chinese, etc.), Afan Oromo lacks robust open-source tokenization tools.
  • Afaan_oromo_tokenizer bridges that gap, facilitating NLP research for afaan Oromo.

Features

  • Included: BPE, Unigram, WordPiece
  • Trained on 14 million tokens
  • Total unique tokens in dataset: 420,000
  • Vocabulary size for each tokenizer type: 55,000

Installation

pip install afaanoromo-tokenizer

Usage

from afaanoromo_tokenizer import ao_tokenizer

# Example text
text = "Afaanni Oromoo afaan saba guddaati!"

# --- BPE tokenizer ---
bpe_tokenizer = ao_tokenizer("bpe")
bpe_encoded = bpe_tokenizer.encode(text)

print("BPE tokens:", bpe_encoded.tokens)
print("BPE ids:", bpe_encoded.ids)

bpe_decoded = bpe_tokenizer.decode(bpe_encoded.ids)
print("BPE decoded:", bpe_decoded)

# --- Unigram tokenizer ---
unigram_tokenizer = ao_tokenizer("unigram")
unigram_encoded = unigram_tokenizer.encode(text)

print("Unigram tokens:", unigram_encoded.tokens)
print("Unigram ids:", unigram_encoded.ids)

unigram_decoded = unigram_tokenizer.decode(unigram_encoded.ids)
print("Unigram decoded:", unigram_decoded)

# --- WordPiece tokenizer ---
wordpiece_tokenizer = ao_tokenizer("wordpiece")
wordpiece_encoded = wordpiece_tokenizer.encode(text)

print("WordPiece tokens:", wordpiece_encoded.tokens)
print("WordPiece ids:", wordpiece_encoded.ids)

wordpiece_decoded = wordpiece_tokenizer.decode(wordpiece_encoded.ids)
print("WordPiece decoded:", wordpiece_decoded)

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

afaanoromo_tokenizer-1.1.3.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

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

afaanoromo_tokenizer-1.1.3-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file afaanoromo_tokenizer-1.1.3.tar.gz.

File metadata

  • Download URL: afaanoromo_tokenizer-1.1.3.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for afaanoromo_tokenizer-1.1.3.tar.gz
Algorithm Hash digest
SHA256 9e42a9ac0649e78b35fdd200e95bb429d2d5091ddbab86bd3c66d5fbdb48d960
MD5 86d1393234467fdc5d5af695d8a035a2
BLAKE2b-256 ab918c2c5f2415c3cb7854424309cc4bf90a542373f94c344be56d180892f719

See more details on using hashes here.

File details

Details for the file afaanoromo_tokenizer-1.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for afaanoromo_tokenizer-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d8981ffa411abcdd0c1dee931292a4509d931bc3e55d46d586883036d9d79e55
MD5 9501dca4d1d2ea3a26e6baa793f38563
BLAKE2b-256 49b54f5dcb9c6f7e9f2b58faa5eef362fa394a4498f1d497a842ef872021d537

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