diff --git a/dan/ocr/predict/attention.py b/dan/ocr/predict/attention.py index 6b78c81d3dc3a57b9cc0580536334442292ea3fe..4f518f9b53e0dc9af7bf46bcb9319ec1cd0e8faa 100644 --- a/dan/ocr/predict/attention.py +++ b/dan/ocr/predict/attention.py @@ -198,6 +198,9 @@ def split_text_and_confidences( return [], [], [] indices = build_ner_indices(text, tokens) + if not indices: + return [], [], [] + texts, confidences = compute_prob_by_ner(text, confidences, indices) case _: logger.error(f"Level should be either {list(map(str, Level))}")