先说明。 2026 年 3 月,本刊登过一篇某位老师做评分工具的文章。这个现场不是某所特定的学校。 我们把它实际运转的形状照实构成,也不点名是哪里。以下是按那个形状自己做的,答案和评分标准全是编的。
原文的问题在别处。它说了工具给了分,却没说凭什么给的。
在评分这件事上,这不是小疏漏。分数必须是学生能申诉的,而老师必须能回应那份申诉。没有理由的分数,既申诉不了,也答不上。
评分标准是数据
先说这个工具没有的东西。这里没有一行代码在判断什么是好答案。 那是评分标准,而评分标准是老师写下的数据。
/// One rubric line, written by the teacher.
///
/// `accept` is the list of things that earn the mark. It is deliberately a list
/// of strings rather than a regular expression or a scoring function: the
/// teacher has to be able to read their own standard back, and change it
/// without asking anyone.
不做成正则或打分函数的理由就写在那里。老师必须能把自己的标准读回来。 运行日志里就有这次读回。
rubric: Q1(10) accept=[24] | Q2(10) accept=[x=3, x = 3, 3]
| Q3(20) accept=[-5, x=-5] | Q4(10) accept=[12cm, 12 cm]
请注意第 2 题的 accept 有三条。x=3、x = 3、3。空格和写法宽容到哪一步,本身就是评分标准,而那是老师的判断,不是工具的宽容。
部分分带着理由出来
这是这一篇的核心。把评分表从查找表变成判断的,正是部分分。
/// Mark one answer against one rubric line, and say which branch was taken.
///
/// The reason for returning the branch and not just the number: a teacher
/// overriding a mark needs to see what the scheme decided, not guess at it.
(int, String) _mark(RubricItem r, String? given) {
if (given == null || given.isEmpty) return (0, 'blank');
if (r.accept.contains(given)) return (r.points, 'accepted');
if (r.partial.containsKey(given)) {
return (r.partial[given]!, 'partial (${r.trap})');
}
return (0, 'wrong');
}
它不只返回分数,还一起返回走了哪一支。把一份真实答卷原样搬过来。
paper 02: Q1 "24" -> 10/10 (accepted)
| Q2 "x=3" -> 10/10 (accepted)
| Q3 "5" -> 8/20 (partial (drops the minus sign on the root))
| Q4 "12 cm" -> 10/10 (accepted)
第 3 题满分 20 得了 8 分,而「为什么是 8 分」就挂在旁边。 因为漏掉了根的负号。学生来问,老师把那一行给他看就行。
验证也看这一条。
# 部分分必须说出是评分标准的哪一支给的。没有理由的数字无法被反驳,
# 而老师必须能够反驳。
grep -q 'partial (drops the minus sign on the root)' captures/run.log \
|| { echo "a partial mark arrived without the reason that produced it"; exit 1; }
