MCPcopy
hub / github.com/HKUDS/MiniRAG / split_string_by_multi_markers

Function split_string_by_multi_markers

minirag/utils.py:143–148  ·  view source on GitHub ↗

Split a string by multiple markers

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

Source from the content-addressed store, hash-verified

141
142
143def split_string_by_multi_markers(content: str, markers: list[str]) -> list[str]:
144 """Split a string by multiple markers"""
145 if not markers:
146 return [content]
147 results = re.split("|".join(re.escape(marker) for marker in markers), content)
148 return [r.strip() for r in results if r.strip()]
149
150
151# Refer the utils functions of the official GraphRAG implementation:

Calls

no outgoing calls

Tested by

no test coverage detected