Skip to main content

devatrans is an easy-to-use tool for transliteration, back transliteration, inter transliteration of SANSKRIT.

Project description

devatrans

This is a simple tool to transliterate SANSKRIT text to IAST, Harvard-Kyoto, ITRANS, Velthuis convention. It can also be used to back transliterate from IAST, Harvard-Kyoto, ITRANS, Velthuis convention to Sanskrit. It is can be used to inter transliterate from one convention to another.

It works with:

          International Alphabet of Sanskrit Transliteration(IAST)
          Indian language transliteration(ITRANS)
          Harvard-Kyoto(HK)
          Velthuis

Code Example


from devatrans import DevaTrans

#create DevaTrans object.
dt = DevaTrans()

transliteration of a sentence.

trans = dt.transliterate(input_type = "sen", to_convention = "hk", sentence = "नारायणं")
print(trans)
#output: nArAyaNaM

transliteration of a text file.

dt.transliterate(input_type = "file", to_convetion = "iast", inp_file_path = "path_to_inp_file",
                  op_file_path = "path_to_out_file")

back transliteration of a sentence.

back_trans = dt.back_transliterate(input_type = "sen", from_convention = "hk", sentence = "nArAyaNaM")
print(back_trans)
#output: नारायणं

back transliteration of a text file.

dt.back_transliterate(input_type = "file", from_convention = "itrans",
                inp_file_path = "path_to_inp_file",op_file_path = "path_to_out_file")                 

inter transliteration of a sentence

inter_trans = dt.inter_transliterate(input_type = "sen", from_convention = "hk",
                               to_convention = "velthuis", sentence = "nArAyaNaM")

inter transliteration of a text file.

dt.inter_transliterate(input_type = "file", from_convention = "itrans",to_convention = "iast",
                      inp_file_path = "path_to_inp_file",op_file_path = "path_to_out_file")

Installation


pip install devatrans

How to use?


transliterate(input_type, to_convention, inp_file_path=None,
                      op_file_path=None,  sentence=None)

The input_type can either be "sen" or "file", if the input_type is file then inp_file_path should be provided, the op_file_path is optional, if not specified the transliterated text is written back to inp_file_path`.

Use this method to transliterate text from SANSKRIT to IAST, ITRANS, HARVARD-KYOTO, VELHTUIS.

If characters which are not part of the convention are encoutered they are left unchanged.

inter_transliterate(input_type, from_convention, to_convention, inp_file_path=None,
                           op_file_path=None,  sentence=None)

The input_type can either be "sen" or "file", if the input_type is file then inp_file_path should be provided, the op_file_path is optional, if not specified the transliterated text is written back to inp_file_path`.

Use this method to transliterate text from one convetion to another.

If characters which are not part of the convention are encoutered they are left unchanged.

back_transliterate(input_type, from_convention, inp_file_path=None,
                          op_file_path=None,  sentence=None):

The input_type can either be "sen" or "file", if the input_type is file then inp_file_path should be provided, the op_file_path is optional, if not specified the transliterated text is written back to inp_file_path`.

Use this method to back transliterate text from IAST, ITRANS, HARVARD-KYOTO, VELHTUIS to SANSKRIT.

If characters which are not part of the convention are encoutered they are left unchanged.

to_convention, from_convnetion can take only take values hk, iast, itrans, velthuis

Contribute


  • Currently only .txt format is supported, it could be extended to PDF and other file formats.
  • Other conventions like Sanskrit Library Phonetic Basic (SLP1), WX notation could be included.

Reference


TY - BOOK AU - Nair, Jayashree AU - Sadasivan, Anand PY - 2019/03/30 SP - T1 - A Roman to Devanagari Back-Transliteration Algorithm based on Harvard-Kyoto Convention ER -

Issue


If a bug encountered please open the issuse here.
My mail ravitejtasubilli@gmail.com

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

devatrans-5.0.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

devatrans-5.0-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file devatrans-5.0.tar.gz.

File metadata

  • Download URL: devatrans-5.0.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5

File hashes

Hashes for devatrans-5.0.tar.gz
Algorithm Hash digest
SHA256 e7ab0d422cc09656e551416d1ffba9690dbfde6bde95cdfaab566a58fbd3e170
MD5 835699fb0d41a9e5eb08669508d62107
BLAKE2b-256 0ecb64feeb9cd5865a3cc8e327d56c72a6fbfefffd9db3a6a6349e33d0ed4ea5

See more details on using hashes here.

File details

Details for the file devatrans-5.0-py3-none-any.whl.

File metadata

  • Download URL: devatrans-5.0-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5

File hashes

Hashes for devatrans-5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e9c75022ab5d6cb608b81e5acf329faee2468390f68b2a0af2ecb1394c432bb
MD5 b15bf617297e6af22e8fefe4b99fe110
BLAKE2b-256 57a50d291469eb301448b745b3ffe237a1c52cac857da8c656addad42639cd2b

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