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

Improved latex tab generator

parent f6d89f91
Branches
No related tags found
No related merge requests found
...@@ -2,28 +2,31 @@ ...@@ -2,28 +2,31 @@
import sys import sys
metrics = []
def toIgnore(model) : def toIgnore(model) :
return "bt2" in model return "bt2" in model
def modelName(model) : def modelName(model) :
if "bt1" in model.lower() : if "bt1" in model.lower() :
return "RL_BT1" return "RL\_BT1"
if "no" in model.lower() : if "no" in model.lower() :
return "RL_NOBT" return "RL\_NOBT"
if "oracle" in model.lower() : if "oracle" in model.lower() :
return "SUPERVISED" return "SL"
print("ERROR %s not found"%model)
exit(1)
return "NOT FOUND" return "NOT FOUND"
def nicePValue(p) : def nicePValue(p) :
if p == "_" : if p == "_" :
return p return "\_"
return "%.3f"%p return "%.3f"%p
for line in open(sys.argv[1]) : for filename in sys.argv[1:] :
metrics = []
for line in open(filename) :
line = line.strip() line = line.strip()
if len(line) == 0 : if len(line) == 0 or "------" in line :
continue continue
splited = line.split() splited = line.split()
if len(splited) == 1 : if len(splited) == 1 :
...@@ -36,7 +39,7 @@ for line in open(sys.argv[1]) : ...@@ -36,7 +39,7 @@ for line in open(sys.argv[1]) :
if len(splited) == 9 : if len(splited) == 9 :
metrics[-1][1][-1].append(splited[8].split('=')[-1]) metrics[-1][1][-1].append(splited[8].split('=')[-1])
else : else :
metrics[-1][1][-1].append("_") metrics[-1][1][-1].append("\_")
asTab = [["\\textbf{Model}"] + ["\\textbf{%s}"%[m[0],"p"][i] for m in metrics for i in [0,1]]] asTab = [["\\textbf{Model}"] + ["\\textbf{%s}"%[m[0],"p"][i] for m in metrics for i in [0,1]]]
models = {} models = {}
...@@ -52,13 +55,17 @@ for model in models : ...@@ -52,13 +55,17 @@ for model in models :
asTab.append([modelName(model)]) asTab.append([modelName(model)])
asTab[-1] += [models[model][i][0][j] for i in range(len(metrics)) for j in [0,2]] asTab[-1] += [models[model][i][0][j] for i in range(len(metrics)) for j in [0,2]]
print("""\\begin{table}[] print("""\\begin{table}
\\begin{tabular}{|l|l|l|l|} \centering
\\tabcolsep=0.8mm
\\begin{tabular}{|l|l|l|l|l|}
\hline""") \hline""")
for line in asTab : for line in asTab :
print(" & ".join(line), "\\\\ \hline") print(" & ".join(line), "\\\\ \hline")
print("""\end{tabular} print("""\end{tabular}
\caption{} \caption{%s on UD\_French-GSD}
\label{tab:my-table} \label{tab:res_%s}
\end{table}""") \end{table}
"""%(filename.split('.')[0],filename.split('.')[0]))
...@@ -8,6 +8,12 @@ def toIgnore(model) : ...@@ -8,6 +8,12 @@ def toIgnore(model) :
return "bt2" in model return "bt2" in model
def modelName(model) : def modelName(model) :
if "tagger" in model.lower() :
return "TAGGER"
if "tagparser" in model.lower() :
return "TAPARSER"
if "parser" in model.lower() :
return "PARSER"
if "bt1" in model.lower() : if "bt1" in model.lower() :
return "RL\_BT1" return "RL\_BT1"
if "no" in model.lower() : if "no" in model.lower() :
...@@ -34,10 +40,10 @@ targetValues = {"nbActions" : ("\#Actions",prettyInt), ...@@ -34,10 +40,10 @@ targetValues = {"nbActions" : ("\#Actions",prettyInt),
"nbBack" : ("\#Backs",prettyInt), "nbBack" : ("\#Backs",prettyInt),
"backPrecision" : ("bPrec",percent), "backPrecision" : ("bPrec",percent),
"backRecall" : ("bRec",percent), "backRecall" : ("bRec",percent),
"nbRedoneCorrectCorrect" : ("\%C$\\rightarrow$C",percent), "nbRedoneCorrectCorrect" : ("C$\\rightarrow$C",percent),
"nbRedoneErrErr" : ("\%E$\\rightarrow$E",percent), "nbRedoneErrErr" : ("E$\\rightarrow$E",percent),
"nbRedoneCorrectErr" : ("\%C$\\rightarrow$E",percent), "nbRedoneCorrectErr" : ("C$\\rightarrow$E",percent),
"nbRedoneErrCorrect" : ("\%E$\\rightarrow$C",percent)} "nbRedoneErrCorrect" : ("E$\\rightarrow$C",percent)}
for t in targetValues : for t in targetValues :
old = targetValues[t] old = targetValues[t]
targetValues[t] = ("\\texttt{%s}"%old[0],old[1]) targetValues[t] = ("\\texttt{%s}"%old[0],old[1])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment