s460929-mlworkshops/count.sh
2020-04-10 16:41:31 +02:00

19 lines
660 B
Bash

#!/bin/bash
MYFILE="wikiniews_results.tsv"
COUNT=$(wc -l "$MYFILE" | awk '{print $1}')
echo $COUNT
# create trn
cut -f2 $MYFILE | awk 'BEGIN{FS=OFS="\t"}{print $0,"(sp1_"NR")"}' > hypothesis.trn
cut -f3 $MYFILE | awk 'BEGIN{FS=OFS="\t"}{print $0,"(sp1_"NR")"}' > reference.trn
#wer for each line
echo wer.txt | sclite -f 0 -r reference.trn trn -h hypothesis.trn trn -e utf-8 -i rm -o all stdout >> wer.txt
COUNT_DIFF=$(diff hypothesis.trn reference.trn | grep "^>" | wc -l)
echo $COUNT_DIFF
let RESULT=$COUNT_DIFF/$COUNT
echo $(echo "$COUNT_DIFF/$COUNT" | bc -l)
echo $(echo "$COUNT_DIFF/$COUNT" | bc -l) >> srr2.txt
echo "$(tail -50 "srr.txt")" > srr2.txt