From: Shawn Boyette Date: Thu, 5 Mar 2009 22:04:59 +0000 (+0000) Subject: added arbitrary score adjustments X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=commitdiff_plain;h=380e74d54350fa83fecf8006691f7d215df2fa4e added arbitrary score adjustments --- diff --git a/fingerprinter b/fingerprinter index b7319c6..db53afe 100755 --- a/fingerprinter +++ b/fingerprinter @@ -228,6 +228,15 @@ sub score_marc { $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'}); + } # -1 if 008 has been padded, -2 if it doesn't exist if ($marc->{tag008}) { $marc->{misc_score}-- if ($marc->{tag008} =~ /\|$/) } @@ -403,6 +412,9 @@ sub initialize { 'tag|t=s', 'fingerprints=s', 'scores=s', + 'arbitrarily-decrease-score-above=i', + 'arbitrarily-decrease-score-below=i', + 'arbitrarily-decrease-score-by=i', 'newwins', 'quiet|q', 'help|h', @@ -449,6 +461,8 @@ sub initialize { $c->{tag} = 903 unless defined $c->{tag}; $c->{subfield} = 'a' unless defined $c->{subfield}; $c->{marctype} = 'XML' unless defined $c->{marctype}; + $c->{'arbitrarily-decrease-score-by'} = 0 + unless defined $c->{'arbitrarily-decrease-score-by'}; if ($c->{prefix}) { $c->{output} = join('.',$c->{prefix},'fp'); $c->{exception} = join('.',$c->{prefix},'fp','ex');