(paper: Dict[str, Any])
| 130 | |
| 131 | |
| 132 | def _paper_topic_candidates(paper: Dict[str, Any]) -> List[str]: |
| 133 | candidates: List[str] = [] |
| 134 | for key in ("topics", "keywords", "categories"): |
| 135 | value = paper.get(key) or [] |
| 136 | if isinstance(value, list): |
| 137 | candidates.extend(str(item).strip() for item in value if str(item).strip()) |
| 138 | elif isinstance(value, str) and value.strip(): |
| 139 | candidates.append(value.strip()) |
| 140 | return canonicalize_direction_terms(candidates, keep_unknown=True) |
| 141 | |
| 142 | |
| 143 | def _build_contrastive_signals(selected: Set[int], skipped: Set[int], papers: List[Dict]) -> List[str]: |
no test coverage detected