MCPcopy Create free account
hub / github.com/RUC-NLPIR/WebThinker / extract_between

Function extract_between

scripts/run_web_thinker_report.py:134–145  ·  view source on GitHub ↗

Extracts text between two markers in a string.

(text, start_marker, end_marker)

Source from the content-addressed store, hash-verified

132
133
134def extract_between(text, start_marker, end_marker):
135 """Extracts text between two markers in a string."""
136 # print('Calling extract_between:', start_marker, end_marker)
137
138 pattern = re.escape(end_marker[::-1]) + r"(.*?)" + re.escape(start_marker[::-1])
139 matches = re.findall(pattern, text[::-1], flags=re.DOTALL)
140
141 if matches:
142 # print('Extracted text:', matches[0][::-1].strip())
143 return matches[0][::-1].strip()
144 print('No matches found')
145 return None
146
147def format_search_results(relevant_info: List[Dict]) -> str:
148 """Format search results into a readable string"""

Callers 2

process_single_sequenceFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected