feat(03-01): add NFL to team canonicalization
Add NFL support to canonicalize_teams.py: - Import NFL_TEAMS from scrape_schedules - Add NFL_DIVISIONS dict with all 32 teams mapped to conference/division - Include NFL in sport_mappings for canonicalization - Add NFL_DIVISIONS to division_map lookup Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,7 @@ from pathlib import Path
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
# Import team mappings from scraper
|
# Import team mappings from scraper
|
||||||
from scrape_schedules import NBA_TEAMS, MLB_TEAMS, NHL_TEAMS
|
from scrape_schedules import NBA_TEAMS, MLB_TEAMS, NHL_TEAMS, NFL_TEAMS
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
@@ -173,6 +173,49 @@ NHL_DIVISIONS = {
|
|||||||
'VGK': ('nhl_western', 'nhl_pacific'),
|
'VGK': ('nhl_western', 'nhl_pacific'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NFL_DIVISIONS = {
|
||||||
|
# AFC East
|
||||||
|
'BUF': ('nfl_afc', 'nfl_afc_east'),
|
||||||
|
'MIA': ('nfl_afc', 'nfl_afc_east'),
|
||||||
|
'NE': ('nfl_afc', 'nfl_afc_east'),
|
||||||
|
'NYJ': ('nfl_afc', 'nfl_afc_east'),
|
||||||
|
# AFC North
|
||||||
|
'BAL': ('nfl_afc', 'nfl_afc_north'),
|
||||||
|
'CIN': ('nfl_afc', 'nfl_afc_north'),
|
||||||
|
'CLE': ('nfl_afc', 'nfl_afc_north'),
|
||||||
|
'PIT': ('nfl_afc', 'nfl_afc_north'),
|
||||||
|
# AFC South
|
||||||
|
'HOU': ('nfl_afc', 'nfl_afc_south'),
|
||||||
|
'IND': ('nfl_afc', 'nfl_afc_south'),
|
||||||
|
'JAX': ('nfl_afc', 'nfl_afc_south'),
|
||||||
|
'TEN': ('nfl_afc', 'nfl_afc_south'),
|
||||||
|
# AFC West
|
||||||
|
'DEN': ('nfl_afc', 'nfl_afc_west'),
|
||||||
|
'KC': ('nfl_afc', 'nfl_afc_west'),
|
||||||
|
'LV': ('nfl_afc', 'nfl_afc_west'),
|
||||||
|
'LAC': ('nfl_afc', 'nfl_afc_west'),
|
||||||
|
# NFC East
|
||||||
|
'DAL': ('nfl_nfc', 'nfl_nfc_east'),
|
||||||
|
'NYG': ('nfl_nfc', 'nfl_nfc_east'),
|
||||||
|
'PHI': ('nfl_nfc', 'nfl_nfc_east'),
|
||||||
|
'WAS': ('nfl_nfc', 'nfl_nfc_east'),
|
||||||
|
# NFC North
|
||||||
|
'CHI': ('nfl_nfc', 'nfl_nfc_north'),
|
||||||
|
'DET': ('nfl_nfc', 'nfl_nfc_north'),
|
||||||
|
'GB': ('nfl_nfc', 'nfl_nfc_north'),
|
||||||
|
'MIN': ('nfl_nfc', 'nfl_nfc_north'),
|
||||||
|
# NFC South
|
||||||
|
'ATL': ('nfl_nfc', 'nfl_nfc_south'),
|
||||||
|
'CAR': ('nfl_nfc', 'nfl_nfc_south'),
|
||||||
|
'NO': ('nfl_nfc', 'nfl_nfc_south'),
|
||||||
|
'TB': ('nfl_nfc', 'nfl_nfc_south'),
|
||||||
|
# NFC West
|
||||||
|
'ARI': ('nfl_nfc', 'nfl_nfc_west'),
|
||||||
|
'LAR': ('nfl_nfc', 'nfl_nfc_west'),
|
||||||
|
'SF': ('nfl_nfc', 'nfl_nfc_west'),
|
||||||
|
'SEA': ('nfl_nfc', 'nfl_nfc_west'),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# FUZZY MATCHING
|
# FUZZY MATCHING
|
||||||
@@ -330,6 +373,7 @@ def canonicalize_teams(
|
|||||||
'NBA': NBA_DIVISIONS,
|
'NBA': NBA_DIVISIONS,
|
||||||
'MLB': MLB_DIVISIONS,
|
'MLB': MLB_DIVISIONS,
|
||||||
'NHL': NHL_DIVISIONS,
|
'NHL': NHL_DIVISIONS,
|
||||||
|
'NFL': NFL_DIVISIONS,
|
||||||
}.get(sport, {})
|
}.get(sport, {})
|
||||||
|
|
||||||
for abbrev, info in team_mappings.items():
|
for abbrev, info in team_mappings.items():
|
||||||
@@ -402,6 +446,7 @@ def canonicalize_all_teams(
|
|||||||
('NBA', NBA_TEAMS),
|
('NBA', NBA_TEAMS),
|
||||||
('MLB', MLB_TEAMS),
|
('MLB', MLB_TEAMS),
|
||||||
('NHL', NHL_TEAMS),
|
('NHL', NHL_TEAMS),
|
||||||
|
('NFL', NFL_TEAMS),
|
||||||
]
|
]
|
||||||
|
|
||||||
for sport, team_map in sport_mappings:
|
for sport, team_map in sport_mappings:
|
||||||
|
|||||||
Reference in New Issue
Block a user