Source Code Assessment and Classification Based on Estimated Error Probability Using Attentive LSTM Language Model and Its Application in Programming Education

Source Code Assessment and Classification Based on Estimated Error Probability Using Attentive LSTM Language Model and Its Application in Programming Education
复制标题

DOI:
10.3390/app10082973
复制
发表时间:
2020-02-01
影响因子:
2.7
通讯作者:
Nakamura, Keita
Nakamura, Keita
中科院分区:
综合性期刊4区
文献类型:
--
作者:
Rahman, Md. Mostafizer;Watanobe, Yutaka;Nakamura, Keita

文献摘要

被引文献

相似文献

软件开发的速度急剧增加。传统编译器无法评估和检测所有源代码错误。因此,软件可能包含错误,对最终用户产生不利影响。使用传统的编译器也很难评估和检测源代码逻辑错误,导致软件包含错误。因此,需要一种利用人工智能来评估和检测错误并将源代码分类为正确(无错误)或不正确的方法。在这里,我们提出了一个序列语言模型,它使用基于注意力机制的长短期记忆(LSTM)神经网络,根据估计的错误概率对源代码进行评估和分类。注意机制提高了所提出的语言模型的错误评估和分类的准确性。我们使用正确的源代码训练了所提出的模型,然后评估了其性能。实验结果表明,该模型的逻辑和语法错误检测准确率分别为92.2%和94.8%,优于最先进的模型。我们还将该模型应用于具有逻辑和语法错误的源代码的分类。这种分类的平均精度,召回率和F-测量值比基准模型好得多。为了加强所提出的模型,我们将注意力机制与LSTM相结合,以增强错误评估和检测以及源代码分类的结果。最后,我们提出的模型可以有效地在编程教育和软件工程,提高代码编写,调试,纠错和推理。
The rate of software development has increased dramatically. Conventional compilers cannot assess and detect all source code errors. Software may thus contain errors, negatively affecting end-users. It is also difficult to assess and detect source code logic errors using traditional compilers, resulting in software that contains errors. A method that utilizes artificial intelligence for assessing and detecting errors and classifying source code as correct (error-free) or incorrect is thus required. Here, we propose a sequential language model that uses an attention-mechanism-based long short-term memory (LSTM) neural network to assess and classify source code based on the estimated error probability. The attentive mechanism enhances the accuracy of the proposed language model for error assessment and classification. We trained the proposed model using correct source code and then evaluated its performance. The experimental results show that the proposed model has logic and syntax error detection accuracies of 92.2% and 94.8%, respectively, outperforming state-of-the-art models. We also applied the proposed model to the classification of source code with logic and syntax errors. The average precision, recall, and F-measure values for such classification are much better than those of benchmark models. To strengthen the proposed model, we combined the attention mechanism with LSTM to enhance the results of error assessment and detection as well as source code classification. Finally, our proposed model can be effective in programming education and software engineering by improving code writing, debugging, error-correction, and reasoning.