Skip to content

Commit

Permalink
add textline-order option
Browse files Browse the repository at this point in the history
  • Loading branch information
bertsky authored Feb 7, 2022
1 parent 847e1a5 commit d81e8e6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ocrd_page_to_alto/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
@click.option('--textequiv-index', default=0, help='If multiple textequiv, use the n-th TextEquiv by @index')
@click.option('--textequiv-fallback-strategy', default='last', type=click.Choice(['raise', 'first', 'last']), help="What to do if nth textequiv isn't available. 'raise' will lead to a runtime error, 'first' will use the first TextEquiv, 'last' will use the last TextEquiv on the element")
@click.option('--region-order', default='document', help="Order in which to iterate over the regions", type=click.Choice(['document', 'reading-order', 'reading-order-only']))
@click.option('--textline-order', default='document', help="Order in which to iterate over the textlines", type=click.Choice(['document', 'index', 'textline-order']))
@click.option('-O', '--output-file', default='-', help='Output filename (or "-" for standard output, the default)',
type=click.Path(dir_okay=False, writable=True, exists=False, allow_dash=True))
@click.argument('filename', type=click.Path(dir_okay=False, exists=True))
def main(log_level, alto_version, check_words, check_border, skip_empty_lines, trailing_dash_to_hyp, dummy_textline, dummy_word, textequiv_index, textequiv_fallback_strategy, region_order, output_file, filename):
def main(log_level, alto_version, check_words, check_border, skip_empty_lines, trailing_dash_to_hyp, dummy_textline, dummy_word,
textequiv_index, textequiv_fallback_strategy, region_order, textline_order, output_file, filename):
"""
Convert PAGE to ALTO
"""
Expand All @@ -37,7 +39,8 @@ def main(log_level, alto_version, check_words, check_border, skip_empty_lines, t
dummy_word=dummy_word,
textequiv_index=textequiv_index,
textequiv_fallback_strategy=textequiv_fallback_strategy,
region_order=region_order
region_order=region_order,
textline_order=textline_order
)
converter.convert()
with open(1 if output_file == '-' else output_file, 'w') as output:
Expand Down

0 comments on commit d81e8e6

Please sign in to comment.