| 90 | return data_files |
| 91 | |
| 92 | def parse_task_file(task_file: Path) -> Tuple[str, str, List[str]]: |
| 93 | |
| 94 | with open(task_file, 'r', encoding='utf-8') as f: |
| 95 | content = f.read() |
| 96 | |
| 97 | |
| 98 | category_match = re.search(r'## Category\s*\n(.+)', content) |
| 99 | category = category_match.group(1).strip() if category_match else "" |
| 100 | |
| 101 | |
| 102 | instruction_match = re.search(r'## Instruction\s*\n(.+?)(?=\n##|\n---|$)', content, re.DOTALL) |
| 103 | instruction = instruction_match.group(1).strip() if instruction_match else "" |
| 104 | |
| 105 | |
| 106 | files_match = re.search(r'## Files\s*\n(.+?)(?=\n##|\n---|$)', content, re.DOTALL) |
| 107 | files_text = files_match.group(1).strip() if files_match else "" |
| 108 | |
| 109 | data_files = [] |
| 110 | for f in files_text.split('\n'): |
| 111 | f = f.strip() |
| 112 | if f and (f.endswith('.csv') or f.endswith('.xlsx')): |
| 113 | data_files.append(f) |
| 114 | |
| 115 | return category, instruction, data_files |
| 116 | |
| 117 | |
| 118 | def find_data_files(directory: Path, filenames: List[str]) -> Dict[str, Path]: |