Skip to content
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

[Python][* DateTimeV2] Fix detection of "00:XX" in Python #3091

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
73b8241
[ES Temperature] Support informal degrees and fix issue in ES auto-ge…
tellarin Mar 3, 2022
365d66f
[Python] Enabling SpanishMexican culture in Number/Unit/DateTimveV2 (…
colm-dillon Mar 3, 2022
ff11e07
[Python] Add Portuguese support for DateTimeV2 (#2876)
samhickey25 Mar 3, 2022
3e520e5
[KO Number] Fixed incorrect extraction of number from datetime mentio…
aitelint Mar 11, 2022
f703254
[.NET Timexlib] Fix timex-to-string conversion of English ordinals 11…
shana Mar 12, 2022
45b0c3b
[EN .NET] Workaround for TimexProperty.ToString() to not crash on Dat…
shana Mar 14, 2022
d6e3692
Merge pull request #24 from microsoft/master
Mar 30, 2022
30dbdaf
Merge pull request #29 from microsoft/master
Apr 28, 2022
3a2342a
Merge pull request #33 from microsoft/master
samhickey25 May 11, 2022
cd9ba48
Merge pull request #37 from microsoft/master
kevinwalshgen Jun 9, 2022
22f56fd
NLU-2966: Fix failing tests
kevinwalshgen Jun 10, 2022
c544eff
Revert "NLU-2966: Fix failing tests"
kevinwalshgen Jun 10, 2022
8f92c9a
Merge pull request #42 from microsoft/master
samhickey25 Jul 15, 2022
f14677d
Merge branch 'microsoft:master' into master
samhickey25 Aug 8, 2022
d631cbe
Merge branch 'microsoft:master' into master
rbrennangen Aug 15, 2022
a830707
Merge branch 'microsoft:master' into master
rbrennangen Aug 17, 2022
e378aa3
Merge branch 'microsoft:master' into master
rbrennangen Aug 31, 2022
86f14b8
Merge branch 'microsoft:master' into master
Conor-Keaney Nov 10, 2022
4451a53
Merge pull request #53 from microsoft/master
samhickey25 Dec 19, 2022
bde6680
Merge branch 'microsoft:master' into master
Conor-Keaney Jan 30, 2023
b03280c
Merge branch 'microsoft:master' into master
Conor-Keaney Feb 8, 2023
b13c2ee
[Python][* DateTimeV2] Fix detection of "00:XX"
andrew-gradinari Apr 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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