-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EN DateTimeV2] Avoid some wrong recognize, like "3 this" (#1790)
- Loading branch information
1 parent
246cd02
commit 79c92e9
Showing
17 changed files
with
295 additions
and
60 deletions.
There are no files selected for viewing
112 changes: 57 additions & 55 deletions
112
...soft.Recognizers.Text.DateTime/Dutch/Extractors/DutchDateTimeAltExtractorConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,68 @@ | ||
using System.Collections.Generic; | ||
using System.Text.RegularExpressions; | ||
using Microsoft.Recognizers.Definitions.Dutch; | ||
|
||
namespace Microsoft.Recognizers.Text.DateTime.Dutch | ||
{ | ||
public class DutchDateTimeAltExtractorConfiguration : BaseDateTimeOptionsConfiguration, IDateTimeAltExtractorConfiguration | ||
{ | ||
public static readonly Regex ThisPrefixRegex = | ||
new Regex(DateTimeDefinitions.ThisPrefixRegex, RegexFlags); | ||
|
||
public static readonly Regex PreviousPrefixRegex = | ||
new Regex(DateTimeDefinitions.PreviousPrefixRegex, RegexFlags); | ||
|
||
public static readonly Regex NextPrefixRegex = | ||
new Regex(DateTimeDefinitions.NextPrefixRegex, RegexFlags); | ||
|
||
public static readonly Regex AmRegex = | ||
new Regex(DateTimeDefinitions.AmRegex, RegexFlags); | ||
|
||
public static readonly Regex PmRegex = | ||
new Regex(DateTimeDefinitions.PmRegex, RegexFlags); | ||
|
||
public static readonly Regex RangePrefixRegex = | ||
new Regex(DateTimeDefinitions.RangePrefixRegex, RegexFlags); | ||
|
||
public static readonly Regex[] RelativePrefixList = | ||
{ | ||
ThisPrefixRegex, PreviousPrefixRegex, NextPrefixRegex, | ||
}; | ||
|
||
public static readonly Regex[] AmPmRegexList = | ||
{ | ||
AmRegex, PmRegex, | ||
}; | ||
|
||
using System.Collections.Generic; | ||
using System.Text.RegularExpressions; | ||
using Microsoft.Recognizers.Definitions.Dutch; | ||
|
||
namespace Microsoft.Recognizers.Text.DateTime.Dutch | ||
{ | ||
public class DutchDateTimeAltExtractorConfiguration : BaseDateTimeOptionsConfiguration, IDateTimeAltExtractorConfiguration | ||
{ | ||
public static readonly Regex ThisPrefixRegex = | ||
new Regex(DateTimeDefinitions.ThisPrefixRegex, RegexFlags); | ||
|
||
public static readonly Regex PreviousPrefixRegex = | ||
new Regex(DateTimeDefinitions.PreviousPrefixRegex, RegexFlags); | ||
|
||
public static readonly Regex NextPrefixRegex = | ||
new Regex(DateTimeDefinitions.NextPrefixRegex, RegexFlags); | ||
|
||
public static readonly Regex AmRegex = | ||
new Regex(DateTimeDefinitions.AmRegex, RegexFlags); | ||
|
||
public static readonly Regex PmRegex = | ||
new Regex(DateTimeDefinitions.PmRegex, RegexFlags); | ||
|
||
public static readonly Regex RangePrefixRegex = | ||
new Regex(DateTimeDefinitions.RangePrefixRegex, RegexFlags); | ||
|
||
public static readonly Regex[] RelativePrefixList = | ||
{ | ||
ThisPrefixRegex, PreviousPrefixRegex, NextPrefixRegex, | ||
}; | ||
|
||
public static readonly Regex[] AmPmRegexList = | ||
{ | ||
AmRegex, PmRegex, | ||
}; | ||
|
||
private const RegexOptions RegexFlags = RegexOptions.Singleline | RegexOptions.ExplicitCapture; | ||
|
||
private static readonly Regex OrRegex = | ||
new Regex(DateTimeDefinitions.OrRegex, RegexFlags); | ||
|
||
private static readonly Regex DayRegex = | ||
new Regex(DateTimeDefinitions.OrRegex, RegexFlags); | ||
|
||
private static readonly Regex DayRegex = | ||
new Regex(DateTimeDefinitions.DayRegex, RegexFlags); | ||
|
||
public DutchDateTimeAltExtractorConfiguration(IDateTimeOptionsConfiguration config) | ||
: base(config) | ||
{ | ||
DateExtractor = new BaseDateExtractor(new DutchDateExtractorConfiguration(this)); | ||
DatePeriodExtractor = new BaseDatePeriodExtractor(new DutchDatePeriodExtractorConfiguration(this)); | ||
: base(config) | ||
{ | ||
DateExtractor = new BaseDateExtractor(new DutchDateExtractorConfiguration(this)); | ||
DatePeriodExtractor = new BaseDatePeriodExtractor(new DutchDatePeriodExtractorConfiguration(this)); | ||
} | ||
|
||
public IDateExtractor DateExtractor { get; } | ||
|
||
public IDateTimeExtractor DatePeriodExtractor { get; } | ||
|
||
IEnumerable<Regex> IDateTimeAltExtractorConfiguration.RelativePrefixList => RelativePrefixList; | ||
|
||
IEnumerable<Regex> IDateTimeAltExtractorConfiguration.AmPmRegexList => AmPmRegexList; | ||
|
||
Regex IDateTimeAltExtractorConfiguration.OrRegex => OrRegex; | ||
|
||
Regex IDateTimeAltExtractorConfiguration.DayRegex => DayRegex; | ||
|
||
Regex IDateTimeAltExtractorConfiguration.RangePrefixRegex => RangePrefixRegex; | ||
} | ||
public IDateTimeExtractor DatePeriodExtractor { get; } | ||
|
||
IEnumerable<Regex> IDateTimeAltExtractorConfiguration.RelativePrefixList => RelativePrefixList; | ||
|
||
IEnumerable<Regex> IDateTimeAltExtractorConfiguration.AmPmRegexList => AmPmRegexList; | ||
|
||
Regex IDateTimeAltExtractorConfiguration.OrRegex => OrRegex; | ||
|
||
Regex IDateTimeAltExtractorConfiguration.ThisPrefixRegex => ThisPrefixRegex; | ||
|
||
Regex IDateTimeAltExtractorConfiguration.DayRegex => DayRegex; | ||
|
||
Regex IDateTimeAltExtractorConfiguration.RangePrefixRegex => RangePrefixRegex; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.