Skip to content
Snippets Groups Projects

Evaluate predictions with nerval

Merged Manon Blanco requested to merge nerval-evaluate into main
All threads resolved!
Files
5
# -*- coding: utf-8 -*-
import re
from collections import defaultdict
from dataclasses import dataclass
from operator import attrgetter
from pathlib import Path
from typing import Dict, List
from typing import Dict, List, NamedTuple
import editdistance
import numpy as np
@@ -24,8 +23,7 @@ REGEX_ONLY_ONE_SPACE = re.compile(r"\s+")
METRICS_KEYWORD = {"cer": "chars", "wer": "words", "ner": "tokens"}
@dataclass
class Inference:
class Inference(NamedTuple):
ground_truth: str
prediction: str
Loading