Skip to content
/ text Public
forked from threedaymonk/text

Collection of text algorithms. gem install text

Notifications You must be signed in to change notification settings

ptyagi16/text

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text

A collection of text algorithms.

Usage

require 'text'

Levenshtein distance

Text::Levenshtein.distance('test', 'test')
# => 0
Text::Levenshtein.distance('test', 'tent')
# => 1

Metaphone

Text::Metaphone.metaphone('BRIAN')
# => 'BRN'

Text::Metaphone.double_metaphone('Coburn')
# => ['KPRN', nil]
Text::Metaphone.double_metaphone('Angier')
# => ['ANJ', 'ANJR']

Soundex

Text::Soundex.soundex('Knuth')
# => 'K530'

Porter stemming

Text::PorterStemming.stem('abatements')  # => 'abat'

White similarity

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.

Ruby version compatibility

The library has been tested on Ruby 1.8.6 to 1.9.3 and on JRuby.

Thanks

  • Hampton Catlin (hcatlin) for Ruby 1.9 compatibility work

  • Wilker Lúcio for the initial implementation of the White algorithm

License

Same as Ruby.

About

Collection of text algorithms. gem install text

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%