v1.6 题目生成逻辑修改完毕

pull/4/head
杨博文 4 months ago
parent 417928c39a
commit bc34de13ce

@ -4,11 +4,13 @@ import com.ybw.mathapp.entity.QuestionWithOptions;
import com.ybw.mathapp.service.JuniorHighGenerator;
import com.ybw.mathapp.service.MultipleChoiceGenerator;
import com.ybw.mathapp.service.PrimarySchoolGenerator;
import com.ybw.mathapp.service.SeniorHighGenerator;
import java.util.List;
public class Main {
public static void main(String[] args) {
// 生成小学选择题
System.out.println("--- Primary School MCQs ---");
PrimarySchoolGenerator primaryGen = new PrimarySchoolGenerator();
MultipleChoiceGenerator primaryMC = new MultipleChoiceGenerator(primaryGen, "小学"); // 传入级别
@ -21,16 +23,15 @@ public class Main {
MultipleChoiceGenerator juniorMC = new MultipleChoiceGenerator(juniorGen, "初中"); // 传入级别
List<QuestionWithOptions> juniorMCQs = juniorMC.generateMultipleChoiceQuestions(10);
juniorMCQs.forEach(q -> System.out.println(q + "\n"));
System.out.println();
/*
// 生成高中选择题
System.out.println("--- Senior High MCQs ---");
SeniorHighGenerator seniorGen = new SeniorHighGenerator();
MultipleChoiceGenerator seniorMC = new MultipleChoiceGenerator(seniorGen, "高中"); // 传入级别
List<QuestionWithOptions> seniorMCQs = seniorMC.generateMultipleChoiceQuestions(2, 4);
List<QuestionWithOptions> seniorMCQs = seniorMC.generateMultipleChoiceQuestions(10);
seniorMCQs.forEach(q -> System.out.println(q + "\n"));
*/
}
}

@ -46,7 +46,6 @@ public class MultipleChoiceGenerator {
// 例如,如果基础生成器的可能组合用尽了
break; // 或者抛出异常
}
QuestionWithOptions mcq = generateSingleMCQ(baseQuestion);
if (mcq != null) {
mcQuestions.add(mcq);
@ -153,10 +152,13 @@ public class MultipleChoiceGenerator {
tokens.add(token);
i += token.length();
} else {
i++;
} /* else {
// 如果找不到匹配的 token可能是单个字符或未知格式
tokens.add(String.valueOf(expression.charAt(i)));
i++;
}
*/
}
return tokens;
}

Loading…
Cancel
Save