concept

Multimodal fidelity and accessibility

Exact-field extraction audit for synthetic integer ground truth, not a semantic judge.

Formal Syntax & Structure

artificial-intelligence syntaxartificial-intelligence
audit(truth, extracted)

Working Example

Example Snippetartificial-intelligence
def audit(truth, extracted):    # Unique field names, integer counts or None for unreadable fields.    if any(type(v) is not int for v in truth.values()):        raise ValueError("truth must be integer counts")    correct, missing, wrong, extra = [], [], [], []    for key,value in truth.items():        if key not in extracted or extracted[key] is None:            missing.append(key)        elif type(extracted[key]) is int and extracted[key] == value:            correct.append(key)        else:            wrong.append(key)    extra = sorted(set(extracted)-set(truth))    return dict(correct=sorted(correct), missing=sorted(missing),                wrong=sorted(wrong), extra=extra)
print(audit({"North":3,"South":5,"West":0},            {"North":3,"South":6,"Other":1}))