(path: str, prompt_mode: str = 'zero-shot', **kwargs)
| 38 | |
| 39 | @staticmethod |
| 40 | def load(path: str, prompt_mode: str = 'zero-shot', **kwargs): |
| 41 | # 读取 CSV 文件为 DataFrame,并将 NaN 转为空字符串 |
| 42 | path = get_data_path(path) |
| 43 | df = pd.read_csv(path, encoding='utf-8') |
| 44 | df = df.fillna('') |
| 45 | |
| 46 | # 转换为字典列表 |
| 47 | data_list = df.to_dict(orient='records') |
| 48 | |
| 49 | # 将数据列表包装为 Dataset |
| 50 | dataset = Dataset.from_list(data_list) |
| 51 | |
| 52 | # 根据提示模式进行解析 |
| 53 | if prompt_mode == 'zero-shot': |
| 54 | dataset = dataset.map(lambda item: _parse(item, prompt_mode)) |
| 55 | elif prompt_mode == 'few-shot': |
| 56 | pass # TODO: Implement few-shot prompt handling |
| 57 | return dataset |
| 58 | |
| 59 | |
| 60 | class MedbulletsEvaluator(BaseEvaluator): |
nothing calls this directly
no test coverage detected