The Rambling Trie is a custom Ruby implementation of the trie data structure. It is designed to be fast to traverse and easy to use.
You can install the
gem like this:
gem install rambling-trie
Or add it to your
To get a new instance just type:
trie = Rambling::Trie.create # or trie = Rambling::Trie.create 'path/to/filename' # to create from words on a file
Then you can add words to it with:
trie.add_branch_from 'word' # or trie << 'word'
And you can ask if a word is contained with:
trie.is_word? 'word' # or trie.include? 'word'
Or if part of a word is contained with:
You can also compress the trie:
Note that you cannot add any more words to a compressed trie) and that the
method acts over the existing trie instance.
And you can ask if a trie is compressed:
If you find any bug, feel free to report it through the project's GitHub issues.
You can also send us an email to email@example.com, with your questions and feature requests.