From 90e968ea44dc8fda3f2e1c3e4b20aa233817488d Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 5 Dec 2024 07:09:20 +0800 Subject: [PATCH] Support Chinese next next week day - first commit (#3184) Co-authored-by: Michael Wang (Centific Technologies Inc) --- .../Chinese/DateTimeDefinitions.cs | 10 +- .../ChineseDateExtractorConfiguration.cs | 6 +- ...ChineseDatePeriodExtractorConfiguration.cs | 1 + .../Parsers/ChineseDateParserConfiguration.cs | 6 ++ .../ChineseDatePeriodParserConfiguration.cs | 3 + .../Parsers/CJK/BaseCJKDateParser.cs | 56 +++++++++++ .../Parsers/CJK/BaseCJKDatePeriodParser.cs | 7 ++ Patterns/Chinese/Chinese-DateTime.yaml | 15 ++- Specs/DateTime/Chinese/DateExtractor.json | 24 +++++ Specs/DateTime/Chinese/DateParser.json | 48 +++++++++ .../DateTime/Chinese/DatePeriodExtractor.json | 24 +++++ Specs/DateTime/Chinese/DatePeriodParser.json | 52 ++++++++++ Specs/DateTime/Chinese/DateTimeModel.json | 99 +++++++++++++++++++ 13 files changed, 344 insertions(+), 7 deletions(-) diff --git a/.NET/Microsoft.Recognizers.Definitions.Common/Chinese/DateTimeDefinitions.cs b/.NET/Microsoft.Recognizers.Definitions.Common/Chinese/DateTimeDefinitions.cs index e46bceb47a..19004b6743 100644 --- a/.NET/Microsoft.Recognizers.Definitions.Common/Chinese/DateTimeDefinitions.cs +++ b/.NET/Microsoft.Recognizers.Definitions.Common/Chinese/DateTimeDefinitions.cs @@ -42,6 +42,8 @@ public static class DateTimeDefinitions public static readonly string DateThisRegex = $@"(这个|这一个|这|这一|本){WeekDayRegex}"; public static readonly string DateLastRegex = $@"(上一个|上个|上一|上|最后一个|最后)(的)?{WeekDayRegex}"; public static readonly string DateNextRegex = $@"(下一个|下个|下一|下)(的)?{WeekDayRegex}"; + public static readonly string DateNextNextRegex = $@"(下下|下下[个個]){WeekDayRegex}"; + public static readonly string DateLastLastRegex = $@"(上上|上上[个個]){WeekDayRegex}"; public const string WeekWithWeekDayRangeRegex = @"^[.]"; public const string WoMLastRegex = @"最后一"; public const string WoMPreviousRegex = @"上个"; @@ -78,7 +80,8 @@ public static class DateTimeDefinitions public const string DatePeriodThisRegex = @"这个|这一个|这|这一|本"; public const string DatePeriodLastRegex = @"上个|上一个|上|上一"; public const string DatePeriodNextRegex = @"下个|下一个|下|下一"; - public const string DatePeriodNextNextRegex = @"下下"; + public const string DatePeriodNextNextRegex = @"下下|下下[个個]"; + public const string DatePeriodLastLastRegex = @"上上|上上[个個]"; public static readonly string RelativeMonthRegex = $@"(?({DatePeriodThisRegex}|{DatePeriodLastRegex}|{DatePeriodNextRegex})\s*月)"; public const string HalfYearRegex = @"((?(上|前)半年)|(?(下|后)半年))"; public static readonly string YearRegex = $@"(({YearNumRegex})(\s*年)?|({SimpleYearRegex})\s*年){HalfYearRegex}?"; @@ -90,7 +93,7 @@ public static class DateTimeDefinitions public static readonly string YearAndMonth = $@"({DatePeriodYearInCJKRegex}|{YearRegex}|(?明年|今年|去年))\s*({MonthRegex}|的?(?第一|第二|第三|第四|第五|第六|第七|第八|第九|第十|第十一|第十二|最后一)\s*个月\s*)"; public static readonly string SimpleYearAndMonth = $@"({YearNumRegex}[/\\\-]{MonthNumRegex}\b$)"; public static readonly string PureNumYearAndMonth = $@"({YearRegexInNumber}\s*[-\.\/]\s*{MonthNumRegex})|({MonthNumRegex}\s*\/\s*{YearRegexInNumber})"; - public static readonly string OneWordPeriodRegex = $@"(((?(明|今|去)年)\s*)?{MonthRegex}|({DatePeriodThisRegex}|{DatePeriodLastRegex}|{DatePeriodNextNextRegex}|{DatePeriodNextRegex})(?半)?\s*(周末|周|月|年)|周末|(今|明|去|前|后)年(\s*{HalfYearRegex})?)"; + public static readonly string OneWordPeriodRegex = $@"(((?(明|今|去)年)\s*)?{MonthRegex}|({DatePeriodThisRegex}|{DatePeriodLastLastRegex}|{DatePeriodLastRegex}|{DatePeriodNextNextRegex}|{DatePeriodNextRegex})(?半)?\s*([周週]末|[周週]|月|年)|[周週]末|(今|明|去|前|后)年(\s*{HalfYearRegex})?)"; public const string LaterEarlyPeriodRegex = @"^[.]"; public const string DatePointWithAgoAndLater = @"^[.]"; public static readonly string WeekOfMonthRegex = $@"(?{MonthSuffixRegex}的(?第一|第二|第三|第四|第五|最后一)\s*周\s*)"; @@ -286,7 +289,8 @@ public static class DateTimeDefinitions }; public static readonly IList WeekendTerms = new List { - @"周末" + @"周末", + @"週末" }; public static readonly IList WeekTerms = new List { diff --git a/.NET/Microsoft.Recognizers.Text.DateTime/Chinese/Extractors/ChineseDateExtractorConfiguration.cs b/.NET/Microsoft.Recognizers.Text.DateTime/Chinese/Extractors/ChineseDateExtractorConfiguration.cs index 25b6f11798..8fb9c11f2b 100644 --- a/.NET/Microsoft.Recognizers.Text.DateTime/Chinese/Extractors/ChineseDateExtractorConfiguration.cs +++ b/.NET/Microsoft.Recognizers.Text.DateTime/Chinese/Extractors/ChineseDateExtractorConfiguration.cs @@ -27,6 +27,10 @@ public class ChineseDateExtractorConfiguration : BaseDateTimeOptionsConfiguratio public static readonly Regex NextRegex = new Regex(DateTimeDefinitions.DateNextRegex, RegexFlags, RegexTimeOut); + public static readonly Regex NextNextRegex = new Regex(DateTimeDefinitions.DateNextNextRegex, RegexFlags, RegexTimeOut); + + public static readonly Regex LastLastRegex = new Regex(DateTimeDefinitions.DateLastLastRegex, RegexFlags, RegexTimeOut); + public static readonly Regex SpecialDayRegex = new Regex(DateTimeDefinitions.SpecialDayRegex, RegexFlags, RegexTimeOut); public static readonly Regex WeekDayOfMonthRegex = new Regex(DateTimeDefinitions.WeekDayOfMonthRegex, RegexFlags, RegexTimeOut); @@ -78,7 +82,7 @@ public ChineseDateExtractorConfiguration(IDateTimeOptionsConfiguration config) ImplicitDateList = new List { - LunarRegex, SpecialDayRegex, ThisRegex, LastRegex, NextRegex, + LunarRegex, SpecialDayRegex, ThisRegex, LastLastRegex, LastRegex, NextNextRegex, NextRegex, WeekDayRegex, WeekDayOfMonthRegex, SpecialDate, }; diff --git a/.NET/Microsoft.Recognizers.Text.DateTime/Chinese/Extractors/ChineseDatePeriodExtractorConfiguration.cs b/.NET/Microsoft.Recognizers.Text.DateTime/Chinese/Extractors/ChineseDatePeriodExtractorConfiguration.cs index 1b8e57353f..1cb6d0df23 100644 --- a/.NET/Microsoft.Recognizers.Text.DateTime/Chinese/Extractors/ChineseDatePeriodExtractorConfiguration.cs +++ b/.NET/Microsoft.Recognizers.Text.DateTime/Chinese/Extractors/ChineseDatePeriodExtractorConfiguration.cs @@ -93,6 +93,7 @@ public class ChineseDatePeriodExtractorConfiguration : BaseDateTimeOptionsConfig public static readonly Regex DateUnitRegex = new Regex(DateTimeDefinitions.DateUnitRegex, RegexFlags, RegexTimeOut); public static readonly Regex LastRegex = new Regex(DateTimeDefinitions.DatePeriodLastRegex, RegexFlags, RegexTimeOut); public static readonly Regex NextNextRegex = new Regex(DateTimeDefinitions.DatePeriodNextNextRegex, RegexFlags, RegexTimeOut); + public static readonly Regex LastLastRegex = new Regex(DateTimeDefinitions.DatePeriodLastLastRegex, RegexFlags, RegexTimeOut); public static readonly Regex NextRegex = new Regex(DateTimeDefinitions.DatePeriodNextRegex, RegexFlags, RegexTimeOut); public static readonly Regex RelativeMonthRegex = new Regex(DateTimeDefinitions.RelativeMonthRegex, RegexFlags, RegexTimeOut); public static readonly Regex LaterEarlyPeriodRegex = new Regex(DateTimeDefinitions.LaterEarlyPeriodRegex, RegexFlags, RegexTimeOut); diff --git a/.NET/Microsoft.Recognizers.Text.DateTime/Chinese/Parsers/ChineseDateParserConfiguration.cs b/.NET/Microsoft.Recognizers.Text.DateTime/Chinese/Parsers/ChineseDateParserConfiguration.cs index 2f4a82f70e..534573f58a 100644 --- a/.NET/Microsoft.Recognizers.Text.DateTime/Chinese/Parsers/ChineseDateParserConfiguration.cs +++ b/.NET/Microsoft.Recognizers.Text.DateTime/Chinese/Parsers/ChineseDateParserConfiguration.cs @@ -51,6 +51,8 @@ public ChineseDateParserConfiguration(ICJKCommonDateTimeParserConfiguration conf WeekDayAndDayRegex = ChineseDateExtractorConfiguration.WeekDayAndDayRegex; DurationRelativeDurationUnitRegex = ChineseDateExtractorConfiguration.DurationRelativeDurationUnitRegex; SpecialDayWithNumRegex = ChineseDateExtractorConfiguration.SpecialDayWithNumRegex; + NextNextRegex = ChineseDateExtractorConfiguration.NextNextRegex; + LastLastRegex = ChineseDateExtractorConfiguration.LastLastRegex; CardinalMap = config.CardinalMap; UnitMap = config.UnitMap; @@ -94,6 +96,10 @@ public ChineseDateParserConfiguration(ICJKCommonDateTimeParserConfiguration conf public Regex NextRegex { get; } + public Regex NextNextRegex { get; } + + public Regex LastLastRegex { get; } + public Regex ThisRegex { get; } public Regex LastRegex { get; } diff --git a/.NET/Microsoft.Recognizers.Text.DateTime/Chinese/Parsers/ChineseDatePeriodParserConfiguration.cs b/.NET/Microsoft.Recognizers.Text.DateTime/Chinese/Parsers/ChineseDatePeriodParserConfiguration.cs index 3a293d9eb0..7eba76ad55 100644 --- a/.NET/Microsoft.Recognizers.Text.DateTime/Chinese/Parsers/ChineseDatePeriodParserConfiguration.cs +++ b/.NET/Microsoft.Recognizers.Text.DateTime/Chinese/Parsers/ChineseDatePeriodParserConfiguration.cs @@ -38,6 +38,7 @@ public ChineseDatePeriodParserConfiguration(ICJKCommonDateTimeParserConfiguratio SimpleCasesRegex = ChineseDatePeriodExtractorConfiguration.SimpleCasesRegex; ThisRegex = ChineseDatePeriodExtractorConfiguration.ThisRegex; NextNextRegex = ChineseDatePeriodExtractorConfiguration.NextNextRegex; + LastLastRegex = ChineseDatePeriodExtractorConfiguration.LastLastRegex; NextRegex = ChineseDatePeriodExtractorConfiguration.NextRegex; LastRegex = ChineseDatePeriodExtractorConfiguration.LastRegex; YearToYear = ChineseDatePeriodExtractorConfiguration.YearToYear; @@ -124,6 +125,8 @@ public ChineseDatePeriodParserConfiguration(ICJKCommonDateTimeParserConfiguratio public Regex NextNextRegex { get; } + public Regex LastLastRegex { get; } + public Regex NextRegex { get; } public Regex LastRegex { get; } diff --git a/.NET/Microsoft.Recognizers.Text.DateTime/Parsers/CJK/BaseCJKDateParser.cs b/.NET/Microsoft.Recognizers.Text.DateTime/Parsers/CJK/BaseCJKDateParser.cs index 3f09c37e7d..e7d7b3d296 100644 --- a/.NET/Microsoft.Recognizers.Text.DateTime/Parsers/CJK/BaseCJKDateParser.cs +++ b/.NET/Microsoft.Recognizers.Text.DateTime/Parsers/CJK/BaseCJKDateParser.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Globalization; using System.Text.RegularExpressions; +using Microsoft.Recognizers.Text.DateTime.Chinese; using Microsoft.Recognizers.Text.Utilities; using DateObject = System.DateTime; @@ -355,11 +356,21 @@ protected DateTimeResolutionResult ParseImplicitDate(string text, DateObject ref ret = MatchThisWeekday(text, referenceDate); } + if (!ret.Success) + { + ret = MatchNextNextWeekday(text, referenceDate); + } + if (!ret.Success) { ret = MatchNextWeekday(text, referenceDate); } + if (!ret.Success) + { + ret = MatchLastLastWeekday(text, referenceDate); + } + if (!ret.Success) { ret = MatchLastWeekday(text, referenceDate); @@ -497,6 +508,28 @@ protected DateTimeResolutionResult MatchNextWeekday(string text, DateObject refe return result; } + protected DateTimeResolutionResult MatchNextNextWeekday(string text, DateObject reference) + { + var result = new DateTimeResolutionResult(); + var cnConfig = this.config as ChineseDateParserConfiguration; + if (cnConfig != null) + { + var match = cnConfig.NextNextRegex.MatchExact(text, trim: true); + if (match.Success) + { + var weekdayKey = match.Groups["weekday"].Value; + var value = reference.Next((DayOfWeek)this.config.DayOfWeek[weekdayKey]); + value = value.Next((DayOfWeek)this.config.DayOfWeek[weekdayKey]); + + result.Timex = DateTimeFormatUtil.LuisDate(value); + result.FutureValue = result.PastValue = DateObject.MinValue.SafeCreateFromValue(value.Year, value.Month, value.Day); + result.Success = true; + } + } + + return result; + } + protected DateTimeResolutionResult MatchThisWeekday(string text, DateObject reference) { var result = new DateTimeResolutionResult(); @@ -533,6 +566,29 @@ protected DateTimeResolutionResult MatchLastWeekday(string text, DateObject refe return result; } + protected DateTimeResolutionResult MatchLastLastWeekday(string text, DateObject reference) + { + var result = new DateTimeResolutionResult(); + var cnConfig = this.config as ChineseDateParserConfiguration; + if (cnConfig != null) + { + var match = cnConfig.LastLastRegex.MatchExact(text, trim: true); + + if (match.Success) + { + var weekdayKey = match.Groups["weekday"].Value; + var value = reference.Last((DayOfWeek)this.config.DayOfWeek[weekdayKey]); + value = value.Last((DayOfWeek)this.config.DayOfWeek[weekdayKey]); + + result.Timex = DateTimeFormatUtil.LuisDate(value); + result.FutureValue = result.PastValue = DateObject.MinValue.SafeCreateFromValue(value.Year, value.Month, value.Day); + result.Success = true; + } + } + + return result; + } + protected DateTimeResolutionResult MatchWeekdayAlone(string text, DateObject reference) { var result = new DateTimeResolutionResult(); diff --git a/.NET/Microsoft.Recognizers.Text.DateTime/Parsers/CJK/BaseCJKDatePeriodParser.cs b/.NET/Microsoft.Recognizers.Text.DateTime/Parsers/CJK/BaseCJKDatePeriodParser.cs index 86abcb02cb..cc2544d471 100644 --- a/.NET/Microsoft.Recognizers.Text.DateTime/Parsers/CJK/BaseCJKDatePeriodParser.cs +++ b/.NET/Microsoft.Recognizers.Text.DateTime/Parsers/CJK/BaseCJKDatePeriodParser.cs @@ -1023,8 +1023,10 @@ private DateTimeResolutionResult ParseOneWordPeriod(string text, DateObject refe } // In Chinese, "下" means next, "下下周" means next next week, "下下周末" means next next weekend, need to check whether the text match "下下" + // "上" means last, "上上周" means last last week, "上上周末" means last last weekend, need to check whether the text match "上上" ChineseDatePeriodParserConfiguration config = this.config as ChineseDatePeriodParserConfiguration; bool nextNextMatch = config == null ? false : config.NextNextRegex.Match(trimmedText).Success; + bool lastlastMatch = config == null ? false : config.LastLastRegex.Match(trimmedText).Success; var nextMatch = this.config.NextRegex.Match(trimmedText); var lastMatch = this.config.LastRegex.Match(trimmedText); @@ -1081,6 +1083,11 @@ private DateTimeResolutionResult ParseOneWordPeriod(string text, DateObject refe // If it is Chinese "下下周" (next next week), "下下周末" (next next weekend), then swift is 2 swift = 2; } + else if (lastlastMatch) + { + // If it is Chinese "上上周" (last last week), "上上周末" (last last weekend), then swift is -2 + swift = -2; + } else if (nextMatch.Success) { if (nextMatch.Groups[Constants.AfterGroupName].Success) diff --git a/Patterns/Chinese/Chinese-DateTime.yaml b/Patterns/Chinese/Chinese-DateTime.yaml index 7fd44bb0c7..0ca34c9bef 100644 --- a/Patterns/Chinese/Chinese-DateTime.yaml +++ b/Patterns/Chinese/Chinese-DateTime.yaml @@ -48,6 +48,12 @@ DateLastRegex: !nestedRegex DateNextRegex: !nestedRegex def: (下一个|下个|下一|下)(的)?{WeekDayRegex} references: [WeekDayRegex] +DateNextNextRegex: !nestedRegex + def: (下下|下下[个個]){WeekDayRegex} + references: [WeekDayRegex] +DateLastLastRegex: !nestedRegex + def: (上上|上上[个個]){WeekDayRegex} + references: [WeekDayRegex] WeekWithWeekDayRangeRegex: !simpleRegex # TODO: modify below regex according to the counterpart in Japanese def: ^[.] @@ -150,7 +156,9 @@ DatePeriodLastRegex: !simpleRegex DatePeriodNextRegex: !simpleRegex def: 下个|下一个|下|下一 DatePeriodNextNextRegex: !simpleRegex - def: 下下 + def: 下下|下下[个個] +DatePeriodLastLastRegex: !simpleRegex + def: 上上|上上[个個] RelativeMonthRegex: !nestedRegex def: (?({DatePeriodThisRegex}|{DatePeriodLastRegex}|{DatePeriodNextRegex})\s*月) references: [DatePeriodThisRegex, DatePeriodLastRegex, DatePeriodNextRegex] @@ -183,8 +191,8 @@ PureNumYearAndMonth: !nestedRegex def: ({YearRegexInNumber}\s*[-\.\/]\s*{MonthNumRegex})|({MonthNumRegex}\s*\/\s*{YearRegexInNumber}) references: [YearRegexInNumber, MonthNumRegex] OneWordPeriodRegex: !nestedRegex - def: (((?(明|今|去)年)\s*)?{MonthRegex}|({DatePeriodThisRegex}|{DatePeriodLastRegex}|{DatePeriodNextNextRegex}|{DatePeriodNextRegex})(?半)?\s*(周末|周|月|年)|周末|(今|明|去|前|后)年(\s*{HalfYearRegex})?) - references: [MonthRegex, DatePeriodThisRegex, DatePeriodLastRegex, DatePeriodNextNextRegex, DatePeriodNextRegex, HalfYearRegex] + def: (((?(明|今|去)年)\s*)?{MonthRegex}|({DatePeriodThisRegex}|{DatePeriodLastLastRegex}|{DatePeriodLastRegex}|{DatePeriodNextNextRegex}|{DatePeriodNextRegex})(?半)?\s*([周週]末|[周週]|月|年)|[周週]末|(今|明|去|前|后)年(\s*{HalfYearRegex})?) + references: [MonthRegex, DatePeriodThisRegex, DatePeriodLastLastRegex, DatePeriodLastRegex, DatePeriodNextNextRegex, DatePeriodNextRegex, HalfYearRegex] LaterEarlyPeriodRegex: !simpleRegex # TODO: modify below regex according to the counterpart in Japanese def: ^[.] @@ -567,6 +575,7 @@ WeekendTerms: !list types: [ string ] entries: - 周末 + - 週末 WeekTerms: !list types: [ string ] entries: diff --git a/Specs/DateTime/Chinese/DateExtractor.json b/Specs/DateTime/Chinese/DateExtractor.json index 0a5c75724d..eec028930d 100644 --- a/Specs/DateTime/Chinese/DateExtractor.json +++ b/Specs/DateTime/Chinese/DateExtractor.json @@ -245,6 +245,30 @@ } ] }, + { + "Input": "马拉松在下下周日举行", + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "下下周日", + "Type": "date", + "Start": 4, + "Length": 4 + } + ] + }, + { + "Input": "任務是在上上個週三完成的", + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "上上個週三", + "Type": "date", + "Start": 4, + "Length": 5 + } + ] + }, { "Input": "下次的12号", "Results": [ diff --git a/Specs/DateTime/Chinese/DateParser.json b/Specs/DateTime/Chinese/DateParser.json index 7e24fac7e8..c1111abc98 100644 --- a/Specs/DateTime/Chinese/DateParser.json +++ b/Specs/DateTime/Chinese/DateParser.json @@ -581,6 +581,54 @@ } ] }, + { + "Input": "马拉松在下下周日举行", + "Context": { + "ReferenceDateTime": "2024-11-15T00:00:00" + }, + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "下下周日", + "Type": "date", + "Value": { + "Timex": "2024-12-01", + "FutureResolution": { + "date": "2024-12-01" + }, + "PastResolution": { + "date": "2024-12-01" + } + }, + "Start": 4, + "Length": 4 + } + ] + }, + { + "Input": "任務是在上上個週三完成的", + "Context": { + "ReferenceDateTime": "2024-11-15T00:00:00" + }, + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "上上個週三", + "Type": "date", + "Value": { + "Timex": "2024-10-30", + "FutureResolution": { + "date": "2024-10-30" + }, + "PastResolution": { + "date": "2024-10-30" + } + }, + "Start": 4, + "Length": 5 + } + ] + }, { "Input": "12号", "Context": { diff --git a/Specs/DateTime/Chinese/DatePeriodExtractor.json b/Specs/DateTime/Chinese/DatePeriodExtractor.json index f8d766c54d..cef7989ccf 100644 --- a/Specs/DateTime/Chinese/DatePeriodExtractor.json +++ b/Specs/DateTime/Chinese/DatePeriodExtractor.json @@ -100,6 +100,30 @@ } ] }, + { + "Input": "我是上上周回来的", + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "上上周", + "Type": "daterange", + "Start": 2, + "Length": 3 + } + ] + }, + { + "Input": "你上上個週末干嘛了", + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "上上個週末", + "Type": "daterange", + "Start": 1, + "Length": 5 + } + ] + }, { "Input": "下个月完工", "Results": [ diff --git a/Specs/DateTime/Chinese/DatePeriodParser.json b/Specs/DateTime/Chinese/DatePeriodParser.json index fb45814be5..5c4af8d50d 100644 --- a/Specs/DateTime/Chinese/DatePeriodParser.json +++ b/Specs/DateTime/Chinese/DatePeriodParser.json @@ -251,6 +251,58 @@ } ] }, + { + "Input": "我是上上周回来的", + "Context": { + "ReferenceDateTime": "2024-11-15T00:00:00" + }, + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "上上周", + "Type": "daterange", + "Value": { + "Timex": "2024-W44", + "FutureResolution": { + "startDate": "2024-10-28", + "endDate": "2024-11-04" + }, + "PastResolution": { + "startDate": "2024-10-28", + "endDate": "2024-11-04" + } + }, + "Start": 2, + "Length": 3 + } + ] + }, + { + "Input": "你上上個週末干嘛了", + "Context": { + "ReferenceDateTime": "2024-11-15T00:00:00" + }, + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "上上個週末", + "Type": "daterange", + "Value": { + "Timex": "2024-W44-WE", + "FutureResolution": { + "startDate": "2024-11-02", + "endDate": "2024-11-04" + }, + "PastResolution": { + "startDate": "2024-11-02", + "endDate": "2024-11-04" + } + }, + "Start": 1, + "Length": 5 + } + ] + }, { "Input": "下个月完工", "Context": { diff --git a/Specs/DateTime/Chinese/DateTimeModel.json b/Specs/DateTime/Chinese/DateTimeModel.json index 2be8a5737a..26a54615bd 100644 --- a/Specs/DateTime/Chinese/DateTimeModel.json +++ b/Specs/DateTime/Chinese/DateTimeModel.json @@ -618,6 +618,57 @@ } ] }, + { + "Input": "我是上上周回来的", + "Context": { + "ReferenceDateTime": "2024-11-15T00:00:00" + }, + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "上上周", + "TypeName": "datetimeV2.daterange", + "Resolution": { + "values": [ + { + "timex": "2024-W44", + "type": "daterange", + "start": "2024-10-28", + "end": "2024-11-04" + } + ] + }, + "Start": 2, + "End": 4 + } + ] + }, + { + "Input": "你上上個週末干嘛了", + "Context": { + "ReferenceDateTime": "2024-11-15T00:00:00" + }, + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "上上個週末", + "TypeName": "datetimeV2.daterange", + "Resolution": { + "values": [ + { + "timex": "2024-W44-WE", + "type": "daterange", + "start": "2024-11-02", + "end": "2024-11-04" + } + ] + }, + "Start": 1, + "End": 5 + } + ] + }, + { "Input": "后1年", "Context": { @@ -2368,6 +2419,54 @@ } ] }, + { + "Input": "马拉松在下下周日举行", + "Context": { + "ReferenceDateTime": "2024-11-15T00:00:00" + }, + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "下下周日", + "TypeName": "datetimeV2.date", + "Resolution": { + "values": [ + { + "timex": "2024-12-01", + "type": "date", + "value": "2024-12-01" + } + ] + }, + "Start": 4, + "End": 7 + } + ] + }, + { + "Input": "任務是在上上個週三完成的", + "Context": { + "ReferenceDateTime": "2024-11-15T00:00:00" + }, + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "上上個週三", + "TypeName": "datetimeV2.date", + "Resolution": { + "values": [ + { + "timex": "2024-10-30", + "type": "date", + "value": "2024-10-30" + } + ] + }, + "Start": 4, + "End": 8 + } + ] + }, { "Input": "这家工厂2015年和2018年的销售额分别为5亿和7.5亿元人民币", "Context": {