NMTKD / translation /translate-mr-en.sh
sakharamg's picture
Uploading all files
158b61b
BASE="output-translation"
# Path to Input file
INP="input-files/input.mr"
LOW=$BASE"/test-low.mr"
TOK=$BASE"/test-tok.mr"
BPE=$BASE"/test-hyp.mr"
TRANS=$BASE"/test.en"
# Path to Output file
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/ &amp;apos;//g' $TRANS
tools/mosesdecoder/scripts/tokenizer/detokenizer.perl < $TRANS > $OUT
rm $LOW
#rm $TOK
rm $BPE
rm $TRANS