Keep daily push volume manageable while preserving all must-read hits.
(scored_papers: List[PaperWithScore], weights: Dict)
| 1546 | return filtered |
| 1547 | |
| 1548 | |
| 1549 | def categorize_paper(score: float, paper: Dict, profile: Dict, weights: Dict) -> str: |
| 1550 | """Backward-compatible coarse categorization.""" |
| 1551 | threshold_high = weights.get("threshold_high_relevant", 0.75) |
| 1552 | threshold_maybe = weights.get("threshold_maybe_interested", 0.50) |
| 1553 | threshold_edge = weights.get("threshold_edge_relevant", 0.15) |
| 1554 | |
| 1555 | if is_must_read(paper, profile) and score >= threshold_edge: |
| 1556 | return "must_read" |
| 1557 | if score >= threshold_high: |
| 1558 | return "high_relevant" |
| 1559 | if score >= threshold_maybe: |
| 1560 | return "maybe_interested" |
| 1561 | return "edge_relevant" |
| 1562 | |
| 1563 | |
| 1564 | def apply_push_count_limit(scored_papers: List[PaperWithScore], weights: Dict) -> List[PaperWithScore]: |
| 1565 | """Keep daily push volume manageable while preserving all must-read hits.""" |
| 1566 | if not scored_papers: |
| 1567 | return scored_papers |
| 1568 | |
| 1569 | target_count = max(1, int(weights.get("push_target_count", 50))) |
| 1570 | max_count = max(target_count, int(weights.get("push_max_count", target_count))) |
| 1571 | must_read_items = [paper for paper in scored_papers if paper.category == "must_read"] |
| 1572 | remainder = [paper for paper in scored_papers if paper.category != "must_read"] |
| 1573 | |
| 1574 | hard_target_count = max(target_count, len(must_read_items)) |
no test coverage detected