改进型SimHash算法用于代码数据相似度检测  被引量:3

Research on Improved SimHash Algorithm for Code Similarity Detection

在线阅读下载全文

作  者:徐莉 刘威 常兴治[1] XU Li;LIU Wei;CHANG Xingzhi(Changzhou College of Information Technology,Changzhou,China,213164)

机构地区:[1]常州信息职业技术学院,江苏常州213164

出  处:《福建电脑》2023年第6期41-45,共5页Journal of Fujian Computer

基  金:全国工业和信息化职业教育教学指导委员会2022-2023年度科研课题-程序设计类课程的课堂行为数据实时反馈教学方法的研究(No.GXHZWC77485);江苏省工信厅直属院校教改课题-数据驱动的反馈式精准教学模式研究(No.2022GXJG005);常州信息学院教育教学改革研究课题-基于分布式实训平台的课堂数据分析与评价(No.CCITSG2022008);常州信息学院自然科学课题-多涡卷蔡氏混沌吸引子的控制策略与应用研究(No.CXKZ202005Y)等课题资助。

摘  要:在程序设计类课程的教学过程中,对学生代码的分析和检测能够有效反映学生的课堂学习行为和知识点掌握情况。学生书写速度的不同会导致相同周期内程序代码长度不一致,对从时间维度提取代码文件的特征会有一定的影响。本文提出了一种用于检测代码相似度的改进型SimHash算法。首先,将学生代码以时间序列进行收集,统计代码的有效行数和字符数量,并结合整个课堂讲授周期数据计算代码有效性权重;其次,对学生代码进行动态时间规整,使学生代码在相同的周期内长度一致;随后,提取代码文件的SimHash特征,根据代码有效性权重对特征进行加权处理并降维,得到改进型SimHash特征;最后,根据代码文件的改进型SimHash特征,计算代码相似度。实验表明,本文提出的算法能够有效计算代码的相似度。In the teaching process of programming courses,the analysis and detection of students'code can effectively reflect students'classroom learning behavior and knowledge mastery.The difference of students'writing speed will lead to the inconsistency of code length within the same cycle.Extracting the features of code files from the time dimension will have certain influence.This paper proposes an improved SimHash algorithm to detect code similarity.First of all,the student code is collected by time series,the number of effective lines and characters of the code are counted,and the weight of code validity is calculated by combining the data of the whole class teaching cycle.Secondly,the dynamic time of the student code is structured to make the length of the student code consistent within the same cycle.Then,the SimHash feature of the code file is extracted,and the feature is weighted according to the code validity weight and the dimension is reduced to obtain the improved SimHash feature.Finally,the code similarity is calculated based on the improved SimHash characteristics of the code file.Experiments show that the proposed algorithm can calculate code similarity effectively.

关 键 词:程序设计 代码相似度 SimHash特征 动态时间规整 

分 类 号:TP391[自动化与计算机技术—计算机应用技术]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象