use of org.trie4j.tail.SuffixTrieDenseTailArrayBuilder in project trie4j by takawitter.
the class TrieWriterTest method test.
@Test
public void test() throws Exception {
LapTimer lt = new LapTimer();
PatriciaTrie origTrie = new PatriciaTrie();
new WikipediaTitles().insertTo(origTrie);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
TrieWriter tw = new TrieWriter(baos);
Trie trie = new TailLOUDSTrie(origTrie, new LOUDSPPBvTree(origTrie.nodeSize()), new SuffixTrieDenseTailArrayBuilder());
lt.reset();
tw.write(trie);
tw.flush();
lt.lapMillis("trie saved.");
System.out.println(baos.size() + " bytes");
TrieReader tr = new TrieReader(new ByteArrayInputStream(baos.toByteArray()));
lt.reset();
Trie trie2 = tr.read();
lt.lapMillis("trie loaded.");
long d = new WikipediaTitles().assertAllContains(trie2);
System.out.println("[" + d + "ms]: verified");
}
use of org.trie4j.tail.SuffixTrieDenseTailArrayBuilder in project trie4j by takawitter.
the class BytesConstantTimeSelect0TailLOUDSPPTrieWithSuffixTrieDenseTailArrayWikipediaSerializeTest method secondTrie.
@Override
protected Trie secondTrie(Trie firstTrie) {
Trie t = new TailLOUDSTrie(firstTrie, new LOUDSPPBvTree(new BytesRank0OnlySuccinctBitVector(), new BytesConstantTimeSelect0SuccinctBitVector()), new SuffixTrieDenseTailArrayBuilder());
t.trimToSize();
return t;
}
use of org.trie4j.tail.SuffixTrieDenseTailArrayBuilder in project trie4j by takawitter.
the class LongsConstantTimeSelect0TailLOUDSPPTrieWithSuffixTrieDenseTailArrayWikipediaSerializeTest method secondTrie.
@Override
protected Trie secondTrie(Trie firstTrie) {
Trie t = new TailLOUDSTrie(firstTrie, new LOUDSPPBvTree(new LongsRank0OnlySuccinctBitVector(), new LongsConstantTimeSelect0SuccinctBitVector()), new SuffixTrieDenseTailArrayBuilder());
t.trimToSize();
return t;
}
use of org.trie4j.tail.SuffixTrieDenseTailArrayBuilder in project trie4j by takawitter.
the class LongsTailLOUDSPPTrieWithSuffixTrieDenseTailArrayWikipediaSerializeTest method secondTrie.
@Override
protected Trie secondTrie(Trie firstTrie) {
Trie t = new TailLOUDSTrie(firstTrie, new LOUDSPPBvTree(new LongsRank0OnlySuccinctBitVector(), new LongsSuccinctBitVector()), new SuffixTrieDenseTailArrayBuilder());
t.trimToSize();
return t;
}
Aggregations