A tool to easily transliterate text to and from various Cyrillic alphabets.
Project description
Domovyk
A package to transliterate various Cyrillic alphabets to and from the Latin alphabet using the American Library Association-Library of Congress Romanization tables.
Domovyk is named after household spirits from Slavic mythology.
Installation
Install using pip:
pip3 install domovyk
Or download the GitHub repo and the install the only dependency (for sentence tokenization):
pip3 install nltk
Usage
The package uses the ALA-LC Romanization tables to transliterate each of the following languages:
- Belarusian
- Bulgarian
- Carpatho-Rusyn
- Church Slavonic
- Macedonian
- Russian
- Serbian
- Ukrainian
Four functions can be called for each language:
- transliterate(var, lang) - Transliterates a Cyrillic string or list of strings (var) from a specified language (lang) into the Latin alphabet. Returns a string.
- translatinate(var, lang) - Transliterates a string or list of strings in the Latin alphabet (var) to a specified Cyrillic script (lang). Returns a string.
- transliterateSents(var, lang) - Tokenizes a given Cyrillic (var) into a list of sentences, then transliterates those sentences from a specified language (lang) into the Latin alphabet. Returns a list.
- translatinateSents(var, lang) - Tokenizes a given string in the Latin alphabet (var) into a list of sentences, then transliterates those sentences to a specified Cyrillic script (lang). Returns a list.
Some usage examples are below:
from domovyk import translit
belarusian_to_latin = translit.transliterate('Як справы?', 'bel')
latin_to_macedonian = translit.translatinate('Hi, how are you?', 'mac')
ukrainian_to_latin_sents = translit.transliterateSents('Єхидна, ґава, їжак ще й шиплячі плазуни бігцем форсують Янцзи.', 'ukr')
latin_to_russian_sents = translit.translatinateSents('Hello, how are you doing?', 'rus')
The languages can be called in the code using the following abbreviations:
- Belarusian - 'bel'
- Bulgarian - 'bulg'
- Carpatho-Rusyn - 'carp'
- Church Slavonic - 'church'
- Macedonian - 'mac'
- Russian 'rus'
- Serbian - 'serb'
- Ukrainian - 'ukr'
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
File details
Details for the file domovyk-1.0.1.tar.gz
.
File metadata
- Download URL: domovyk-1.0.1.tar.gz
- Upload date:
- Size: 39.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bdc5e94b43e49c457150b567707836e2a7a66c40d06f22d5604e85fe8ce2726 |
|
MD5 | 0abd8722833460b9596640a219ff3e96 |
|
BLAKE2b-256 | 68c22d92952276ccec40cef2c5ef290ffa1d81202dc8de52048ef3c0684e9863 |
File details
Details for the file domovyk-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: domovyk-1.0.1-py3-none-any.whl
- Upload date:
- Size: 46.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f3f4a0d1d734492eda0c78a6e6e59c36e1b87301f1bba624918f723a651211e |
|
MD5 | eb558b4332bf8c1ccb69ee9e1ba7f716 |
|
BLAKE2b-256 | c5cb05274a2d62f24362f931f96b002d6858b4cc84916e6cbd96aebf28d48fcc |