sacrebleu_pregen.sh 574 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

if [ $# -ne 4 ]; then
    echo "usage: $0 TESTSET SRCLANG TGTLANG GEN"
    exit 1
fi

TESTSET=$1
SRCLANG=$2
TGTLANG=$3

GEN=$4

echo 'Cloning Moses github repository (for tokenization scripts)...'
git clone https://github.com/moses-smt/mosesdecoder.git

SCRIPTS=mosesdecoder/scripts
Myle Ott's avatar
Myle Ott committed
18
DETOKENIZER=$SCRIPTS/tokenizer/detokenizer.perl
19
20
21
22
23
24
25
26
27
28

grep ^H $GEN \
| sed 's/^H\-//' \
| sort -n -k 1 \
| cut -f 3 \
| perl $DETOKENIZER -l $TGTLANG \
| sed "s/ - /-/g" \
> $GEN.sorted.detok

sacrebleu --test-set $TESTSET --language-pair "${SRCLANG}-${TGTLANG}" < $GEN.sorted.detok