INNER CODE UNIT · Python
evaluate_error_cases
grobidOrg/grobid · grobid-home/scripts/select_error_cases.py:106
def evaluate_error_cases(grobid_tei, jats_files, grobid_training=None, output=None):
interesting_error_cases = []
ns = {"tei": "http://www.tei-c.org/ns/1.0"}
for root, directories, filenames in os.walk(grobid_tei):
for filename in filenames:
if filename.endswith(".tei.xml"):
tei_file = os.path.join(root, filename)
jats_file = os.path.join(jats_files, filename.replace(".tei.xml", ""), filename.replace(".tei.xml", ".xml"))
# apply some xpath on the files
parser = ET.XMLParser(remove_comments=True)
try:
tei_xml = ET.parse(tei_file, parser=parser)
except:
#print("XML parsing error with", tei_file)
continue