Skip to content

Commit 068db21

Browse files
committed
Feat: Rename the column name of dataset to follow standrad
1 parent 666b73c commit 068db21

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

scripts/README.md.dataset

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ A curated Traditional Chinese LeetCode solution dataset with high-efficiency ans
6363
本資料集適用於以下用途:
6464
- **訓練與評估程式邏輯推理模型**:透過「Top Concept → Step Implement → Complexity Explanation」的結構化說明,有助於模型學習具可解釋性的程式邏輯。
6565
- **用於語言模型(LLM)的微調或持續預訓練**,特別是針對程式碼與技術文本領域,並支援繁體中文語境(zh-Hant)。
66-
- **作為程式教學或線上課程的素材**,可協助學習者以母語理解高效且高可讀性的 LeetCode 題解,並透過 questionCode 欄位提供的函數框架進行練習。
67-
- **演算法邏輯與步驟拆解能力的評測基準**:適合用於建立自動解題(auto-solver)或邏輯步驟生成任務的資料來源,questionCode 欄位可作為起始程式碼模板。
68-
- **程式碼補全與生成任務**:利用 questionCode 提供的函數簽名作為輸入,訓練模型從函數框架生成完整解法。
66+
- **作為程式教學或線上課程的素材**,可協助學習者以母語理解高效且高可讀性的 LeetCode 題解,並透過 question_code 欄位提供的函數框架進行練習。
67+
- **演算法邏輯與步驟拆解能力的評測基準**:適合用於建立自動解題(auto-solver)或邏輯步驟生成任務的資料來源,question_code 欄位可作為起始程式碼模板。
68+
- **程式碼補全與生成任務**:利用 question_code 提供的函數簽名作為輸入,訓練模型從函數框架生成完整解法。
6969

7070
### Out-of-Scope Use
7171

@@ -84,7 +84,7 @@ A curated Traditional Chinese LeetCode solution dataset with high-efficiency ans
8484
- **constraints(string)**:題目的限制條件說明,包含輸入範圍、邊界條件等重要資訊,有助於理解解法的適用範圍。
8585
- **thought(string)**:對應於 ## 基礎思路 之後的內容,包含作者對解法邏輯、步驟與策略的說明。
8686
- **answer(string)**:對應題目的實際程式碼解法,提供完整可執行的 TypeScript 解答,對應於前述 thought 的實作。
87-
- **questionCode(string)**:TypeScript 函數簽名的起始程式碼框架,提供題目的基礎函數定義與參數型別。此欄位內容來源於 HuggingFace 上的 `whiskwhite/leetcode-complete` 資料集,部分缺失則由人工收集。
87+
- **question_code(string)**:TypeScript 函數簽名的起始程式碼框架,提供題目的基礎函數定義與參數型別。此欄位內容來源於 HuggingFace 上的 `whiskwhite/leetcode-complete` 資料集,部分缺失則由人工收集。
8888
- **src(string)**:原始 .md 檔案所屬資料夾的名稱,通常對應該題的 LeetCode 題號或標題,作為來源參考。
8989
- **time_complexity(string)**:詳細的時間複雜度分析,包含演算法效率說明與大 O 表示法。
9090
- **space_complexity(string)**:詳細的空間複雜度分析,包含記憶體使用效率說明與大 O 表示法。

scripts/compile-dataset.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ class DatasetCompiler {
104104
const answer = this.parseAnswerFile(answerPath);
105105

106106
// Parse questionCode - this is now required
107-
let questionCode = '';
107+
let question_code = '';
108108
if (existsSync(questionCodePath)) {
109-
questionCode = this.parseQuestionCodeFile(questionCodePath);
109+
question_code = this.parseQuestionCodeFile(questionCodePath);
110110
}
111111

112112
// Use full raw content as the text field
@@ -118,7 +118,7 @@ class DatasetCompiler {
118118
constraints,
119119
thought,
120120
answer,
121-
questionCode,
121+
question_code,
122122
src: problemDir,
123123
time_complexity,
124124
space_complexity
@@ -134,7 +134,7 @@ class DatasetCompiler {
134134
* Validate the compiled entry format
135135
*/
136136
validateEntry(entry) {
137-
const requiredFields = ['text', 'question', 'constraints', 'thought', 'answer', 'questionCode', 'src', 'time_complexity', 'space_complexity'];
137+
const requiredFields = ['text', 'question', 'constraints', 'thought', 'answer', 'question_code', 'src', 'time_complexity', 'space_complexity'];
138138

139139
for (const field of requiredFields) {
140140
if (!entry[field] || entry[field].trim() === '') {
@@ -221,7 +221,7 @@ class DatasetCompiler {
221221
* Generate summary statistics
222222
*/
223223
generateSummary(entries, outputDir) {
224-
const entriesWithQuestionCode = entries.filter(e => e.questionCode && e.questionCode.trim() !== '');
224+
const entriesWithQuestionCode = entries.filter(e => e.question_code && e.question_code.trim() !== '');
225225

226226
const summary = {
227227
total_problems: entries.length,
@@ -234,7 +234,7 @@ class DatasetCompiler {
234234
average_text_length: Math.round(entries.reduce((sum, e) => sum + e.text.length, 0) / entries.length),
235235
average_answer_length: Math.round(entries.reduce((sum, e) => sum + e.answer.length, 0) / entries.length),
236236
average_question_code_length: entriesWithQuestionCode.length > 0 ?
237-
Math.round(entriesWithQuestionCode.reduce((sum, e) => sum + e.questionCode.length, 0) / entriesWithQuestionCode.length) : 0
237+
Math.round(entriesWithQuestionCode.reduce((sum, e) => sum + e.question_code.length, 0) / entriesWithQuestionCode.length) : 0
238238
};
239239

240240
const summaryPath = join(outputDir, 'dataset_summary.json');

0 commit comments

Comments
 (0)