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

[NLU-3534] Fix for case like 'March one 2020' #73

Merged
merged 3 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Python/libraries/datatypes-timex-expression/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def read(fname):


NAME = 'datatypes_timex_expression_genesys'
VERSION = '1.0.47'
VERSION = '1.0.50'
REQUIRES = []

setup(
Expand Down
2 changes: 1 addition & 1 deletion Python/libraries/recognizers-choice/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def read(fname):


NAME = 'recognizers-text-choice-genesys'
VERSION = '1.0.47'
VERSION = '1.0.50'
REQUIRES = ['recognizers-text-genesys', 'regex', 'grapheme']

setup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ def _get_year_in_affix(self, affix, in_prefix):
+ match_year.end() == len(affix.strip())

if success:
year = self.config.date_extractor.get_year_from_text(match_year)
year = self.config.date_extractor.get_year_from_text(match_year)
if Constants.MIN_YEAR_NUM <= year <= Constants.MAX_YEAR_NUM:
return year

Expand Down Expand Up @@ -1417,8 +1417,13 @@ def parse_number_with_month(self, source: str, reference: datetime) -> DateTimeP
if match:
month = self.config.month_of_year.get(match.group())
day = num
suffix = trimmed_source[match.end():]
prefix = trimmed_source[0: match.start()]

prefix_end = min(ers[0].start, match.start())
prefix = trimmed_source[0:prefix_end]

suffix_start = max(ers[0].start + ers[0].length, match.end())
suffix = trimmed_source[suffix_start:]

year = self._get_year_in_affix(suffix, False)

if year == Constants.INVALID_YEAR and self.config.check_both_before_after:
Expand Down Expand Up @@ -1472,7 +1477,7 @@ def parse_number_with_month(self, source: str, reference: datetime) -> DateTimeP
future_date = future_date.replace(year=future_date.year+1)

if past_date >= reference:
past_date = past_date.replace(year=past_date.year+1)
past_date = past_date.replace(year=past_date.year-1)
else:
result.timex = DateTimeFormatUtil.luis_date(year, month, day)

Expand Down
2 changes: 1 addition & 1 deletion Python/libraries/recognizers-date-time/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def read(fname):


NAME = 'recognizers-text-date-time-genesys'
VERSION = '1.0.47'
VERSION = '1.0.50'
REQUIRES = ['recognizers-text-genesys', 'recognizers-text-number-genesys',
'recognizers-text-number-with-unit-genesys', 'regex', 'datedelta']

Expand Down
2 changes: 1 addition & 1 deletion Python/libraries/recognizers-number-with-unit/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def read(fname):


NAME = "recognizers-text-number-with-unit-genesys"
VERSION = "1.0.47"
VERSION = "1.0.50"
REQUIRES = ['recognizers-text-genesys', 'recognizers-text-number-genesys', 'regex']

setup(
Expand Down
2 changes: 1 addition & 1 deletion Python/libraries/recognizers-number/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def read(fname):


NAME = "recognizers-text-number-genesys"
VERSION = "1.0.47"
VERSION = "1.0.50"
REQUIRES = ['recognizers-text-genesys', 'regex']

setup(
Expand Down
2 changes: 1 addition & 1 deletion Python/libraries/recognizers-sequence/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def read(fname):


NAME = "recognizers-text-sequence-genesys"
VERSION = "1.0.47"
VERSION = "1.0.50"
REQUIRES = ['recognizers-text-genesys', 'recognizers-text-number-genesys', 'regex']

setup(
Expand Down
14 changes: 7 additions & 7 deletions Python/libraries/recognizers-suite/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ def read(fname):


NAME = 'recognizers-text-suite-genesys'
VERSION = '1.0.47'
VERSION = '1.0.50'
REQUIRES = [
'recognizers-text-genesys==1.0.47',
'recognizers-text-number-genesys==1.0.47',
'recognizers-text-number-with-unit-genesys==1.0.47',
'recognizers-text-date-time-genesys==1.0.47',
'recognizers-text-sequence-genesys==1.0.47',
'recognizers-text-choice-genesys==1.0.47'
'recognizers-text-genesys==1.0.50',
'recognizers-text-number-genesys==1.0.50',
'recognizers-text-number-with-unit-genesys==1.0.50',
'recognizers-text-date-time-genesys==1.0.50',
'recognizers-text-sequence-genesys==1.0.50',
'recognizers-text-choice-genesys==1.0.50'
]

setup(
Expand Down
2 changes: 1 addition & 1 deletion Python/libraries/recognizers-text/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from setuptools import setup, find_packages

NAME = "recognizers-text-genesys"
VERSION = "1.0.47"
VERSION = "1.0.50"
REQUIRES = ['emoji==1.1.0', 'multipledispatch']

setup(
Expand Down
104 changes: 104 additions & 0 deletions Specs/DateTime/English/DateExtractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,110 @@
}
]
},
{
"Input": "I'll go back on April first 2021.",
"NotSupported": "javascript",
"Results": [
{
"Text": "April first 2021",
"Type": "date",
"Start": 16,
"Length": 16
}
]
},
{
"Input": "I'll go back Jun third 2023",
"NotSupported": "javascript",
"Results": [
{
"Text": "Jun third 2023",
"Type": "date",
"Start": 13,
"Length": 14
}
]
},
{
"Input": "I'll go back September the second 2025.",
"NotSupported": "javascript",
"Results": [
{
"Text": "September the second 2025",
"Type": "date",
"Start": 13,
"Length": 25
}
]
},
{
"Input": "I'll go back March one 2020",
"NotSupported": "javascript",
"Results": [
{
"Text": "March one 2020",
"Type": "date",
"Start": 13,
"Length": 14
}
]
},
{
"Input": "I'll go back Aug twelve 2024.",
"NotSupported": "javascript",
"Results": [
{
"Text": "Aug twelve 2024",
"Type": "date",
"Start": 13,
"Length": 15
}
]
},
{
"Input": "I'll go back February twenty fifth",
"Results": [
{
"Text": "February twenty fifth",
"Type": "date",
"Start": 13,
"Length": 21
}
]
},
{
"Input": "I'll go back on Nov the twelfth.",
"Results": [
{
"Text": "Nov the twelfth",
"Type": "date",
"Start": 16,
"Length": 15
}
]
},
{
"Input": "I'll go back January thirty one",
"Results": [
{
"Text": "January thirty one",
"Type": "date",
"Start": 13,
"Length": 18
}
]
},
{
"Input": "I'll go back Oct twenty three.",
"Results": [
{
"Text": "Oct twenty three",
"Type": "date",
"Start": 13,
"Length": 16
}
]
},
{
"Input": "i went back two months ago",
"Results": [
Expand Down
Loading