2020-04-03 12:39:23 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-04-22 22:31:46 +02:00
|
|
|
wc -l wikiniews_results.tsv > cl_result.txt
|
|
|
|
|
|
|
|
# Otrzymanie plików reference.txt i hypothesis.txt
|
|
|
|
cut -f 2 wikiniews_results.tsv > hypothesis.txt
|
|
|
|
cut -f 3 wikiniews_results.tsv > reference.txt
|
|
|
|
|
|
|
|
# Zmiana formatu z txt na trn
|
|
|
|
awk 'BEGIN{FS=OFS="\t"}{print $0,"(sp1_"NR")"}' < hypothesis.txt > hypothesis.trn
|
|
|
|
awk 'BEGIN{FS=OFS="\t"}{print $0,"(sp1_"NR")"}' < reference.txt > reference.trn
|
|
|
|
|
|
|
|
# Wywołanie SCLITE
|
|
|
|
sclite -f 0 -r reference.trn trn -h hypothesis.trn trn -e utf-8 -i rm -o all stdout | grep Scores > scores
|
|
|
|
|
|
|
|
# WER
|
2020-04-22 22:37:07 +02:00
|
|
|
awk 'BEGIN{OFS="\t"}{print $6, $7, $8, $9}' < scores | awk '{print ($2+$3+$4)/($2+$3+$1)}' > wer.tsv
|
2020-04-22 22:31:46 +02:00
|
|
|
paste wikiniews_results.tsv wer.tsv > wikiniews_results_wer.tsv
|
2020-04-22 22:37:07 +02:00
|
|
|
awk 'BEGIN{FS=OFS="\t"}{notCorrect+=$1; sum++} END {print notCorrect/sum}' < wer.tsv >> wer.txt
|
2020-04-22 22:31:46 +02:00
|
|
|
|
|
|
|
# SRR
|
2020-04-22 22:37:07 +02:00
|
|
|
awk 'BEGIN{FS=OFS="\t"}{if($1==0) correct++; total++} END {print correct/total}' < wer.tsv >> srr.txt
|