more tweaks to capitalization based on fields
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 14 Sep 2013 13:15:34 +0000 (15:15 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 14 Sep 2013 13:15:34 +0000 (15:15 +0200)
crolist2marc.pl

index 50ae051..720b2e7 100755 (executable)
@@ -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 );
 });