Package joshua.prefix_tree

Examples of joshua.prefix_tree.Node


    Assert.assertTrue(simplePrefixTree.root.children.containsKey(sourceVocab.getID("it")));
    Assert.assertTrue(simplePrefixTree.root.children.containsKey(sourceVocab.getID("makes")));
    Assert.assertTrue(simplePrefixTree.root.children.containsKey(sourceVocab.getID("him")));
    Assert.assertTrue(simplePrefixTree.root.children.containsKey(PrefixTree.X));
   
    Node root_it = simplePrefixTree.root.children.get(sourceVocab.getID("it"));
    Node root_makes = simplePrefixTree.root.children.get(sourceVocab.getID("makes"));
    Node root_him = simplePrefixTree.root.children.get(sourceVocab.getID("him"));
    Node root_X = simplePrefixTree.root.children.get(PrefixTree.X);
   
    Assert.assertNotNull(root_it);
    Assert.assertNotNull(root_makes);
    Assert.assertNotNull(root_him);
    Assert.assertNotNull(root_X);
   
    /////////////////////////////
   
    Assert.assertEquals(root_it.children.size(), 2);
   
    Assert.assertTrue(root_it.children.containsKey(sourceVocab.getID("makes")));
    Assert.assertTrue(root_it.children.containsKey(PrefixTree.X));
   
    Node root_it_makes = root_it.children.get(sourceVocab.getID("makes"));
    Node root_it_X = root_it.children.get(PrefixTree.X);
       
    Assert.assertNotNull(root_it_makes);
    Assert.assertNotNull(root_it_X);

    /////////////////////////////
   
    Assert.assertEquals(root_makes.children.size(), 2);
   
    Assert.assertTrue(root_makes.children.containsKey(sourceVocab.getID("him")));
    Assert.assertTrue(root_makes.children.containsKey(PrefixTree.X));
   
    Node root_makes_him = root_makes.children.get(sourceVocab.getID("him"));
    Node root_makes_X = root_makes.children.get(PrefixTree.X);
       
    Assert.assertNotNull(root_makes_him);
    Assert.assertNotNull(root_makes_X);
   
    /////////////////////////////
   
    Assert.assertEquals(root_X.children.size(), 2);

    Assert.assertTrue(root_X.children.containsKey(sourceVocab.getID("makes")));
    Assert.assertTrue(root_X.children.containsKey(sourceVocab.getID("him")));
   
    Node root_X_makes = root_X.children.get(sourceVocab.getID("makes"));
    Node root_X_him = root_X.children.get(sourceVocab.getID("him"));
       
    Assert.assertNotNull(root_X_makes);
    Assert.assertNotNull(root_X_him);
   
    /////////////////////////////
   
    Assert.assertEquals(root_him.children.size(), 0);
       
    /////////////////////////////
    // Level 3 in the tree
    /////////////////////////////   
   
    Assert.assertEquals(root_it_makes.children.size(), 2);
   
    Assert.assertTrue(root_it_makes.children.containsKey(sourceVocab.getID("him")));
    Assert.assertTrue(root_it_makes.children.containsKey(PrefixTree.X));
   
    Node root_it_makes_him = root_it_makes.children.get(sourceVocab.getID("him"));
    Node root_it_makes_X = root_it_makes.children.get(PrefixTree.X);
       
    Assert.assertNotNull(root_it_makes_him);
    Assert.assertNotNull(root_it_makes_X);

    /////////////////////////////
   
    Assert.assertEquals(root_it_X.children.size(), 1);
   
    Assert.assertTrue(root_it_X.children.containsKey(sourceVocab.getID("him")));
   
    Node root_it_X_him = root_it_X.children.get(sourceVocab.getID("him"));
       
    Assert.assertNotNull(root_it_X_him);

    /////////////////////////////
   
    Assert.assertEquals(root_makes_him.children.size(), 0);
   
    /////////////////////////////
   
    Assert.assertEquals(root_makes_X.children.size(), 0);
   
    /////////////////////////////
   
    Assert.assertEquals(root_X_him.children.size(), 0);
   
    /////////////////////////////
   
    Assert.assertEquals(root_X_makes.children.size(), 2);
   
    Assert.assertTrue(root_X_makes.children.containsKey(sourceVocab.getID("him")));
    Assert.assertTrue(root_X_makes.children.containsKey(PrefixTree.X));
   
    Node root_X_makes_him = root_makes.children.get(sourceVocab.getID("him"));
    Node root_X_makes_X = root_makes.children.get(PrefixTree.X);
       
    Assert.assertNotNull(root_X_makes_him);
    Assert.assertNotNull(root_X_makes_X);
   
    /////////////////////////////
