Skip to content

Commit 0dde6bc

Browse files
committed
Merge branch 'مرکز' of https://github.com/SaadBazaz/UrduPython into مرکز
2 parents ec2f126 + 3e6a21b commit 0dde6bc

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/filters/pycnnun.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import pycnnun
2+
3+
def filter (input_str):
4+
return pycnnun.cn2num(input_str)
5+
6+
def unfilter (input_str):
7+
return pycnnun.num2cn(input_str)

src/filters/unidecoder.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from unidecode import unidecode
2+
3+
4+
def filter(input_str):
5+
return unidecode(input_str)

src/lex.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ def t_NUMBER(t):
131131
value_str[i] = reserved.get(value_str[i], value_str[i])
132132
t.value = ''.join(value_str)
133133
else:
134-
t.value = unidecode(t.value)
134+
import src.filters.unidecoder as num_filter
135+
t.value = num_filter.filter(t.value)
135136

136137
# ------------- Debugging ---------------
137138
# print ("The number is now:", t.value)

0 commit comments

Comments
 (0)