ncaa_eval.ingest.fuzzy module

Centralized fuzzy team-name matching utility.

Provides a single public function for resolving team names against a candidate mapping, used by both the ESPN connector and the sync engine.

ncaa_eval.ingest.fuzzy.fuzzy_match_team(name: str, candidates: dict[str, int], threshold: int = 80) int | None[source]

Match a team name to a candidate mapping using fuzzy lookup.

Applies rapidfuzz.fuzz.token_set_ratio (case-insensitive) against all candidates and returns the best match whose score meets the threshold. Callers are responsible for attempting exact matches before calling this function.

Parameters:
  • name – Team name to match.

  • candidates – Mapping of known names to team IDs.

  • threshold – Minimum rapidfuzz token_set_ratio score (0-100).

Returns:

Matched team ID, or None if no match meets the threshold.