From 159e7b256c1d89f5b2ba99c9db939bedef8de142 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sun, 12 Mar 2017 00:28:14 +0200 Subject: [PATCH] Better distance function --- lib/Text/Levenshtein/Edlib.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Text/Levenshtein/Edlib.pm b/lib/Text/Levenshtein/Edlib.pm index e61b4a3..6b38a6c 100644 --- a/lib/Text/Levenshtein/Edlib.pm +++ b/lib/Text/Levenshtein/Edlib.pm @@ -67,8 +67,8 @@ sub align { } sub distance { - my ($q, $t, $k) = @_; - align($q, $t, $k)->{editDistance} + my ($q, $t, $k, $mode) = @_; + align($q, $t, $k, $mode, EDLIB_TASK_DISTANCE())->{editDistance} } sub to_cigar { @@ -120,7 +120,7 @@ This module has two functions: =over -=item B(I<$query>, I<$target>, [I<$max_distance>]) +=item B(I<$query>, I<$target>, [I<$max_distance>, [I<$mode>]]) This is the basic interface to the library. It is compatible with the function of the same name in L. @@ -128,7 +128,8 @@ function of the same name in L. It returns the edit distance between the two given strings. If the third argument is specified, and the edit distance is greater than the value of the third argument, then the function finishes the -computation early and returns undef. +computation early and returns undef. See below for the meaning of the +optional I<$mode> argument. =item B(I<$query>, I<$target>, [I<$max_distance>, [I<$mode>, [I<$task>]]]) -- 2.39.2