new_tools / avg_wer.py
patrickvonplaten's picture
improve
84a4607
raw
history blame contribute delete
396 Bytes
#!/usr/bin/env python3
import sys
file = sys.argv[1]
key = sys.argv[2]
with open(file, "r") as f:
lines = f.readlines()
wers = []
count = 0
for line in lines:
if key in line:
wers.append(float(line.split(key)[-1].lstrip().rstrip()))
count += 1
mean = sum(wers) / len(wers)
var = sum([(w - mean)**2 for w in wers]) / len(wers)
print("mean", mean)
print("var", var)