Skip to content

Commit

Permalink
[Python][* DateTimeV2] Fix detection of "00:XX"
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-gradinari committed Apr 7, 2023
1 parent b03280c commit b13c2ee
Show file tree
Hide file tree
Showing 12 changed files with 320 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def match_to_time(self, match: Match, reference: datetime):
else:
hour = int(hour_str) if hour_str.isnumeric(
) else self.config.numbers.get(hour_str, None)
if not hour:
if hour is None:
return result
# get minute
min_str = RegExpUtility.get_group(match, Constants.MINUTE_GROUP_NAME)
Expand Down
24 changes: 24 additions & 0 deletions Specs/DateTime/Dutch/DateTimeModel.json
Original file line number Diff line number Diff line change
Expand Up @@ -1610,6 +1610,30 @@
}
]
},
{
"Input": "Ik ben 00:00 terug",
"Context": {
"ReferenceDateTime": "2023-11-07T00:00:00"
},
"NotSupportedByDesign": "javascript,java",
"Results": [
{
"Text": "00:00",
"Start": 7,
"End": 11,
"TypeName": "datetimeV2.time",
"Resolution": {
"values": [
{
"timex": "T00:00",
"type": "time",
"value": "00:00:00"
}
]
}
}
]
},
{
"Input": "Het is half acht",
"Context": {
Expand Down
22 changes: 22 additions & 0 deletions Specs/DateTime/English/DateTimeExtractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,28 @@
}
]
},
{
"Input": "I'll go back on 15 at 00:00",
"Results": [
{
"Text": "15 at 00:00",
"Type": "datetime",
"Start": 16,
"Length": 11
}
]
},
{
"Input": "I'll go back on 15 at 00:00:00",
"Results": [
{
"Text": "15 at 00:00:00",
"Type": "datetime",
"Start": 16,
"Length": 14
}
]
},
{
"Input": "I'll go back on 15 at 8:00",
"Results": [
Expand Down
48 changes: 48 additions & 0 deletions Specs/DateTime/English/DateTimeModel.json
Original file line number Diff line number Diff line change
Expand Up @@ -10581,6 +10581,54 @@
"NotSupported": "javascript, java, python",
"Results": []
},
{
"Input": "I'll be back at 00:00",
"Context": {
"ReferenceDateTime": "2023-03-28T00:00:00"
},
"NotSupported": "javascript",
"Results": [
{
"Text": "00:00",
"Start": 16,
"End": 20,
"TypeName": "datetimeV2.time",
"Resolution": {
"values": [
{
"timex": "T00:00",
"type": "time",
"value": "00:00:00"
}
]
}
}
]
},
{
"Input": "I'll be back tomorrow at 00:00.",
"Context": {
"ReferenceDateTime": "2023-03-28T00:00:00"
},
"NotSupported": "javascript",
"Results": [
{
"Text": "tomorrow at 00:00",
"Start": 13,
"End": 29,
"TypeName": "datetimeV2.datetime",
"Resolution": {
"values": [
{
"timex": "2023-03-29T00:00",
"type": "datetime",
"value": "2023-03-29 00:00:00"
}
]
}
}
]
},
{
"Input": "I'll be back at 9:00a.",
"Context": {
Expand Down
48 changes: 48 additions & 0 deletions Specs/DateTime/English/DateTimeParser.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,54 @@
}
]
},
{
"Input": "I'll go back on 15 at 00:00",
"Context": {
"ReferenceDateTime": "2023-11-07T00:00:00"
},
"NotSupported": "javascript",
"Results": [
{
"Text": "15 at 00:00",
"Type": "datetime",
"Value": {
"Timex": "XXXX-XX-15T00:00",
"FutureResolution": {
"dateTime": "2023-11-15 00:00:00"
},
"PastResolution": {
"dateTime": "2023-10-15 00:00:00"
}
},
"Start": 16,
"Length": 11
}
]
},
{
"Input": "I'll go back on 15 at 00:00:00",
"Context": {
"ReferenceDateTime": "2023-11-07T00:00:00"
},
"NotSupported": "javascript",
"Results": [
{
"Text": "15 at 00:00:00",
"Type": "datetime",
"Value": {
"Timex": "XXXX-XX-15T00:00:00",
"FutureResolution": {
"dateTime": "2023-11-15 00:00:00"
},
"PastResolution": {
"dateTime": "2023-10-15 00:00:00"
}
},
"Start": 16,
"Length": 14
}
]
},
{
"Input": "I'll go back on 15 at 8:00",
"Context": {
Expand Down
11 changes: 11 additions & 0 deletions Specs/DateTime/English/TimeExtractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,17 @@
}
]
},
{
"Input": "I'll be back 00:00:00",
"Results": [
{
"Text": "00:00:00",
"Type": "time",
"Start": 13,
"Length": 8
}
]
},
{
"Input": "I'll be back 00:00:30",
"Results": [
Expand Down
21 changes: 21 additions & 0 deletions Specs/DateTime/English/TimeParser.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,27 @@
}
]
},
{
"Input": "I'll be back 00:00",
"NotSupported": "javascript",
"Results": [
{
"Text": "00:00",
"Type": "time",
"Value": {
"Timex": "T00:00",
"FutureResolution": {
"time": "00:00:00"
},
"PastResolution": {
"time": "00:00:00"
}
},
"Start": 13,
"Length": 5
}
]
},
{
"Input": "I'll be back 12:34",
"Results": [
Expand Down
50 changes: 49 additions & 1 deletion Specs/DateTime/EnglishOthers/DateTimeModel.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,30 @@
}
]
},
{
"Input": "I'll go back 5/3/23 @ 00:00:00",
"Context": {
"ReferenceDateTime": "2023-05-01T00:00:00"
},
"NotSupported": "javascript",
"Results": [
{
"Text": "5/3/23 @ 00:00:00",
"Start": 13,
"End": 29,
"TypeName": "datetimeV2.datetime",
"Resolution": {
"values": [
{
"timex": "2023-03-05T00:00:00",
"type": "datetime",
"value": "2023-03-05 00:00:00"
}
]
}
}
]
},
{
"Input": "The date should be 05-Aug-2016",
"Context": {
Expand Down Expand Up @@ -913,6 +937,30 @@
}
]
},
{
"Input": "The target time is 00:00",
"Context": {
"ReferenceDateTime": "2023-12-26T00:00:00"
},
"NotSupported": "javascript",
"Results": [
{
"Text": "00:00",
"Start": 19,
"End": 23,
"TypeName": "datetimeV2.time",
"Resolution": {
"values": [
{
"timex": "T00:00",
"type": "time",
"value": "00:00:00"
}
]
}
}
]
},
{
"Input": "I'll go back Sep-23-2020.",
"Context": {
Expand Down Expand Up @@ -1057,4 +1105,4 @@
}
]
}
]
]
24 changes: 24 additions & 0 deletions Specs/DateTime/French/DateTimeModel.json
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,30 @@
}
]
},
{
"Input": "Je retournerai 00:00",
"Context": {
"ReferenceDateTime": "2023-11-07T00:00:00"
},
"NotSupported": "javascript",
"Results": [
{
"Text": "00:00",
"TypeName": "datetimeV2.time",
"Resolution": {
"values": [
{
"timex": "T00:00",
"type": "time",
"value": "00:00:00"
}
]
},
"Start": 15,
"End": 19
}
]
},
{
"Input": "Je retournerai 19:56:30",
"Context": {
Expand Down
24 changes: 24 additions & 0 deletions Specs/DateTime/Italian/DateTimeModel.json
Original file line number Diff line number Diff line change
Expand Up @@ -1442,6 +1442,30 @@
}
]
},
{
"Input": "Tornerò alle 00:00",
"Context": {
"ReferenceDateTime": "2016-11-07T00:00:00"
},
"NotSupportedByDesign": "javascript,java",
"Results": [
{
"Text": "00:00",
"TypeName": "datetimeV2.time",
"Resolution": {
"values": [
{
"timex": "T00:00",
"type": "time",
"value": "00:00:00"
}
]
},
"Start": 13,
"End": 17
}
]
},
{
"Input": "Tornerò alle 7:56:30 pm",
"Context": {
Expand Down
24 changes: 24 additions & 0 deletions Specs/DateTime/Portuguese/DateTimeModel.json
Original file line number Diff line number Diff line change
Expand Up @@ -3001,6 +3001,30 @@
}
]
},
{
"Input": "reunião para 00:00",
"Context": {
"ReferenceDateTime": "2023-05-14T12:00:00"
},
"NotSupported": "javascript, java",
"Results": [
{
"Text": "00:00",
"Start": 13,
"End": 17,
"TypeName": "datetimeV2.time",
"Resolution": {
"values": [
{
"timex": "T00:00",
"type": "time",
"value": "00:00:00"
}
]
}
}
]
},
{
"Input": "reunião para as 5 e 45",
"Context": {
Expand Down
Loading

0 comments on commit b13c2ee

Please sign in to comment.