Clean up code

This commit is contained in:
Gabriela Pałka 2020-04-03 16:43:09 +02:00
parent 4fa3357cfd
commit 6be954481b
2 changed files with 4 additions and 4 deletions

View File

@ -6,8 +6,8 @@ if __name__ == '__main__':
correct_sentences = 0 correct_sentences = 0
with open(sys.argv[1], 'r') as sclite_result, \ with open(sys.argv[1], 'r') as sclite_result, \
open('wer.txt', 'w') as wer, \ open('new_wer.txt', 'w') as wer, \
open('srr.txt', 'w') as srr: open('srr.txt', 'a+') as srr:
for line in sclite_result: for line in sclite_result:
complited = False complited = False

View File

@ -6,5 +6,5 @@ cut -f3 $1 | awk 'BEGIN{FS=OFS="\t"}{print $0,"(sp1_"NR")"}' > reference.trn
sclite -f 0 -r reference.trn trn -h hypothesis.trn trn -e utf-8 -i rm -o all stdout > results.txt sclite -f 0 -r reference.trn trn -h hypothesis.trn trn -e utf-8 -i rm -o all stdout > results.txt
python3 count_metrics.py results.txt python3 count_metrics.py results.txt
paste wikiniews_results.tsv wer.txt > tmp.txt && mv tmp.txt wikiniews_results.tsv paste wikiniews_results.tsv wer.txt > tmp.txt && mv tmp.txt wikiniews_results.tsv
#awk '{ total += $1; count++ } END { print total/count }' wer.txt >> average && mv average wer.txt awk '{ total += $1; count++ } END { print total/count }' new_wer.txt >> wer.txt
awk '{ total += $1; count++ } END { print total/count }' wer.txt > average && mv average wer.txt rm results.txt new_wer.txt