from typing import List
from typing import Dict
from typing import Any


def exact_str_match_fn(targets: List[str], responses: List[str]) -> Dict[str, Any]:
    """Exact match between targets and responses."""
    # aitor: might want to use these metrics after removing irrelevant words.
    # they do something like this in see t5.data.postprocessors.wsc_simple
    count = 0

    for target, response in zip(targets, responses):
        if not isinstance(target, list):
            target = [target]
        if response in target:
            count += 1

    return {"exact_str_match": count / len(targets)}