July 15, 2011
Is there any such method in Phobos?

I have to rename some files based on a string array of known names which need to be fuzzy-matched to file names and then rename the files to the matches.

E.g.:

string[] strings = ["food", "lamborghini", "architecture"]

files on system:
.\foo.ext
.\lmbrghinione.ext
.\archtwo.ext

and if there's a fuzzy match then the matched files would be renamed to:
.\food.ext
.\lamborghini.ext
.\architecture.ext

Perhaps there's a C library I can use for this?
July 16, 2011
On 07/16/2011 01:17 AM, Andrej Mitrovic wrote:
> Is there any such method in Phobos?
>
> I have to rename some files based on a string array of known names
> which need to be fuzzy-matched to file names and then rename the files
> to the matches.
>
> E.g.:
>
> string[] strings = ["food", "lamborghini", "architecture"]
>
> files on system:
> .\foo.ext
> .\lmbrghinione.ext
> .\archtwo.ext
>
> and if there's a fuzzy match then the matched files would be renamed to:
> .\food.ext
> .\lamborghini.ext
> .\architecture.ext
>
> Perhaps there's a C library I can use for this?

You could try stc.algorithm.levenshteinDistance to check how much the two names differ.

-- 
Mike Wey