MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / score_row

Function score_row

experiments/baselines/nl_profile/runner.py:367–391  ·  view source on GitHub ↗
(row: Dict[str, Any], idf: Dict[str, float], state: UserNaturalProfileState)

Source from the content-addressed store, hash-verified

365
366
367def score_row(row: Dict[str, Any], idf: Dict[str, float], state: UserNaturalProfileState) -> Dict[str, Any]:
368 row_text = paper_text(row)
369 title = str(row.get("title") or "")
370 row_vector = vectorize_text(row_text, idf)
371 profile_similarity = scaled_similarity(row_vector, state.profile_vector)
372 keyphrase_alignment = phrase_alignment_score(row_text, state.terms)
373 title_alignment = phrase_alignment_score(title, state.terms)
374 aspect_coverage = aspect_coverage_score(row_text, state.directions)
375 final_score = clamp(
376 SCORE_WEIGHTS["profile_similarity"] * profile_similarity
377 + SCORE_WEIGHTS["keyphrase_alignment"] * keyphrase_alignment
378 + SCORE_WEIGHTS["title_alignment"] * title_alignment
379 + SCORE_WEIGHTS["aspect_coverage"] * aspect_coverage
380 )
381 return {
382 "system_score": final_score,
383 "system_label": label_for_score(final_score),
384 "profile_similarity_score": profile_similarity,
385 "keyphrase_alignment_score": keyphrase_alignment,
386 "title_alignment_score": title_alignment,
387 "aspect_coverage_score": aspect_coverage,
388 "profile_term_count": len(state.terms),
389 "profile_direction_count": len(state.directions),
390 "uses_feedback_update": False,
391 }
392
393
394def load_user_metadata(input_dir: Path) -> Dict[str, Dict[str, Any]]:

Callers 1

rerank_episodesFunction · 0.70

Calls 8

phrase_alignment_scoreFunction · 0.85
aspect_coverage_scoreFunction · 0.85
getMethod · 0.80
paper_textFunction · 0.70
vectorize_textFunction · 0.70
scaled_similarityFunction · 0.70
clampFunction · 0.70
label_for_scoreFunction · 0.70

Tested by

no test coverage detected