Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

melisa

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

melisa

  • 0.2.5
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Melisa is a Ruby gem that wraps the very efficient Marisa Trie C++ library. See also Marisa Trie's README.

A "trie" is a useful data structure for storing strings, especially ngrams.

Example

gem install melisa

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.

trie = Melisa::Trie.new(['snow', 'snow cone'])
trie.save('winter.trie')
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:

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

FAQs

Package last updated on 29 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc