(
row: Dict[str, Any],
row_vector: Dict[str, float],
state: UserCitationState,
*,
max_log_citations: float,
)
| 458 | |
| 459 | |
| 460 | def score_row( |
| 461 | row: Dict[str, Any], |
| 462 | row_vector: Dict[str, float], |
| 463 | state: UserCitationState, |
| 464 | *, |
| 465 | max_log_citations: float, |
| 466 | ) -> Dict[str, Any]: |
| 467 | content = content_score(row_vector, state) |
| 468 | relation, direct_link, bibliographic_overlap = citation_relation_score(row, state) |
| 469 | impact, has_citation_count = impact_score(row, max_log_citations) |
| 470 | source = source_prior(row) |
| 471 | final_score = clamp( |
| 472 | SCORE_WEIGHTS["content"] * content |
| 473 | + SCORE_WEIGHTS["citation_relation"] * relation |
| 474 | + SCORE_WEIGHTS["impact"] * impact |
| 475 | + SCORE_WEIGHTS["source_prior"] * source |
| 476 | ) |
| 477 | return { |
| 478 | "system_score": final_score, |
| 479 | "system_label": label_for_score(final_score), |
| 480 | "content_score": content, |
| 481 | "citation_relation_score": relation, |
| 482 | "citation_direct_link": direct_link, |
| 483 | "bibliographic_overlap": bibliographic_overlap, |
| 484 | "impact_score": impact, |
| 485 | "has_citation_count": has_citation_count, |
| 486 | "citation_count": citation_count(row), |
| 487 | "source_prior": source, |
| 488 | "training_selected_count": state.selected_count, |
| 489 | } |
| 490 | |
| 491 | |
| 492 | def load_user_metadata(input_dir: Path) -> Dict[str, Dict[str, Any]]: |
no test coverage detected