refactor
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user