Skip to content

lkk214/DoubleArrayTrie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Double Array Trie

An efficient implementation of Double Array Trie data structure in Java.

Installation

Maven

<dependency>
    <groupId>io.github.lkk214</groupId>
    <artifactId>double-array-trie</artifactId>
    <version>1.1.1</version>
</dependency>

Gradle

implementation 'io.github.lkk214:double-array-trie:1.1.1'

Usage

// Build a trie
TreeMap<String, String> map = new TreeMap<>();
map.put("apple", "fruit");
map.put("banana", "fruit");
map.put("carrot", "vegetable");

DoubleArrayTrie<String> trie = DoubleArrayTrie.builder().build(map);

// Analyze text - find all matches
trie.analyze("I like apple and banana", (begin, end, value) -> {
    System.out.println("Found: " + value + " at [" + begin + "," + end + ")");
});

// Analyze text - stop after first match
trie.analyze("I like apple and banana", (begin, end, value) -> {
    System.out.println("First match: " + value + " at [" + begin + "," + end + ")");
    return true; // stop early by returning true
});

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A Java implementation of Double-Array Trie structure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages