summaryrefslogtreecommitdiff
path: root/corpus/tokenize-anything.sh
blob: bca954d15d666602fba923cef823f2e797238f4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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 |
  $SUPPORT/fix-eos.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;}'