mirror of
https://github.com/Helsinki-NLP/OPUS-MT-train.git
synced 2024-09-11 20:27:19 +03:00
45 lines
958 B
Bash
45 lines
958 B
Bash
#!/bin/bash
|
||
#
|
||
# USAGE preprocess.sh < input > output
|
||
#
|
||
## simple pre-processing steps adapted from Moses tools
|
||
|
||
sed -e 's/,/,/g' \
|
||
-e 's/。 */. /g' \
|
||
-e 's/、/,/g' \
|
||
-e 's/”/"/g' \
|
||
-e 's/“/"/g' \
|
||
-e 's/∶/:/g' \
|
||
-e 's/:/:/g' \
|
||
-e 's/?/\?/g' \
|
||
-e 's/《/"/g' \
|
||
-e 's/》/"/g' \
|
||
-e 's/)/\)/g' \
|
||
-e 's/!/\!/g' \
|
||
-e 's/(/\(/g' \
|
||
-e 's/;/;/g' \
|
||
-e 's/1/"/g' \
|
||
-e 's/」/"/g' \
|
||
-e 's/「/"/g' \
|
||
-e 's/0/0/g' \
|
||
-e 's/3/3/g' \
|
||
-e 's/2/2/g' \
|
||
-e 's/5/5/g' \
|
||
-e 's/6/6/g' \
|
||
-e 's/9/9/g' \
|
||
-e 's/7/7/g' \
|
||
-e 's/8/8/g' \
|
||
-e 's/4/4/g' \
|
||
-e 's/. */. /g' \
|
||
-e 's/~/\~/g' \
|
||
-e "s/’/\'/g" \
|
||
-e 's/…/\.\.\./g' \
|
||
-e 's/━/\-/g' \
|
||
-e 's/〈/\</g' \
|
||
-e 's/〉/\>/g' \
|
||
-e 's/【/\[/g' \
|
||
-e 's/】/\]/g' \
|
||
-e 's/%/\%/g' |
|
||
perl -C -pe 's/\p{C}/ /g;' |
|
||
sed 's/ */ /g;s/^ *//g;s/ *$//g'
|