Skip to content

kenany/levenshtein

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

levenshtein

Levenshtein string difference as a component.

Source from gf3/Levenshtein.

Installation

$ component install KenanY/levenshtein

API

Levenshtein(m, n)

Initialise a new Levenshtein object.

  • m (String): first string
  • n (String): second string
var l = new Levenshtein('kitten', 'sitting');

.distance()

Distance between strings.

l.distance
// => 3

.inspect()

Pretty print Levenshtein table.

l.inspect();
// =>  0 | 1 | 2 | 3 | 4 | 5 | 6
// => ---+---+---+---+---+---+---
// =>  1 | 1 | 2 | 3 | 4 | 5 | 6
// => ---+---+---+---+---+---+---
// =>  2 | 2 | 1 | 2 | 3 | 4 | 5
// => ---+---+---+---+---+---+---
// =>  3 | 3 | 2 | 1 | 2 | 3 | 4
// => ---+---+---+---+---+---+---
// =>  4 | 4 | 3 | 2 | 1 | 2 | 3
// => ---+---+---+---+---+---+---
// =>  5 | 5 | 4 | 3 | 2 | 2 | 3
// => ---+---+---+---+---+---+---
// =>  6 | 6 | 5 | 4 | 3 | 3 | 2
// => ---+---+---+---+---+---+---
// =>  7 | 7 | 6 | 5 | 4 | 4 | 3

.toString()

Alias of Levenshtein.inspect().

Development

$ make

License

UNLICENSE

About

Levenshtein string difference as a component.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published