File size: 736 Bytes
158b61b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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