public void BasicTest(string text, DateObject futureDate, DateObject pastDate)
        {
            var er = extractor.Extract(text);

            Assert.AreEqual(1, er.Count);
            var pr = parser.Parse(er[0], refrenceDay);

            Assert.AreEqual(Constants.SYS_DATETIME_DATE, pr.Type);
            Assert.AreEqual(futureDate, ((DateTimeResolutionResult)pr.Value).FutureValue);
            Assert.AreEqual(pastDate, ((DateTimeResolutionResult)pr.Value).PastValue);
        }
Exemple #2
0
        public void BasicTest(string text, int start, int length)
        {
            var results = extractor.Extract(text);

            Assert.AreEqual(1, results.Count);
            Assert.AreEqual(start, results[0].Start);
            Assert.AreEqual(length, results[0].Length);
            Assert.AreEqual(Constants.SYS_DATETIME_DATE, results[0].Type);
        }
Exemple #3
0
        public void BasicTest(string text, string timex)
        {
            var er = extractor.Extract(text);

            Assert.AreEqual(1, er.Count);
            var pr = parser.Parse(er[0], refTime);

            Assert.AreEqual(Constants.SYS_DATETIME_DATE, pr.Type);
            Assert.AreEqual(timex, ((DateTimeResolutionResult)pr.Value).Timex);
        }
        public List <ExtractResult> Extract(string text, DateObject referenceTime)
        {
            var ret = DateExtractor.Extract(text, referenceTime);

            // the order is important, since there is a problem in merging
            AddTo(ret, TimeExtractor.Extract(text, referenceTime));
            AddTo(ret, DurationExtractor.Extract(text, referenceTime));
            AddTo(ret, DatePeriodExtractor.Extract(text, referenceTime));
            AddTo(ret, DateTimeExtractor.Extract(text, referenceTime));
            AddTo(ret, TimePeriodExtractor.Extract(text, referenceTime));
            AddTo(ret, DateTimePeriodExtractor.Extract(text, referenceTime));
            AddTo(ret, SetExtractor.Extract(text, referenceTime));
            AddTo(ret, HolidayExtractor.Extract(text, referenceTime));

            CheckBlackList(ret, text);
            return(ret);
        }
        public List <ExtractResult> Extract(string text)
        {
            var ret = new List <ExtractResult>();

            // the order is important, since there is a problem in merging
            ret = _dateExtractor.Extract(text);
            AddTo(ret, _timeExtractor.Extract(text));
            AddTo(ret, _durationExtractor.Extract(text));
            AddTo(ret, _datePeriodExtractor.Extract(text));
            AddTo(ret, _dateTimeExtractor.Extract(text));
            AddTo(ret, _timePeriodExtractor.Extract(text));
            AddTo(ret, _dateTimePeriodExtractor.Extract(text));
            AddTo(ret, _setExtractor.Extract(text));
            AddTo(ret, _holidayExtractor.Extract(text));

            CheckBlackList(ret, text);
            return(ret);
        }