(path: str)
| 106 | |
| 107 | |
| 108 | def load_cases(path: str) -> List[PromptCase]: |
| 109 | cases: List[PromptCase] = [] |
| 110 | with open(path, "r", encoding="utf-8") as f: |
| 111 | for line in f: |
| 112 | line = line.rstrip("\n") |
| 113 | if not line: |
| 114 | continue |
| 115 | fields = line.split("\t") |
| 116 | while len(fields) < 5: |
| 117 | fields.append("") |
| 118 | cases.append( |
| 119 | PromptCase( |
| 120 | case_id=fields[0], |
| 121 | multimask=fields[1] == "1", |
| 122 | pos_points=parse_points(fields[2]), |
| 123 | neg_points=parse_points(fields[3]), |
| 124 | box=parse_box(fields[4]), |
| 125 | ) |
| 126 | ) |
| 127 | return cases |
| 128 | |
| 129 | |
| 130 | def build_point_inputs(case: PromptCase): |
no test coverage detected