DebasishDhal99
commited on
Commit
·
b3477e4
1
Parent(s):
6f68287
Adding serbo-croatian
Browse files
app.py
CHANGED
@@ -34,6 +34,8 @@ import streamlit as st
|
|
34 |
from polish import polish_sentence_to_latin
|
35 |
from hungarian import hungarian_sentence_to_latin
|
36 |
from turkish import turkish_sentence_to_latin
|
|
|
|
|
37 |
|
38 |
from essential_generators import DocumentGenerator
|
39 |
from googletrans import Translator
|
@@ -49,7 +51,7 @@ def random_sentence(lang):
|
|
49 |
return str(translator.translate(sentence,dest=lang).text) #Translates the sentence to target language
|
50 |
|
51 |
|
52 |
-
tab1, tab2, tab3= st.tabs(["Polish/Polski", "Hungarian/Magyar", "Turkish/Türkçe"])
|
53 |
|
54 |
with tab1:
|
55 |
st.header("Polish Transliteration")
|
@@ -124,4 +126,25 @@ with tab3:
|
|
124 |
else:
|
125 |
st.write(output_string)
|
126 |
else:
|
127 |
-
st.warning("Please enter a string.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
from polish import polish_sentence_to_latin
|
35 |
from hungarian import hungarian_sentence_to_latin
|
36 |
from turkish import turkish_sentence_to_latin
|
37 |
+
from serbo_croatian import serbian_sentence_to_latin
|
38 |
+
|
39 |
|
40 |
from essential_generators import DocumentGenerator
|
41 |
from googletrans import Translator
|
|
|
51 |
return str(translator.translate(sentence,dest=lang).text) #Translates the sentence to target language
|
52 |
|
53 |
|
54 |
+
tab1, tab2, tab3, tab4= st.tabs(["Polish/Polski", "Hungarian/Magyar", "Turkish/Türkçe", "Serbo-Croatian-Bosniak"])
|
55 |
|
56 |
with tab1:
|
57 |
st.header("Polish Transliteration")
|
|
|
126 |
else:
|
127 |
st.write(output_string)
|
128 |
else:
|
129 |
+
st.warning("Please enter a string.")
|
130 |
+
|
131 |
+
with tab4:
|
132 |
+
st.header("Serbo-Coratian-Bosniak Transliteration")
|
133 |
+
input_string_serbian = st.text_input("Enter a Serbian/Croatian/Bosniak word/sentence in Latin or Cyrillic to transliterate")
|
134 |
+
serbian_examples = ["Српски језик је богат ћириличким алфабетом са словима као ш, ж, њ, ч, and ћ.",
|
135 |
+
"Čini se da hrvatski jezik ima mnogo složenih znakova",
|
136 |
+
"Bosna je najbolja zemlja na svijetu"]
|
137 |
+
selected_example_sr = st.selectbox([None]+serbian_examples)
|
138 |
+
|
139 |
+
if selected_example_sr != ' None':
|
140 |
+
input_string_serbian = selected_example_sr
|
141 |
+
|
142 |
+
if st.button("Transliterate Serbo-Croatian-Bosniak"):
|
143 |
+
if input_string_serbian:
|
144 |
+
output_string = serbian_sentence_to_latin(input_string_serbian)
|
145 |
+
st.subheader("Transliterated Output")
|
146 |
+
st.write(output_string)
|
147 |
+
|
148 |
+
else:
|
149 |
+
st.warning("Please enter a string")
|
150 |
+
|