public override bool IsMatch(Concept concept)
        {
            // Is this a time?  If so, we can work with it!
            if (concept.IsSpecial && (concept == memory.past || concept == memory.now || concept == memory.future))
            {
                return(true);
            }

            List <string> parts = StringUtilities.SplitWords(concept.Name, true);

            foreach (string part in parts)
            {
                if (!(part == "en" || part == "ing" || Verbs.IsModal(part) || Verbs.IsToBe(part) || Verbs.IsToDo(part) || Verbs.IsToHave(part)))
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #2
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));
        }