Package Exports
- string-metric
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (string-metric) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
String Metric
A library implementing different string similarity and distance measures, and Implement by TypeScript. Also, you can use in JavaScript.
Algorithm reference java-string-similarity
Install
npm install string-metric
Progress
Algorithm | Complete? |
---|---|
Jaro-Winkler | Yes |
Levenshtein | Yes |
Normalized-Levenshtein | Yes |
Weighted-Levenshtein | Yes |
Damerau-Levenshtein | Yes |
Optimal String Alignment | No |
Longest Common Subsequence | No |
Metric Longest Common Subsequence | No |
N-Gram | No |
Q-Gram | No |
Shingle (n-gram) based algorithms | No |
Cosine similarity | No |
Jaccard index | No |
Sorensen-Dice coefficient | No |
Ratcliff-Obershelp | No |
Jaro-Winkler
For more specs, please go to tests/JaroWinkler.spec.ts
in the repository.
const instance = new JaroWinkler();
const s1 = 'My string';
const s2 = 'My string';
instance.similarity(s1, s2); // 1
const s1 = 'My string';
const s2 = 'My tsring';
instance.similarity(s1, s2); // 0.974074
const s1 = 'My string';
const s2 = 'My ntrisg';
instance.similarity(s1, s2); // 0.896296
Levenshtein
For more specs, please go to tests/Levenshtein.spec.ts
in the repository.
const instance = new Levenshtein();
const s1 = 'My string';
const s2 = 'My string';
instance.distance(s1, s2); // 0
const s1 = 'My string';
const s2 = 'My tring';
instance.distance(s1, s2); // 1
const s1 = 'My string';
const s2 = 'M string2';
instance.distance(s1, s2); // 2
Normalized-Levenshtein
For more specs, please go to tests/NormalizedLevenshtein.spec.ts
in the repository.
const instance = new NormalizedLevenshtein();
Weighted-Levenshtein
For more specs, please go to tests/WeightedLevenshtein.spec.ts
in the repository.
const instance = new WeightedLevenshtein();