主要任务:优化考试流程与评价系统
设置考试开始提示
点击考试开始后创建新的examid,并且进入考试
评价系统优化并且生成提示
考试结束时,模型生成得分与评价,使用正则表达式分别提取得分与评价
评价模板
score:8,comment:考生回答流畅,能够清晰地表达自己的想法。在Part 1中,考生对于使用社交媒体的时间进行了明确的回答。在Part 2的个人陈述中,考生详细地描述了自己想要去放松的地方,并解释了原因。在Part 3的深入讨论中,考生能够针对问题进行讨论,表达自己的观点。虽然在某些方面可以进一步深入和扩展,但整体表现良好。
使用正则表达式提取出成绩和评价,返回前端并展示
public static ScoreAndComment extractFeedback(String message) {
// 定义正则表达式
String scoreRegex = "score:(\\d+)";
String commentRegex = "comment:(.*)";
// 编译正则表达式
Pattern scorePattern = Pattern.compile(scoreRegex);
Pattern commentPattern = Pattern.compile(commentRegex);
// 创建匹配器
Matcher scoreMatcher = scorePattern.matcher(message);
Matcher commentMatcher = commentPattern.matcher(message);
// 提取分数
String score = null;
if (scoreMatcher.find()) {
score = scoreMatcher.group(1);
}
int scoreInt=Integer.parseInt(score);
// 提取评论
String comment = null;
if (commentMatcher.find()) {
comment = commentMatcher.group(1);
}
ScoreAndComment s=new ScoreAndComment();
s.setComment(comment);
s.setScore(scoreInt);
return s;
}
前端展示