From: Dobrica Pavlinusic Date: Sat, 14 Sep 2013 13:15:34 +0000 (+0200) Subject: more tweaks to capitalization based on fields X-Git-Url: http://git.rot13.org/?p=crolist2marc;a=commitdiff_plain;h=8490e532bc5919fac2411f95d06b64aecdfd31b8 more tweaks to capitalization based on fields --- diff --git a/crolist2marc.pl b/crolist2marc.pl index 50ae051..720b2e7 100755 --- a/crolist2marc.pl +++ b/crolist2marc.pl @@ -10,7 +10,7 @@ use utf8; my $data; sub vc_casefix { # partial reverse-engeenered implementation of case mapping - my ( $vc, $k, $rest ) = @_; + my ( $tag, $sfi, $vc, $k, $rest ) = @_; $vc .= " " x (4 - length($vc)); @@ -27,7 +27,7 @@ sub vc_casefix { # partial reverse-engeenered implementation of case mapping $sel >>= 1; } - if ( substr($vc,0,1) eq 'x' ) { + if ( substr($vc,0,1) eq 'x' || ( $vc eq 'am ' && $tag =~ m/^(200|210|225)$/ ) ) { #&& $sfi eq '$a' )) { $fixed = ucfirst $fixed; } @@ -86,7 +86,7 @@ csv_file( 'tsv/TEKTAG.csv', sub { my ( $idsl, $tag, $tagno, $id, $sfi, $sfino, $textkey, $textres, $vc ) = split(/\t/,$_); - my $text = vc_casefix( $vc, $textkey, $textres ); + my $text = vc_casefix( $tag, $sfi, $vc, $textkey, $textres ); return ( $idsl, $tag, $tagno, $id, $sfi, $sfino, $text ); }); @@ -96,7 +96,7 @@ csv_file( 'tsv/NUMTAG.csv', sub { my ( $IDSL, $TAG, $TAGNO, $ID, $SFI, $SFINO, $LTAG, $LTAGNO, $LID, $LSFI, $TXKEY, $TXRES, $VC, $STOPW ) = split(/\t/,$_); - my $text = vc_casefix( $VC, $TXKEY, $TXRES ); + my $text = vc_casefix( $TAG, $SFI, $VC, $TXKEY, $TXRES ); return ( $IDSL, $TAG, $TAGNO, $ID, $SFI, $SFINO, $text ); });