Merge pull request #2335 from ChanceNCounter/bug/day-after-tomorrow

Fixes index error in parse_en.extract_datetime()
pull/2292/head
Åke 2019-09-30 11:20:13 +02:00 committed by GitHub
commit 87a7821926
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -828,7 +828,7 @@ def extract_datetime_en(string, dateNow, default_time):
wordNext == "after" and
wordNextNext == "tomorrow" and
not fromFlag and
not wordPrev[0].isdigit()):
not (wordPrev[0].isdigit() if wordPrev else False)):
dayOffset = 2
used = 3
if wordPrev == "the":

View File

@ -254,6 +254,8 @@ class TestNormalize(unittest.TestCase):
"2017-07-02 00:00:00", "set ambush")
testExtract("What is the day after tomorrow's weather?",
"2017-06-29 00:00:00", "what is weather")
testExtract("day after tomorrow",
"2017-06-29 00:00:00", "")
testExtract("Remind me at 10:45 pm",
"2017-06-27 22:45:00", "remind me")
testExtract("what is the weather on friday morning",