Spaces:
Sleeping
Sleeping
VPNRY
commited on
Commit
·
4446e90
1
Parent(s):
e9db24c
v003 ,yan,ar num
Browse files
app.py
CHANGED
@@ -11,22 +11,35 @@ import re
|
|
11 |
from collections import OrderedDict
|
12 |
import gradio as gr # huggingface demo
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
vowel_str = 'a,ā,i,ī,u,ū,e,o'
|
15 |
vowels = vowel_str.split(',')
|
16 |
vowels += vowel_str.upper().split(',')
|
17 |
# asp_consonants = 'ch,jh,kh,gh,th,ṭh,dh,ḍh,bh,ph'.split(',')
|
18 |
|
19 |
escape_xh = OrderedDict([
|
20 |
-
|
21 |
-
('
|
22 |
-
('
|
23 |
-
('
|
24 |
-
('
|
25 |
-
('
|
26 |
-
('
|
27 |
-
('
|
28 |
-
('
|
29 |
-
('
|
|
|
30 |
|
31 |
('vh', '$'),
|
32 |
# pariyogāḷhadhammo => pa ri yo gā ḷha dham mo
|
@@ -171,7 +184,7 @@ def easy_read(text, word_div=' _ ', show_origin=True, syl_div=' '):
|
|
171 |
'Error: word_div or syl_div must not contain these chars\n',
|
172 |
not_allow_divs)
|
173 |
print('Please use other dividers.')
|
174 |
-
return
|
175 |
|
176 |
res = ''
|
177 |
lines = text.strip().splitlines()
|
@@ -205,6 +218,7 @@ def easy_read(text, word_div=' _ ', show_origin=True, syl_div=' '):
|
|
205 |
return res.strip()
|
206 |
|
207 |
|
|
|
208 |
# -------- huggingface demo --------
|
209 |
|
210 |
|
|
|
11 |
from collections import OrderedDict
|
12 |
import gradio as gr # huggingface demo
|
13 |
|
14 |
+
|
15 |
+
# app logic
|
16 |
+
# v0.0.3
|
17 |
+
#-------- modify these 3 values to your choice
|
18 |
+
my_word_divider = ' _ '
|
19 |
+
my_syllable_divider = ' '
|
20 |
+
my_show_origin = True
|
21 |
+
# below is the app logic
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
vowel_str = 'a,ā,i,ī,u,ū,e,o'
|
27 |
vowels = vowel_str.split(',')
|
28 |
vowels += vowel_str.upper().split(',')
|
29 |
# asp_consonants = 'ch,jh,kh,gh,th,ṭh,dh,ḍh,bh,ph'.split(',')
|
30 |
|
31 |
escape_xh = OrderedDict([
|
32 |
+
# Myanmar number 1->0
|
33 |
+
('kh', '၁'),
|
34 |
+
('gh', '၂'),
|
35 |
+
('ch', '၃'),
|
36 |
+
('jh', '၄'),
|
37 |
+
('th', '၅'),
|
38 |
+
('ṭh', '၆'),
|
39 |
+
('dh', '၇'),
|
40 |
+
('ḍh', '၈'),
|
41 |
+
('ph', '၉'),
|
42 |
+
('bh', '၀'),
|
43 |
|
44 |
('vh', '$'),
|
45 |
# pariyogāḷhadhammo => pa ri yo gā ḷha dham mo
|
|
|
184 |
'Error: word_div or syl_div must not contain these chars\n',
|
185 |
not_allow_divs)
|
186 |
print('Please use other dividers.')
|
187 |
+
return ''
|
188 |
|
189 |
res = ''
|
190 |
lines = text.strip().splitlines()
|
|
|
218 |
return res.strip()
|
219 |
|
220 |
|
221 |
+
|
222 |
# -------- huggingface demo --------
|
223 |
|
224 |
|