Percentage matching of text

Eddie Corns eddie at holyrood.ed.ac.uk
Fri Jul 30 18:38:30 CEST 2004


Bruce Eckel <BruceEckel at MailBlocks.com> writes:

>What I'd like to do is find an algorithm that produces the results of
>a text comparison as a percentage-match. Thus I would be able to
>assert that my test samples must match the control sample by at least
>(for example) 83% for the test to pass. Clearly, this wouldn't be a
>perfect test but it would help flag problems, which is primarily what
>I need.

How about using the edit distance?  This would maybe give you finer control,
eg the maximum edit distance for a date would be within X characters if the
times are close or XX characters if completely random.

Googling for "python string edit distance" came up with a few matches.

Eddie



More information about the Python-list mailing list