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

Function _normalize_string_list

agents/reading-agent/main.py:4137–4150  ·  view source on GitHub ↗
(value: Any, limit: int = 4, max_chars: int = 180)

Source from the content-addressed store, hash-verified

4135
4136
4137def _normalize_string_list(value: Any, limit: int = 4, max_chars: int = 180) -> List[str]:
4138 if isinstance(value, str):
4139 candidates = re.split(r"\n+|[;;]+", value)
4140 elif isinstance(value, list):
4141 candidates = [str(item) for item in value]
4142 else:
4143 return []
4144
4145 items: List[str] = []
4146 for candidate in candidates:
4147 cleaned = re.sub(r"^\s*[-*•\d\.\)\(]+\s*", "", str(candidate)).strip()
4148 if len(cleaned) >= 4:
4149 items.append(_truncate_text(cleaned, max_chars))
4150 return _unique_preserve_order(items)[:limit]
4151
4152
4153def _looks_like_extraction_noise(text: str) -> bool:

Callers 1

_merge_report_payloadFunction · 0.70

Calls 2

_truncate_textFunction · 0.85
_unique_preserve_orderFunction · 0.85

Tested by

no test coverage detected