arrow
返回

A graph-based code representation method to improve code readability classification

delete2023-05-23
delete4
PRE
AI
Q
Qing Mi
Y
Yi Zhan
W
Weng, Han
Q
Qinghang Bao
L
Longjie Cui
马
马伟 (Wei Ma) *
DOI:10.1007/s10664-023-10319-6delete
delete原文链接
delete原文求助
delete分享
delete收藏
摘要

摘要

En 中文
Context Code readability is crucial for developers since it is closely related to code maintenance and affects developers' work efficiency. Code readability classification refers to the source code being classified as pre-defined certain levels according to its readability. So far, many code readability classification models have been proposed in existing studies, including deep learning networks that have achieved relatively high accuracy and good performance. Objective However, in terms of representation, these methods lack effective preservation of the syntactic and semantic structure of the source code. To extract these features, we propose a graph-based code representation method. Method Firstly, the source code is parsed into a graph containing its abstract syntax tree (AST) combined with control and data flow edges to reserve the semantic structural information and then we convert the graph nodes' source code and type information into vectors. Finally, we train our graph neural networks model composing Graph Convolutional Network (GCN), DMoNPooling, and K-dimensional Graph Neural Networks (k-GNNs) layers to extract these features from the program graph. Result We evaluate our approach to the task of code readability classification using a Java dataset provided by Scalabrino et al. (2016). The results show that our method achieves 72.5% and 88% in three-class and two-class classification accuracy, respectively. Conclusion We are the first to introduce graph-based representation into code readability classification. Our method outperforms state-of-the-art readability models, which suggests that the graph-based code representation method is effective in extracting syntactic and semantic information from source code, and ultimately improves code readability classification.
Keyword:
Code readability classification
Graph neural network
Code representation
Abstract syntax tree
Program comprehension

期刊

Empirical Software Engineering 封面图
Empirical Software Engineering
IF:
3.6
论文数:
2.0K
被引数:
5.3K

机构

B
Beijing University of Technology
学者数:
2.8W
论文数: 2.1W
被引数: 2.7W
引用论文

引用论文

err分享
err收藏
Ca2+ Activated K Channels-New Tools to Induce Cardiac Commitment from Pluripotent Stem Cells in Mice and Men
err2011-10-26
err0
PREAI
errMartin Müller; Marianne Stockmann; Daniela Malan; Anne Wolheim; Michael Tischendorf; Leonhard Linta; Sarah-Fee Katz; Qiong Lin; Stephan Latz; Cornelia Brunner; Anna M. Wobus; Martin Zenke; Maria Wartenberg; Tobias M. Boeckers; Götz von Wichert; Bernd K. Fleischmann; Stefan Liebau; Alexander Kleger
err分享
err收藏
Measuring Program Comprehension: A Large-Scale Field Study with Professionals
err2018-10-01
err195
errOAAI
errXia, Xin; Bao, Lingfeng; Lo, David; Xing, Zhenchang; Hassan, Ahmed E.; Li, Shanping
err分享
err收藏
err分享
err收藏
err分享
err收藏
The heritability of insomnia: A meta‐analysis of twin studies
err2020-12-03
err0
errOAAI
errNicola L. Barclay; Desi Kocevska; Wichor M. Bramer; Eus J. W. Van Someren; Philip Gehrman
err分享
err收藏
学者 查看更多内容