From de63b7755a07ea0b8c8899a74619cfe8111eabef Mon Sep 17 00:00:00 2001
From: M Generali <mgenerali@teklia.com>
Date: Tue, 20 Jun 2023 14:30:01 +0000
Subject: [PATCH] Add space confidence to the confidence by ner token

---
 dan/predict/prediction.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dan/predict/prediction.py b/dan/predict/prediction.py
index 357bb4df..4b5c33d1 100644
--- a/dan/predict/prediction.py
+++ b/dan/predict/prediction.py
@@ -353,8 +353,8 @@ def run(
 
         result["confidences"]["by ner token"] = [
             {
-                "text": f"{text[current: next_token-1]}",
-                "confidence_ner": f"{np.around(np.mean(char_confidences[current : next_token-1]), 2)}",
+                "text": f"{text[current: next_token]}",
+                "confidence_ner": f"{np.around(np.mean(char_confidences[current : next_token]), 2)}",
             }
             for current, next_token in pairwise(index + [0])
         ]
-- 
GitLab