From 1fb0be242b4532e03f2996dfaf48d501683831e7 Mon Sep 17 00:00:00 2001 From: s407323 Date: Fri, 26 Apr 2019 16:01:09 +0200 Subject: [PATCH] grep WER --- Jenkinsfile | 5 +++-- zadanie3/grep.sh | 7 +++++++ zadanie3/script.py | 11 ----------- zadanie3/trn.sh | 3 +-- 4 files changed, 11 insertions(+), 15 deletions(-) create mode 100644 zadanie3/grep.sh delete mode 100644 zadanie3/script.py diff --git a/Jenkinsfile b/Jenkinsfile index 711e8f6..37cb826 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -34,8 +34,9 @@ pipeline { sh './zadanie3/trn.sh' archiveArtifacts 'zadanie3/hypothesis.trn' archiveArtifacts 'zadanie3/reference.trn' - archiveArtifacts 'zadanie3/results.txt' - archiveArtifacts 'zadanie3/results-p.txt' + + sh 'chmod 755 ./zadanie3/grep.sh' + sh './zadanie3/grep.sh' } } } diff --git a/zadanie3/grep.sh b/zadanie3/grep.sh new file mode 100644 index 0000000..bc45208 --- /dev/null +++ b/zadanie3/grep.sh @@ -0,0 +1,7 @@ + +cat zadanie3/sclite.txt | grep -oP '(?<=Scores: \(#C #S #D #I\) ).*' > results_wer.txt + +# (S + D + I)/(S + D + C) +awk '{ print ($2 + $3 + $4) / ($2 + $3 + $1) }' results_wer.txt + +cat results_wer.txt \ No newline at end of file diff --git a/zadanie3/script.py b/zadanie3/script.py deleted file mode 100644 index fd0fcd6..0000000 --- a/zadanie3/script.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -import numpy, pandas - -input_data = pandas.read_csv('ASR-eval/wikiniews_results.tsv', encoding='latin1', error_bad_lines=False, sep='\t', header=None) -sentences = input_data[1] -references = input_data[2] - -numpy.savetxt('zadanie3/sentences.txt', sentences, '%s') -numpy.savetxt('zadanie3/references.txt', references, '%s') \ No newline at end of file diff --git a/zadanie3/trn.sh b/zadanie3/trn.sh index e734817..6e3f32b 100644 --- a/zadanie3/trn.sh +++ b/zadanie3/trn.sh @@ -5,5 +5,4 @@ cut -f 3 ASR-eval/wikiniews_results.tsv > zadanie3/reference.txt awk 'BEGIN{FS=OFS="\t"}{print $0,"(sp1_"NR")"}' < zadanie3/hypothesis.txt > zadanie3/hypothesis.trn awk 'BEGIN{FS=OFS="\t"}{print $0,"(sp1_"NR")"}' < zadanie3/reference.txt > zadanie3/reference.trn -sclite -f 0 -r zadanie3/reference.trn trn -h zadanie3/hypothesis.trn trn -e utf-8 -i rm -o all stdout > zadanie3/results.txt -sclite -f 0 -r zadanie3/reference.trn trn -h zadanie3/hypothesis.trn trn -e utf-8 -i rm -o all -p > zadanie3/results-p.txt \ No newline at end of file +sclite -f 0 -r zadanie3/reference.trn trn -h zadanie3/hypothesis.trn trn -e utf-8 -i rm -o all stdout > zadanie3/sclite.txt \ No newline at end of file