NAME

Text::EditTranscript - Perl extension for determining the edit transcript between two strings

SYNOPSIS

use Text::EditTranscript;
print EditTranscript("foo","bar");

DESCRIPTION

The edit transcript is a sequence of operations to transform one string into another string. The operations include 'Insertion', 'Deletion', and Substitution. This module creates a string denoting the list of operations to transfer the second string into the first string where:

-

No operation required.

S

The character from second string should be substituted into the first string.

D

The character in that position from the first string should be deleted.

I

The character in that position in the second string should be inserted into the first string at that position.

This method uses the Levenshtein distance calculation to create the edit transcript.

EXAMPLES

  • $string1 = "bar";
    $string2 = "baz";
    print EditDistance($string1,$string2),"\n";

    This will result in "--S". Interpreted, this means that 'ba' matches in both strings and the 'z' in string2 should be replaced by 'r' in string1 in order for the strings to match.

  • $string1 = "This is a test";
    $string2 = "This isn't a test";
    print EditDistance($string1,$string2),"\n";

    This will result in "-------III-------", implying that the characters in the eighth, ninth, and tenth positions should be inserted into the first string starting at position eight.

SEE ALSO

Text::Levenshtein, Text::LevenshteinXS

AUTHOR

Leigh Metcalf, <leigh@fprime.net>

COPYRIGHT AND LICENSE

Copyright (C) 2008 by Leigh Metcalf

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.