File: README.rdoc

package info (click to toggle)
ruby-text 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch
  • size: 568 kB
  • ctags: 102
  • sloc: ruby: 1,134; makefile: 2
file content (59 lines) | stat: -rw-r--r-- 1,190 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
= Text

A collection of text algorithms.

== Usage

  require 'text'

=== Levenshtein distance

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

=== 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

MIT. See COPYING.txt for details.