public List <ExtractResult> Extract(string text, DateObject reference) { var ret = new List <ExtractResult>(); if (((this.config.Options & DateTimeOptions.FailFast) != 0) && IsFailFastCase(text)) { // @TODO needs better handling of holidays and timezones. // AddTo(ret, this.config.HolidayExtractor.Extract(text, reference), text); // ret = AddMod(ret, text); return(ret); } var originText = text; List <MatchResult <string> > superfluousWordMatches = null; if ((this.config.Options & DateTimeOptions.EnablePreview) != 0) { text = MatchingUtil.PreProcessTextRemoveSuperfluousWords( text, this.config.SuperfluousWordMatcher, out superfluousWordMatches); } // The order is important, since there can be conflicts in merging AddTo(ret, this.config.DateExtractor.Extract(text, reference), text); AddTo(ret, this.config.TimeExtractor.Extract(text, reference), text); AddTo(ret, this.config.DatePeriodExtractor.Extract(text, reference), text); AddTo(ret, this.config.DurationExtractor.Extract(text, reference), text); AddTo(ret, this.config.TimePeriodExtractor.Extract(text, reference), text); AddTo(ret, this.config.DateTimePeriodExtractor.Extract(text, reference), text); AddTo(ret, this.config.DateTimeExtractor.Extract(text, reference), text); AddTo(ret, this.config.SetExtractor.Extract(text, reference), text); AddTo(ret, this.config.HolidayExtractor.Extract(text, reference), text); if ((this.config.Options & DateTimeOptions.EnablePreview) != 0) { AddTo(ret, this.config.TimeZoneExtractor.Extract(text, reference), text); ret = this.config.TimeZoneExtractor.RemoveAmbiguousTimezone(ret); } // This should be the last extraction step, as it needs to determine if the previous text contains time or not AddTo(ret, NumberEndingRegexMatch(text, ret), text); // Modify time entity to an alternative DateTime expression if it follows a DateTime entity if ((this.config.Options & DateTimeOptions.ExtendedTypes) != 0) { ret = this.config.DateTimeAltExtractor.Extract(ret, text, reference); } ret = FilterUnspecificDatePeriod(ret); // Remove common ambiguous cases ret = FilterAmbiguity(ret, text); ret = AddMod(ret, text); // Filtering if ((this.config.Options & DateTimeOptions.CalendarMode) != 0) { ret = CheckCalendarModeFilters(ret, text); } ret = ret.OrderBy(p => p.Start).ToList(); if ((this.config.Options & DateTimeOptions.EnablePreview) != 0) { ret = MatchingUtil.PostProcessRecoverSuperfluousWords(ret, superfluousWordMatches, originText); } return(ret); }