krisk / fuse-swift

A lightweight fuzzy-search library, with zero dependencies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Best match

iguron opened this issue · comments

Hi kirsk,

Congrats for this excellent library.

One suggestion that maybe you could implement on the library.

Sometimes we need to find the best match, and only the best match on the string. One example. If we try to find "Hello World." inside "Hellu Wo** round" (returned by OCR) the result´s ranges include "Hell","Wo","r" and "d". It could be really interesting if fuze could return only the best match according to a character distance. For example.

Best Match with distance of 1 character: "Hell_ Wo" (range 0..7) and "r" and "d" would not be included in the result as they are more than one character far away from the best match.

Another example "Hellu Wuid" could return "Hell_ W__d" (range 0..9) with a character distance of 2 characters and "Hell_ W" with a distance of 1 character.

This porperty could make fuze really really a gem for OCR result´s processing.

Thanks in advance.