From: Shawn Boyette Date: Fri, 6 Mar 2009 17:54:02 +0000 (+0000) Subject: age scoring was bad. better implementation. X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=commitdiff_plain;h=94a0102ed53ccb07f0183944a89cf60c340bc4f5 age scoring was bad. better implementation. --- diff --git a/fingerprinter b/fingerprinter index fe3645b..ddf3db8 100755 --- a/fingerprinter +++ b/fingerprinter @@ -225,18 +225,9 @@ sub score_marc { #---------------------------------- # static criteria scoring #---------------------------------- - $marc->{misc_score} = 999999999999; - # subtract record id if we want older records to win - $marc->{misc_score} -= $marc->{id} unless ($conf->{newwins}); - # handle arbitrary adjustments - if ($conf->{'arbitrarily-decrease-score-above'}) { - $marc->{misc_score} -= $conf->{'arbitrarily-decrease-score-by'} - if ($marc->{id} >= $conf->{'arbitrarily-decrease-score-above'}); - } - if ($conf->{'arbitrarily-decrease-score-below'}) { - $marc->{misc_score} -= $conf->{'arbitrarily-decrease-score-by'} - if ($marc->{id} <= $conf->{'arbitrarily-decrease-score-below'}); - } + $marc->{misc_score} = 999; + $marc->{age_score} = 999999999999; + # -1 if 008 has been padded, -2 if it doesn't exist if ($marc->{tag008}) { $marc->{misc_score}-- if ($marc->{tag008} =~ /\|$/) } @@ -248,6 +239,18 @@ sub score_marc { $marc->{misc_score}-- if (defined $marc->{tag300a} and $marc->{tag300a} =~ /copy/i); + # subtract record id if we want older records to win + $marc->{age_score} -= $marc->{id} unless ($conf->{newwins}); + # handle arbitrary adjustments + if ($conf->{'arbitrarily-decrease-score-above'}) { + $marc->{age_score} -= $conf->{'arbitrarily-decrease-score-by'} + if ($marc->{id} >= $conf->{'arbitrarily-decrease-score-above'}); + } + if ($conf->{'arbitrarily-decrease-score-below'}) { + $marc->{age_score} -= $conf->{'arbitrarily-decrease-score-by'} + if ($marc->{id} <= $conf->{'arbitrarily-decrease-score-below'}); + } + #---------------------------------- # dynamic calculated scoring #---------------------------------- @@ -284,7 +287,7 @@ sub score_marc { } $json .= 'misc:' . $marc->{misc_score} . '}'; - my $compact = join('', $marc->{misc_score}, @score); + my $compact = join('', $marc->{misc_score}, @score, $marc->{age_score}); $marc->{score} = "$compact\t$json"; }