Skip to main content

Transliterate Cyrillic → Latin in every possible way

Project description

Iuliia

Transliterate Cyrillic → Latin in every possible way

PyPI Version Build Status Code Coverage Code Quality

Transliteration means representing Cyrillic data (mainly names and geographic locations) with Latin letters. It is used for international passports, visas, green cards, driving licenses, mail and goods delivery etc.

Iuliia makes transliteration as easy as:

>>> import iuliia
>>> iuliia.translate("Юлия Щеглова", schema=iuliia.WIKIPEDIA)
'Yuliya Shcheglova'

Why use Iuliia

  • 20 transliteration schemas (rule sets), including all main international and Russian standards.
  • Correctly implements not only the base mapping, but all the special rules for letter combinations and word endings (AFAIK, Iuliia is the only library which does so).
  • Simple API and zero third-party dependencies.

For schema details and other information, see iuliia.ru (in Russian).

Issues and limitations

Installation

pip install iuliia

Usage

List all supported schemas:

>>> import iuliia
>>> import iuliia
>>> for name, schema in iuliia.Schemas.items():
...     print("{0:<20}{1}".format(name, schema.description))
...
ala_lc              ALA-LC transliteration schema.
ala_lc_alt          ALA-LC transliteration schema.
bgn_pcgn            BGN/PCGN transliteration schema
bgn_pcgn_alt        BGN/PCGN transliteration schema
bs_2979             British Standard 2979:1958 transliteration schema
bs_2979_alt         British Standard 2979:1958 transliteration schema
gost_16876          GOST 16876-71 (aka GOST 1983) transliteration schema
gost_16876_alt      GOST 16876-71 (aka GOST 1983) transliteration schema
gost_52290          GOST R 52290-2004 transliteration schema
gost_52535          GOST R 52535.1-2006 transliteration schema
gost_7034           GOST R 7.0.34-2014 transliteration schema
gost_779            GOST 7.79-2000 (aka ISO 9:1995) transliteration schema
gost_779_alt        GOST 7.79-2000 (aka ISO 9:1995) transliteration schema
icao_doc_9303       ICAO DOC 9303 transliteration schema
iso_9_1954          ISO/R 9:1954 transliteration schema
iso_9_1968          ISO/R 9:1968 transliteration schema
iso_9_1968_alt      ISO/R 9:1968 transliteration schema
mosmetro            Moscow Metro map transliteration schema
mvd_310             MVD 310-1997 transliteration schema
mvd_310_fr          MVD 310-1997 transliteration schema
mvd_782             MVD 782-2000 transliteration schema
scientific          Scientific transliteration schema
telegram            Telegram transliteration schema
ungegn_1987         UNGEGN 1987 V/18 transliteration schema
wikipedia           Wikipedia transliteration schema
yandex_maps         Yandex.Maps transliteration schema
yandex_money        Yandex.Money transliteration schema

Transliterate using specified schema:

>>> source = "Юлия Щеглова"
>>> iuliia.translate(source, schema=iuliia.ICAO_DOC_9303)
'Iuliia Shcheglova'

Or pick schema by name

>>> schema = iuliia.Schemas.get("wikipedia")
>>> iuliia.translate(source, schema)
'Yuliya Shcheglova'

Command line:

$ iuliia icao_doc_9303 "Юлия Щеглова"
Iuliia Shcheglova

Development setup

$ python3 -m venv env
$ . env/bin/activate
$ make deps schemas
$ tox

Development tasks:

$ make help
Usage: make [task]

task                 help
------               ----
changelog            Generate changelog
coverage             Run tests with coverage
deps                 Install dependencies
lint                 Lint and static-check code
pull                 Pull code and schemas
push                 Push commits and tags
schemas              Update schemas
test                 Run tests
help                 Show help message

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Make sure to add or update tests as appropriate.

Use Black for code formatting and Conventional Commits for commit messages.

Changelog

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iuliia-0.11.5.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

iuliia-0.11.5-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

Details for the file iuliia-0.11.5.tar.gz.

File metadata

  • Download URL: iuliia-0.11.5.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for iuliia-0.11.5.tar.gz
Algorithm Hash digest
SHA256 2adef8817cd10ba33e160ace9ee52777774d7fc9c352260005138ccc45a91b7b
MD5 59db2a6d2b0a901fc61e14b4f4923295
BLAKE2b-256 ea83140153c8e37e342d5cae48f06352055936425a12f3b39b94f132360218a6

See more details on using hashes here.

File details

Details for the file iuliia-0.11.5-py3-none-any.whl.

File metadata

  • Download URL: iuliia-0.11.5-py3-none-any.whl
  • Upload date:
  • Size: 35.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for iuliia-0.11.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b47bc186f9fb903a6940980ac0d31f6761792969bc7e0fc9595deee1d653167f
MD5 f6a21c257c333681f6806bf853cbbf4e
BLAKE2b-256 ffb2603d050bcd3138c2a2e854726260176804c5b2de06b21eeca96f6e478bb9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page