Skip to content
Snippets Groups Projects
Commit 133e3ddb authored by Marie Generali's avatar Marie Generali :worried:
Browse files

Merge branch 'dan-temperature-scaling' of gitlab.com:teklia/atr/dan into dan-temperature-scaling

parents 2b450d52 7f9934ae
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
import os
import pickle
from itertools import pairwise
from pathlib import Path
import cv2
......@@ -351,14 +352,13 @@ def run(
index = [pos for pos, char in enumerate(text) if char in ["", "", "", ""]]
# calculates scores by token
score_by_token = []
for rang, position in enumerate(index[:-1]):
score_by_token.append(
{
"text": f"{text[position: index[rang+1]-1]}",
"confidence_ner": f"{np.around(np.mean(char_confidences[position : index[rang+1]-1]), 2)}",
}
)
score_by_token = [
{
"text": f"{text[current: next_token-1]}",
"confidence_ner": f"{np.around(np.mean(char_confidences[current : next_token-1]), 2)}",
}
for current, next_token in pairwise(index)
]
result["confidences"]["total"] = np.around(np.mean(char_confidences), 2)
result["confidences"]["by ner token"] = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment