Example #1
0
        public override bool?IsMatch(IParsedPhrase check)
        {
            string verb;

            if (check.IsLeaf || !check.Text.Contains(" "))
            {
                verb = check.Text;

                if (Verbs.IsToHave(verb))
                {
                    if (bases.Contains("have"))
                    {
                        return(true);
                    }
                    else
                    {
                        return(null);
                    }
                }
                if (Verbs.IsToBe(verb))
                {
                    if (bases.Contains("be"))
                    {
                        return(true);
                    }
                    else
                    {
                        return(null);
                    }
                }
                if (Verbs.IsToDo(verb))
                {
                    if (bases.Contains("do"))
                    {
                        return(true);
                    }
                    else
                    {
                        return(null);
                    }
                }
                if (verb == "will" || verb == "shall")
                {
                    return(null);                    // not sure yet
                }
            }
            else
            {
                GroupPhrase groupPhrase = new GroupPhrase(check);
                if (groupPhrase.Count > 2)
                {
                    return(false);
                }

                string helper = groupPhrase.GetBranch(0).Text.ToLower();
                verb = groupPhrase.GetBranch(1).Text.ToLower();

                if (!Verbs.IsToHave(helper) && !Verbs.IsToBe(helper) && !Verbs.IsToDo(helper) &&
                    helper != "will" && helper != "shall")
                {
                    return(false);
                }
            }

            string baseverb = verbs.InputToBase(verb);

            return(comparer.MatchAny(verb, options) || comparer.MatchAny(verb, bases) ||
                   comparer.MatchAny(baseverb, bases));
        }
Example #2
0
 public override bool IsMatch(IParsedPhrase check)
 {
     return(comparer.MatchAny(check.Text, options));
 }