(row: Dict[str, Any], idf: Dict[str, float], state: UserDiscourseState)
| 492 | |
| 493 | |
| 494 | def score_row(row: Dict[str, Any], idf: Dict[str, float], state: UserDiscourseState) -> Dict[str, Any]: |
| 495 | facets = extract_discourse_facets(row) |
| 496 | facet_similarity = facet_similarity_score(facets, idf, state) |
| 497 | coverage = discourse_coverage_score(facets) |
| 498 | contribution = contribution_signal_score(facets) |
| 499 | final_score = clamp( |
| 500 | SCORE_WEIGHTS["facet_similarity"] * facet_similarity |
| 501 | + SCORE_WEIGHTS["discourse_coverage"] * coverage |
| 502 | + SCORE_WEIGHTS["contribution_signal"] * contribution |
| 503 | ) |
| 504 | return { |
| 505 | "system_score": final_score, |
| 506 | "system_label": label_for_score(final_score), |
| 507 | "facet_similarity_score": facet_similarity, |
| 508 | "discourse_coverage_score": coverage, |
| 509 | "contribution_signal_score": contribution, |
| 510 | "discourse_facets": sorted(facets.keys()), |
| 511 | "training_selected_count": state.selected_count, |
| 512 | } |
| 513 | |
| 514 | |
| 515 | def load_user_metadata(input_dir: Path) -> Dict[str, Dict[str, Any]]: |
no test coverage detected