Belorthography
Python 3 library for converting Belarusian text various orthographies (e.g. lacinka).
Install
pip install belorthography
Usage
from belorthography import convert, Orthography
convert('Груша цвiла апошнi год.', Orthography.OFFICIAL, Orthography.LATIN)
# returns "Hruša cviła apošni hod."
Supported orthographies:
- OFFICIAL (Narkamaŭka)
- CLASSICAL (Taraškievica)
- LATIN
- LATIN_NO_DIACTRIC
Supported conversions
| from / to | official | classical | latin | latin no diactric |
|---|---|---|---|---|
| official | ✓ | ✓ | ✓ | |
| classical | ✓ | ✓ | ||
| latin | ✓ |
Development
Create Python virtual enviroment
Ensure venv is installed:
apt-get install python3-venv
In the project folder run:
python -m venv ./venv
source ./venv/bin/activate
Setup package and run tests:
pip install -r requirements.txt
pytest
Diff mode
Diff mode helps to see if changes to translation algorithms have any effect. it is useful during development, especially while we are working on an existing algorithm that we don't fully understand yet. Steps to use it:
- Guard changes using
diff_mode.is_new()condition. For example in order to test whether removal of some conversion affects results:
# somewhere in conversion algorithm...
# Check if removal of сслі => ślli replacement has any effect.
# Control version is replacement is present while new version is replacement removed.
if not diff_mode.is_new():
res = res.replace('сллі', 'ślli')
- Run diff tool:
python diff.py
It will go through a set of Belarusian texts, converting each into Lacinka twice: once with is_new() being set to False (golden) and once with it set to True (test). If there are changes - they will be printed an a html file with nice handy UI.
- Run tests:
DIFF_NEW=true pytest
This will run unit tests with is_new() being set to true. This helps to quickly see if the change affects existing tests. If you change affects a set of sample texts from step 2 but doesn't affect any unit tests - consider adding a new unit test.
Metadata
Release files for belorthography 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| belorthography-1.0.0.tar.gz | 8.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| belorthography-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.7 kB
Release files / belorthography-1.0.0.tar.gz
| Download URL | belorthography-1.0.0.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f345bf38f623eb6e4bfde3a5ef5b73e9bcd8ab4359fe9028b21d01df9cdde63b
|
|
BLAKE2b-256 checksum How to use checksums |
86f2bb1762193c6ef2852012a22e83bed0087b2b7b38e32fc21e929696b38a30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.0
|
Release files / belorthography-1.0.0-py3-none-any.whl
| Download URL | belorthography-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4038784a284fa5dbc1f5567a828fbcfb1e05b93d6a934ab49958ad5fc7e238bf
|
|
BLAKE2b-256 checksum How to use checksums |
697729a068acc5c01c33356bc37bc24fc318281109e39e13e5c2931f8b83a5c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.0
|
Security for belorthography 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.