-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Datetime parsing does recognize am or pm #1289
Conversation
@gunthercox any comments/suggestions? |
The changes to the regular expression look good to me. I'd just recommend adding two test cases to the unit tests, one for am and one for pm. |
Fixes #651 Master, will add tests also from chatterbot import parsing
text = u'Your appointment in next 3 weeks'
dates_ch = parsing.datetime_parsing(text)
print(dates_ch)
text = u'Your appointment in next 4 days'
dates_ch = parsing.datetime_parsing(text)
print(dates_ch)
text = u'Your appointment in next 10 years'
dates_ch = parsing.datetime_parsing(text)
print(dates_ch) [('next 3 weeks', datetime.datetime(2018, 5, 24, 0, 0), (20, 32))]
[('next 4 days', datetime.datetime(2018, 5, 7, 0, 0), (20, 31))]
[('next 10 year', datetime.datetime(2023, 11, 21, 0, 0), (20, 32))] |
I was trying to add more test scenario next 12 months, next day which falls to next month etc. |
I think this PR addresses this issue also #1291 |
@gunthercox any comments/suggestions? |
@vkosuri This does appear to correct the issue. Very nice work! |
@coolrb The script assumes 24hr format by default, to work for you scenario you have to write like this
Scenario 1
Update regular expression
Scenario 2:
Scenario 3:
Skip minutes, the regex will work.
Closes: #1277