summaryrefslogtreecommitdiff
path: root/corpus/tokenize-anything.sh
blob: 5b7933d872ee06a8530925fa2baa21c7de810113 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash

ROOTDIR=`dirname $0`
SUPPORT=$ROOTDIR/support

if [[ $# == 1 && $1 == '-u' ]] ; then
    NORMARGS="--batchline"
    SEDFLAGS="-u"
else
    NORMARGS=""
    SEDFLAGS=""
fi

$SUPPORT/utf8-normalize.sh $NORMARGS |
  $SUPPORT/quote-norm.pl |
  $SUPPORT/tokenizer.pl |
  sed $SEDFLAGS -e 's/ al - / al-/g' |
  $SUPPORT/fix-contract.pl |
  sed $SEDFLAGS -e 's/^ //' | sed $SEDFLAGS -e 's/ $//' |
  perl -e '$|++; while(<>){s/(\d+)(\.+)$/$1 ./; s/(\d+)(\.+) \|\|\|/$1 . |||/;  print;}'