加载排序权重配置
()
| 416 | |
| 417 | |
| 418 | def load_scoring_weights() -> Dict: |
| 419 | """加载排序权重配置""" |
| 420 | import yaml |
| 421 | config_file = os.path.join(CONFIG_PATH, "scoring_weights.yaml") |
| 422 | if os.path.exists(config_file): |
| 423 | with open(config_file, 'r', encoding='utf-8') as f: |
| 424 | return apply_relevance_threshold_override(yaml.safe_load(f) or {}) |
| 425 | # 默认配置 |
| 426 | return apply_relevance_threshold_override({ |
| 427 | "w1_interest_vector": 0.35, |
| 428 | "w2_topic_weight": 0.25, |
| 429 | "w3_author_institution": 0.20, |
| 430 | "w4_quality_signal": 0.20, |
| 431 | "bonus_must_read": 0.15, |
| 432 | "threshold_high_relevant": 0.75, |
| 433 | "threshold_maybe_interested": 0.50, |
| 434 | "drift_bonus_shifting": 0.08, |
| 435 | "drift_bonus_recovered": 0.04, |
| 436 | "drift_short_topic_bonus": 0.03, |
| 437 | "reading_signal_short_term_bonus": 0.05, |
| 438 | }) |
| 439 | |
| 440 | |
| 441 | def apply_relevance_threshold_override(weights: Dict) -> Dict: |
no test coverage detected