-
Notifications
You must be signed in to change notification settings - Fork 30
/
apply_bpe_traindevtest_notag.sh
41 lines (34 loc) · 1.22 KB
/
apply_bpe_traindevtest_notag.sh
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
38
39
40
41
#!/bin/bash
expdir=$1 # EXPDIR
SUBWORD_NMT_DIR="subword-nmt"
data_dir="$expdir/data"
mkdir -p $expdir/bpe
for dset in `echo train dev test`
do
echo $dset
in_dset_dir="$data_dir/$dset"
out_dset_dir="$expdir/bpe/$dset"
# out_dset_dir="$expdir/final/$dset"
echo "Apply joint vocab to SRC corpus"
# for very large datasets, use gnu-parallel to speed up applying bpe
# uncomment the below line if the apply bpe is slow
# parallel --pipe --keep-order \
python $SUBWORD_NMT_DIR/subword_nmt/apply_bpe.py \
-c $expdir/vocab/bpe_codes.32k.SRC_TGT \
--vocabulary $expdir/vocab/vocab.SRC \
--vocabulary-threshold 5 \
--num-workers "-1" \
< $in_dset_dir.SRC \
> $out_dset_dir.SRC
echo "Apply joint vocab to TGT corpus"
# for very large datasets, use gnu-parallel to speed up applying bpe
# uncomment the below line if the apply bpe is slow
# parallel --pipe --keep-order \
python $SUBWORD_NMT_DIR/subword_nmt/apply_bpe.py \
-c $expdir/vocab/bpe_codes.32k.SRC_TGT \
--vocabulary $expdir/vocab/vocab.TGT \
--vocabulary-threshold 5 \
--num-workers "-1" \
< $in_dset_dir.TGT \
> $out_dset_dir.TGT
done