Exemple #1
0
        public static void Main(string [] args)
        {
            string src = "bazar this is some foo, bar, and baz bazbarfoofoo bazbazarbaz end bazar";

            Logger.Log("Searching in '{0}':", src);

            TrieTree trie = new TrieTree(false);

            trie.AddKeyword("foo", "foo");
            trie.AddKeyword("bar", "bar");
            trie.AddKeyword("baz", "baz");
            trie.AddKeyword("bazar", "bazar");

            Logger.Log("Starting search...");
            foreach (TrieHit hit in trie.FindMatches(src))
            {
                Logger.Log("*** Match: '{0}' at {1}-{2}",
                           hit.Key,
                           hit.Start,
                           hit.End);
            }
            Logger.Log("Search finished!");
        }