From c052ee35eebfb0404a6d5479fdfee1e5bbbf0517 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sol=C3=A8ne=20Tarride?= <starride@teklia.com>
Date: Fri, 24 Feb 2023 10:40:52 +0100
Subject: [PATCH] Fix lint

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

diff --git a/dan/predict/prediction.py b/dan/predict/prediction.py
index 2260c231..3cff98d7 100644
--- a/dan/predict/prediction.py
+++ b/dan/predict/prediction.py
@@ -218,11 +218,9 @@ def compute_prob_by_separator(characters, probabilities, separator):
     # match anything except separators, get start and end index
     pattern = re.compile(f"[^{separator.pattern}]+")
     matches = [(m.start(), m.end()) for m in re.finditer(pattern, characters)]
-    return [
-        np.mean(probabilities[start:end])
-        for (start, end) in matches
-    ]
 
+    # Iterate over text pieces and compute mean confidence
+    return [np.mean(probabilities[start:end]) for (start, end) in matches]
 
 
 def run(
-- 
GitLab