jeancroy / FuzzySearch

:mag: Fast autocomplete suggestion engine using approximate string matching
MIT License
194 stars 32 forks source link

Score evaluation #23

Open Hasan-git opened 4 years ago

Hasan-git commented 4 years ago

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 ?

jeancroy commented 4 years ago

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

Hasan-git commented 4 years ago

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 commented 4 years ago

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

jeancroy commented 4 years ago

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

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;