Ejemplo n.º 1
0
        public void RecognizeMammals(IListener st, Mammal1 mammal)
        {
            st.Say("Yes, all " + mammal.Plural.Text + " are mammals");
            string description = nlp.GetDefinition(mammal);

            if (!string.IsNullOrEmpty(description))
            {
                st.Say("Where " + mammal.Text + ": " + description);
            }
            else
            {
                st.Say("Where " + mammal.Text + " is " + mammal.Synset.Name);
            }
        }
        // By using the interface Noun.Mammal1 (instead of Noun.mammal1) this rule recognizes instances of mammals
        // instead of the word mammal, so "Tiger", "Fox" will all cause this rule to execute.

        /// <summary>
        /// Recognize a class of words instead of just a single word
        /// Note the capital on "Mammal1". This will recognize lion, tiger, elephant, ...
        /// whereas "mammal1" would recognize just the word mammal or any synonyms of it.
        /// </summary>
        public NLPActionResult RecognizeMammals(Mammal1 mammal)
        {
            intent.RecognizeMammals(st, mammal);
            return(NLPActionResult.None);
        }