Fuzzy string matching based on physical distance between keyboard keys
Fuzzy string matching based on physical distance between keys
new Fuzzical('yrdy', ['tester', 'test', 'Lorem ipsum dolor sit amet']);
will return an ordered array of objects like so:
[
{"Phrase":"test","Score":0.4375},
{"Phrase":"tester","Score":0.2916666666666667},
{"Phrase":"Lorem ipsum dolor sit amet","Score":0.028846153846153848}
]
You can also pass a single string as the second argument (new Fuzzical('yrdy', 'test');
), though this will still return an array as above (with a single entry).
I built this for fun so can’t guarantee any updates/improvements going forward