def _detect_region(tokens: List[str]) -> Optional[str]: for tok in tokens: if tok in REGION_MAP: return REGION_MAP[tok] return None
| Environment | Steps | |-------------|-------| | | Save the file as video_title_parser.py next to your code and import VideoTitleParser . | | Web service (FastAPI/Flask) | Wrap VideoTitleParser.parse() in an endpoint that receives a raw title string and returns ParsedTitle.to_json() . | | Database ingestion | When you pull a new video record, run the parser once and store the returned fields in dedicated columns for fast filtering. | | Command‑line utility | Add a tiny if __name__ == "__main__": block that reads stdin or a file and prints the display title – handy for quick audits. | def _detect_region(tokens: List[str]) ->