From b2db7c00a8087148c55b88fdf1c6e0cd526bbc45 Mon Sep 17 00:00:00 2001 From: Blanche Miret <bmiret@teklia.com> Date: Tue, 1 Jun 2021 18:49:11 +0200 Subject: [PATCH] Correct research of predicted entity beginning --- nerval/evaluate.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/nerval/evaluate.py b/nerval/evaluate.py index 97fe775..7c39ab7 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]) -- GitLab