NMTKD / translation /translate-hi-en.sh
sakharamg's picture
Uploading all files
158b61b
raw
history blame
978 Bytes
BASE="output-translation/flores"
# Path to Input file
INP="input-files/flores/hin.devtest"
# INP=$BASE"/input.txt"
LOW=$BASE"/test-low.hi"
TOK=$BASE"/test-tok.hi"
BPEI=$BASE"/test-hyp-i.hi"
BPE=$BASE"/test-hyp.hi"
TRANS=$BASE"/test.en"
# Path to Output file
OUT=$BASE"/test-flores.en"
MODEL="hi-en/model.pt"
CODES="hi-en/bpe-codes/bpe-codes.hi"
python3 tools/indic_nlp_library/indicnlp/normalize/indic_normalize.py $INP $LOW hi
python3 tools/indic_nlp_library/indicnlp/tokenize/indic_tokenize.py $LOW $TOK hi
python3 apply_bpe.py -c $CODES < $TOK > $BPEI
python3 merge_bpe_word.py $BPEI $TOK $BPE
CUDA_VISIBLE_DEVICES=0 python3 /home/development/akashb/web-service/OpenNMT-py/translate.py --gpu 0 --model $MODEL --src $BPE --output $TRANS
# onmt_translate -model $MODEL -src $BPE -output $TRANS -gpu 0
sed -r -i 's/(@@ )|(@@ ?$)//g; s/ ▁//g' $TRANS
tools/mosesdecoder/scripts/tokenizer/detokenizer.perl < $TRANS > $OUT
rm $LOW
# rm $TOK
rm $BPE
rm $BPEI
rm $TRANS