Skip to main content

Python utils for EWTS conversion from / to Unicode

Project description


OpenPecha

Python Tibetan Unicode to Wylie (EWTS) Converter

DescriptionInstallationExamplesChangesLicenseMaintenanceOwner


Description

The goal of this code is to provide a library to convert back and forth between Tibetan Unicode and EWTS. The code is adapted from Java ewts-converter.

It also provides a conversion from the ACIP Transliteration to EWTS.

Installation

pip install pyewts

Examples

Convert Wylie to Unicode

import pyewts

converter = pyewts.pyewts()
print(converter.toUnicode("ba b+ba [a] ba\\u0f0b"))
# བ་བྦ་a་བ་

Convert Unicode to Wylie

print(converter.toWylie("༼༽"))
# ()

Catch Wylie warnings

>>> orig = """dangs
... zhwa
... dwang
... rma
... tshe
... phywa
... dge
... rgya
... dwags
... (rtse mgron)"""
>>> 
>>> print(orig)
dangs
zhwa
dwang
rma
tshe
phywa
dge
rgya
dwags
(rtse mgron)
>>> warns = []
>>> res = converter.toUnicode(orig, warns)
>>> print(res)
དངས
ཞྭ
དྭང
རྨ
ཚེ
ཕྱྭ
དགེ
རྒྱ
དྭགས
རྩེམགྲོན
>>> print(warns)
['line 1: "dangs": Syllable should probably be "dngas".']

See demo.py

Changes

See CHANGELOG.md.

License

The Python code is Copyright (C) 2018 Esukhia, provided under MIT License. See CONTRIBUTORS.md for a list of authors and contributors.

Maintenance

Build the source dist:

rm -rf dist/
python3 setup.py clean sdist

and upload on twine (version >= 1.11.0) with:

twine upload dist/*

Owner

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

pyewts-0.2.0.tar.gz (18.2 kB view hashes)

Uploaded Source

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