Build a reusable summary string from canonical directions.
(
directions: Iterable[Any],
*,
lexicon: Optional[Dict[str, Any]] = None,
prefer_chinese: bool = False,
limit: int = 6,
)
| 519 | |
| 520 | |
| 521 | def build_bootstrap_summary( |
| 522 | directions: Iterable[Any], |
| 523 | *, |
| 524 | lexicon: Optional[Dict[str, Any]] = None, |
| 525 | prefer_chinese: bool = False, |
| 526 | limit: int = 6, |
| 527 | ) -> str: |
| 528 | """Build a reusable summary string from canonical directions.""" |
| 529 | labels = [ |
| 530 | format_direction_label(direction, lexicon=lexicon, prefer_chinese=prefer_chinese) |
| 531 | for direction in directions |
| 532 | ] |
| 533 | deduped = _dedupe_strings(labels) |
| 534 | if not deduped: |
| 535 | return "" |
| 536 | return f"direction: {', '.join(deduped[: max(1, int(limit))])}" |
| 537 | |
| 538 | |
| 539 | def _iter_match_terms(entry: Dict[str, Any], include_paper_terms: bool = True) -> Iterable[tuple[str, str]]: |
nothing calls this directly
no test coverage detected