script-converter

Converts strings between two character sets


License
GPL-3.0
Install
pip install script-converter==0.0.2

Documentation

script_converter

This is a simple tool to transliterate a given string using two character sets. The mapping between the sets must be provided in a .csv file, which has two columns, IPA and Ortho

Use is script_converter.convert(STRING, MAPPING_FILE_PATH), which will return a transliterated string. Per default, the Ortho values will be replaced by the IPA values. If transliteration should happen the other way around, the option to_ipa=False can be used.

example

I illustrate the functionality using Vamale as an example. The IPA and orthographic representations of all Vamale phonemes are listed in a file vamale_mapping.csv:

IPA Ortho
xh x
x ɣ
xhw
â
ê
î
ô
û
g ᵑɡ
d ⁿd
j ᶮɟ
mw
pw
vw
fw
phw pʰʷ
bw ᵐbʷ
b ᵐb
ph
kh
th
hm
hny ɲ̊
ny ɲ
hn
hl
aa
ee
ii
oo
uu
ââ ãː
êê ẽː
îî ĩː
ôô õː
ûû ũː
a a
e e
i i
o o
u u
ng ŋ

Now, the example sentence i beeng a kon hnyimake ko li aman a a vwa ('My friend is thinking about the things he is doing') can be converted:

print(script_converter.convert("i beeng a kon hnyimake ko li aman a a vwa", "vamale_mapping.csv"))

This results in the output i ᵐbeːŋ a kon ɲ̊imake ko li aman a a vʷa. This, in turn, could be converted back to i beeng a kon hnyimake ko li aman a a vwa using the following command:

print(script_converter.convert("i ᵐbeːŋ a kon ɲ̊imake ko li aman a a vʷa", "vamale_mapping.csv", to_ipa=False))