string-similarity
string-similarity copied to clipboard
compareTwoStrings with arguments length lower than 3 since
Hello!
If I try to compare two strings like
compareTwoStrings("set", "st");
the result is always 0. Strings with length lower than 3 cannot be compared.
Is this normal?
Greatings!
In your example, 0 is the correct value of the Dice coefficient. The two string do not have any bigrams in common.
It can give non-zero results for strings of length two and three:
compareTwoStrings("abc", "abc") === 1
compareTwoStrings("abc", "ab") === compareTwoStrings("abc", "bc") === 2/3