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

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

if [[ $# == 1 && $1 == '-u' ]] ; then
    NORMCMD=cat
else
    NORMCMD=$SUPPORT/utf8-normalize.sh
fi

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