Split a string by multiple markers
(content: str, markers: list[str])
| 141 | |
| 142 | |
| 143 | def 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: |
no outgoing calls
no test coverage detected