(direction: Any)
| 330 | |
| 331 | |
| 332 | def _direction_terms(direction: Any) -> List[str]: |
| 333 | direction_text = str(direction or "").strip() |
| 334 | if not direction_text: |
| 335 | return [] |
| 336 | terms = [direction_text, direction_text.replace("-", " ")] |
| 337 | if direction_lexicon is None: |
| 338 | return terms |
| 339 | try: |
| 340 | expanded = direction_lexicon.expand_direction_terms([direction_text]) |
| 341 | except Exception: |
| 342 | return terms |
| 343 | for entry in expanded.values(): |
| 344 | terms.extend(parse_string_list(entry.get("aliases"))) |
| 345 | terms.extend(parse_string_list(entry.get("paper_terms"))) |
| 346 | terms.append(str(entry.get("name") or "")) |
| 347 | terms.append(str(entry.get("name_cn") or "")) |
| 348 | return [term for term in terms if term.strip()] |
| 349 | |
| 350 | |
| 351 | def dedupe_strings(values: Iterable[Any]) -> List[str]: |
no test coverage detected