MCPcopy Index your code
hub / github.com/KnowledgeXLab/LeanRAG / split_string_by_multi_markers

Function split_string_by_multi_markers

GraphExtraction/_utils.py:19–24  ·  view source on GitHub ↗

Split a string by multiple markers

(content: str, markers: list[str])

Source from the content-addressed store, hash-verified

17 {"role": roles[i % 2], "content": content} for i, content in enumerate(args)
18 ]
19def split_string_by_multi_markers(content: str, markers: list[str]) -> list[str]:
20 """Split a string by multiple markers"""
21 if not markers:
22 return [content]
23 results = re.split("|".join(re.escape(marker) for marker in markers), content)
24 return [r.strip() for r in results if r.strip()]
25async def _handle_single_entity_extraction(
26 record_attributes: list[str],
27 chunk_key: str,

Calls

no outgoing calls

Tested by

no test coverage detected