(direction: Any)
| 383 | |
| 384 | |
| 385 | def _direction_terms(direction: Any) -> List[str]: |
| 386 | direction_text = str(direction or "").strip() |
| 387 | if not direction_text: |
| 388 | return [] |
| 389 | terms = [direction_text, direction_text.replace("-", " ")] |
| 390 | if direction_lexicon is None: |
| 391 | return terms |
| 392 | try: |
| 393 | expanded = direction_lexicon.expand_direction_terms([direction_text]) |
| 394 | except Exception: |
| 395 | return terms |
| 396 | for entry in expanded.values(): |
| 397 | terms.extend(parse_string_list(entry.get("aliases"))) |
| 398 | terms.extend(parse_string_list(entry.get("paper_terms"))) |
| 399 | terms.append(str(entry.get("name") or "")) |
| 400 | terms.append(str(entry.get("name_cn") or "")) |
| 401 | return [term for term in terms if term.strip()] |
| 402 | |
| 403 | |
| 404 | def build_initial_profile(user_meta: Dict[str, Any], role: Dict[str, Any]) -> Dict[str, Any]: |
no test coverage detected