[fpc-pascal] Text matching for configuration files etc.

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Thu Apr 12 18:55:12 CEST 2012

Mark Morgan Lloyd wrote:
> I know that there are algorithms which given a text fragment will find 
> the "best fit" from a number of candidates, based on how many substrings 
> have to be deleted or changed.
> Is there anything like this in the standard FPC library, and if not does 
> anybody have one or a URL?
> Application is a configuration file handler, where parameters describe 
> things like keyboard layout, and I want to include some latitude so that 
> a user doesn't have to get it exactly right if editing by hand.

 > Maybe you mean something like Soundex:
 >   http://lazarus-ccr.sourceforge.net/docs/rtl/strutils/soundex.html
 > I myself would make a GUI for the configuration file and give all
 > valid choices in comboboxes and radiogroups etc.
 > Juha

Soundex had occurred to me, but it's very much oriented towards 
(American) surnames: encode the start of the name followed by a digest 
of the remainder.

 > I think this sounds more like "edit distance", but I am not sure why
 > it would be needed for a config file.
 > Thank you,
 >    Noah silva

That was the term I was looking for, I see there's a Wp entry and I 
haven't even blown the dust off Knuth yet :-)

Basically, I've got descriptions of golfballs like

BCD, 88 character
Correspondence, 96 character
Correspondence, 88 character + APL

and (if I get enough interest from the target audience) I want to be 
able to provide users the option of applying tweaks that might exceed 
what's provided by the GUI.

Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

More information about the fpc-pascal mailing list