VPNRY commited on
Commit
4446e90
·
1 Parent(s): e9db24c

v003 ,yan,ar num

Browse files
Files changed (1) hide show
  1. app.py +25 -11
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
- ('kh', '1'),
21
- ('gh', '2'),
22
- ('ch', '3'),
23
- ('jh', '4'),
24
- ('th', '5'),
25
- ('ṭh', '6'),
26
- ('dh', '7'),
27
- ('ḍh', '8'),
28
- ('ph', '9'),
29
- ('bh', '0'),
 
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