Converts strings between two character sets
Project description
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 | 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))
Project details
Release history Release notifications
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size script_converter-0.0.2-py3-none-any.whl (15.8 kB) | File type Wheel | Python version py3 | Upload date | Hashes View hashes |
Filename, size script_converter-0.0.2.tar.gz (2.7 kB) | File type Source | Python version None | Upload date | Hashes View hashes |
Hashes for script_converter-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d92a056f8fed71d1e2d98e45710a0d917a5a097f13deb981f05b678b9d44ff3c |
|
MD5 | 74cf701208a6e1877be4b810914ea3c4 |
|
BLAKE2-256 | a77ce4011130349c4a6be5a6ab34396afc9c1f28c1a37012693aebcd198c8f6a |