Archive for February 10, 2012

  • Rambling Trie: A custom Trie data structure implementation in Ruby

    February 10, 2012


    This post was originally published in the Rambling Labs Blog on February 10, 2012.


    We’re proud to announce that our first gem is here!

    It’s called rambling-trie, and it’s an implementation of the Trie data structure. A Trie is an ordered tree data structure, and it is great for managing dictionaries and for word searching and matching.

    Now, to install the rambling-trie, you can either install it manually by running:

    gem install rambling-trie
    

    Or, you can add this line to the Gemfile of your application:

    gem 'rambling-trie'
    

    To create a new Trie you can do this:

    require 'rambling-trie'
    
    trie = Rambling::Trie.new
    

    And to add a new word to the Trie, you can call this:

    trie.add_branch_from 'word'
    

    Or to automatically load words from a file…

    Continue Reading →