cli: separate tsv2page and tsv2page_cli

pull/9/head
Konstantin Baierer 3 years ago
parent fe0c355e5a
commit 0aee20a7f6

@ -22,8 +22,10 @@ setup(
'console_scripts': [
"extract-doc-links=tsvtools.cli:extract_document_links",
"annotate-tsv=tsvtools.cli:annotate_tsv",
"page2tsv=tsvtools.cli:page2tsv",
"tsv2page=tsvtools.cli:tsv2page",
"ocrd-neat-export=tsvtools.ocrd_cli:export_cli",
"ocrd-neat-import=tsvtools.ocrd_cli:import_cli",
"page2tsv=tsvtools.cli:page2tsv_cli",
"tsv2page=tsvtools.cli:tsv2page_cli",
"make-page2tsv-commands=tsvtools.cli:make_page2tsv_commands"
]
},

@ -159,13 +159,6 @@ def page2tsv(page_xml_file, tsv_out_file, purpose, image_url, ner_rest_endpoint,
except requests.HTTPError as e:
print(e)
@click.command()
@click.option('--output-filename', '-o', help="Output filename. "
"If omitted, PAGE-XML filename with .corrected.xml extension")
@click.option('--keep-words', '-k', is_flag=True, help="Keep (out-of-date) Words of TextLines")
@click.argument('page-file')
@click.argument('tsv-file')
def tsv2page(output_filename, keep_words, page_file, tsv_file):
if not output_filename:
output_filename = Path(page_file).stem + '.corrected.xml'
@ -181,6 +174,14 @@ def tsv2page(output_filename, keep_words, page_file, tsv_file):
with open(output_filename, 'w', encoding='utf-8') as f:
f.write(ET.tostring(tree, pretty_print=True).decode('utf-8'))
@click.command()
@click.option('--output-filename', '-o', help="Output filename. "
"If omitted, PAGE-XML filename with .corrected.xml extension")
@click.option('--keep-words', '-k', is_flag=True, help="Keep (out-of-date) Words of TextLines")
@click.argument('page-file')
@click.argument('tsv-file')
def tsv2page_cli(output_filename, keep_words, page_file, tsv_file):
return tsv2page_cli(output_filename, keep_words, page_file, tsv_file)
@click.command()
@click.option('--xls-file', type=click.Path(exists=True), default=None,

Loading…
Cancel
Save