Пример #1
0
        private static void CheckForDateOfMonth(Sentence sentence, Claim claim)
        {
            var lastX = new Regex(@"(\d\d?)\w* of (\w+)");

            if (!lastX.IsMatch(sentence.Text.Content))
            {
                return;
            }

            var match    = lastX.Match(sentence.Text.Content);
            var date     = int.Parse(match.Groups[1].Value);
            var monthStr = match.Groups[2].Value;

            int month;

            switch (monthStr.ToLower())
            {
            case "january":
            case "jan":
                month = 1;
                break;

            case "february":
            case "feb":
                month = 2;
                break;

            case "march":
            case "mar":
                month = 3;
                break;

            case "april":
            case "apr":
                month = 4;
                break;

            case "may":
                month = 5;
                break;

            case "june":
            case "jun":
                month = 6;
                break;

            case "july":
            case "jul":
                month = 7;
                break;

            case "august":
            case "aug":
                month = 8;
                break;

            case "september":
            case "sep":
                month = 9;
                break;

            case "october":
            case "oct":
                month = 10;
                break;

            case "november":
            case "nob":
                month = 11;
                break;

            case "december":
            case "dec":
                month = 12;
                break;

            default:
                return;
            }
            claim.DateOfDamage = new DateTime(DateTime.Now.Year, month, date);
        }
Пример #2
0
 private void PopulateFromSentences(AnnotateTextResponse response, Claim claim)
 {
     CheckTime(response, claim);
 }