View Full Code Here


    Assert.assertTrue(prefixTree.root.children.containsKey(sourceVocab.getID("takes")));
    Assert.assertTrue(prefixTree.root.children.containsKey(sourceVocab.getID("off")));
    Assert.assertTrue(prefixTree.root.children.containsKey(sourceVocab.getID(".")));
    Assert.assertTrue(prefixTree.root.children.containsKey(PrefixTree.X));
   
    Node root_it = prefixTree.root.children.get(sourceVocab.getID("it"));
    Node root_makes = prefixTree.root.children.get(sourceVocab.getID("makes"));
    Node root_him = prefixTree.root.children.get(sourceVocab.getID("him"));
    Node root_and = prefixTree.root.children.get(sourceVocab.getID("and"));
    Node root_mars = prefixTree.root.children.get(sourceVocab.getID("mars"));
    Node root_comma = prefixTree.root.children.get(sourceVocab.getID(","));
    Node root_sets = prefixTree.root.children.get(sourceVocab.getID("sets"));
    Node root_on = prefixTree.root.children.get(sourceVocab.getID("on"));
    Node root_takes = prefixTree.root.children.get(sourceVocab.getID("takes"));
    Node root_off = prefixTree.root.children.get(sourceVocab.getID("off"));
    Node root_period = prefixTree.root.children.get(sourceVocab.getID("."));
    Node root_X = prefixTree.root.children.get(PrefixTree.X);
   
    Assert.assertNotNull(root_it);
    Assert.assertNotNull(root_makes);
    Assert.assertNotNull(root_him);
    Assert.assertNotNull(root_and);
    Assert.assertNotNull(root_mars);
    Assert.assertNotNull(root_comma);
    Assert.assertNotNull(root_sets);
    Assert.assertNotNull(root_on);
    Assert.assertNotNull(root_takes);
    Assert.assertNotNull(root_off);
    Assert.assertNotNull(root_period);
    Assert.assertNotNull(root_X);
   
    /////////////////////////////
   
    Assert.assertEquals(root_it.children.size(), 5);
   
    Assert.assertTrue(root_it.children.containsKey(sourceVocab.getID("makes")));
    Assert.assertTrue(root_it.children.containsKey(PrefixTree.X));
   
    Node root_it_makes = root_it.children.get(sourceVocab.getID("makes"));
    Node root_it_mars = root_it.children.get(sourceVocab.getID("mars"));
    Node root_it_sets = root_it.children.get(sourceVocab.getID("sets"));
    Node root_it_takes = root_it.children.get(sourceVocab.getID("takes"));
    Node root_it_X = root_it.children.get(PrefixTree.X);
       
    Assert.assertNotNull(root_it_makes);
    Assert.assertNotNull(root_it_mars);
    Assert.assertNotNull(root_it_sets);
    Assert.assertNotNull(root_it_takes);
    Assert.assertNotNull(root_it_X);

    /////////////////////////////
   
    Assert.assertEquals(root_makes.children.size(), 2);
   
    Assert.assertTrue(root_makes.children.containsKey(sourceVocab.getID("him")));
    Assert.assertTrue(root_makes.children.containsKey(PrefixTree.X));
   
    Node root_makes_him = root_makes.children.get(sourceVocab.getID("him"));
    Node root_makes_X = root_makes.children.get(PrefixTree.X);
       
    Assert.assertNotNull(root_makes_him);
    Assert.assertNotNull(root_makes_X);
   
    /////////////////////////////
   
    Assert.assertEquals(root_X.children.size(), 11);

    Assert.assertTrue(root_X.children.containsKey(sourceVocab.getID("it")));
    Assert.assertTrue(root_X.children.containsKey(sourceVocab.getID("makes")));
    Assert.assertTrue(root_X.children.containsKey(sourceVocab.getID("him")));
    Assert.assertTrue(root_X.children.containsKey(sourceVocab.getID("and")));
    Assert.assertTrue(root_X.children.containsKey(sourceVocab.getID("mars")));
    Assert.assertTrue(root_X.children.containsKey(sourceVocab.getID(",")));
    Assert.assertTrue(root_X.children.containsKey(sourceVocab.getID("sets")));
    Assert.assertTrue(root_X.children.containsKey(sourceVocab.getID("on")));
    Assert.assertTrue(root_X.children.containsKey(sourceVocab.getID("takes")));
    Assert.assertTrue(root_X.children.containsKey(sourceVocab.getID("off")));
    Assert.assertTrue(root_X.children.containsKey(sourceVocab.getID(".")));
   
    Node root_X_it = root_X.children.get(sourceVocab.getID("it"));
    Node root_X_makes = root_X.children.get(sourceVocab.getID("makes"));
    Node root_X_him = root_X.children.get(sourceVocab.getID("him"));
    Node root_X_and = root_X.children.get(sourceVocab.getID("and"));
    Node root_X_mars = root_X.children.get(sourceVocab.getID("mars"));
    Node root_X_comma = root_X.children.get(sourceVocab.getID(","));
    Node root_X_sets = root_X.children.get(sourceVocab.getID("sets"));
    Node root_X_on = root_X.children.get(sourceVocab.getID("on"));
    Node root_X_takes = root_X.children.get(sourceVocab.getID("takes"));
    Node root_X_off = root_X.children.get(sourceVocab.getID("off"));
    Node root_X_period = root_X.children.get(sourceVocab.getID("."));
   
    Assert.assertNotNull(root_X_it);   
    Assert.assertNotNull(root_X_makes);
    Assert.assertNotNull(root_X_him);
    Assert.assertNotNull(root_X_and);
View Full Code Here

TOP

Related Classes of joshua.prefix_tree.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.