File size: 571 Bytes
325b400
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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