Spaces:
Sleeping
Sleeping
| import re | |
| # Hàm parse_step_data_blocks để trích xuất các yêu cầu từ văn bản | |
| def parse_step_data_blocks(text): | |
| blocks = re.findall(r"<step_data>(.*?)</step_data>", text, re.DOTALL) | |
| parsed_steps = [] | |
| for block in blocks: | |
| match = re.match(r"Yêu cầu\s+(\d+):", block.strip()) | |
| if match: | |
| step_id = int(match.group(1)) | |
| parsed_steps.append({ | |
| "id": step_id, | |
| "content": block.strip(), | |
| "dependencies": set(), | |
| }) | |
| return parsed_steps |