(
row: Dict[str, Any],
rep: PaperRepresentation,
state: UserKnowledgeEntityState,
*,
max_log_citations: float,
)
| 552 | |
| 553 | |
| 554 | def score_row( |
| 555 | row: Dict[str, Any], |
| 556 | rep: PaperRepresentation, |
| 557 | state: UserKnowledgeEntityState, |
| 558 | *, |
| 559 | max_log_citations: float, |
| 560 | ) -> Dict[str, Any]: |
| 561 | profile_entity = profile_entity_score(rep, state) |
| 562 | history_entity = history_entity_score(rep, state) |
| 563 | multifacet = multifacet_similarity(rep, state) |
| 564 | metadata_signal, has_citation_count = metadata_signal_score(row, rep, max_log_citations) |
| 565 | density = entity_density_score(rep) |
| 566 | final_score = clamp( |
| 567 | SCORE_WEIGHTS["profile_entity"] * profile_entity |
| 568 | + SCORE_WEIGHTS["history_entity"] * history_entity |
| 569 | + SCORE_WEIGHTS["multifacet_similarity"] * multifacet |
| 570 | + SCORE_WEIGHTS["metadata_signal"] * metadata_signal |
| 571 | + SCORE_WEIGHTS["entity_density"] * density |
| 572 | ) |
| 573 | return { |
| 574 | "system_score": final_score, |
| 575 | "system_label": label_for_score(final_score), |
| 576 | "profile_entity_score": profile_entity, |
| 577 | "history_entity_score": history_entity, |
| 578 | "multifacet_similarity_score": multifacet, |
| 579 | "metadata_signal_score": metadata_signal, |
| 580 | "entity_density_score": density, |
| 581 | "entity_count": len(rep.entities), |
| 582 | "top_entities": rep.entities[:10], |
| 583 | "has_citation_count": has_citation_count, |
| 584 | "citation_count": citation_count(row), |
| 585 | "training_selected_count": state.selected_count, |
| 586 | } |
| 587 | |
| 588 | |
| 589 | def load_user_metadata(input_dir: Path) -> Dict[str, Dict[str, Any]]: |
no test coverage detected