[READ-ONLY] Mirror of https://github.com/FoxxMD/string-sameness. Compare the sameness of two strings foxxmd.github.io/string-sameness/
compare cosine-similarity dice-coefficient levenshtein-distance sameness string text typescript
0

Configure Feed

Select the types of activity you want to include in your feed.

fix: Round up cosine result when identical

FoxxMD (Oct 26, 2023, 12:56 PM EDT) f5819da3 ddd07f26

+4 -1
+4 -1
src/matchingStrategies/cosineSimilarity.ts
··· 72 72 export const cosineStrategy: ComparisonStrategy<ComparisonStrategyResultObject> = { 73 73 name: 'cosine', 74 74 strategy: (valA: string, valB: string) => { 75 - const res = calculateCosineSimilarity(valA, valB); 75 + let res = calculateCosineSimilarity(valA, valB); 76 + if(res > 0.99999) { 77 + res = 1; 78 + } 76 79 return { 77 80 score: res * 100, 78 81 rawScore: res