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

Function _prefer_candidate_abstract

agents/reading-agent/main.py:707–724  ·  view source on GitHub ↗

Whether a candidate abstract is meaningfully better than the current one.

(
    current_abstract: Any,
    candidate_abstract: Any,
    *,
    min_extra_chars: int = 40,
)

Source from the content-addressed store, hash-verified

705
706def _prefer_candidate_abstract(
707 current_abstract: Any,
708 candidate_abstract: Any,
709 *,
710 min_extra_chars: int = 40,
711) -> bool:
712 """Whether a candidate abstract is meaningfully better than the current one."""
713 current_raw = current_abstract
714 current_clean = _clean_abstract_text(current_raw)
715 candidate_clean = _clean_abstract_text(candidate_abstract)
716
717 if not candidate_clean:
718 return False
719 if not current_clean:
720 return True
721 if _looks_like_feed_metadata_abstract(current_raw):
722 return True
723 return len(candidate_clean) > len(current_clean) + min_extra_chars
724
725
726def _truncate_text(text: Any, max_chars: int) -> str:
727 normalized = _clean_text(text)

Callers 3

_merge_paper_detailsFunction · 0.85

Calls 2

_clean_abstract_textFunction · 0.70

Tested by

no test coverage detected