devatrans是梵语音译、反音译、互译的一个简单易用的工具。
devatrans的Python项目详细描述
天成
这是一个简单的工具音译梵语文本到IAST,Harvard Kyoto,ITRANS,Velthuis convention。它也可以用于从IAST、Harvard Kyoto、ITRANS、Velthuis convention到梵语的^{str1}$back音译。它可用于从一个约定到另一个约定之间的跨音译。在
它与:
International Alphabet of Sanskrit Transliteration(IAST)
Indian language transliteration(ITRANS)
Harvard-Kyoto(HK)
Velthuis
代码示例
^{pr2}$
一个句子的音译。在
trans=dt.transliterate(input_type="sen",to_convention="hk",sentence="नारायणं")print(trans)#output: nArAyaNaM
文本文件的音译。在
dt.transliterate(input_type="file",to_convetion="iast",inp_file_path="path_to_inp_file",op_file_path="path_to_out_file")
一个句子的反音译。在
back_trans=dt.back_transliterate(input_type="sen",from_convention="hk",sentence="nArAyaNaM")print(back_trans)#output: नारायणं
文本文件的反音译。在
dt.back_transliterate(input_type="file",from_convention="itrans",inp_file_path="path_to_inp_file",op_file_path="path_to_out_file")
句间音译
inter_trans=dt.inter_transliterate(input_type="sen",from_convention="hk",to_convention="velthuis",sentence="nArAyaNaM")
文本文件的互译。在
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")
安装
pip install devatrans
如何使用?在
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 theinput_type
is file theninp_file_path
should be provided, theop_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
toIAST
,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 theinput_type
is file theninp_file_path
should be provided, theop_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 theinput_type
is file theninp_file_path
should be provided, theop_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
toSANSKRIT
.If characters which are not part of the convention are encoutered they are left unchanged.
to_convention
,from_convnetion
只能取值hk
,iast
,itrans
,velthuis
贡献
- 目前只支持
.txt
格式,可以扩展为PDF和其他文件格式。在 - 其他惯例,如梵语库拼音基本(SLP1),WX符号可以包括在内。在
参考文献
TY-书籍 AU-Nair,Jayashree 阿南德,萨达西万 2018年3月30日 SP公司- T1-一个基于哈佛京都协议的罗马天成文书反音译算法 呃-
发行
如果遇到错误,请打开问题here。
我的邮件ravitejtasubilli@gmail.com
- 项目
标签: