Update OCR Pipeline

This commit is contained in:
Patrick Jentsch
2020-04-03 17:35:30 +02:00
parent eb5ccf4e21
commit 36a86887b0
3 changed files with 305 additions and 472 deletions

View File

@ -2,25 +2,15 @@
# coding=utf-8
from xml.sax.saxutils import escape
import argparse
from argparse import ArgumentParser
import xml.etree.ElementTree as ET
parser = argparse.ArgumentParser(
description='Merges several hOCR files in order of their occurrence on command line to one TEI result file.'
)
parser.add_argument(
'i',
metavar='hOCR-sourcefile',
nargs='+'
)
parser.add_argument(
'o',
metavar='TEI-destfile',
)
parser = ArgumentParser(description='Merges hOCR files to one P5 file.')
parser.add_argument('i', metavar='hOCR-sourcefile', nargs='+')
parser.add_argument('o', metavar='TEI-destfile',)
args = parser.parse_args()
output_file = open(args.o, 'w')
output_file.write(
'<?xml version="1.0" encoding="UTF-8"?>\n'
+ '<TEI xmlns="http://www.tei-c.org/ns/1.0" xml:id="dtabf">\n'
@ -54,5 +44,4 @@ output_file.write(
' </body>\n'
+ ' </text>\n'
+ '</TEI>')
output_file.close()