Name | avro-py JSON |
Version |
2024.12.9
JSON |
| download |
home_page | None |
Summary | A modern Pythonic implementation of Avro Phonetic. |
upload_time | 2024-12-09 15:11:34 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT License Copyright (c) 2022-present HitBlast Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
avro
avro phonetic
bangla
bengali
bengali phonetics
phonetics
python
transliteration
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<!-- SPDX-License-Identifier: MIT -->
<div align="center">
# <img src="https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/python/python.png" height="40px"/> avro.py
A modern Pythonic implementation of the popular Bengali phonetic-typing software **Avro Phonetic.**
[](https://pepy.tech/project/avro-py)


<br>
<img src="https://github.com/hitblast/avro.py/blob/main/assets/banner.png?raw=True" style="width: 500px; height: auto;"><br>
[](https://github.com/hitblast/avro.py/actions/workflows/unit-tests.yml)
[](https://github.com/hitblast/avro.py/actions/workflows/nightly.yml)
[](https://github.com/hitblast/avro.py/actions/workflows/linting.yml)
[](https://github.com/hitblast/avro.py/actions/workflows/formatting.yml)
<br>
</div>
## ⚡ 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](https://github.com/mugli).
> [!NOTE]
> Update: As of October 2024, Python 3.8 has reached its EOL, so for keeping
> this project updated, the minimum required version will be Python 3.9 from now
> onwards. It is strongly suggested that you migrate your project for better
> compatibility. <br>
## ✨ Inspirations
This package is inspired from Rifat Nabi's jsAvroPhonetic library and derives from Kaustav Das Modak's pyAvroPhonetic.
<br>
## 🔨 Installation
This package requires **Python 3.9 or higher** to be used inside your development environment.
```sh
# Install / upgrade.
$ pip install avro.py
```
#### 📦 ...or you can try the CLI!
[**avnie**](https://github.com/hitblast/avnie) is a newly developed CLI tool that uses avro.py under the hood. You can install it using:
```sh
# Install / upgrade avnie.
$ pip install avnie
```
<br>
## 🔖 Usage Guide
This small tour guide will describe how you can use avro.py back and forth to operate (cutlery!) on Bengali text. You can also check the [examples](https://github.com/hitblast/avro.py/tree/main/examples) directory for checking [this whole snippet](https://github.com/hitblast/avro.py/blob/main/examples/simple.py) in action, as well as other use cases.
#### 1. `parse()`
Let's assume I want to parse some English text to Bengali, which is "ami banglay gan gai.", so in this case to convert it to Bengali, we can use this snippet as a starter code and then extend upon it as our boilerplate for multiple operations later on:
```python
# Import the package.
import avro
# Our dummy text.
dummy = 'ami banglay gan gai.'
# Parsing the text.
avro_output = avro.parse(dummy)
print(output) # Output: আমি বাংলায় গান গাই।
```
#### 2. `parse(bijoy=True)`
Alternatively, I can also do it in Bijoy Keyboard format:
```python
bijoy_output = avro.parse(dummy, bijoy=True) # Output: Avwg evsjvh় Mvb MvB।
```
#### 3. `to_bijoy()`
Or, we can take the previous `avro_output` and convert it to Bijoy if we want to, like this:
```python
bijoy_text = avro.to_bijoy(avro_output) # Output: Avwg evsjvh় Mvb MvB।
```
#### 4. `to_unicode()`
Conversely, we can convert the Bijoy text we got just now and convert it back to Unicode Bengali:
```python
unicode_text = avro.to_unicode(bijoy_text) # Output: আমি বাংলায় গান গাই।
```
#### 4. `reverse()`
Finally, we can just reverse back to the original text we passed as input in the first place:
```python
reversed_text = avro.reverse(uncode_text) # Output: ami banglay gan gai.
```
<br>
## 🐍 A Note on `async`/`await` Support
Since version [2024.12.5](https://github.com/hitblast/avro.py/releases/tag/2024.12.5), the package now supports `async`/`await` syntax for all the functions.
> [!NOTE]
> Unless you have a very specific use, the asynchronous functions only
> provide slight performance improvements and are not necessary for most use
> cases, the asynchronous functions only provide slight performance improvements
> and are not necessary for most use cases.
Here's a reiteration of the previous example using the new syntax:
```python
import asyncio
import avro
async def main():
# Our dummy text.
dummy = 'ami banglay gan gai.'
avro_output = await avro.parse_async(dummy)
print(output) # Output: আমি বাংলায় গান গাই।
bijoy_output = await avro.parse_async(dummy, bijoy=True)
print(bijoy_output) # Output: Avwg evsjvh় Mvb MvB।
bijoy_text = await avro.to_bijoy_async(avro_output)
print(bijoy_text) # Output: Avwg evsjvh় Mvb MvB।
unicode_text = await avro.to_unicode_async(bijoy_text)
print(unicode_text) # Output: আমি বাংলায় গান গাই।
reversed_text = await avro.reverse_async(uncode_text)
print(reversed_text) # Output: ami banglay gan gai.
# Running the event loop.
asyncio.run(main())
```
<br>
## 🛠️ Contributing
:octocat: _Fork -> Do your changes -> Send a Pull Request, it's that easy!_ <br>
---
**Additional Developer Notes**
This project is based on the [uv](https://github.com/astral-sh/uv) package manager by Astral. In order to automatically update and set up the environment, you can run the following command:
```sh
# (Optional) Install recommended Python version: (also sets up the virtual environment)
$ 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:
```sh
# Run unit tests:
$ uv run pytest .
```
<br>
### 🐛 We're looking for bug hunters, by the way!
If you come across any kind of bug or wanna request a feature, please let us know by opening an issue [here](https://github.com/hitblast/avro.py/issues). We do need more ideas to keep the project alive and running, don't we? :P
---
<br>
## 👑 Acknowledgements
- [Mehdi Hasan Khan](https://github.com/mugli) for originally developing and maintaining [Avro Phonetic](https://github.com/omicronlab/Avro-Keyboard).
- [Rifat Nabi](https://github.com/torifat) for porting it to Javascript.
- [Sarim Khan](https://github.com/sarim) for writing ibus-avro which helped to clarify my concepts further.
- [Kaustav Das Modak](https://github.com/kaustavdm) for porting Rifat Nabi's JavaScript iteration to Python 2.
- Md Enzam Hossain for helping him understand the ins and outs of the Avro dictionary and the way it works.
<br>
## 📋 License
Licensed under the [MIT License](https://github.com/hitblast/avro.py/blob/main/LICENSE).
Raw data
{
"_id": null,
"home_page": null,
"name": "avro-py",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "avro, avro phonetic, bangla, bengali, bengali phonetics, phonetics, python, transliteration",
"author": null,
"author_email": "HitBlast <hitblastlive@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/ae/72/9966107d4d6da328f2c531a613b63d0ee6276c427b8c57521264aa906981/avro_py-2024.12.9.tar.gz",
"platform": null,
"description": "<!-- SPDX-License-Identifier: MIT -->\n\n<div align=\"center\">\n\n# <img src=\"https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/python/python.png\" height=\"40px\"/> avro.py\n\nA modern Pythonic implementation of the popular Bengali phonetic-typing software **Avro Phonetic.**\n\n[](https://pepy.tech/project/avro-py)\n\n\n\n<br>\n\n<img src=\"https://github.com/hitblast/avro.py/blob/main/assets/banner.png?raw=True\" style=\"width: 500px; height: auto;\"><br>\n\n[](https://github.com/hitblast/avro.py/actions/workflows/unit-tests.yml)\n[](https://github.com/hitblast/avro.py/actions/workflows/nightly.yml)\n[](https://github.com/hitblast/avro.py/actions/workflows/linting.yml)\n[](https://github.com/hitblast/avro.py/actions/workflows/formatting.yml)\n\n<br>\n\n</div>\n\n## \u26a1 Overview\n\n**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](https://github.com/mugli).\n\n> [!NOTE]\n> Update: As of October 2024, Python 3.8 has reached its EOL, so for keeping\n> this project updated, the minimum required version will be Python 3.9 from now\n> onwards. It is strongly suggested that you migrate your project for better\n> compatibility. <br>\n\n## \u2728 Inspirations\n\nThis package is inspired from Rifat Nabi's jsAvroPhonetic library and derives from Kaustav Das Modak's pyAvroPhonetic.\n\n<br>\n\n## \ud83d\udd28 Installation\n\nThis package requires **Python 3.9 or higher** to be used inside your development environment.\n\n```sh\n# Install / upgrade.\n$ pip install avro.py\n```\n\n#### \ud83d\udce6 ...or you can try the CLI!\n\n[**avnie**](https://github.com/hitblast/avnie) is a newly developed CLI tool that uses avro.py under the hood. You can install it using:\n\n```sh\n# Install / upgrade avnie.\n$ pip install avnie\n```\n\n<br>\n\n## \ud83d\udd16 Usage Guide\n\nThis small tour guide will describe how you can use avro.py back and forth to operate (cutlery!) on Bengali text. You can also check the [examples](https://github.com/hitblast/avro.py/tree/main/examples) directory for checking [this whole snippet](https://github.com/hitblast/avro.py/blob/main/examples/simple.py) in action, as well as other use cases.\n\n#### 1. `parse()`\n\nLet's assume I want to parse some English text to Bengali, which is \"ami banglay gan gai.\", so in this case to convert it to Bengali, we can use this snippet as a starter code and then extend upon it as our boilerplate for multiple operations later on:\n\n```python\n# Import the package.\nimport avro\n\n# Our dummy text.\ndummy = 'ami banglay gan gai.'\n\n# Parsing the text.\navro_output = avro.parse(dummy)\nprint(output) # Output: \u0986\u09ae\u09bf \u09ac\u09be\u0982\u09b2\u09be\u09af\u09bc \u0997\u09be\u09a8 \u0997\u09be\u0987\u0964\n```\n\n#### 2. `parse(bijoy=True)`\n\nAlternatively, I can also do it in Bijoy Keyboard format:\n\n```python\nbijoy_output = avro.parse(dummy, bijoy=True) # Output: Avwg evsjvh\u09bc Mvb MvB\u0964\n```\n\n#### 3. `to_bijoy()`\n\nOr, we can take the previous `avro_output` and convert it to Bijoy if we want to, like this:\n\n```python\nbijoy_text = avro.to_bijoy(avro_output) # Output: Avwg evsjvh\u09bc Mvb MvB\u0964\n```\n\n#### 4. `to_unicode()`\n\nConversely, we can convert the Bijoy text we got just now and convert it back to Unicode Bengali:\n\n```python\nunicode_text = avro.to_unicode(bijoy_text) # Output: \u0986\u09ae\u09bf \u09ac\u09be\u0982\u09b2\u09be\u09af\u09bc \u0997\u09be\u09a8 \u0997\u09be\u0987\u0964\n```\n\n#### 4. `reverse()`\n\nFinally, we can just reverse back to the original text we passed as input in the first place:\n\n```python\nreversed_text = avro.reverse(uncode_text) # Output: ami banglay gan gai.\n```\n\n<br>\n\n## \ud83d\udc0d A Note on `async`/`await` Support\n\nSince version [2024.12.5](https://github.com/hitblast/avro.py/releases/tag/2024.12.5), the package now supports `async`/`await` syntax for all the functions.\n\n> [!NOTE]\n> Unless you have a very specific use, the asynchronous functions only\n> provide slight performance improvements and are not necessary for most use\n> cases, the asynchronous functions only provide slight performance improvements\n> and are not necessary for most use cases.\n\nHere's a reiteration of the previous example using the new syntax:\n\n```python\nimport asyncio\nimport avro\n\nasync def main():\n # Our dummy text.\n dummy = 'ami banglay gan gai.'\n\n avro_output = await avro.parse_async(dummy)\n print(output) # Output: \u0986\u09ae\u09bf \u09ac\u09be\u0982\u09b2\u09be\u09af\u09bc \u0997\u09be\u09a8 \u0997\u09be\u0987\u0964\n\n bijoy_output = await avro.parse_async(dummy, bijoy=True)\n print(bijoy_output) # Output: Avwg evsjvh\u09bc Mvb MvB\u0964\n\n bijoy_text = await avro.to_bijoy_async(avro_output)\n print(bijoy_text) # Output: Avwg evsjvh\u09bc Mvb MvB\u0964\n\n unicode_text = await avro.to_unicode_async(bijoy_text)\n print(unicode_text) # Output: \u0986\u09ae\u09bf \u09ac\u09be\u0982\u09b2\u09be\u09af\u09bc \u0997\u09be\u09a8 \u0997\u09be\u0987\u0964\n\n reversed_text = await avro.reverse_async(uncode_text)\n print(reversed_text) # Output: ami banglay gan gai.\n\n# Running the event loop.\nasyncio.run(main())\n```\n\n<br>\n\n## \ud83d\udee0\ufe0f Contributing\n\n:octocat: _Fork -> Do your changes -> Send a Pull Request, it's that easy!_ <br>\n\n---\n\n**Additional Developer Notes**\n\nThis project is based on the [uv](https://github.com/astral-sh/uv) package manager by Astral. In order to automatically update and set up the environment, you can run the following command:\n\n```sh\n# (Optional) Install recommended Python version: (also sets up the virtual environment)\n$ uv python install && uv venv\n$ source .venv/bin/activate\n\n# Install the project:\n$ uv sync --all-extras --dev\n\n# Build the project:\n$ uv build --verbose\n```\n\nIn order to run the tests, you can use the following command:\n\n```sh\n# Run unit tests:\n$ uv run pytest .\n```\n\n\n<br>\n\n### \ud83d\udc1b We're looking for bug hunters, by the way!\n\nIf you come across any kind of bug or wanna request a feature, please let us know by opening an issue [here](https://github.com/hitblast/avro.py/issues). We do need more ideas to keep the project alive and running, don't we? :P\n\n---\n\n<br>\n\n## \ud83d\udc51 Acknowledgements\n\n- [Mehdi Hasan Khan](https://github.com/mugli) for originally developing and maintaining [Avro Phonetic](https://github.com/omicronlab/Avro-Keyboard).\n- [Rifat Nabi](https://github.com/torifat) for porting it to Javascript.\n- [Sarim Khan](https://github.com/sarim) for writing ibus-avro which helped to clarify my concepts further.\n- [Kaustav Das Modak](https://github.com/kaustavdm) for porting Rifat Nabi's JavaScript iteration to Python 2.\n- Md Enzam Hossain for helping him understand the ins and outs of the Avro dictionary and the way it works.\n\n<br>\n\n## \ud83d\udccb License\n\nLicensed under the [MIT License](https://github.com/hitblast/avro.py/blob/main/LICENSE).\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2022-present HitBlast Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "A modern Pythonic implementation of Avro Phonetic.",
"version": "2024.12.9",
"project_urls": {
"Documentation": "https://hitblast.github.io/avro.py",
"Homepage": "https://pypi.org/project/avro-py",
"Repository": "https://github.com/hitblast/avro.py"
},
"split_keywords": [
"avro",
" avro phonetic",
" bangla",
" bengali",
" bengali phonetics",
" phonetics",
" python",
" transliteration"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "9a52a7b63bf0b33144cc40c20611402165eaa06b06cea4cefd644d421bf4d6bb",
"md5": "89c11544781368a92e58792f8e2c01e4",
"sha256": "61cc357ba9785e0f3ab473f3b01c189741a601dc05648f6b59c15178a78d1630"
},
"downloads": -1,
"filename": "avro_py-2024.12.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "89c11544781368a92e58792f8e2c01e4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 20540,
"upload_time": "2024-12-09T15:11:33",
"upload_time_iso_8601": "2024-12-09T15:11:33.115331Z",
"url": "https://files.pythonhosted.org/packages/9a/52/a7b63bf0b33144cc40c20611402165eaa06b06cea4cefd644d421bf4d6bb/avro_py-2024.12.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "ae729966107d4d6da328f2c531a613b63d0ee6276c427b8c57521264aa906981",
"md5": "eecd2b5c8a081eadd5ccb07db639c0cd",
"sha256": "4948d9c9e81c03e75125835abb2b79f6dce86ace3cc39cc0b41d659e6aed1c1a"
},
"downloads": -1,
"filename": "avro_py-2024.12.9.tar.gz",
"has_sig": false,
"md5_digest": "eecd2b5c8a081eadd5ccb07db639c0cd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 18643,
"upload_time": "2024-12-09T15:11:34",
"upload_time_iso_8601": "2024-12-09T15:11:34.740778Z",
"url": "https://files.pythonhosted.org/packages/ae/72/9966107d4d6da328f2c531a613b63d0ee6276c427b8c57521264aa906981/avro_py-2024.12.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-09 15:11:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hitblast",
"github_project": "avro.py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "avro-py"
}