[][src]Crate basic_tree

basic_tree

basic_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 = basic_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 = basic_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.

Modules

trie

trie mod to implement the basic_tree