diff --git a/dan/ocr/predict/attention.py b/dan/ocr/predict/attention.py index 7df72e6e00b0c3cb3275285be17528426a3991d4..399f72b6fd94139ca44ab5eb9906ed4b5ffe5c29 100644 --- a/dan/ocr/predict/attention.py +++ b/dan/ocr/predict/attention.py @@ -93,7 +93,7 @@ def compute_prob_by_ner( return zip( *[ ( - f"{characters[current: next_token]}".replace("\n", " "), + characters[current:next_token], np.mean(probabilities[current:next_token]), ) for current, next_token in indices @@ -154,10 +154,7 @@ def split_text( return [], [] indices = build_ner_indices(text, tokens) - text_split = [ - f"{text[current: next_token]}".replace("\n", " ") - for current, next_token in indices - ] + text_split = [text[current:next_token] for current, next_token in indices] case _: logger.error(f"Level should be either {list(map(str, Level))}") return [], []