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

compareTwoStrings with arguments length lower than 3 since #126

Open
Flo0806 opened this issue Jul 1, 2022 · 1 comment
Open

compareTwoStrings with arguments length lower than 3 since #126

Flo0806 opened this issue Jul 1, 2022 · 1 comment

Comments

@Flo0806
Copy link

Flo0806 commented Jul 1, 2022

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!

@dlnnlsn
Copy link

dlnnlsn commented Nov 2, 2022

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

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