conda activate onmtkd2 BASE="output-translation/flores" # Path to Input file INP="input-files/flores/eng.devtest" # INP=$BASE"/input.txt" LOW=$BASE"/test-low.en" TOK=$BASE"/test-tok.en" BPE=$BASE"/test-hyp.en" TRANS=$BASE"/test.hi" # Path to Output file OUT=$BASE"/test-flores.hi" MODEL="en-hi/model.pt" CODES="en-hi/bpe-codes/codes.en" # MODEL="../web-service/translation_models/en-hi/v1.0/model.pt" # CODES="../web-service/translation_models/en-hi/v1.0/bpe-codes/codes.en" tools/mosesdecoder/scripts/tokenizer/lowercase.perl < $INP > $LOW tools/mosesdecoder/scripts/tokenizer/tokenizer.perl < $LOW > $TOK subword-nmt apply-bpe -c $CODES < $TOK > $BPE onmt_translate -model $MODEL -src $BPE -output $TRANS # CUDA_VISIBLE_DEVICES=0 python3 /home/development/akashb/web-service/OpenNMT-py/translate.py --gpu 0 --model $MODEL --src $BPE --output $TRANS sed -r -i 's/(@@ )|(@@ ?$)//g; s/ ▁//g' $TRANS python3 tools/indic_nlp_library/indicnlp/tokenize/indic_detokenize.py $TRANS $OUT hi rm $LOW rm $TOK rm $BPE rm $TRANS conda deactivate