예제 #1
0
        public bool addPhraseAndDeleteExistingPhrases(Phrase phrase)
        {
            //	Get the node where the phrase belongs
            bool created;

            Trie <ProseObject, List <Phrase> > .Node phraseNode = patternTrie.getOrCreateNodeAtObjectPath(phrase.getPattern(), out created);

            //	Make this phrase the only one at the node.
            phraseNode.setValue(new List <Phrase>(1));
            phraseNode.Value.Add(phrase);
            return(created);
        }
예제 #2
0
        public bool addPhrase(Phrase phrase)
        {
            //	Get the node where the phrase belongs
            bool created;

            Trie <ProseObject, List <Phrase> > .Node phraseNode = patternTrie.getOrCreateNodeAtObjectPath(phrase.getPattern(), out created);

            //	Add the phrase to the node
            if (phraseNode.Value == null)                                               //	If we have to make a place in the node to put our phrase...
            {
                phraseNode.setValue(new List <Phrase>());
            }
            phraseNode.Value.Add(phrase);
            return(created);
        }