Search in sources :

Example 1 with SuffixTrieTailBuilder

use of org.trie4j.tail.builder.SuffixTrieTailBuilder in project trie4j by takawitter.

the class TailPatriciaTrieWithSuffixTrieTailBuilderTest method investigate.

public void investigate() throws Exception {
    Trie t = new TailPatriciaTrie(new SuffixTrieTailBuilder());
    int start = 0;
    int end = 5;
    int i = 0;
    for (String word : new WikipediaTitles()) {
        if (i >= end)
            break;
        if (i >= start) {
            t.insert(word);
            System.out.println(word);
        }
        i++;
    }
    i = 0;
    for (String word : new WikipediaTitles()) {
        if (i >= end)
            break;
        if (i >= start)
            Assert.assertTrue(i + "th word: " + word, t.contains(word));
        i++;
    }
}
Also used : WikipediaTitles(org.trie4j.test.WikipediaTitles) Trie(org.trie4j.Trie) SuffixTrieTailBuilder(org.trie4j.tail.builder.SuffixTrieTailBuilder)

Aggregations

Trie (org.trie4j.Trie)1 SuffixTrieTailBuilder (org.trie4j.tail.builder.SuffixTrieTailBuilder)1 WikipediaTitles (org.trie4j.test.WikipediaTitles)1