Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Matching % seems incorrect #91

Closed
oom- opened this issue Feb 21, 2021 · 1 comment
Closed

Matching % seems incorrect #91

oom- opened this issue Feb 21, 2021 · 1 comment

Comments

@oom-
Copy link

oom- commented Feb 21, 2021

I just tryed the example:

stringSimilarity.compareTwoStrings("healed", "sealed");
//0.8

=> 80% for a 1 letter change.

stringSimilarity.compareTwoStrings("healed", "ehaled");
//0.6

=> 60% for 2 letter switching

Ok I get it but now I just try with another word that contains 1 letter less (5 char length vs 6)

stringSimilarity.compareTwoStrings("fuira", "fuia");
//0.57

=> 57% for a 1 letter change (just lost 23%)

stringSimilarity.compareTwoStrings("furia", "fuira");
//0.25

=> 25% for a 1 letter change (just lost 35%)

Seems to me that less the string is long more the matching is severe.
Is there a way to make it "average" undepending of the length ?

@aceakash
Copy link
Owner

@oom- Different algorithms will have different trade-offs. This library implements the Sørensen–Dice_coefficient as the similarity score. I would encourage you to try out other string comparison algorithms to see which one best fits your needs. This might be a good starting point.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants