From a834da494abd61a2683f11e57329c604a7725955 Mon Sep 17 00:00:00 2001 From: Kai Labusch Date: Sat, 15 Aug 2020 08:46:18 +0200 Subject: [PATCH] permit empty files --- cli.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli.py b/cli.py index b467944..7e57eef 100644 --- a/cli.py +++ b/cli.py @@ -284,6 +284,9 @@ def page2tsv(page_xml_file, tsv_out_file, image_url, ner_rest_endpoint, ned_rest tsv = pd.DataFrame(tsv, columns=['rid', 'line', 'hcenter'] + out_columns) + if len(tsv)==0: + return + vlinecenter = pd.DataFrame(tsv[['line', 'top']].groupby('line', sort=False).mean().top + (tsv[['line', 'bottom']].groupby('line', sort=False).mean().bottom - tsv[['line', 'top']].groupby('line', sort=False).mean().top) / 2,