The MEHDIE Transliteration Service and Python Package
This repository contains the source code for the MEHDIE Transliteration Service and Python package. The service is a RESTful API that can be used to transliterate names between Hebrew, Arabic and Latin characters. The Python package provides a Python interface to the service.
The service was developed as part of the MEHDIE project- https://mehdie.org/. )
MEHDIE is funded by the Israel Ministry of Science and Technology MOST. )
Installation
You can use the Dockerfile and cloudbuild yaml file to deploy to a cloud run service or you can use the python package to use the service in your own code.
Usage
Python Package - Transliteration
import unittest
from translit_me.transliterator import transliterate as tr
from translit_me.lang_tables import *
class TestTransliterate(unittest.TestCase):
def test_hebrew_arabic(self):
names = ['נועַם', "מאנץ'", "בישינה", "דימונה"]
expected = ['نوعَم', 'مانض', 'بيشينة', 'بيسينة', 'ديمونة', 'ضيمونة']
res = tr(names, HE_AR)
print(res)
self.assertListEqual(res, expected)
More examples can be found in the tests folder.
RESTful API
The service is a RESTful API that can be used to transliterate names between Hebrew, Arabic and Latin characters.
import requests
def transliterate_service(to_transliterate: list,from_lang: str,to_lang: str):
"""
This method invokes a cloud run service to transliterate a list of strings
(e.g., ['نوعم', 'مانض', 'پيشينة'])
from the from_lang (e.g., 'ar') to the to_lang (e.g., 'en').
Supported languages: ('he','ar','en'). Anything non 'he'/'ar' will be treated
as 'en'
"""
url = 'https://hebrew-transliteration-service-snlwejaxvq-ez.a.run.app/'
args = {'from_lang': from_lang, 'to_lang': to_lang, 'data': to_transliterate}
x = requests.post(url, json=args)
res_list = x.json()['transliterations']
return res_list
names = ["תִפְלִיס","תַרְג'","תַרוּג'ה"]
from_language = 'he'
to_language = 'ar'
transliterate_service(names, from_language, to_language)
Metadata
Release files for translit-me 1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| translit_me-1.3.tar.gz | 13.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| translit_me-1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.3 kB
Release files / translit_me-1.3.tar.gz
| Download URL | translit_me-1.3.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5255edc6201d82274532f0b7cfeb4a84813a704fcccdc094d216c6e12405f0a
|
|
BLAKE2b-256 checksum How to use checksums |
704ca26ef137a47679cf3b9b70e7307f42a225bc6e09feb7a27dfb4799444602
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / translit_me-1.3-py3-none-any.whl
| Download URL | translit_me-1.3-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac97b108417444d36b644db3aeea6a617754ad438e600c139e906e989ba1017e
|
|
BLAKE2b-256 checksum How to use checksums |
fda445a1e93106e9d52f51aaa0187666e4c900922c6580bb2ca18403caf135e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|