This commit is contained in:
hsafaei
2025-02-22 16:44:14 +03:30
parent 43f46a17a3
commit fd2b89ed65
13 changed files with 669 additions and 50 deletions
+8
View File
@@ -169,6 +169,14 @@ class TextNormalizer:
return text
def date_correction(self, text):
# فرمت YYYY/MM/DD یا YYYY-MM-DD
text = re.sub(r'(\d{4})[\/\-](\d{1,2})[\/\-](\d{1,2})', '\1/\2/\3', text)
# فرمت DD/MM/YYYY یا DD-MM-YYYY
text = re.sub(r'(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})', '\3/\2/\1', text)
def space_correction(self, text):
text = re.sub(r"^(بی|می|نمی)( )", r"\1‌", text)