FuzzySearch icon indicating copy to clipboard operation
FuzzySearch copied to clipboard

Score evaluation

Open Hasan-git opened this issue 6 years ago • 4 comments

I need a way to specify the score result if it fit a minimum, I found that thresh_include not convenient in general, where it depends input length. I think I need to compare the score and its relativity to input length ?

Hasan-git avatar Sep 20 '19 08:09 Hasan-git

Can you expand your idea of "if it fit a minimum" ?

jeancroy avatar Sep 24 '19 16:09 jeancroy

Sorry for being late, I have a contact records( name, phone and birthday), I am trying to figure a way to check if a contact is highly possible duplicate through these inputs against persisted contact records.

I am grateful for you!

Hasan-git avatar Nov 20 '19 09:11 Hasan-git

is there a way to calculate Similarity Score relative to 1. Example : if searching for a name like "forda", I expect to get result as the image below

image

Hasan-git avatar Nov 20 '19 10:11 Hasan-git

I have written a section on why I score the way I do. https://github.com/jeancroy/FuzzySearch#scoring-a-token-in-a-auto-complete-friendly-manner

  • Basically I found basic string similarity measure (like your example) unreliable when comparing result of very different size. I do use such measure, just add another layer of relative size.
  • In a auto complete scenario, I also want to match end of words for a very low cost.
  • There's also another layer to handle multiple words and multiple field which is really implemented as more is better, and max score among competing options.
  • Finally there's some amount of products / help page recommendation assumptions, so I really prefers to show something vaguely related over nothing.

I understand some of those assumptions are different from what you would want in a auto-de-duplication scenario.

You could score the query against itself and divide all the score by this maximal(?) one. See how far that takes you. If you want more basic LCS score, there's plenty of library that'll do that.


The individual word score works like this: m = size A n = size B
lcs_len = max number of character in common in proper order prefix = max number of character in common at the start of word.

var sz = (m + n) / ( 2.0 * m * n); scores[k] = sz * lcs_len * lcs_len + bonus_prefix * prefix;

jeancroy avatar Nov 22 '19 20:11 jeancroy