Update 2 Task 3

This commit is contained in:
s416178 2020-04-03 13:18:44 +02:00
parent 5ce3d39208
commit b62473820d
2 changed files with 9 additions and 5 deletions

6
Jenkinsfile vendored
View File

@ -11,10 +11,10 @@ pipeline {
stage('Run script and save results') {
steps {
sh('chmod +x ./shell_script.sh')
sh('./shell_script.sh wikiniews_results.tsv > result.log')
sh('./shell_script.sh wikiniews_results.tsv')
archiveArtifacts 'result.log'
archiveArtifacts 'hypothesis.trn'
archiveArtifacts 'reference.trn'
archiveArtifacts 'wer.txt'
archiveArtifacts 'srr.txt'
}
}
}

View File

@ -1,6 +1,6 @@
#!/bin/bash
wc -l $1
wc -l $1 > result.log
cut -f 2 $1 > hypothesis.txt
cut -f 3 $1 > reference.txt
@ -8,4 +8,8 @@ cut -f 3 $1 > reference.txt
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
sclite -f 0 -r reference.trn trn -h hypothesis.trn trn -e utf-8 -i rm -o all stdout
sclite -f 0 -r reference.trn trn -h hypothesis.trn trn -e utf-8 -i rm -o all stdout | grep Scores > scores
awk 'BEGIN{FS=OFS="\t"}{ print $6, $7, $8, $9 }' scores | awk '{ print ($2 + $3 + $4)/($2 + $3 + $1) }' > wer.tsv
awk 'BEGIN{FS=OFS="\t"}{ bad = bad + $1; all++ }END{ print bad/all }' wer.tsv > wer.txt
awk 'BEGIN{FS=OFS="\t"}{ if ( $1 == 0 ) good++; all++ }END{ print good/all }' wer.tsv > srr.txt