From 961e2e8f2a9367700c96d8c05be7ba840705ef21 Mon Sep 17 00:00:00 2001 From: Bartosz Pawlak Date: Fri, 1 Jun 2018 20:59:45 +0000 Subject: [PATCH] labs04 labs04 --- zadaniedomowe1/labs04/cwiczenie5.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 zadaniedomowe1/labs04/cwiczenie5.py diff --git a/zadaniedomowe1/labs04/cwiczenie5.py b/zadaniedomowe1/labs04/cwiczenie5.py new file mode 100644 index 0000000..39c7d9a --- /dev/null +++ b/zadaniedomowe1/labs04/cwiczenie5.py @@ -0,0 +1,23 @@ +import os + +import glob + +import re + +import pandas + + + +if __name__ == "__main__": + + bleu_files = glob.glob('./scores/model.iter*.npz.bleu') + + lines = [] + + for bleu_file in bleu_files: + + lines += [[os.path.abspath(bleu_file), float(re.sub(r'.*?=\s*([^,]+).*', '\\1', line.rstrip('\n')))] for line in open(bleu_file)] + + df = pandas.DataFrame(lines, columns=list('AB')) + + print(df['A'].loc[df['B'].idxmax()])