(text: Any, *, min_chars: int = 40)
| 672 | |
| 673 | def _is_noisy_pdf_evidence_text(text: Any, *, min_chars: int = 40) -> bool: |
| 674 | cleaned = _clean_text(text) |
| 675 | if len(cleaned) < min_chars: |
| 676 | return True |
| 677 | alpha_count = len(re.findall(r"[A-Za-z]", cleaned)) |
| 678 | alpha_ratio = alpha_count / max(1, len(cleaned)) |
| 679 | if alpha_ratio < 0.45: |
| 680 | return True |
| 681 | |
| 682 | lower = cleaned.lower() |
| 683 | hard_noise_patterns = ( |
| 684 | "corresponding author", |
| 685 | "this work was supported", |
| 686 | "all rights reserved", |
| 687 | "published as a conference paper", |
| 688 | "arxiv preprint arxiv:", |
| 689 | "references", |
| 690 | ) |
| 691 | if any(pattern in lower for pattern in hard_noise_patterns): |
| 692 | return True |
| 693 | |
| 694 | citation_like = len(re.findall(r"\[\d+\]|\bet al\.\b|\bpages?\s+\d+\b", lower)) |
| 695 | figure_like = len(re.findall(r"\bfig(?:ure)?\.?\s*\d+|\btable\s+\d+", lower)) |
| 696 | if citation_like + figure_like >= 4: |
| 697 | return True |
| 698 | |
| 699 | symbol_count = len(re.findall(r"[=<>±∑√∞≈≠≤≥_{}^$\\]", cleaned)) |
| 700 | if symbol_count > 12 and symbol_count / max(1, len(cleaned)) > 0.03: |
| 701 | return True |
| 702 | |
| 703 | return False |
| 704 | |
| 705 | |
| 706 | def _prefer_candidate_abstract( |
| 707 | current_abstract: Any, |
no test coverage detected