(direction: Any)
| 249 | |
| 250 | |
| 251 | def _direction_terms(direction: Any) -> List[str]: |
| 252 | direction_text = str(direction or "").strip() |
| 253 | if not direction_text: |
| 254 | return [] |
| 255 | terms = [direction_text, direction_text.replace("-", " ")] |
| 256 | if direction_lexicon is None: |
| 257 | return terms |
| 258 | try: |
| 259 | expanded = direction_lexicon.expand_direction_terms([direction_text]) |
| 260 | except Exception: |
| 261 | return terms |
| 262 | for entry in expanded.values(): |
| 263 | terms.extend(parse_string_list(entry.get("aliases"))) |
| 264 | terms.extend(parse_string_list(entry.get("paper_terms"))) |
| 265 | terms.append(str(entry.get("name") or "")) |
| 266 | terms.append(str(entry.get("name_cn") or "")) |
| 267 | return [term for term in terms if term.strip()] |
| 268 | |
| 269 | |
| 270 | def build_natural_language_profile(user_meta: Dict[str, Any], role: Dict[str, Any]) -> Dict[str, Any]: |
no test coverage detected