File size: 2,025 Bytes
981b783 |
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 42 43 44 45 46 47 48 |
#!/bin/bash
# lang=en-de
# lang=en-zh
lang=$2
src_lang=${lang%%-*}
tgt_lang=${lang##*-}
dir_path=$1
level=$3
data_path=/data/wyt/codes/DocDPO/data/2017-01-ted-test/$lang
# align_script_path=/data/wyt/codes/DocMTAgent/Bleualign
# dir_path=/data/wyt/codes/DocDPO/inference_mcts_shorten_rag_entity_tldr_vq_lowerbound_comet/results/window10_epc2/en-zh
# dir_path=/data/wyt/codes/DocDPO/inference_mcts_shorten_rag_entity_tldr_vq_lowerbound_comet/results/window10_epc1/en-zh
# dir_path=/data/wyt/codes/DocDPO/inference_mcts_shorten_rag_entity_tldr_vq_lowerbound_comet/results/window10_epc1_trans14b/en-zh
echo $dir_path
python preprocess_robust.py \
--original_src_path /data/wyt/codes/DocDPO/data/2017-01-ted-test/${src_lang}-${tgt_lang} \
--disturb_src_path /data/wyt/codes/DocDPO/data/ted_robust/level_${level}/${src_lang}-${tgt_lang} \
--tgt_path results_robust/level_${level}/${src_lang}-${tgt_lang}_1200 \
--output_path results_robust/level_${level}/${src_lang}-${tgt_lang}_1200/tmp_robust \
--lang_pair $lang
for i in {0..11}; do
source=$data_path/IWSLT17.TED.tst2017.$lang.$src_lang.$i
target=results_robust/level_${level}/${src_lang}-${tgt_lang}_1200/tmp_robust/IWSLT17.TED.tst2017.$lang.$src_lang.$i.$tgt_lang
reference=$data_path/IWSLT17.TED.tst2017.$lang.$tgt_lang.$i
python comet_api.py -s $source -t $target -r $reference -u 127.0.0.1:8088 >> $dir_path/comet_api.txt
done
python calc_avg_comet.py $dir_path/comet_api.txt
# cd $dir_path/aligned
# file_nums=$(ls test.*-s | sort -n -t . -k 2 | xargs wc -l | head -n -1 | awk '{ print $1 }')
# echo $file_nums
# cat $(ls test.*-t | sort -n -t . -k 2) > $dir_path/whole.hyp
# cat $(ls test.*-s | sort -n -t . -k 2) > $dir_path/whole.src
# sh /data/wyt/codes/DocMTAgent/consistency_evaluation/run_eval_sep.sh \
# $dir_path/whole.src $dir_path/whole.hyp $dir_path/consistency $lang "$file_nums"
# cd $work_dir
# python indiversity_sep.py -r $dir_path/whole.src.record_sep.json | tee -a $dir_path/whole.src.consistency_sep
|