new-words

diff new-words.sh @ 15:c6efd17741aa

Точка, следующая за Mr./Mrs. не считается окончанием предложения
author Igor Chubin <igor@chub.in>
date Sun Apr 04 14:12:35 2010 +0300 (2010-04-04)
parents 975b549364f2
children c65ffd60cc18
line diff
     1.1 --- a/new-words.sh	Sat Apr 03 15:11:12 2010 +0300
     1.2 +++ b/new-words.sh	Sun Apr 04 14:12:35 2010 +0300
     1.3 @@ -60,7 +60,25 @@
     1.4      total_known="`echo $total-$total_unknown|bc`"
     1.5      percentage="`echo '100*('$total-$total_unknown')'/$total | bc -l | sed 's/\\.\(.\).*/.\1/'`"
     1.6      echo "# $LANGUAGE, $percentage, <$total_known/$total>"
     1.7 -    cat "$after"
     1.8 +    PERL_SCRIPT_TEMP_NAME=`mktemp /tmp/perl-grep-v-english-XXXXXXXX`
     1.9 +    cat <<'PERL_SCRIPT' > $PERL_SCRIPT_TEMP_NAME
    1.10 +my $total=shift(@ARGV);
    1.11 +my $total_known=shift(@ARGV);
    1.12 +my $s=0;
    1.13 +my $mark_line=int($total_known*100/$total/5)*5+5;
    1.14 +while(<>)
    1.15 +{
    1.16 +    print;
    1.17 +    /^\s*([0-9]*)\s*/;
    1.18 +    $s+=$1;
    1.19 +    if (int(($total_known+$s)*100/$total)>=$mark_line) {
    1.20 +        print "# $mark_line\n";
    1.21 +        if ($mark_line>=90) { $mark_line+=1; } else { $mark_line +=5; };
    1.22 +    }
    1.23 +}
    1.24 +PERL_SCRIPT
    1.25 +    perl $PERL_SCRIPT_TEMP_NAME "$total" "$total_known" "$after"
    1.26 +    rm $PERL_SCRIPT_TEMP_NAME
    1.27      rm $after
    1.28  }
    1.29