#trie #tree #basic #node #word #seq #traits

trie_tree

basic trie tree for rust

4 releases

0.1.3 Oct 22, 2019
0.1.2 Jul 9, 2019
0.1.1 Jul 9, 2019
0.1.0 Jul 9, 2019

#11 in #seq

MIT license

785KB
364 lines

Contains (WOFF font, 190KB) doc/FiraSans-Medium.woff, (WOFF font, 185KB) doc/FiraSans-Regular.woff, (WOFF font, 94KB) doc/SourceSerifPro-Bold.ttf.woff, (WOFF font, 89KB) doc/SourceSerifPro-Regular.ttf.woff, (WOFF font, 56KB) doc/SourceCodePro-Regular.woff, (WOFF font, 56KB) doc/SourceCodePro-Semibold.woff and 1 more.

trie_tree

trie_tree is the trie lib for rust , which utilizes Rc and Refcell to implemented

Examples

Word Trie

used for constructing word level trie

let word_trie = trie_tree::trie::word::WordTrie::new();
let seq = "你在干什么";
let seq1 = "你在找什么";
word_trie.insert_words(seq, "没干嘛");
word_trie.insert_words(seq1, "是吗");
println!("{:?}", word_trie);

Node Trie

used for constructing char level trie

let node = trie_tree::trie::basic::Node::new();
let seq = vec!["".to_string(), "".to_string(), "".to_string()];
let seq1 = vec!["".to_string(), "".to_string()];
Node::insert_seq(node.clone(), &seq, Leaf::End("intention".to_string()));
let leaf = Node::get_leaf(node.clone(), &seq1);
assert_ne!(leaf, Leaf::End("intention".to_string()));

Trie trait

the basic trie trait. you can implement your own trie structure based on this trait.

No runtime deps