use of org.trie4j.doublearray.DoubleArray in project trie4j by takawitter.
the class Issue_031 method test_DoubleArray.
@Test
public void test_DoubleArray() throws Throwable {
Trie trie = new PatriciaTrie();
insertLines(trie, FILE_NAME);
Trie da = new DoubleArray(trie);
Assert.assertFalse(trie.contains("you"));
Assert.assertFalse(da.contains("you"));
}
use of org.trie4j.doublearray.DoubleArray in project trie4j by takawitter.
the class MapTailLOUDSTrieWithConcatTailArrayTest method investigate2.
public void investigate2() throws Exception {
String[] words = { "!SHOUT!", "!_-attention-", "!wagero!", "![ai-ou]", "\"74ers\"_LIVE_IN_OSAKA-JO_HALL_2003" };
Integer[] values = { 1, 3, 2, 6, 100 };
MapTailLOUDSTrie<Integer> trie = trieWithWordsAndValues(words, values);
DoubleArray da = (DoubleArray) trie.getTrie();
int n = words.length;
BytesRank1OnlySuccinctBitVector bv = (BytesRank1OnlySuccinctBitVector) da.getTerm();
System.out.println(bv.rank1(67));
for (int i = 0; i < n; i++) {
String s = words[i];
System.out.println(String.format("%s, nid: %d, tid: %d, ev: %d, av: %d", s, da.getNodeId(s), da.getTermId(s), values[i], trie.get(s)));
Assert.assertEquals(values[i], trie.get(words[i]));
}
}
use of org.trie4j.doublearray.DoubleArray in project trie4j by takawitter.
the class MapTailLOUDSTrieWithSBVConcatTailArrayTest method investigate2.
public void investigate2() throws Exception {
String[] words = { "!SHOUT!", "!_-attention-", "!wagero!", "![ai-ou]", "\"74ers\"_LIVE_IN_OSAKA-JO_HALL_2003" };
Integer[] values = { 1, 3, 2, 6, 100 };
MapTailLOUDSTrie<Integer> trie = (MapTailLOUDSTrie<Integer>) trieWithWordsAndValues(words, values);
DoubleArray da = (DoubleArray) trie.getTrie();
int n = words.length;
BytesRank1OnlySuccinctBitVector bv = (BytesRank1OnlySuccinctBitVector) da.getTerm();
System.out.println(bv.rank1(67));
for (int i = 0; i < n; i++) {
String s = words[i];
System.out.println(String.format("%s, nid: %d, tid: %d, ev: %d, av: %d", s, da.getNodeId(s), da.getTermId(s), values[i], trie.get(s)));
Assert.assertEquals(values[i], trie.get(words[i]));
}
}
use of org.trie4j.doublearray.DoubleArray in project trie4j by takawitter.
the class MapTailLOUDSTrieWithSuffixTrieTailArrayTest method investigate2.
public void investigate2() throws Exception {
String[] words = { "!SHOUT!", "!_-attention-", "!wagero!", "![ai-ou]", "\"74ers\"_LIVE_IN_OSAKA-JO_HALL_2003" };
Integer[] values = { 1, 3, 2, 6, 100 };
MapTailLOUDSTrie<Integer> trie = (MapTailLOUDSTrie<Integer>) trieWithWordsAndValues(words, values);
DoubleArray da = (DoubleArray) trie.getTrie();
int n = words.length;
BytesRank1OnlySuccinctBitVector bv = (BytesRank1OnlySuccinctBitVector) da.getTerm();
System.out.println(bv.rank1(67));
for (int i = 0; i < n; i++) {
String s = words[i];
System.out.println(String.format("%s, nid: %d, tid: %d, ev: %d, av: %d", s, da.getNodeId(s), da.getTermId(s), values[i], trie.get(s)));
Assert.assertEquals(values[i], trie.get(words[i]));
}
}
Aggregations