Change opening mode

This commit is contained in:
Gabriela Pałka 2020-04-03 16:30:37 +02:00
parent 1566da1849
commit 0bd59dfc21

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('wer.txt', 'a+') 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
@ -18,9 +18,9 @@ if __name__ == '__main__':
complited = True complited = True
if complited: if complited:
wer.write(f'{word_error_rate:.5f}\n') wer.write(f'{word_error_rate:.6f}\n')
if word_error_rate == 0: if word_error_rate == 0:
correct_sentences += 1 correct_sentences += 1
sentence_recognition_rate = correct_sentences / number_of_sentence sentence_recognition_rate = correct_sentences / number_of_sentence
srr.write(f'{sentence_recognition_rate:.5f}\n') srr.write(f'{sentence_recognition_rate:.6f}\n')