s416422-mlworkshops/script.sh
2019-04-26 15:18:47 +02:00

17 lines
604 B
Bash

FILE=$1
awk 'BEGIN{FS=OFS="\t"}{print $0,"(sp1_"NR")"}' < FILE > reference_a.trn
cut -f2 $FILE > reference.txt
cut -f3 $FILE > hypothesis.txt
awk 'BEGIN{FS=OFS="\t"}{print $0,"(sp1_"NR")"}' < reference.txt > reference.trn
awk 'BEGIN{FS=OFS="\t"}{print $0,"(sp1_"NR")"}' < hypothesis.txt > hypothesis.trn
sclite -f 0 -r reference.trn trn -h hypothesis.trn trn -e utf-8 -i rm -o all stdout > WER_SSR.txt
cat WER_SSR.txt | grep -oP '(?<=Scores: \(#C #S #D #I\) ).*' > values.txt
awk '{ print ($2+$3+$4)/($2+$3+$1) }' values.txt > WER_outcomes.txt
paste $FILE WER_outcomes.txt > wikiniews_results2.tsv