Skip to main content

mlotsawa

Description

The purpose of this module is user-friendly translation and transliteration of Classical Tibetan.

Currently, separate classes are provided for translation and transliteration tasks. Both classes will accept either a list of strings, or a single string. The output of each will be of the same type as the input.

You can also run the translator and transliteration functions through a web-based user interface. The web interface will open automatically when you use the code below. You can use this to serve the app to others on your network, as well.

Under the hood, this module uses the T5 transformer architecture, custom fine-tuned on data from Lotsawa House.

The models and datasets used by this project can be found on Hugging Face where you can find more information on training, data collection, and how to use these models and datasets for your own projects.

This module is part of the larger MLotsawa project for machine translation of Literary Tibetan. The code for the entire project, including this module is available on GitHub here.

Installation

pip install --upgrade mlotsawa

Examples

For transliteration:

from mlotsawa.transliterator import Transliterator 

tibetan_text = '<your Tibetan text>'

transliterator = Transliterator()

phonetics = transliterator.transliterate(tibetan_text)

For translation:

from mlotsawa.translator import Translator 

tibetan_text = '<your Tibetan text>' # may be in Tibetan script or phoneticized

translator = Translator()

translation = translator.translate(tibetan_text)

To serve the Web based user-interface:

from mlotsawa.webui import WebUI

webui = WebUI()

webui.run()

The WebUI.run() method has several optional parameters. These parameters and their default values are shown below.

from mlotsawa.webui import WebUI

webui = WebUI()

webui.run(
    logging=False, # keep log of when translations are done through your host
    log_filepath='mlotsawa_logs.txt', # filepath and filename to be used for the log file (i.e. '/my_log_folder/my_logs.txt)
    port=5000, # which port to run the webui from
    autolaunch=True # automatically start the webapp in your default browser
)

License

Shield: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

CC BY-NC-SA 4.0

Owner

@billingsmoore

Metadata

Release files for mlotsawa 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mlotsawa 1.0.0
File Size Uploaded
mlotsawa-1.0.0.tar.gz 2.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mlotsawa 1.0.0
File Interpreter ABI Platform
mlotsawa-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 5.5 kB

Release files / mlotsawa-1.0.0.tar.gz

Download URL mlotsawa-1.0.0.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8231c6f7c8626ca40ce92151d27982222483ef55c4986b062458750c65f2258c
BLAKE2b-256 checksum
How to use checksums
7ff97343b14693753b98a5a09425edffe6e5e03f18b00de808f96fd57fa7f0bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / mlotsawa-1.0.0-py3-none-any.whl

Download URL mlotsawa-1.0.0-py3-none-any.whl
Size 2.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6f02730a606d47151f83d03bb5535edae3c836aabcae55288c1c5b26b0abe4c6
BLAKE2b-256 checksum
How to use checksums
1fe0897e8b24bf1d6fda0230e93a163ab2a932ddea161f105a8f5da7fabefdbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page