diff --git a/nerval/evaluate.py b/nerval/evaluate.py index 97fe7754c5918b7e9dfb64cca5467070e350636a..7c39ab760137b7b0a42a6f8570592f77a112d421 100644 --- a/nerval/evaluate.py +++ b/nerval/evaluate.py @@ -273,7 +273,17 @@ def compute_matches( and j not in visited_predict ): j -= 1 - current_compar += prediction[j + 1 : i] + + if ( + "B" in labels_predict[j] + and get_type_label(labels_predict[j]) == tag_ref + and j not in visited_predict + ): + start = j + else: + start = j + 1 + + current_compar += prediction[start:i] found_aligned_beginning = True current_compar.append(prediction[i])