摘要
针对数据库测试中SQL脚本类题目,提出基于语法分析和字符串编辑距离相结合的自动阅卷算法。该算法首先对答案进行词法分析和语法分析,获得SQL语句的语法分析树,并基于字符串编辑距离从标准答案集中选择最匹配的标准答案,以及对语法树的节点进行相似度比较,并根据评分标准,实现题目的自动评阅。阅卷系统采用开源语法分析器——ANTLR3.4和VS2010实现自动评阅。该自动阅卷算法得到参考评分,同时可以指出错误点,并且更好地支持答案的多样性和容错性,实现高效率、较精确的阅卷结果。
An automatic marking algorithm based on syntax analysis and string Levenshtein distance for SQL script in database tests was proposed. Firstly, through the lexical analysis and syntax analysis for student’s answer, the syntax analysis tree is obtained. Secondly, the most matched standard answer is chosen from the standard answers set by comparing the string edit distance between the student’s answer and the standard answers. Thirdly, by comparing the similarity of all the corresponding nodes of the two syntax analysis tree, the mark is achieved based on the score value of the standard answer. The marking system is implemented using open source parser—ANTLR3.4 and VS2010. This automatic marking method not only can give reference scores, but also point out the error position. Furthermore, it supports efficient and accurate marking for multi-answers with fault tolerance.
出处
《软件工程与应用》
2014年第1期9-14,共6页
Software Engineering and Applications