Skip to content
Snippets Groups Projects
Commit 70bf7113 authored by Franck Dary's avatar Franck Dary
Browse files

Added script to print results of btch experiments

parent 37598301
Branches
No related tags found
No related merge requests found
#! /usr/bin/python3
import glob
import sys
if __name__ == "__main__" :
metrics = ["LAS","UAS","Tokens","Sentences","UPOS","UFeats","Lemmas"]
output = []
for pathToFile in glob.iglob("" + '*stdout') :
model = pathToFile.split(".")[0].split("_UD_")[0]
corpus = pathToFile.split(".")[0].split("_UD_")[1]
for line in open(pathToFile, "r") :
for metric in metrics :
if metric in line and metric[0] == line[0]:
splited = line.strip().replace("|","").split()
output.append([corpus, splited[0], splited[3], model])
maxColLens = [0 for _ in range(len(output[0]))]
for line in output :
for i in range(len(line)) :
maxColLens[i] = max(maxColLens[i], len(line[i]))
output.sort()
output = [["Corpus","Metric","F1.score","Model"]] + output
dashLine = '-' * 80
for i in range(len(output)) :
if i > 0 and output[i][0] != output[i-1][0] :
print(dashLine)
elif i > 0 and output[i][1] != output[i-1][1] :
print("")
for j in range(len(output[i])) :
padding = (' '*(maxColLens[j]-len(output[i][j])))+" "*3
print(output[i][j], end=padding)
print("")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment