1
This commit is contained in:
+4
-2
@@ -295,8 +295,10 @@ class TextNormalizer:
|
||||
# text = re.sub(r'(\d{4})[\/\-](\d{1,2})[\/\-](\d{1,2})', r'\1/\2/\3', text)
|
||||
|
||||
# فرمت DD/MM/YYYY یا DD-MM-YYYY ---> YYYY/MM/DD
|
||||
text = re.sub(r'(\d{4})[\/\-](\d{2})[\/\-](\d{2})', r'\3/\2/\1', text)
|
||||
text = re.sub(r'(\d{1})[\/\-](\d{1})[\/\-](\d{4})', r'0\1/0\2/\3', text)
|
||||
text = re.sub(r'(\d{4})[\/\-](\d{1,2})[\/\-](\d{1,2})', r'\3/\2/\1', text)
|
||||
text = re.sub(r' (\d{1})[\/\-](\d{1})[\/\-](\d{4})', r' 0\1/0\2/\3', text)
|
||||
text = re.sub(r' (\d{1})[\/\-](\d{2})[\/\-](\d{4})', r' 0\1/\2/\3', text)
|
||||
text = re.sub(r' (\d{2})[\/\-](\d{1})[\/\-](\d{4})', r' \1/0\2/\3', text)
|
||||
return text
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user