Skip to content

yoshoku/darts-clone.rb

Repository files navigation

Darts-clone.rb

Build Status Gem Version BSD 2-Clause License

Darts-clone.rb provides Ruby bindings for the Darts-clone.

Installation

Add this line to your application's Gemfile:

gem 'dartsclone'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install dartsclone

Usage

require 'dartsclone'

da = DartsClone::DoubleArray.new

# Construct a dictionary.
keys = ['abc', 'abcd', 'abcde', 'bcd', 'cde']
da.build(keys)

# Search for keys which match the prefix of given string.
p da.common_prefix_search('abcde')
# => [["abc", "abcd", "abcde"], [0, 1, 2]]

# Search a key which matches a given string.
p da.exact_match_search('abcd')
# => 1

# Dump the dictionary.
da.save('foo.dat')

# Load the dictionary.
da.open('foo.dat')

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/yoshoku/darts-clone.rb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the BSD 2-clause License. Moreover, the gem includes the source code of Darts-clone. The License of Darts-clone can be found in COPYING.md.

About

Darts-clone.rb provides Ruby bindings for the Darts-clone.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages