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-_okenizer

Usage

from afaanoromo_tokenizer import ao_tokenizer

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

# --- BPE tokenizer ---
bpe_tokenizer = ao_tokenizer("bpe")
bpe_tokens = bpe_tokenizer.encode(text).tokens
print("BPE tokens:", bpe_tokens)
bpe_decoded = bpe_tokenizer.decode(bpe_tokens)
print("BPE decoded:", bpe_decoded)

# --- Unigram tokenizer ---
unigram_tokenizer = ao_tokenizer("unigram")
unigram_tokens = unigram_tokenizer.encode(text).tokens
print("Unigram tokens:", unigram_tokens)
unigram_decoded = unigram_tokenizer.decode(unigram_tokens)
print("Unigram decoded:", unigram_decoded)

# --- WordPiece tokenizer ---
wordpiece_tokenizer = ao_tokenizer("wordpiece")
wordpiece_tokens = wordpiece_tokenizer.encode(text).tokens
print("WordPiece tokens:", wordpiece_tokens)
wordpiece_decoded = wordpiece_tokenizer.decode(wordpiece_tokens)
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.1.tar.gz (3.4 kB 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.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: afaanoromo_tokenizer-1.1.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • 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.1.tar.gz
Algorithm Hash digest
SHA256 0e52a3d9cdabd6b838448626eba10b17b9a27fddd9cb74f4ebbe108c96389ec3
MD5 884d649a07165f6a650970c590634cbc
BLAKE2b-256 c591e4ba510ad8aa9aaa8228856769bf52b4138e8493cd3641a486b76bd23909

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for afaanoromo_tokenizer-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fc666c22b151741e78e4ea37ae1d31ab14577cb8aa96150194b61cd2f78acecf
MD5 ea8fc0aa874b4c85163596b9df779bf0
BLAKE2b-256 c3caebc0fefc4d8895d3fa1cd36dfa16004bb5b1cd4bb2f8fcc3612434377404

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