mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/ocr.git
synced 2025-07-01 18:50:34 +00:00
Update OCR Pipeline
This commit is contained in:
19
hocrtotei
19
hocrtotei
@ -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()
|
||||
|
Reference in New Issue
Block a user