Text::WagnerFischer

Text::WagnerFischer is an implementation of the Wagner-Fischer edit distance.
Download

Text::WagnerFischer Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Dree Mistrut
  • Publisher web site:
  • http://search.cpan.org/~davidebe/Text-WagnerFischer-0.04/WagnerFischer.pm

Text::WagnerFischer Tags


Text::WagnerFischer Description

Text::WagnerFischer is an implementation of the Wagner-Fischer edit distance. Text::WagnerFischer is an implementation of the Wagner-Fischer edit distance.SYNOPSIS use Text::WagnerFischer qw(distance); print distance("foo","four");# prints "2" print distance(,"foo","four");# prints "3" my @words=("four","foo","bar"); my @distances=distance("foo",@words); print "@distances"; # prints "2 0 3" @distances=distance(,"foo",@words); print "@distances"; # prints "3 0 3"This module implements the Wagner-Fischer dynamic programming technique, used here to calculate the edit distance of two strings. The edit distance is a measure of the degree of proximity between two strings, based on "edits": the operations of substitutions, deletions or insertions needed to transform the string into the other one (and vice versa). A cost (weight) is needed for every of the operation defined above: / a if x=y (cost for letter match) w(x,y) = | b if x=- or y=- (cost for insertion/deletion operation) c if x!=y (cost for letter mismatch)These costs are given through an array reference as first argument of the distance subroutine: . If the costs are not given, a default array cost is used: that is the case of the Levenshtein edit distance: / 0 if x=y (cost for letter match) w(x,y) = | 1 if x=- or y=- (cost for insertion/deletion operation) 1 if x!=y (cost for letter mismatch)This particular distance is the exact number of edit needed to transform the string into the other one (and vice versa). When two strings have distance 0, they are the same. Note that the distance is calculated to reach the _minimum_ cost, i.e. choosing the most economic operation for each edit. Requirements: · Perl


Text::WagnerFischer Related Software