Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

text

> 编程语言
Open source

Collection of text algorithms. gem install text

598 stars0 likes2 views
WebsiteGitHub

About

Collection of text algorithms. gem install text

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

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言