|
|
@ -75,9 +75,9 @@ def page2tsv(page_xml_file, tsv_out_file, purpose, image_url, ner_rest_endpoint,
|
|
|
|
ned_threshold, min_confidence, max_confidence):
|
|
|
|
ned_threshold, min_confidence, max_confidence):
|
|
|
|
|
|
|
|
|
|
|
|
if purpose == "NERD":
|
|
|
|
if purpose == "NERD":
|
|
|
|
out_columns = ['No.', 'TOKEN', 'NE-TAG', 'NE-EMB', 'ID', 'url_id', 'left', 'right', 'top', 'bottom']
|
|
|
|
out_columns = ['No.', 'TOKEN', 'NE-TAG', 'NE-EMB', 'ID', 'url_id', 'left', 'right', 'top', 'bottom', 'conf']
|
|
|
|
elif purpose == "OCR":
|
|
|
|
elif purpose == "OCR":
|
|
|
|
out_columns = ['TEXT', 'url_id', 'left', 'right', 'top', 'bottom']
|
|
|
|
out_columns = ['TEXT', 'url_id', 'left', 'right', 'top', 'bottom', 'conf']
|
|
|
|
|
|
|
|
|
|
|
|
if min_confidence is not None and max_confidence is not None:
|
|
|
|
if min_confidence is not None and max_confidence is not None:
|
|
|
|
out_columns += ['ocrconf']
|
|
|
|
out_columns += ['ocrconf']
|
|
|
@ -168,6 +168,7 @@ def page2tsv(page_xml_file, tsv_out_file, purpose, image_url, ner_rest_endpoint,
|
|
|
|
tsv['NE-TAG'] = 'O'
|
|
|
|
tsv['NE-TAG'] = 'O'
|
|
|
|
tsv['NE-EMB'] = 'O'
|
|
|
|
tsv['NE-EMB'] = 'O'
|
|
|
|
tsv['ID'] = '-'
|
|
|
|
tsv['ID'] = '-'
|
|
|
|
|
|
|
|
tsv['conf'] = '-'
|
|
|
|
|
|
|
|
|
|
|
|
tsv = tsv.rename(columns={'TEXT': 'TOKEN'})
|
|
|
|
tsv = tsv.rename(columns={'TEXT': 'TOKEN'})
|
|
|
|
elif purpose == 'OCR':
|
|
|
|
elif purpose == 'OCR':
|
|
|
|