Spaces:
Runtime error
Runtime error
File size: 1,063 Bytes
a013c5c 145304e a013c5c 48ffbb5 44f705d 48ffbb5 a013c5c 48ffbb5 44f705d a013c5c 62383b9 44f705d bfca28f 44f705d 2bd2657 145304e 44f705d 2bd2657 44f705d a013c5c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import streamlit as st
import epitran
# TODO: reverse transliterate?
if __name__ == "__main__":
iso_lang_code = st.text_input(
label="Three-letter ISO-639-3 (https://iso639-3.sil.org/) language code",
value="swa"
)
st.write(f"iso code is {iso_lang_code}")
iso_script_code = st.text_input(
label="ISO 15924 (https://unicode.org/iso15924/iso15924-codes.html) script code, e.g. 'Latn' for Latin script, 'Hans' for Chinese script, etc.",
value="Latn"
)
st.write(f'iso code is {iso_script_code }')
input_text = st.text_area(label="Whatever you type here will be transliterated!", value="Gari langu linaloangama limejaa na mikunga")
combined_code = "-".join([iso_lang_code, iso_script_code])
st.write(f"Combined code: {combined_code}")
st.info("attempting to instantiate epitran transliterator for your language/script")
epi = epitran.Epitran(combined_code)
st.info(f"transliterating `{input_text}`\n\tusing {epi}...")
transliteration = epi.transliterate(input_text)
st.success(transliteration)
|