phonemize-text / app.py
cdleong's picture
Update app.py
62383b9
raw
history blame
963 Bytes
import streamlit as st
import epitran
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)
transliteration = epi.transliterate(input_text)
st.info("transliterating...")