in tools/ragindex/vector_index_retrieval.py [0:0]
def extract_captions(str_captions):
# Regular expression pattern to match image references followed by their descriptions
pattern = r"\[.*?\]:\s(.*?)(?=\[.*?\]:|$)"
# Find all matches
matches = re.findall(pattern, str_captions, re.DOTALL)
return [match.strip() for match in matches]