Project

ncd

0.0
No commit activity in last 3 years
No release in over 3 years
calculating Normalized Compression Distance(NCD).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
>= 2.13.0
 Project Readme

NCD Build Status

Ruby gem for calculating Normalized Compression Distance (NCD).

It's inspired by RubyForge code snippet.

Installation

Add this line to your application's Gemfile:

gem 'ncd'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ncd

Usage

require 'ncd'

a = File.read('somefile.a')
b = File.read('somefile.b')
distance = NCD.distance(a, b)
# or 
distance = a.ncd(b)

Setting compression level

NCD.level = Zlib::Defalate::DEAULT_COMPRESSION

Valid values of level are Zlib::Deflate::NO_COMPRESSION, BEST_SPEED, BEST_COMPRESSION, DEFAULT_COMPRESSION, and an integer from 0 to 9.

default compression level is Zlib::Defaulte::BEST_COMPRESSION.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request