train-scripts / run_eval_cohesion.sh
Ashton2000's picture
Upload folder using huggingface_hub
981b783 verified
#!/bin/bash
dir_path=$1
lang=$2
src_lang=${lang%%-*}
tgt_lang=${lang##*-}
data_path=/data/wyt/codes/DocDPO/data/2017-01-ted-test/$lang
for i in {0..11}; do
# source=$data_path/test.en.$i
target=$dir_path/IWSLT17.TED.tst2017.${lang}.${src_lang}.$i.${tgt_lang}
reference=$data_path/IWSLT17.TED.tst2017.${lang}.${tgt_lang}.$i
result=$dir_path/cohesion.txt
# echo $target
python -u /data/wyt/codes/DocDPO/evaluator/fine_grained_multi_demensional/eval_cohesion.py \
--model gpt-4.1 \
--input_file $target \
--reference_file $reference \
--target_language $tgt_lang \
--output_file $result
done
python /data/wyt/codes/DocDPO/evaluator/fine_grained_multi_demensional/calc_avg_cohesion.py $dir_path/cohesion.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