Converts strings between two character sets
pip install script-converter==0.0.2
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.
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 | xʷ |
â | ã |
ê | ẽ |
î | ĩ |
ô | õ |
û | ũ |
g | ᵑɡ |
d | ⁿd |
j | ᶮɟ |
mw | mʷ |
pw | pʷ |
vw | vʷ |
fw | fʷ |
phw | pʰʷ |
bw | ᵐbʷ |
b | ᵐb |
ph | pʰ |
kh | kʰ |
th | tʰ |
hm | m̥ |
hny | ɲ̊ |
ny | ɲ |
hn | n̥ |
hl | l̥ |
aa | aː |
ee | eː |
ii | iː |
oo | oː |
uu | uː |
ââ | ãː |
êê | ẽː |
îî | ĩː |
ôô | õː |
ûû | ũː |
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))