A Code Comment Generation Method Based on Information Retrieval and Code Structure

Code comments can help developers quickly understand code and reduce maintenance costs. However, due to the widespread phenomenon of code cloning and the complex syntax structure of code, existing comment generation methods, which rely solely on Syntax Tree (AST) representations of code information, often result in low-quality comments. Therefore, this paper proposes a code comment generation method based on information retrieval and code structural information. By leveraging information retrieval techniques that combine code semantics, syntax, and lexical features, the method retrieves the most similar results from a codebase and integrates abstract syntax trees with data flow graphs to further improve the accuracy of comment generation. Experimental results show that, compared to mainstream methods, this approach achieves better performance on Python datasets, and the generated comments exhibit higher readability.

Authors

Institutions

Publication Details

Published
2024-12-20
DOI
https://doi.org/10.1109/aiim64537.2024.10934152
Primary Topic
Advanced Text Analysis Techniques
Type
article
Field-Weighted Citation Impact
0.00

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

A Code Comment Generation Method Based on Information Retrieval and Code Structure

Xinran Jiang, Daiwei Li, Hai-Qing Zhang, Xinguang Xiang et al.
Advanced Text Analysis Techniques
article

A Code Comment Generation Method Based on Information Retrieval and Code Structure

Xinran Jiang, Daiwei Li, Hai-Qing Zhang, Xinguang Xiang, Ying Zhou, Hang Liu
article en

Abstract

Code comments can help developers quickly understand code and reduce maintenance costs. However, due to the widespread phenomenon of code cloning and the complex syntax structure of code, existing comment generation methods, which rely solely on Syntax Tree (AST) representations of code information, often result in low-quality comments. Therefore, this paper proposes a code comment generation method based on information retrieval and code structural information. By leveraging information retrieval techniques that combine code semantics, syntax, and lexical features, the method retrieves the most similar results from a codebase and integrates abstract syntax trees with data flow graphs to further improve the accuracy of comment generation. Experimental results show that, compared to mainstream methods, this approach achieves better performance on Python datasets, and the generated comments exhibit higher readability.

Chengdu University of Information Technology (CN)
China Meteorological Administration
Quality Education
Openalex Percentile: Top 74%
Advanced Text Analysis Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.