diff --git a/.NET/Microsoft.Recognizers.Definitions.Common/English/DateTimeDefinitions.cs b/.NET/Microsoft.Recognizers.Definitions.Common/English/DateTimeDefinitions.cs index 8e5662c43d..f13dcec317 100644 --- a/.NET/Microsoft.Recognizers.Definitions.Common/English/DateTimeDefinitions.cs +++ b/.NET/Microsoft.Recognizers.Definitions.Common/English/DateTimeDefinitions.cs @@ -256,6 +256,7 @@ public static class DateTimeDefinitions public const string AroundRegex = @"(?:\b(?:around|circa)\s*?\b)(\s+the)?"; public static readonly string BeforeRegex = $@"((\b{InclusiveModPrepositions}?(?:before|in\s+advance\s+of|prior\s+to|(no\s+later|earlier|sooner)\s+than|ending\s+(with|on)|by|(un)?till?|(?as\s+late\s+as)){InclusiveModPrepositions}?\b\s*?)|(?)((?<\s*=)|<))(\s+the)?"; public static readonly string AfterRegex = $@"((\b{InclusiveModPrepositions}?((after(\s+on)?(?!\sfrom)|(?>\s*=)|>))(\s+the)?"; + public const string StartingRegex = @"(starting|beginning)(\s+)?(?:from|on|with)?"; public const string SinceRegex = @"(?:(?:\b(?:since|after\s+or\s+equal\s+to|(starting|beginning)(\s)?(?:from|on|with)?|as\s+early\s+as|(any\s+time\s+)from)\b\s*?)|(?=))(\s+the)?"; public static readonly string SinceRegexExp = $@"({SinceRegex}|\bfrom(\s+the)?\b)"; public const string AgoRegex = @"\b(ago|earlier|before\s+(?yesterday|today))\b"; diff --git a/.NET/Microsoft.Recognizers.Text.DateTime/English/Extractors/EnglishDatePeriodExtractorConfiguration.cs b/.NET/Microsoft.Recognizers.Text.DateTime/English/Extractors/EnglishDatePeriodExtractorConfiguration.cs index aa2ed947c2..7816834d7b 100644 --- a/.NET/Microsoft.Recognizers.Text.DateTime/English/Extractors/EnglishDatePeriodExtractorConfiguration.cs +++ b/.NET/Microsoft.Recognizers.Text.DateTime/English/Extractors/EnglishDatePeriodExtractorConfiguration.cs @@ -175,6 +175,9 @@ public class EnglishDatePeriodExtractorConfiguration : BaseDateTimeOptionsConfig public static readonly Regex OfYearRegex = new Regex(DateTimeDefinitions.OfYearRegex, RegexFlags, RegexTimeOut); + public static readonly Regex StartingRegex = + new Regex(DateTimeDefinitions.StartingRegex, RegexFlags, RegexTimeOut); + private const RegexOptions RegexFlags = RegexOptions.Singleline | RegexOptions.ExplicitCapture; private static readonly Regex FromTokenRegex = diff --git a/.NET/Microsoft.Recognizers.Text.DateTime/English/Extractors/EnglishDateTimePeriodExtractorConfiguration.cs b/.NET/Microsoft.Recognizers.Text.DateTime/English/Extractors/EnglishDateTimePeriodExtractorConfiguration.cs index 0e2d1aa41d..ca45a0e792 100644 --- a/.NET/Microsoft.Recognizers.Text.DateTime/English/Extractors/EnglishDateTimePeriodExtractorConfiguration.cs +++ b/.NET/Microsoft.Recognizers.Text.DateTime/English/Extractors/EnglishDateTimePeriodExtractorConfiguration.cs @@ -62,6 +62,9 @@ public class EnglishDateTimePeriodExtractorConfiguration : BaseDateTimeOptionsCo public static readonly Regex TasksmodeMealTimeofDayRegex = new Regex(DateTimeDefinitions.TasksmodeMealTimeofDayRegex, RegexFlags, RegexTimeOut); + public static readonly Regex StartingRegex = + new Regex(DateTimeDefinitions.StartingRegex, RegexFlags, RegexTimeOut); + private const RegexOptions RegexFlags = RegexOptions.Singleline | RegexOptions.ExplicitCapture; private static readonly Regex[] SimpleCases = diff --git a/.NET/Microsoft.Recognizers.Text.DateTime/English/Parsers/EnglishDatePeriodParserConfiguration.cs b/.NET/Microsoft.Recognizers.Text.DateTime/English/Parsers/EnglishDatePeriodParserConfiguration.cs index a1922fd658..b67d2ac334 100644 --- a/.NET/Microsoft.Recognizers.Text.DateTime/English/Parsers/EnglishDatePeriodParserConfiguration.cs +++ b/.NET/Microsoft.Recognizers.Text.DateTime/English/Parsers/EnglishDatePeriodParserConfiguration.cs @@ -107,6 +107,7 @@ public EnglishDatePeriodParserConfiguration(ICommonDateTimeParserConfiguration c NowRegex = NowParseRegex; SpecialDayRegex = EnglishDateExtractorConfiguration.SpecialDayRegex; TodayNowRegex = new Regex(DateTimeDefinitions.TodayNowRegex, RegexOptions.Singleline, RegexTimeOut); + StartingRegex = EnglishDatePeriodExtractorConfiguration.StartingRegex; UnitMap = config.UnitMap; CardinalMap = config.CardinalMap; @@ -227,6 +228,8 @@ public EnglishDatePeriodParserConfiguration(ICommonDateTimeParserConfiguration c public Regex OfYearRegex { get; } + public Regex StartingRegex { get; } + Regex ISimpleDatePeriodParserConfiguration.RelativeRegex => RelativeRegex; Regex IDatePeriodParserConfiguration.NextPrefixRegex => NextPrefixRegex; diff --git a/.NET/Microsoft.Recognizers.Text.DateTime/English/Parsers/EnglishDateTimePeriodParserConfiguration.cs b/.NET/Microsoft.Recognizers.Text.DateTime/English/Parsers/EnglishDateTimePeriodParserConfiguration.cs index 48060d4917..22607d75a8 100644 --- a/.NET/Microsoft.Recognizers.Text.DateTime/English/Parsers/EnglishDateTimePeriodParserConfiguration.cs +++ b/.NET/Microsoft.Recognizers.Text.DateTime/English/Parsers/EnglishDateTimePeriodParserConfiguration.cs @@ -69,6 +69,7 @@ public EnglishDateTimePeriodParserConfiguration(ICommonDateTimeParserConfigurati AfterRegex = EnglishDateTimePeriodExtractorConfiguration.AfterRegex; UnitMap = config.UnitMap; Numbers = config.Numbers; + StartingRegex = EnglishDateTimePeriodExtractorConfiguration.StartingRegex; TasksmodeMealTimeofDayRegex = EnglishDateTimePeriodExtractorConfiguration.TasksmodeMealTimeofDayRegex; } @@ -143,6 +144,8 @@ public EnglishDateTimePeriodParserConfiguration(ICommonDateTimeParserConfigurati public Regex TasksmodeMealTimeofDayRegex { get; } + public Regex StartingRegex { get; } + bool IDateTimePeriodParserConfiguration.CheckBothBeforeAfter => DateTimeDefinitions.CheckBothBeforeAfter; public IImmutableDictionary UnitMap { get; } diff --git a/.NET/Microsoft.Recognizers.Text.DateTime/Extractors/BaseDatePeriodExtractor.cs b/.NET/Microsoft.Recognizers.Text.DateTime/Extractors/BaseDatePeriodExtractor.cs index 433fa5f3fd..8e7b7e91c9 100644 --- a/.NET/Microsoft.Recognizers.Text.DateTime/Extractors/BaseDatePeriodExtractor.cs +++ b/.NET/Microsoft.Recognizers.Text.DateTime/Extractors/BaseDatePeriodExtractor.cs @@ -746,6 +746,25 @@ private List SingleTimePointWithPatterns(string text, List ret.AddRange(GetTokenForRegexMatching(beforeString, EnglishDatePeriodExtractorConfiguration.ForPrefixRegex, extractionResult, inPrefix: true)); } } + + // For cases like xx weeks/days starting (from) a date point + if (this.config as EnglishDatePeriodExtractorConfiguration != null) + { + var match = EnglishDatePeriodExtractorConfiguration.StartingRegex.MatchEnd(beforeString, true); + if (match.Success) + { + var durationERs = this.config.DurationExtractor.Extract(beforeString); + if (durationERs.Count >= 1) + { + var lastDuration = durationERs[durationERs.Count - 1]; + string startingWord = beforeString.Substring(beforeString.LastIndexOf(lastDuration.Text, StringComparison.Ordinal) + lastDuration.Text.Length); + if (startingWord.Trim() == match.Value.Trim()) + { + ret.Add(new Token(lastDuration.Start ?? 0, (extractionResult.Start ?? 0) + (extractionResult.Length ?? 0))); + } + } + } + } } } diff --git a/.NET/Microsoft.Recognizers.Text.DateTime/Extractors/BaseDateTimePeriodExtractor.cs b/.NET/Microsoft.Recognizers.Text.DateTime/Extractors/BaseDateTimePeriodExtractor.cs index f76e3a83b5..0bcbf84478 100644 --- a/.NET/Microsoft.Recognizers.Text.DateTime/Extractors/BaseDateTimePeriodExtractor.cs +++ b/.NET/Microsoft.Recognizers.Text.DateTime/Extractors/BaseDateTimePeriodExtractor.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; - +using Microsoft.Recognizers.Text.DateTime.English; using Microsoft.Recognizers.Text.Utilities; using DateObject = System.DateTime; @@ -52,6 +52,9 @@ public List Extract(string text, DateObject reference) tokens.AddRange(MatchDateWithPeriodPrefix(text, reference, new List(dateErs))); tokens.AddRange(MergeDateWithTimePeriodSuffix(text, new List(dateErs), new List(timeErs))); + // Extracting cases like [duration] starting [datetime] + tokens.AddRange(MatchStartingWithDuration(text, reference)); + var ers = Token.MergeAllTokens(tokens, text, ExtractorName); if ((this.config.Options & DateTimeOptions.EnablePreview) != 0) @@ -820,5 +823,36 @@ private List MatchPureNumberCases(string text, Token tok, bool before) return ret; } + + private List MatchStartingWithDuration(string text, DateObject reference) + { + var ret = new List(); + + if (this.config as EnglishDateTimePeriodExtractorConfiguration != null + && EnglishDateTimePeriodExtractorConfiguration.StartingRegex.Match(text).Success) + { + var dateTimeERs = this.config.SingleDateTimeExtractor.Extract(text, reference); + foreach (var dateTimeER in dateTimeERs) + { + var beforeString = text.Substring(0, (int)dateTimeER.Start); + var match = EnglishDatePeriodExtractorConfiguration.StartingRegex.MatchEnd(beforeString, true); + if (match.Success) + { + var durationERs = this.config.DurationExtractor.Extract(beforeString); + if (durationERs.Count >= 1) + { + var lastDuration = durationERs[durationERs.Count - 1]; + string startingWord = beforeString.Substring(beforeString.LastIndexOf(lastDuration.Text, StringComparison.Ordinal) + lastDuration.Text.Length); + if (startingWord.Trim() == match.Value.Trim()) + { + ret.Add(new Token((int)lastDuration.Start, (int)dateTimeER.Start + (int)dateTimeER.Length)); + } + } + } + } + } + + return ret; + } } } diff --git a/.NET/Microsoft.Recognizers.Text.DateTime/Extractors/BaseMergedDateTimeExtractor.cs b/.NET/Microsoft.Recognizers.Text.DateTime/Extractors/BaseMergedDateTimeExtractor.cs index 7839a39e9a..5f18a4b8c0 100644 --- a/.NET/Microsoft.Recognizers.Text.DateTime/Extractors/BaseMergedDateTimeExtractor.cs +++ b/.NET/Microsoft.Recognizers.Text.DateTime/Extractors/BaseMergedDateTimeExtractor.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; - using Microsoft.Recognizers.Text.Matcher; using Microsoft.Recognizers.Text.Utilities; using DateObject = System.DateTime; diff --git a/.NET/Microsoft.Recognizers.Text.DateTime/Parsers/BaseDatePeriodParser.cs b/.NET/Microsoft.Recognizers.Text.DateTime/Parsers/BaseDatePeriodParser.cs index 134b85079f..f94f322ab1 100644 --- a/.NET/Microsoft.Recognizers.Text.DateTime/Parsers/BaseDatePeriodParser.cs +++ b/.NET/Microsoft.Recognizers.Text.DateTime/Parsers/BaseDatePeriodParser.cs @@ -416,6 +416,12 @@ private DateTimeResolutionResult ParseBaseDatePeriod(string text, DateObject ref innerResult = ParseOneWordPeriod(text, referenceDate); } + // Cases like "x weeks/days starting (from) today/12 sep etc." + if (!innerResult.Success) + { + innerResult = ParseStartingWithDuration(text, referenceDate); + } + if (!innerResult.Success) { innerResult = MergeTwoTimePoints(text, referenceDate); @@ -686,6 +692,52 @@ private DateTimeResolutionResult ParseDatePointWithForPrefix(string text, DateOb return ret; } + // Only handle cases like "x weeks/days starting (from) today/tomorrow/some day" + private DateTimeResolutionResult ParseStartingWithDuration(string text, DateObject referenceDate) + { + var ret = new DateTimeResolutionResult(); + var dateER = this.config.DateExtractor.Extract(text, referenceDate); + var enConfig = this.config as EnglishDatePeriodParserConfiguration; + + if (enConfig != null && enConfig.StartingRegex.Match(text).Success && dateER.Count == 1) + { + var beforeString = text.Substring(0, (int)dateER[0].Start); + + if (!string.IsNullOrEmpty(beforeString) && enConfig.StartingRegex.MatchEnd(beforeString, true).Success) + { + var pr = this.config.DateParser.Parse(dateER[0], referenceDate); + var durationER = this.config.DurationExtractor.Extract(beforeString, referenceDate); + + if (durationER.Count == 1) + { + var duration = this.config.DurationParser.Parse(durationER[0]); + var durationInSeconds = (double)((DateTimeResolutionResult)duration.Value).PastValue; + + DateObject startDate; + DateObject endDate; + + startDate = (DateObject)((DateTimeResolutionResult)pr.Value).PastValue; + endDate = startDate.AddSeconds(durationInSeconds); + + if (startDate != DateObject.MinValue) + { + var startLuisStr = DateTimeFormatUtil.LuisDate(startDate); + var endLuisStr = DateTimeFormatUtil.LuisDate(endDate); + var durationTimex = ((DateTimeResolutionResult)duration.Value).Timex; + + ret.Timex = $"({startLuisStr},{endLuisStr},{durationTimex})"; + ret.FutureValue = new Tuple(startDate, endDate); + ret.PastValue = new Tuple(startDate, endDate); + ret.SubDateTimeEntities = new List { pr, duration }; + ret.Success = true; + } + } + } + } + + return ret; + } + private DateTimeResolutionResult ParseSingleTimePoint(string text, DateObject referenceDate, DateContext dateContext = null) { var ret = new DateTimeResolutionResult(); diff --git a/.NET/Microsoft.Recognizers.Text.DateTime/Parsers/BaseDateTimePeriodParser.cs b/.NET/Microsoft.Recognizers.Text.DateTime/Parsers/BaseDateTimePeriodParser.cs index 35dda0806f..fcad359082 100644 --- a/.NET/Microsoft.Recognizers.Text.DateTime/Parsers/BaseDateTimePeriodParser.cs +++ b/.NET/Microsoft.Recognizers.Text.DateTime/Parsers/BaseDateTimePeriodParser.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Reflection; using System.Text.RegularExpressions; +using Microsoft.Recognizers.Text.DateTime.English; using Microsoft.Recognizers.Text.Utilities; using DateObject = System.DateTime; @@ -170,6 +171,12 @@ protected DateTimeResolutionResult InternalParse(string entityText, DateObject r innerResult = ParseDateWithTimePeriodSuffix(entityText, referenceTime); } + if (!innerResult.Success) + { + // Parsing cases like [duration] starting [datetime] + innerResult = ParseStartingWithDuration(entityText, referenceTime); + } + if (!innerResult.Success) { innerResult = ParseDuration(entityText, referenceTime); @@ -1378,6 +1385,51 @@ private DateTimeResolutionResult ParseDuration(string text, DateObject reference return ret; } + private DateTimeResolutionResult ParseStartingWithDuration(string text, DateObject referenceTime) + { + var ret = new DateTimeResolutionResult(); + var datetimeERs = Config.DateTimeExtractor.Extract(text, referenceTime); + var enConfig = Config as EnglishDateTimePeriodParserConfiguration; + + if (enConfig != null && enConfig.StartingRegex.Match(text).Success && datetimeERs.Count == 1) + { + var beforeString = text.Substring(0, (int)datetimeERs[0].Start); + + if (!string.IsNullOrEmpty(beforeString) && enConfig.StartingRegex.MatchEnd(beforeString, true).Success) + { + var pr = Config.DateTimeParser.Parse(datetimeERs[0], referenceTime); + var durationERs = Config.DurationExtractor.Extract(beforeString, referenceTime); + + if (durationERs.Count == 1) + { + var duration = Config.DurationParser.Parse(durationERs[0]); + var durationInSeconds = (double)((DateTimeResolutionResult)duration.Value).PastValue; + + DateObject startDate; + DateObject endDate; + + startDate = (DateObject)((DateTimeResolutionResult)pr.Value).PastValue; + endDate = startDate.AddSeconds(durationInSeconds); + + if (startDate != DateObject.MinValue) + { + var startLuisStr = $"{DateTimeFormatUtil.LuisDate(startDate)}{DateTimeFormatUtil.ShortTime(startDate.Hour, startDate.Minute, startDate.Second)}"; + var endLuisStr = $"{DateTimeFormatUtil.LuisDate(endDate)}{DateTimeFormatUtil.ShortTime(endDate.Hour, endDate.Minute, endDate.Second)}"; + var durationTimex = ((DateTimeResolutionResult)duration.Value).Timex; + + ret.Timex = $"({startLuisStr},{endLuisStr},{durationTimex})"; + ret.FutureValue = new Tuple(startDate, endDate); + ret.PastValue = new Tuple(startDate, endDate); + ret.SubDateTimeEntities = new List { pr, duration }; + ret.Success = true; + } + } + } + } + + return ret; + } + // Parse "last minute", "next hour" private DateTimeResolutionResult ParseRelativeUnit(string text, DateObject referenceTime) { diff --git a/Patterns/English/English-DateTime.yaml b/Patterns/English/English-DateTime.yaml index 60f80caecc..a77958d16d 100644 --- a/Patterns/English/English-DateTime.yaml +++ b/Patterns/English/English-DateTime.yaml @@ -613,6 +613,8 @@ BeforeRegex: !nestedRegex AfterRegex: !nestedRegex def: ((\b{InclusiveModPrepositions}?((after(\s+on)?(?!\sfrom)|(?>\s*=)|>))(\s+the)? references: [ InclusiveModPrepositions ] +StartingRegex: !simpleRegex + def: (starting|beginning)(\s+)?(?:from|on|with)? SinceRegex: !simpleRegex def: (?:(?:\b(?:since|after\s+or\s+equal\s+to|(starting|beginning)(\s)?(?:from|on|with)?|as\s+early\s+as|(any\s+time\s+)from)\b\s*?)|(?=))(\s+the)? SinceRegexExp: !nestedRegex diff --git a/Specs/DateTime/English/DatePeriodExtractor.json b/Specs/DateTime/English/DatePeriodExtractor.json index c76b0261cd..ac905d6a65 100644 --- a/Specs/DateTime/English/DatePeriodExtractor.json +++ b/Specs/DateTime/English/DatePeriodExtractor.json @@ -3897,6 +3897,42 @@ } ] }, + { + "Input": "Schedule Out of office replies for 3 days starting from next Monday", + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "3 days starting from next Monday", + "Type": "daterange", + "Start": 35, + "Length": 32 + } + ] + }, + { + "Input": "set ooo for a week starting tomorrow", + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "a week starting tomorrow", + "Type": "daterange", + "Start": 12, + "Length": 24 + } + ] + }, + { + "Input": "set ooo for 2 weeks starting May 20th", + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "2 weeks starting may 20th", + "Type": "daterange", + "Start": 12, + "Length": 25 + } + ] + }, { "Input": "please schedule a meeting for the week starting on february 4", "Results": [ diff --git a/Specs/DateTime/English/DatePeriodParser.json b/Specs/DateTime/English/DatePeriodParser.json index 4be33a8551..bb4570db4d 100644 --- a/Specs/DateTime/English/DatePeriodParser.json +++ b/Specs/DateTime/English/DatePeriodParser.json @@ -6002,6 +6002,7 @@ }, { "Input": "please schedule a meeting for the week starting february 4", + "Debug": true, "Context": { "ReferenceDateTime": "2019-11-07T00:00:00" }, @@ -6025,6 +6026,85 @@ } ] }, + { + "Input": "Schedule Out of office replies for 3 days starting from next Monday", + "Context": { + "ReferenceDateTime": "2024-11-07T00:00:00" + }, + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "3 days starting from next monday", + "Type": "daterange", + "Value": { + "Timex": "(2024-11-11,2024-11-14,P3D)", + "FutureResolution": { + "startDate": "2024-11-11", + "endDate": "2024-11-14" + }, + "PastResolution": { + "startDate": "2024-11-11", + "endDate": "2024-11-14" + } + }, + "Start": 35, + "Length": 32 + } + ] + }, + { + "Input": "set ooo for a week starting tomorrow", + "Context": { + "ReferenceDateTime": "2024-11-07T00:00:00" + }, + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "a week starting tomorrow", + "Type": "daterange", + "Value": { + "Timex": "(2024-11-08,2024-11-15,P1W)", + "FutureResolution": { + "startDate": "2024-11-08", + "endDate": "2024-11-15" + }, + "PastResolution": { + "startDate": "2024-11-08", + "endDate": "2024-11-15" + } + }, + "Start": 12, + "Length": 24 + } + ] + }, + { + "Input": "set ooo for 2 weeks starting May 20th", + "Context": { + "ReferenceDateTime": "2024-11-07T00:00:00" + }, + "NotSupported": "javascript, python, java", + "Results": [ + { + "Text": "2 weeks starting may 20th", + "Type": "daterange", + "Value": { + "Timex": "(2024-05-20,2024-06-03,P2W)", + "FutureResolution": { + "startDate": "2024-05-20", + "endDate": "2024-06-03" + }, + "PastResolution": { + "startDate": "2024-05-20", + "endDate": "2024-06-03" + } + }, + "Start": 12, + "Length": 25 + } + ] + }, + { "Input": "please schedule a meeting for the week starting on february 4", "Context": { diff --git a/Specs/DateTime/English/DateTimeModel.json b/Specs/DateTime/English/DateTimeModel.json index aec4bdbf18..b06040324e 100644 --- a/Specs/DateTime/English/DateTimeModel.json +++ b/Specs/DateTime/English/DateTimeModel.json @@ -15353,6 +15353,106 @@ } ] }, + { + "Input": "Set out of office response for a day starting this Friday at 5 pm", + "Context": { + "ReferenceDateTime": "2019-10-07T00:00:00" + }, + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "a day starting this friday at 5 pm", + "Start": 31, + "End": 64, + "TypeName": "datetimeV2.datetimerange", + "Resolution": { + "values": [ + { + "timex": "(2019-10-11T17:00:00,2019-10-12T17:00:00,P1D)", + "type": "datetimerange", + "start": "2019-10-11 17:00:00", + "end": "2019-10-12 17:00:00" + } + ] + } + } + ] + }, + { + "Input": "Schedule Out of office replies for 3 days starting from next Monday", + "Context": { + "ReferenceDateTime": "2019-10-07T00:00:00" + }, + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "3 days starting from next monday", + "Start": 35, + "End": 66, + "TypeName": "datetimeV2.daterange", + "Resolution": { + "values": [ + { + "timex": "(2019-10-14,2019-10-17,P3D)", + "type": "daterange", + "start": "2019-10-14", + "end": "2019-10-17" + } + ] + } + } + ] + }, + { + "Input": "set ooo for a week starting tomorrow", + "Context": { + "ReferenceDateTime": "2019-10-07T00:00:00" + }, + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "a week starting tomorrow", + "Start": 12, + "End": 35, + "TypeName": "datetimeV2.daterange", + "Resolution": { + "values": [ + { + "timex": "(2019-10-08,2019-10-15,P1W)", + "type": "daterange", + "start": "2019-10-08", + "end": "2019-10-15" + } + ] + } + } + ] + }, + { + "Input": "set ooo for 2 weeks starting May 20th", + "Context": { + "ReferenceDateTime": "2019-10-07T00:00:00" + }, + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "2 weeks starting may 20th", + "Start": 12, + "End": 36, + "TypeName": "datetimeV2.daterange", + "Resolution": { + "values": [ + { + "timex": "(2019-05-20,2019-06-03,P2W)", + "type": "daterange", + "start": "2019-05-20", + "end": "2019-06-03" + } + ] + } + } + ] + }, { "Input": "please schedule a meeting for the week commencing February 4", "Context": { diff --git a/Specs/DateTime/English/DateTimePeriodExtractor.json b/Specs/DateTime/English/DateTimePeriodExtractor.json index 0590d471f5..5a65031ba9 100644 --- a/Specs/DateTime/English/DateTimePeriodExtractor.json +++ b/Specs/DateTime/English/DateTimePeriodExtractor.json @@ -32,6 +32,18 @@ } ] }, + { + "Input": "Set out of office response for a day starting this Friday at 5 pm", + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "a day starting this friday at 5 pm", + "Type": "datetimerange", + "Start": 31, + "Length": 34 + } + ] + }, { "Input": "I'll be out from 5 to 6pm next sunday", "Results": [ diff --git a/Specs/DateTime/English/DateTimePeriodParser.json b/Specs/DateTime/English/DateTimePeriodParser.json index 620d5c4dde..402c004519 100644 --- a/Specs/DateTime/English/DateTimePeriodParser.json +++ b/Specs/DateTime/English/DateTimePeriodParser.json @@ -74,6 +74,32 @@ } ] }, + { + "Input": "Set out of office response for a day starting this Friday at 5 pm", + "Context": { + "ReferenceDateTime": "2024-11-06T16:12:00" + }, + "NotSupported": "java, javascript, python", + "Results": [ + { + "Text": "a day starting this friday at 5 pm", + "Type": "datetimerange", + "Value": { + "Timex": "(2024-11-08T17:00:00,2024-11-09T17:00:00,P1D)", + "FutureResolution": { + "startDateTime": "2024-11-08 17:00:00", + "endDateTime": "2024-11-09 17:00:00" + }, + "PastResolution": { + "startDateTime": "2024-11-08 17:00:00", + "endDateTime": "2024-11-09 17:00:00" + } + }, + "Start": 31, + "Length": 34 + } + ] + }, { "Input": "I'll be out from 5 to 6pm of April 22", "Context": {