Skip to content

Compute the similarity of two strings based on the trigram (n-gram) method

License

Notifications You must be signed in to change notification settings

milk1000cc/trigram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trigram Build Status

Compute the similarity of two strings based on the trigram (n-gram) method

Installation

Add this line to your application's Gemfile:

gem 'trigram'

And then execute:

$ bundle

Or install it yourself as:

$ gem install trigram

Usage

Trigram.compare 'he is genius', 'he is genius'  # => 1

Trigram.compare 'he is genius', 'he is very genius'  # => 0.5625

Trigram.compare 'he is genius', 'she is cute'  # => 0.26666666666666666

Trigram.compare 'he is genius', 'I can fly'  # => 0

Credits

Contributing

  1. Fork it ( https://github.com/milk1000cc/trigram/fork )
  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 a new Pull Request

About

Compute the similarity of two strings based on the trigram (n-gram) method

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages