2.1.2 • Published 10 years ago
up-levenshtein v2.1.2
#What? Lightweight implementation for Levenshtein distance calculation. Without dependencies.
#Install
$ npm install --save up-levenshtein#API
getDistance(:string, :string) : number
getClosest(:string, :array) : string#Where this library could be useful? You might consider this library if you want to measure distance between two strings. For example - emails comparison and getting correction suggestions.
Levenshtein.getClosest('@nekrasov.nl', [
'@gmail.com',
'@nekgasov.nl',
'@nekasov.nl',
'@ya.ru'
]);returns: @nekgasov.nl.
#Tests
Run npm t
#Benchmarks
To run benchmarks locally: npm run benchmarks.
Tests performed on: MacBook Pro Early 2015 (2,7 GHz Intel Core i5, 8 GB 1867 MHz DDR3)
Results:
| Size | Strings to compare | Results |
|---|---|---|
| S | 'some1' and 'some2' | x 6,729,838 ops/sec ±1.62% (84 runs sampled) |
| M | 'alexey@nekrasov.nl' and 'alexey@gmail.com' | x 987,762 ops/sec ±0.82% (85 runs sampled) |
| XL | 'I don\'t really need to compare long texts' and 'But what wouldn\'t you do for good benchmarks?' | x 158,916 ops/sec ±1.39% (81 runs sampled) |
#License MIT
2.1.2
10 years ago
2.1.1
10 years ago
2.1.0
10 years ago
2.0.14
10 years ago
2.0.13
10 years ago
2.0.12
10 years ago
2.0.11
10 years ago
2.0.10
10 years ago
2.0.9
10 years ago
2.0.8
10 years ago
2.0.7
10 years ago
2.0.6
10 years ago
2.0.5
10 years ago
2.0.4
10 years ago
2.0.3
10 years ago
2.0.2
10 years ago
2.0.1
10 years ago
2.0.0
10 years ago
1.0.1
10 years ago
1.0.0
10 years ago