(values: List[Any])
| 84 | |
| 85 | def _canonicalize_topics(values: List[Any]) -> List[str]: |
| 86 | if direction_lexicon and hasattr(direction_lexicon, "canonicalize_direction_terms"): |
| 87 | try: |
| 88 | return direction_lexicon.canonicalize_direction_terms(values, keep_unknown=True) |
| 89 | except Exception: |
| 90 | pass |
| 91 | |
| 92 | canonical_topics: List[str] = [] |
| 93 | for value in values: |
| 94 | cleaned = str(value or "").strip().lower().replace("_", "-").replace(" ", "-") |
| 95 | if cleaned and cleaned not in canonical_topics: |
| 96 | canonical_topics.append(cleaned) |
| 97 | return canonical_topics |
| 98 | |
| 99 | |
| 100 | def _direction_match_terms(direction: str) -> List[str]: |
| 101 | cleaned = str(direction or "").strip() |
no outgoing calls
no test coverage detected