diff options
author | Michael Denkowski <mdenkows@cs.cmu.edu> | 2013-09-05 14:15:43 -0700 |
---|---|---|
committer | Michael Denkowski <mdenkows@cs.cmu.edu> | 2013-09-05 14:15:43 -0700 |
commit | c55f37fee9f43c0a13b47aac512804ecf9f5bd48 (patch) | |
tree | 5b29abbc119dab32d1e991fc4fd55594803b6850 /corpus/support/utf8-normalize.sh | |
parent | 208fabfbbe19c1ba2ee744e9d16b54805ec8b141 (diff) |
Slower but correct (wrt buffered) unbuffered version.
Diffstat (limited to 'corpus/support/utf8-normalize.sh')
-rwxr-xr-x | corpus/support/utf8-normalize.sh | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/corpus/support/utf8-normalize.sh b/corpus/support/utf8-normalize.sh index c85ae9f7..af9895ba 100755 --- a/corpus/support/utf8-normalize.sh +++ b/corpus/support/utf8-normalize.sh @@ -25,13 +25,19 @@ else fi fi -perl -e '$|++; while(<>){s/\r\n*/\n/g; print;}' | $CMD | /usr/bin/perl -w -e ' - $|++; - while (<>) { - chomp; - s/[\x00-\x1F]+/ /g; - s/ +/ /g; - s/^ //; - s/ $//; - print "$_\n"; - }' +if [[ $# == 1 && $1 == "--batchline" ]]; then + perl $(dirname $0)/utf8-normalize-batch.pl "$CMD" +else + perl -e '$|++; while(<>){s/\r\n*/\n/g; print;}' \ + |$CMD \ + |/usr/bin/perl -w -e ' + $|++; + while (<>) { + chomp; + s/[\x00-\x1F]+/ /g; + s/ +/ /g; + s/^ //; + s/ $//; + print "$_\n"; + }' +fi |