This commit is contained in:
Simon Priet
2021-09-05 22:53:58 +02:00
commit 9e2991e668
17888 changed files with 1263126 additions and 0 deletions

21
node_modules/js-levenshtein/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 Gustaf Andersson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

59
node_modules/js-levenshtein/README.md generated vendored Normal file
View File

@@ -0,0 +1,59 @@
# js-levenshtein [![Build Status](https://travis-ci.org/gustf/js-levenshtein.svg?branch=master)](https://travis-ci.org/gustf/js-levenshtein)
A very efficient JS implementation calculating the Levenshtein distance, i.e. the difference between two strings.
Based on Wagner-Fischer dynamic programming algorithm, optimized for speed and memory
- use a single distance vector instead of a matrix
- loop unrolling on the outer loop
- remove common prefixes/postfixes from the calculation
- minimize the number of comparisons
## Install
```
$ npm install --save js-levenshtein
```
## Usage
```js
const levenshtein = require('js-levenshtein');
levenshtein('kitten', 'sitting');
//=> 3
```
## Benchmark
```
$ npm run bench
50 paragraphs, length max=500 min=240 avr=372.5
162 op/s » js-levenshtein
98 op/s » talisman
94 op/s » levenshtein-edit-distance
85 op/s » leven
39 op/s » fast-levenshtein
100 sentences, length max=170 min=6 avr=57.5
3,076 op/s » js-levenshtein
2,024 op/s » talisman
1,817 op/s » levenshtein-edit-distance
1,633 op/s » leven
800 op/s » fast-levenshtein
2000 words, length max=20 min=3 avr=9.5
3,119 op/s » js-levenshtein
2,416 op/s » talisman
2,141 op/s » levenshtein-edit-distance
1,855 op/s » leven
1,260 op/s » fast-levenshtein
```
Benchmarks was performed with node v8.12.0 on a MacBook Pro 15", 2.9 GHz Intel Core i9
## License
MIT © Gustaf Andersson

105
node_modules/js-levenshtein/index.js generated vendored Normal file
View File

@@ -0,0 +1,105 @@
'use strict';
module.exports = (function()
{
function _min(d0, d1, d2, bx, ay)
{
return d0 < d1 || d2 < d1
? d0 > d2
? d2 + 1
: d0 + 1
: bx === ay
? d1
: d1 + 1;
}
return function(a, b)
{
if (a === b) {
return 0;
}
if (a.length > b.length) {
var tmp = a;
a = b;
b = tmp;
}
var la = a.length;
var lb = b.length;
while (la > 0 && (a.charCodeAt(la - 1) === b.charCodeAt(lb - 1))) {
la--;
lb--;
}
var offset = 0;
while (offset < la && (a.charCodeAt(offset) === b.charCodeAt(offset))) {
offset++;
}
la -= offset;
lb -= offset;
if (la === 0 || lb < 3) {
return lb;
}
var x = 0;
var y;
var d0;
var d1;
var d2;
var d3;
var dd;
var dy;
var ay;
var bx0;
var bx1;
var bx2;
var bx3;
var vector = [];
for (y = 0; y < la; y++) {
vector.push(y + 1);
vector.push(a.charCodeAt(offset + y));
}
var len = vector.length - 1;
for (; x < lb - 3;) {
bx0 = b.charCodeAt(offset + (d0 = x));
bx1 = b.charCodeAt(offset + (d1 = x + 1));
bx2 = b.charCodeAt(offset + (d2 = x + 2));
bx3 = b.charCodeAt(offset + (d3 = x + 3));
dd = (x += 4);
for (y = 0; y < len; y += 2) {
dy = vector[y];
ay = vector[y + 1];
d0 = _min(dy, d0, d1, bx0, ay);
d1 = _min(d0, d1, d2, bx1, ay);
d2 = _min(d1, d2, d3, bx2, ay);
dd = _min(d2, d3, dd, bx3, ay);
vector[y] = dd;
d3 = d2;
d2 = d1;
d1 = d0;
d0 = dy;
}
}
for (; x < lb;) {
bx0 = b.charCodeAt(offset + (d0 = x));
dd = ++x;
for (y = 0; y < len; y += 2) {
dy = vector[y];
vector[y] = dd = _min(dy, d0, dd, bx0, vector[y + 1]);
d0 = dy;
}
}
return dd;
};
})();

49
node_modules/js-levenshtein/package.json generated vendored Normal file
View File

@@ -0,0 +1,49 @@
{
"name": "js-levenshtein",
"version": "1.1.6",
"description": "The most efficient JS implementation calculating the Levenshtein distance, i.e. the difference between two strings.",
"license": "MIT",
"repository": "gustf/js-levenshtein",
"author": {
"name": "Gustaf Andersson",
"email": "gustaf@me.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "ava",
"bench": "matcha bench.js"
},
"files": [
"index.js"
],
"keywords": [
"levenshtein",
"distance",
"algorithm",
"algo",
"string",
"difference",
"diff",
"fast",
"fuzzy",
"similar",
"similarity",
"compare",
"comparison",
"edit",
"text",
"match",
"matching"
],
"devDependencies": {
"ava": "^0.25.0",
"fast-levenshtein": "^2.0.6",
"levenshtein-edit-distance": "^2.0.3",
"matcha": "^0.7.0",
"talisman": "^0.21.0",
"leven": "^2.1.0",
"xo": "^0.23.0"
}
}