A modern Pythonic implementation of Avro Phonetic.
Project description
avro.py
A modern Pythonic implementation of the popular Bengali phonetic-typing software Avro Phonetic.
⚡ Overview
avro.py provides a fully fledged, batteries-included text parser which can parse, reverse and even convert English Roman script into its phonetic equivalent (unicode) of Bengali. At its core, it implements an extensively modified version of the Avro Phonetic Dictionary Search Library by Mehdi Hasan Khan.
✨ Inspirations
This package is inspired from Rifat Nabi's jsAvroPhonetic library and derives from Kaustav Das Modak's pyAvroPhonetic.
🔨 Installation
This package requires Python 3.10 or higher to be used inside your development environment.
# Install or upgrade.
$ pip install -U avro.py
# Or, add with the uv package manager.
$ uv add avro.py
Usage Guide
You can also check the examples directory for checking this whole snippet in action, as well as other use cases.
Parsing to Bengali
For a single block of text, use avro.parse():
# Import the package.
import avro
# Our dummy text.
dummy = 'ami banglay gan gai.'
# Parse a single string.
parsed = avro.parse(dummy)
print(parsed) # আমি বাংলায় গান গাই।
If you have multiple strings, use avro.parse_iter() to get a list of parsed results:
texts = ['ami banglay gan gai.', 'tumi kOthay zao?']
parsed_list = avro.parse_iter(texts)
print(parsed_list) # ['আমি বাংলায় গান গাই।', 'তুমি কোথায় যাও?']
Alternatively, set the bijoy flag to True for receiving the output in the Bijoy Keyboard format.
bijoy_output = avro.parse(dummy, bijoy=True)
# Output: Avwg evsjvh় Mvb MvB।
Conversions
To convert a single Bengali string (Avro/Unicode) to the Bijoy Keyboard format:
bijoy_text = avro.to_bijoy("আমি বাংলায় গান গাই।")
print(bijoy_text) # Avwg evsjvh় Mvb MvB।
To convert multiple strings at once, use avro.to_bijoy_iter():
bijoy_list = avro.to_bijoy_iter(['আমি বাংলায় গান গাই।', 'তুমি কোথায় যাও?'])
print(bijoy_list) # ['Avwg evsjvh় Mvb MvB।', 'tvmf wkrwb‡¶ jd?']
On the contrary, to convert a single Bijoy string back to Unicode Bengali:
unicode_text = avro.to_unicode("Avwg evsjvh় Mvb MvB।")
print(unicode_text) # আমি বাংলায় গান গাই।
For multiple strings, use avro.to_unicode_iter():
unicode_list = avro.to_unicode_iter(['Avwg evsjvh় Mvb MvB।', 'tvmf wkrwb‡¶ jd?'])
print(unicode_list) # ['আমি বাংলায় গান গাই।', 'তুমি কোথায় যাও?']
Reversing Back
To reverse a single Unicode Bengali string back to English Roman script:
reversed_text = avro.reverse("আমি বাংলায় গান গাই।")
print(reversed_text) # ami banglay gan gai.
[!WARNING] The reverse functions are by-nature lossy and might not output the correct replacement for some letters in favor of readability sometimes.
To reverse multiple strings at once, use avro.reverse_iter():
rev_list = avro.reverse_iter(['আমি বাংলায় গান গাই।', 'তুমি কোথায় যাও?'])
print(rev_list) # ['ami banglay gan gai.', 'tumi kothay zaw?']
Remapped Exceptions
avro.py also contains a built-in collection of words which are pre-baked to be passed into your text without any processing. These words can be accessed through both the parse and reverse functions, so that you do not have to care for phonetics:
[!NOTE] Remapping is a work-in-progress feature. Some words may still be missing.
avro.parse("ami Microsoft e kaj kori")
# আমি মাইক্রোসফট এ কাজ করি
Asynchronous Operations
All of the functions above, when suffixed with _async, provide their asynchronous counterparts which have a slight performance bump in certain use cases. Please see the async examples to find out more about their usage.
🛠️ Contributing
:octocat: Fork -> Do your changes -> Send a Pull Request, it's that easy!
This project is based on the uv package manager by Astral. In order to automatically update and set up the environment, you can run the following command:
# (Optional) Install recommended Python version and
# setup virtual environment for development.
$ uv python install && uv venv
$ source .venv/bin/activate
# Install the project:
$ uv sync --all-extras --dev
# Build the project:
$ uv build --verbose
In order to run the tests, you can use the following command:
# Run unit tests:
$ uv run pytest .
❤️ Acknowledgements
avro.py would not be possible without the awesome minds behind the original Avro Keyboard software:
And, some awesome people:
License
MIT or MIT OR Apache-2.0 (your choice).
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 avro_py-2025.11.3.tar.gz.
File metadata
- Download URL: avro_py-2025.11.3.tar.gz
- Upload date:
- Size: 25.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f702004d2a9bdab4af487382c38396416e79a861ba7b1b0bbcef6240da11f20f
|
|
| MD5 |
dccba82c4dfe6e3b9f397143d89d7f89
|
|
| BLAKE2b-256 |
a3e6be4673df4d202ab3681879591e8ced909f709f74a888b0c2757964adec85
|
File details
Details for the file avro_py-2025.11.3-py3-none-any.whl.
File metadata
- Download URL: avro_py-2025.11.3-py3-none-any.whl
- Upload date:
- Size: 30.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ede12a3fbc39f30e26be3a12853cf0fb08e89e15bea8cde7e682971a993dd88
|
|
| MD5 |
ff3943442fa38f9e27323c05aac39445
|
|
| BLAKE2b-256 |
37861ef28392d9e868bc56c160a768a9dfb3c0ac5e36496a9810c5fa34962184
|