| Path: | README.rdoc |
| Last Update: | Tue Mar 01 23:34:32 +0000 2016 |
A collection of text algorithms.
require 'text'
Text::Levenshtein.distance('test', 'test')
# => 0
Text::Levenshtein.distance('test', 'tent')
# => 1
Text::Metaphone.metaphone('BRIAN')
# => 'BRN'
Text::Metaphone.double_metaphone('Coburn')
# => ['KPRN', nil]
Text::Metaphone.double_metaphone('Angier')
# => ['ANJ', 'ANJR']
Text::Soundex.soundex('Knuth')
# => 'K530'
Text::PorterStemming.stem('abatements') # => 'abat'
white = Text::WhiteSimilarity.new
white.similarity('Healed', 'Sealed') # 0.8
white.similarity('Healed', 'Help') # 0.25
Note that some intermediate information is cached on the instance to improve performance.
The library has been tested on Ruby 1.8.6 to 1.9.3 and on JRuby.
MIT. See COPYING.txt for details.