EditSum: A Retrieve-and-Edit Framework for Source Code Summarization

要約

既存の研究によると、コードの概要は開発者がソース コードを理解し、維持するのに役立ちます。
残念ながら、ソフトウェア プロジェクトでは、これらの概要が欠落しているか、古くなっていることがよくあります。
コード要約は、ソース コードの自然言語記述を自動的に生成することを目的としています。
コードの要約は高度に構造化されており、反復的なパターンがあります。
コードの概要には、パターン化された単語のほかに、コードの機能を反映するための鍵となる重要なキーワードも含まれています。
ただし、最先端のアプローチではキーワードの予測が不十分であり、生成される要約の情報量が損なわれてしまいます。
この問題を軽減するために、この論文では、コードを要約するための EditSum という新しい検索と編集のアプローチを提案します。
具体的には、EditSum はまず、事前定義されたコーパスから同様のコード スニペットを取得し、その概要をプロトタイプの概要として処理してパターンを学習します。
次に、EditSum はプロトタイプを自動的に編集して、プロトタイプ内のパターンと入力コードの意味情報を結合します。
私たちの動機は、類似したコード スニペットの要約は同じパターンを持つことが多いため、取得したプロトタイプが生成後の良い開始点となることです。
編集後のプロセスでは、プロトタイプ内のパターン化された単語がさらに再利用され、入力コードの意味情報に基づいてキーワードが生成されます。
私たちは大規模な Java コーパスで実験を行い、実験結果では EditSum が最先端のアプローチを大幅に上回るパフォーマンスを示しました。
人間による評価は、EditSum によって生成された概要がより有益で有益であることも証明しています。
また、パターン化された単語やキーワードの予測において EditSum が適切に機能することも検証します。

要約(オリジナル)

Existing studies show that code summaries help developers understand and maintain source code. Unfortunately, these summaries are often missing or outdated in software projects. Code summarization aims to generate natural language descriptions automatically for source code. Code summaries are highly structured and have repetitive patterns. Besides the patternized words, a code summary also contains important keywords, which are the key to reflecting the functionality of the code. However, the state-of-the-art approaches perform poorly on predicting the keywords, which leads to the generated summaries suffering a loss in informativeness. To alleviate this problem, this paper proposes a novel retrieve-and-edit approach named EditSum for code summarization. Specifically, EditSum first retrieves a similar code snippet from a pre-defined corpus and treats its summary as a prototype summary to learn the pattern. Then, EditSum edits the prototype automatically to combine the pattern in the prototype with the semantic information of input code. Our motivation is that the retrieved prototype provides a good start-point for post-generation because the summaries of similar code snippets often have the same pattern. The post-editing process further reuses the patternized words in the prototype and generates keywords based on the semantic information of input code. We conduct experiments on a large-scale Java corpus and experimental results demonstrate that EditSum outperforms the state-of-the-art approaches by a substantial margin. The human evaluation also proves the summaries generated by EditSum are more informative and useful. We also verify that EditSum performs well on predicting the patternized words and keywords.

arxiv情報

著者 Jia Li,Yongmin Li,Ge Li,Xing Hu,Xin Xia,Zhi Jin
発行日 2023-09-07 11:19:30+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.CL, cs.SE パーマリンク