--- language: - en - zh license: mit size_categories: - 1K>> func(...)` / `>>> output` 的交互式示例,便于直接用于代码生成评测或训练。 ## 数据格式 每行是一个 JSON 对象(JSONL): - `task_id`:题目唯一标识 - `prompt`:包含函数签名与 docstring 的完整提示 示例字段: - `task_id`: string - `prompt`: string ## 生成流程(概述) 1. 读取 LeetCode 题目(题目描述 + starter code)。 2. 提取函数名。 3. 将题目描述中的 Input/Output 转为: - `>>> func(inputs...)` - `>>> output` 4. 输出为 JSONL。 ## 数据划分 - `train.jsonl` - `test.jsonl` ## 使用方式 Python 读取示例: ```python import json with open("train.jsonl", "r", encoding="utf-8") as f: for line in f: item = json.loads(line) print(item["task_id"], item["prompt"][:80]) break ``` ## 许可协议 MIT ## 引用 如果使用该数据集,请注明来源或引用本项目。