From 5d2a75b2b2049f01306a1a7f0ee0871bf63b6a03 Mon Sep 17 00:00:00 2001 From: Kai Labusch Date: Mon, 2 Dec 2019 15:53:16 +0100 Subject: [PATCH] permit empty input --- qurator/sbb_ner/webapp/app.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/qurator/sbb_ner/webapp/app.py b/qurator/sbb_ner/webapp/app.py index 50f8b3a..fb86304 100644 --- a/qurator/sbb_ner/webapp/app.py +++ b/qurator/sbb_ner/webapp/app.py @@ -119,7 +119,13 @@ class NERPredictor: prev_guid = fe.guid - assert len(sentences) == len(prediction) + try: + assert len(sentences) == len(prediction) + except AssertionError: + print('Sentences:\n') + print(sentences) + print('\n\nPrediciton:\n') + print(prediction) return prediction @@ -142,6 +148,9 @@ class NERTokenizer: sen = [tok.replace(" ", "") for tok in sen] + if len(sen) == 0: + continue + sentences.append((sen, [])) return sentences