fix: remove dots from strings

This commit is contained in:
Mahdi Dibaiee 2018-02-09 18:05:35 +03:30
parent 4abc7d4034
commit 18d01dc186
3 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,6 @@
import datetime import datetime
from datetime import timedelta from datetime import timedelta
import re import re
from itertools import repeat
days_long = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'] days_long = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']
days_short = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'] days_short = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']
@ -54,7 +53,7 @@ keywords = list(multipliers.keys()) + months + months_short + years + days + day
text = '12 jan 2019 at 12 will be amazing' text = '12 jan 2019 at 12 will be amazing'
def tokenize(string): def tokenize(string):
sym_pattern = re.compile(r'([!,@#$%^&*?\'"])') sym_pattern = re.compile(r'([!,@#$%^&*?\'".])')
string = sym_pattern.sub(lambda x: ' {} '.format(x.group()), string) string = sym_pattern.sub(lambda x: ' {} '.format(x.group()), string)
for ts in transformations: for ts in transformations:

View File

@ -56,6 +56,7 @@ class HumanDateTests(unittest.TestCase):
'jan 12': (12, 1), 'jan 12': (12, 1),
'february 28': (28, 2), 'february 28': (28, 2),
'december 1th': (1, 12), 'december 1th': (1, 12),
'Feb. 28': (28, 2),
} }
for (k, (day, m)) in tests.items(): for (k, (day, m)) in tests.items():

View File

@ -2,7 +2,7 @@ from distutils.core import setup
setup( setup(
name = 'humandate', name = 'humandate',
packages = ['humandate'], packages = ['humandate'],
version = '0.6', version = '0.7',
description = 'Parse human-readable dates', description = 'Parse human-readable dates',
author = 'Mahdi Dibaiee', author = 'Mahdi Dibaiee',
author_email = 'mdibaiee@aol.com', author_email = 'mdibaiee@aol.com',