(raw_value: Any)
| 231 | |
| 232 | |
| 233 | def _seed_direction_entries(raw_value: Any) -> List[Tuple[str, float]]: |
| 234 | entries: List[Tuple[str, float]] = [] |
| 235 | if isinstance(raw_value, dict): |
| 236 | for key, value in raw_value.items(): |
| 237 | entries.append((str(key), safe_float(value, 0.6))) |
| 238 | elif isinstance(raw_value, list): |
| 239 | for item in raw_value: |
| 240 | if isinstance(item, dict): |
| 241 | key = str(item.get("canonical_name") or item.get("bootstrap_phrase") or "").strip() |
| 242 | weight = safe_float(item.get("weight"), 0.6) |
| 243 | else: |
| 244 | key = str(item or "").strip() |
| 245 | weight = 0.6 |
| 246 | if key: |
| 247 | entries.append((key, weight)) |
| 248 | return entries |
| 249 | |
| 250 | |
| 251 | def _direction_terms(direction: Any) -> List[str]: |
no test coverage detected