Sha256: 7a6d529c4f3de0173b63c29933ed565e1927ec46f585c93df37b6da19d4a79b2
Contents?: true
Size: 1.39 KB
Versions: 6
Compression:
Stored size: 1.39 KB
Contents
Melisa is a Ruby gem that wraps the very efficient [Marisa Trie C++ library](https://pypi.python.org/pypi/marisa-trie/). See also Marisa Trie's [README](http://marisa-trie.googlecode.com/svn/trunk/docs/readme.en.html). A "trie" is a useful data structure for storing strings, especially ngrams. Example ------- ```gem install melisa``` ```ruby require 'melisa' trie = Melisa::Trie.new trie.add('snow') trie.add('snow cone') trie.add('ice') trie.add('ice cream') trie.search('ice').keys # => ["ice", "ice cream"] ``` You can also save and load complete tries. Marisa Tries are space efficient, often achieving significant compression over regular string or hash storage. ```ruby trie = Melisa::Trie.new(['snow', 'snow cone']) trie.save('winter.trie') ``` ```ruby trie = Melisa::Trie.new trie.load('winter.trie') trie.include? 'snow' # => true ``` Melisa includes an IntTrie type that can be used to time- and space-efficiently store integer values in association with a string: ```ruby trie = Melisa::IntTrie.new "one" => 1, "two" => 2, "onetwo" => 3 trie['one'] # => 1 trie.get_all('one') # => [3, 1] ``` Features -------- - fast search for exact strings and prefixes - has a BytesTrie that can be used to store binary data - has an IntTrie that can be used to store integer values easily - Ruby bindings for Marisa Trie built into the gem (require 'marisa') About ----- (c) 2014 Duane Johnson License: MIT
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
melisa-0.2.5 | README.md |
melisa-0.2.4 | README.md |
melisa-0.2.3 | README.md |
melisa-0.2.2 | README.md |
melisa-0.2.1 | README.md |
melisa-0.2.0 | README.md |