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

optimize code

parent 0a46d69a
No related branches found
No related tags found
No related merge requests found
......@@ -350,7 +350,7 @@ def run(
index = [pos for pos, char in enumerate(text) if char in ["", "", "", ""]]
# calculates scores by token
score_by_token = [
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)}",
......@@ -359,9 +359,6 @@ def run(
]
result["confidences"]["total"] = np.around(np.mean(char_confidences), 2)
result["confidences"]["by ner token"] = []
for entity in score_by_token:
result["confidences"]["by ner token"].append(entity)
for level in confidence_score_levels:
result["confidences"][level] = []
......
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