Modifications to C4/Matcher for colon and ending punctuation

Recommended by Michele Maenpaa, this adds handling colon and end-punctuation stripping
in subroutine _normalize, and fixes length testing in subroutine _get_match_keys

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
J. David Bavousett 2008-12-26 15:38:00 -06:00 committed by Galen Charlton
parent 5e99f59fa6
commit 13cce1b3c5
1 changed files with 9 additions and 2 deletions

View File

@ -786,6 +786,11 @@ sub _get_match_keys {
}
}
$key = _normalize($key);
if ($component->{'length'}){
if (length($key) > $component->{'length'}){
$key = _normalize(substr($key,$component->{'offset'},$component{'length'}));
}
}
}
if ($i == 0) {
push @keys, $key if $key;
@ -815,10 +820,12 @@ sub _parse_match_component {
# FIXME - default normalizer
sub _normalize {
my $value = uc shift;
$value =~ s/.;:,\]\[\)\(\/'"//g;
$value =~ s/^\s+//;
$value =~ s/^\s+$//;
#$value =~ s/^\s+$//;
$value =~ s/\s+$//;
$value =~ s/\s+/ /g;
$value =~ s/[.;,\]\[\)\(\/"']//g;
#$value =~ s/[.;,\]\[\)\(\/"']//g;
return $value;
}