s460929-mlworkshops/count.sh

17 lines
618 B
Bash
Raw Normal View History

2020-04-03 13:05:00 +02:00
#!/bin/bash
2020-04-03 14:19:40 +02:00
MYFILE="wikiniews_results.tsv"
2020-04-04 15:24:01 +02:00
COUNT=$(wc -l "$MYFILE" | awk '{print $1}')
2020-04-03 15:30:30 +02:00
echo $COUNT
2020-04-03 14:16:40 +02:00
# create trn
2020-04-03 14:19:40 +02:00
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
2020-04-03 14:16:40 +02:00
#wer for each line
2020-04-10 17:36:56 +02:00
echo wer.txt | sclite -f 0 -r reference.trn trn -h hypothesis.trn trn -e utf-8 -i rm -o all stdout > scliteresult.txt
2020-04-04 15:24:01 +02:00
COUNT_DIFF=$(diff hypothesis.trn reference.trn | grep "^>" | wc -l)
echo $COUNT_DIFF
2020-04-03 14:44:38 +02:00
2020-04-10 18:51:22 +02:00
echo $(echo "$COUNT_DIFF/$COUNT" | bc -l) >> srr_results.txt
2020-04-10 19:14:12 +02:00
echo "$(tail -50 "srr_results.txt")" > srr_results.txt