Project

dartsclone

0.0
No release in over a year
Darts-clone.rb provides Ruby bindings for the Darts-clone.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

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.