(direction: Any)
| 307 | |
| 308 | |
| 309 | def _direction_terms(direction: Any) -> List[str]: |
| 310 | direction_text = str(direction or "").strip() |
| 311 | if not direction_text: |
| 312 | return [] |
| 313 | terms = [direction_text, direction_text.replace("-", " ")] |
| 314 | if direction_lexicon is None: |
| 315 | return terms |
| 316 | try: |
| 317 | expanded = direction_lexicon.expand_direction_terms([direction_text]) |
| 318 | except Exception: |
| 319 | return terms |
| 320 | for entry in expanded.values(): |
| 321 | terms.extend(parse_string_list(entry.get("aliases"))) |
| 322 | terms.extend(parse_string_list(entry.get("paper_terms"))) |
| 323 | terms.append(str(entry.get("name") or "")) |
| 324 | terms.append(str(entry.get("name_cn") or "")) |
| 325 | return [term for term in terms if term.strip()] |
| 326 | |
| 327 | |
| 328 | def dedupe_strings(values: Iterable[Any]) -> List[str]: |
no test coverage detected