Nantes Université

Skip to content
Extraits de code Groupes Projets
Valider ce42449a rédigé par ayushkumarshah's avatar ayushkumarshah
Parcourir les fichiers

feat: Fix description and lg2dot generation

parent e090d6c1
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -20,7 +20,8 @@ usage()
echo -e "-s or --strokes \t\tConstruct stroke(primitive) confusion histograms in addition"
echo -e "\t\t\t\tto object confusion histograms"
echo -e "-i or --lgimgDir <directory> \tThe directory containing the expression images of the lg files"
echo -e "-p or --dotpdfDir <directory> \tThe directory containing the expression images of the lg files"
echo -e "-p or --dotpdfDir <directory> \tThe directory containing the lg2dot comparison pdf outputs"
echo -e "\t\t\t\t If not provided, new lg2dot comparison outputs are generated and used"
echo -e "-sp or --split \t\t\tSeparate the more frequent(>minCount) errors and (<=minCount)"
echo -e "\t\t\t\terrors"
echo -e "-f or --filter \t\t\tIgnore the less frequent(<=minCount) errors"
......
......@@ -29,12 +29,10 @@ def main(fileList, minCount=1, confMat=False, confMatObj=True,
pdf_count = 0
if os.path.exists(dotpdf_dir):
pdf_count = len(glob(os.path.join(dotpdf_dir, '*.pdf')))
with open(fileList, 'r') as f:
lg_count = len(f.read().split('\n'))
if pdf_count != lg_count:
if not os.path.exists("confHist_outputs/dotpdfs"):
os.makedirs("confHist_outputs/dotpdfs")
if pdf_count == 0:
dotpdf_dir = "confHist_outputs/dotpdfs"
if not os.path.exists(dotpdf_dir):
os.makedirs(dotpdf_dir)
for row in fileReader:
# Skip comments and empty lines.
if not row == [] and not row[0].strip()[0] == "#":
......@@ -57,7 +55,7 @@ def main(fileList, minCount=1, confMat=False, confMatObj=True,
(head, tail) = os.path.split(lgfile1)
(base, _) = os.path.splitext(tail)
fileName = base + ".lg"
if pdf_count != lg_count:
if pdf_count == 0:
os.system("python $LgEvalDir/src/lg2dot.py " + lgfile1 + " " + lgfile2 + " >" + os.path.join(dotpdf_dir, base + ".dot"))
os.system("dot -Tpdf " + os.path.join(dotpdf_dir, base + ".dot") + " -o " + os.path.join(dotpdf_dir, base + ".pdf"))
if confMat:
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter