The MultiTrie is a Trie of Tries. It stores words and their associated patch commands. The MultiTrie handles patch commands individually (each command by itself).
Inheritance: Egothor.Stemmer.Trie
示例#1
0
        public void TestMultiTrie()
        {
            Trie t = new MultiTrie(true);

            string[] keys = { "a", "ba", "bb", "c" };
            string[] vals = { "1", "2", "2", "4" };

            for (int i = 0; i < keys.Length; i++)
            {
                t.Add(keys[i], vals[i]);
            }

            AssertTrieContents(t, keys, vals);
        }
示例#2
0
        /// <summary>
        /// Remove empty rows from the given <see cref="Trie"/> and return the newly reduced <see cref="Trie"/>.
        /// </summary>
        /// <param name="by">the <see cref="Trie"/> to reduce</param>
        /// <returns>the newly reduced Trie</returns>
        public override Trie Reduce(Reduce by)
        {
            List<Trie> h = new List<Trie>();
            foreach (Trie trie in tries)
                h.Add(trie.Reduce(by));

            MultiTrie m = new MultiTrie(forward);
            m.tries = h;
            return m;
        }
示例#3
0
 internal static Trie LoadTrie(string path)
 {
     Trie trie;
     using (DataInputStream @is = new DataInputStream(
         new FileStream(path, FileMode.Open, FileAccess.Read)))
     {
         string method = @is.ReadUTF().ToUpperInvariant();
         if (method.IndexOf('M') < 0)
         {
             trie = new Trie(@is);
         }
         else
         {
             trie = new MultiTrie(@is);
         }
     }
     return trie;
 }