(record: dict[str, Any])
| 286 | |
| 287 | |
| 288 | def candidate_priority_score(record: dict[str, Any]) -> int: |
| 289 | source = normalize_whitespace(str(record.get("source", ""))).lower() |
| 290 | source_url = normalize_whitespace(str(record.get("source_url", ""))).lower() |
| 291 | doi = normalize_whitespace(str(record.get("doi", ""))).lower() |
| 292 | joined = " ".join([source, source_url, doi]) |
| 293 | |
| 294 | if "10.20944/preprints" in joined or any(token in joined for token in PREPRINT_HINTS): |
| 295 | return 0 |
| 296 | |
| 297 | if record.get("doi") and publication_quality_score(record) >= 2: |
| 298 | return 4 |
| 299 | |
| 300 | if record.get("arxiv_id") or source == "arxiv" or "arxiv.org" in source_url: |
| 301 | return 3 |
| 302 | |
| 303 | if record.get("pdf_url"): |
| 304 | return 2 |
| 305 | |
| 306 | return 1 |
| 307 | |
| 308 | |
| 309 | def extract_arxiv_id(paper_ref: str) -> str | None: |
no test coverage detected