V2
This commit is contained in:
@@ -140,6 +140,19 @@ def _normalize_keys(flat: dict) -> dict:
|
||||
return {k.replace(".rang", ".niveau"): v for k, v in flat.items()}
|
||||
|
||||
|
||||
_LOWER_FIELDS = {"accord_desaccord", "avis_dim_final", "decision_finale"}
|
||||
|
||||
def _norm_values(flat: dict) -> dict:
|
||||
"""Normalise en minuscule les champs textuels dont la casse varie entre extraction et correction."""
|
||||
out = {}
|
||||
for k, v in flat.items():
|
||||
field = k.split(".")[-1]
|
||||
if field in _LOWER_FIELDS and isinstance(v, str):
|
||||
v = v.strip().lower().replace("desaccord", "désaccord")
|
||||
out[k] = v
|
||||
return out
|
||||
|
||||
|
||||
def _get_cat(key: str, ptype: str = "") -> str:
|
||||
k = key.lower()
|
||||
if ptype == "ELEMENTS_PREUVE":
|
||||
@@ -210,8 +223,8 @@ def compare_extractions(orig_list, corr_list):
|
||||
ep_counters["json_non_parsable"]["dossiers"].add(fichier)
|
||||
continue
|
||||
|
||||
o_flat = _normalize_keys(_flatten(od))
|
||||
c_flat = _normalize_keys(_flatten(cd))
|
||||
o_flat = _norm_values(_normalize_keys(_flatten(od)))
|
||||
c_flat = _norm_values(_normalize_keys(_flatten(cd)))
|
||||
all_keys = set(o_flat) | set(c_flat)
|
||||
|
||||
for k in all_keys:
|
||||
|
||||
Reference in New Issue
Block a user