[SP-pm] Feature ou Bug?

Blabos de Blebe blabos at gmail.com
Wed Jul 23 07:41:42 PDT 2008


Olá Perlsoal,

Recentemente eu andei brincando com umas strings e ao rodar o código:

<code>
#!/usr/bin/perl

use String::Trigram;


@lista1 = qw/abacate laranja abobora/;
@lista2 = qw/abacate laranja abobora/;
@lista3 = qw/abacate laranja abobora/;

$trig = String::Trigram->new(
                          "cmpBase"           =>  [],
                          "minSim"            =>  0.1,
                          "warp"              =>  1.0,
                          "ignoreCase"        =>  1,
                          "keepOnlyAlNums"    =>  1,
                          "ngram"             =>  3,
                          "debug"             =>  0
                      );

@bm1 = ();
@bm2 = ();
@bm3 = ();


$trig->reInit(\@lista1);
$sim = $trig->getBestMatch( 'abacate', \@bm1);
print $sim, $/;

$trig->reInit(\@lista2);
$sim = $trig->getBestMatch( 'abacate', \@bm2);
print $sim, $/;

$trig->reInit(\@lista3);
$sim = $trig->getBestMatch( 'abacate', \@bm3);
print $sim, $/;
</code>

Eu esperava obeter:

<result>
1
1
1
</result>

Mas obtive:

<result>
1
0
0
</result>

Seria isso uma Feature, Bug, ou eu não estou dormindo o quanto deveria?

Abraços


More information about the SaoPaulo-pm mailing list