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

Callers 1

_merge_report_payloadFunction · 0.70

Calls 2

_truncate_textFunction · 0.85
_unique_preserve_orderFunction · 0.85

Tested by

no test coverage detected