16 Oct 2009 14:56:42 UTC
- Distribution: Text-EditTranscript
- Module version: 0.07
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (556 / 0 / 13)
- KwaliteeBus factor: 1
- 89.47% Coverage
- License: unknown
- Activity24 month
- Download (3.52KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionLMETCALF Leigh Metcalfand 1 contributors
Text::EditTranscript - Perl extension for determining the edit transcript between two strings
use Text::EditTranscript; print EditTranscript("foo","bar");
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.
The character from second string should be substituted into the first string.
The character in that position from the first string should be deleted.
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.
$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.
Leigh Metcalf, <firstname.lastname@example.org>
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.
Module Install Instructions
To install Text::EditTranscript, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Text::EditTranscript
For more information on module installation, please visit the detailed CPAN module installation guide.