2.1.2 • Published 7 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
7 years ago
2.1.1
7 years ago
2.1.0
7 years ago
2.0.14
7 years ago
2.0.13
8 years ago
2.0.12
8 years ago
2.0.11
8 years ago
2.0.10
8 years ago
2.0.9
8 years ago
2.0.8
8 years ago
2.0.7
8 years ago
2.0.6
8 years ago
2.0.5
8 years ago
2.0.4
8 years ago
2.0.3
8 years ago
2.0.2
8 years ago
2.0.1
8 years ago
2.0.0
8 years ago
1.0.1
8 years ago
1.0.0
8 years ago