|
BASE="output-translation" |
|
|
|
|
|
INP="input-files/input.mr" |
|
|
|
LOW=$BASE"/test-low.mr" |
|
TOK=$BASE"/test-tok.mr" |
|
BPE=$BASE"/test-hyp.mr" |
|
TRANS=$BASE"/test.en" |
|
|
|
|
|
OUT=$BASE"/output.en" |
|
|
|
MODEL="mr-en/model.pt" |
|
CODES="mr-en/bpe-codes/bpe-codes.mr" |
|
|
|
|
|
python3 tools/indic_nlp_library/indicnlp/normalize/indic_normalize.py $INP $LOW mr |
|
|
|
python3 tools/indic_nlp_library/indicnlp/tokenize/indic_tokenize.py $LOW $TOK mr |
|
|
|
subword-nmt apply-bpe -c $CODES < $TOK > $BPE |
|
|
|
onmt_translate -model $MODEL -src $BPE -output $TRANS -gpu 0 |
|
|
|
sed -r -i 's/(@@ )|(@@ ?$)//g' $TRANS |
|
|
|
sed -r -i 's/ &apos;//g' $TRANS |
|
|
|
tools/mosesdecoder/scripts/tokenizer/detokenizer.perl < $TRANS > $OUT |
|
|
|
|
|
rm $LOW |
|
|
|
rm $BPE |
|
rm $TRANS |
|
|