s452097-mlworkshops/metrics.sh
2020-04-03 18:19:31 +02:00

18 lines
534 B
Bash

#!/bin/bash
cut -f2 wikiniews_results.tsv > hypothesis.txt
cut -f3 wikiniews_results.tsv > reference.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 > wynik2.txt
python3 WERcreator.py
paste wikiniews_results.tsv wer.txt > new.txt && mv new.txt wikiniews_results.tsv
python3 werAvCounter.py
rm wer.txt
mv werFinish.txt wer.txt