s407604-mlworkshops2/skrypt2.sh
2019-04-26 16:19:51 +02:00

11 lines
648 B
Bash

cut -f 2 wikiniews_results.tsv > reference.txt
cut -f 3 wikiniews_results.tsv > 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 > tekst.txt
grep 'Scores:' tekst.txt | cut -d ' ' -f 6-9 > oceny.txt
awk '{print ($2 + $3 + $4)/($1 + $2 + $3)}' oceny.txt > WER.txt
awk '{sum += $1; n++} END {if (n>0) print sum/n;}' WER.txt > WER_SRR.txt
awk '{n++; if ($2==0 && $3==0 && $4==0) corr++} END {print corr/n;}' oceny.txt >> WER_SRR.txt