import matplotlib.pyplot as plt import sys import re ssr = open("ssr.txt", "r") wer = open("wer.txt", "r") reversedSSR = [] for line in reversed(list(open("ssr.txt"))): if (re.match('[0-9]+[\.]*[0-9]*\%', line)): reversedSSR.append(line.replace('%','').replace('\n','')) if (len(reversedSSR) >= 50): break SSR = [] for i in reversed(reversedSSR): SSR.append(float(i)) reversedWER = [] for line in reversed(list(open("wer.txt"))): if (re.match('AVG: [0-9]+[\.]*[0-9]*\%', line)): reversedWER.append(line.replace('%','').replace('\n','').replace('AVG: ','')) if (len(reversedWER) >= 50): break WER = [] for i in reversed(reversedWER): WER.append(float(i)) plt.plot(SSR) plt.xlabel('timeline') plt.ylabel('ssr') plt.savefig('ssr.png', dpi=800) plt.close() plt.plot(WER) plt.xlabel('timeline') plt.ylabel('wer') plt.savefig('wer.png', dpi=800) plt.close()