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

Function normalize_authors

agents/feedback-agent/main.py:308–328  ·  view source on GitHub ↗

Normalize author field from list / JSON string / plain string.

(authors: Any)

Source from the content-addressed store, hash-verified

306
307
308def normalize_authors(authors: Any) -> List[str]:
309 """Normalize author field from list / JSON string / plain string."""
310 if not authors:
311 return []
312
313 if isinstance(authors, list):
314 return [str(author).strip() for author in authors if str(author).strip()]
315
316 if isinstance(authors, str):
317 authors_text = authors.strip()
318 if not authors_text:
319 return []
320 try:
321 parsed = json.loads(authors_text)
322 except json.JSONDecodeError:
323 parsed = None
324 if isinstance(parsed, list):
325 return [str(author).strip() for author in parsed if str(author).strip()]
326 return [part.strip() for part in re.split(r"[;,,、]", authors_text) if part.strip()]
327
328 return [str(authors).strip()]
329
330
331def _build_interest_vector_descriptor(profile: Dict[str, Any]) -> str:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected