Home > freetb4matlab > strings > editdistance.m

editdistance

PURPOSE ^

% computes the Levenshtein edit distance between the two strings.

SYNOPSIS ^

function [dist,L]=editdistance(str1,str2,weights)

DESCRIPTION ^

% -*- texinfo -*-
% @deftypefn {Function File} [@var{dist},@var{L}] = {} editdistance(@var{string1},@var{string2},@var{weights})
% computes the Levenshtein edit distance between the two strings.
% @var{string1} and @var{string2}. This operation is symmetrical.
% The optional argument @var{weights} specifies weights for the
% deletion, matched, and insertion operations; by default it is set to
% +1, 0, +1 respectively, so that a least editdistance means a 
% closer match between the two strings. This function implements
% the Levenshtein edit distance as presented in Wikipedia article,
% accessed Nov 2006. Also the levenshtein edit distance of a string
% with an empty string is defined to be its length.
% 
% The default return value is @var{dist} the edit distance, and
% the other return value  @var{L} is the distance matrix.
%
% @example
% @group  
%          editdistance('marry','marie') 
%          %%returns value +2 for the distance.
% @end group
% @end example
%
% @end deftypefn
%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Fri 22-May-2009 15:13:00 by m2html © 2003