检测遗漏的论文(用户跳过但可能重要的) Args: logs: 行为日志 recent_pushes: 最近推送的论文 Returns: 遗漏论文列表
(logs: List[Dict], recent_pushes: List[Dict])
| 232 | |
| 233 | def _detect_missed_papers(logs: List[Dict], recent_pushes: List[Dict]) -> List[Dict]: |
| 234 | """ |
| 235 | 检测遗漏的论文(用户跳过但可能重要的) |
| 236 | |
| 237 | Args: |
| 238 | logs: 行为日志 |
| 239 | recent_pushes: 最近推送的论文 |
| 240 | |
| 241 | Returns: |
| 242 | 遗漏论文列表 |
| 243 | """ |
| 244 | selected_ids = { |
| 245 | int(log.get("paper_id")) |
| 246 | for log in logs |
| 247 | if str(log.get("action_type") or "") == "selected" and log.get("paper_id") is not None |
| 248 | } |
| 249 | |
| 250 | candidates: List[Dict[str, Any]] = [] |
| 251 | seen_titles = set() |
| 252 | for paper in recent_pushes: |
| 253 | paper_id = paper.get("id") |
| 254 | if paper_id in selected_ids: |
| 255 | continue |
| 256 | |
| 257 | title_key = _normalize_title_key(paper.get("title")) |
| 258 | if not title_key or title_key in seen_titles: |
| 259 | continue |
| 260 | seen_titles.add(title_key) |
| 261 | |
| 262 | category = str(paper.get("category") or "") |
| 263 | score = float(paper.get("score") or 0.0) |
| 264 | if category not in {"high_relevant", "maybe_interested", "must_read"} and score < 0.35: |
| 265 | continue |
| 266 | |
| 267 | impact = _fetch_openalex_impact_signal(paper) |
| 268 | cited_by_count = int(impact.get("cited_by_count") or 0) |
| 269 | if cited_by_count <= 0 and category != "must_read": |
| 270 | continue |
| 271 | |
| 272 | candidates.append( |
| 273 | { |
| 274 | "title": paper.get("title", "Unknown"), |
| 275 | "category": category, |
| 276 | "score": score, |
| 277 | "cited_by_count": cited_by_count, |
| 278 | "impact_venue": impact.get("venue", ""), |
| 279 | "is_open_access": impact.get("is_open_access", False), |
| 280 | } |
| 281 | ) |
| 282 | |
| 283 | candidates.sort( |
| 284 | key=lambda item: ( |
| 285 | int(item.get("cited_by_count", 0)), |
| 286 | float(item.get("score", 0.0)), |
| 287 | ), |
| 288 | reverse=True, |
| 289 | ) |
| 290 | return candidates[:3] |
| 291 |
no test coverage detected