From c81375e35610b6cf71f0fb8641e90b526fad4c0a Mon Sep 17 00:00:00 2001 From: s152483 Date: Wed, 22 Apr 2020 22:31:46 +0200 Subject: [PATCH] Metrics --- Jenkinsfile | 3 +++ cl.sh | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 382d066..ade9cff 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,6 +20,9 @@ pipeline { stage('Archive Artifacts') { steps { archiveArtifacts 'cl_result.txt' + archiveArtifacts 'wikiniews_results_wer.tsv' + archiveArtifacts 'wer.txt' + archiveArtifacts 'srr.txt' } } } diff --git a/cl.sh b/cl.sh index 078faf6..5d02bfc 100644 --- a/cl.sh +++ b/cl.sh @@ -1,3 +1,22 @@ #!/bin/sh -wc -l wikiniews_results.tsv > cl_result.txt \ No newline at end of file +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 +awk 'BEGIN{OFS="\t"}' < scores | awk '{print ($2+$3+$4)/($2+$3+$1)}' > wer.tsv +paste wikiniews_results.tsv wer.tsv > wikiniews_results_wer.tsv +awk '{notCorrect+=$1; sum++} END {print notCorrect/sum}' < wer.tsv >> wer.txt + +# SRR +awk '{if($1==0) correct++; total++} END {print correct/total}' < wer.tsv >> srr.txt \ No newline at end of file