A simple tokenizer for Burmese text
Project description
Burmese Tokenizer
Tokenize Burmese text like a pro. No fancy stuff, just gets the job done.
Quick Start
# Using pip
pip install burmese-tokenizer
# Using uv (faster)
uv add burmese-tokenizer
from burmese_tokenizer import BurmeseTokenizer
tokenizer = BurmeseTokenizer()
text = "မင်္ဂလာပါ။ နေကောင်းပါသလား။"
# Tokenize
result = tokenizer.encode(text)
print(result["pieces"]) # ['▁မင်္ဂလာ', '▁ပါ', '။', '▁နေ', '▁ကောင်း', '▁ပါ', '▁သလား', '။']
# Decode
decoded = tokenizer.decode(result["pieces"])
print(decoded) # မင်္ဂလာပါ။ နေကောင်းပါသလား။
CLI
# Tokenize
burmese-tokenizer "မင်္ဂလာပါ။"
# Verbose mode (shows all the details)
burmese-tokenizer -v "မင်္ဂလာပါ။"
# Decode tokens back to text
burmese-tokenizer -d -t "▁မင်္ဂလာ,▁ပါ,။"
API
encode(text)- Chop text into tokensdecode(pieces)- Glue tokens back togetherdecode_ids(ids)- Convert IDs back to textget_vocab_size()- How many tokens we knowget_vocab()- The whole vocabulary
Dev Setup
git clone git@github.com:Code-Yay-Mal/burmese_tokenizer.git
cd burmese_tokenizer
uv sync --dev
uv run pytest
uv build
uv build --no-sources
# make sure to have pypirc
uv run twine upload dist/* or uv publish
# bump version
uv version --bump patch
uv version --short
# or publish with gh-action
git tag v0.1.2
git push origin v0.1.2
# if something goes wrong delete and restart all over again
git tag -d v0.1.2 && git push origin :refs/tags/v0.1.2
License
MIT - do whatever you want with it.
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 burmese_tokenizer-0.1.2.tar.gz.
File metadata
- Download URL: burmese_tokenizer-0.1.2.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc38ec28e8722e23ea8a24e728cd5b327a07c5b2ee490d73b6c3fedc018dbb97
|
|
| MD5 |
5a5aed05940f387253bb958df70c5a40
|
|
| BLAKE2b-256 |
14266bb9852e13aec329a3d7a96b427a50beb044df412607d4936088a5eff678
|
File details
Details for the file burmese_tokenizer-0.1.2-py3-none-any.whl.
File metadata
- Download URL: burmese_tokenizer-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcc356f296ba258efdc9b76d9126252c0b8fc15ced377ed0aa688be09f48c31d
|
|
| MD5 |
0a9372a3001252db37a2b7366a50be8e
|
|
| BLAKE2b-256 |
a719ef79ac440bbc3dc880b727e12ec965940d003e9783843e7c3fdc657a628a
|