1.1.6 • Published 8 years ago
symlar v1.1.6
Verification is 1-2 orders of magnitude faster than other libraries (leven, talisman, fast-levenshtein, js-levenshtein, levenshtein-edit-distance):
$ node benchmarks.js
COMPUTATION VS VERIFICATION OF LEVENSHTEIN DISTANCE:
symlar/lev x 41.88 ops/sec ±5.40% (54 runs sampled)
symlar/vlev x 1,135 ops/sec ±1.26% (90 runs sampled)
symlar/eddist x 36.43 ops/sec ±1.02% (62 runs sampled)
symlar/veddist x 972 ops/sec ±1.46% (89 runs sampled)
leven x 65.14 ops/sec ±0.70% (66 runs sampled)
talisman x 81.01 ops/sec ±0.71% (69 runs sampled)
fast-levenshtein x 57.93 ops/sec ±1.07% (66 runs sampled)
js-levenshtein x 96.58 ops/sec ±1.40% (69 runs sampled)
levenshtein-edit-distance x 62.36 ops/sec ±1.18% (64 runs sampled)
fastest is symlar/vlevInstall
npm i symlarUsage
Node
$ node> symlar = require('./symlar')
{ GAP: [Getter],
LEVENSHTEIN: [Getter],
EN_GB_PHONE: [Getter],
eddist: [Getter],
veddist: [Getter],
lev: [Getter],
vlev: [Getter],
edsim: [Getter],
vedsim: [Getter],
phonesim: [Getter],
vphonesim: [Getter] }levenshtein distance
> symlar.lev('SIMILARITY', 'SIMILAR')
3verify levenshtein distance
> symlar.vlev('SIMILARITY', 'SIMILAR', 3)
trueedit similarity
> symlar.edsim('SYMLAR', 'SIMILAR', sym.LEVENSHTEIN)
0.7142857142857143verify edit similarity
> symlar.vedsim('SYMLAR', 'SIMILAR', sym.LEVENSHTEIN, .7)
truephonetic similarity
> symlar.phonesim('SOW', 'SEW')
1verify phonetic similarity
> symlar.vphonesim('SOW', 'SEW', .9)
truecustom edit similarity
> symlar.edsim('SYMLAR', 'SIMILAR', (L, R) => +(L !== R)*.5)
0.85custom weighted edit distance
> symlar.eddist('SIMILARITY', 'SIMILAR',(L, R) => +(L !== R)*.5)
1.5verify weighted edit distance
> symlar.veddist('SIMILARITY', 'SIMILAR',(L, R) => +(L !== R)*.5, 1)
falseBrowser
<script src='symlar.js'></script>symlar will be available as a global
npm tasks
test
npm testTests are slow due to there being thousands of them, as the functions are tested generatively
coverage
npm run coverbenchmark
npm run benchLicense
MIT © Jose Llarena