TranS^3:一个基于Transformer的统一代码摘要和代码搜索的框架
TranS^3: A Transformer-based Framework for Unifying Code Summarization and Code Search
摘要:
代码摘要和代码搜索在软件开发和维护中得到了广泛的应用。然而,很少有研究探讨了统一它们的效果。在本文中,我们提出了一个基于transformer的框架,将代码摘要与代码搜索集成在一起。具体来说,对于代码摘要,Trans^3启用了一个Actor-Critic网络,在Actor网络中,我们通过基于Transformer和基于树的Transformer编码器对收集的代码片段进行编码,并对给定的代码片段进行解码以生成其注释。同时,我们通过评论家网络的反馈迭代地调整演员网络,以提高生成评论的质量。此外,我们将生成的注释导入代码搜索,以提高其准确性。为了评估TranS^3的有效性,我们进行了一系列实验研究和案例研究,实验结果表明,TranS^3在代码摘要和代码搜索方面都明显优于多种最先进的方法,并且从开发人员的角度来看,研究结果进一步加强了TranS^3的有效性。
英文摘要:
Code summarization and code search have been widely adopted in sofwaredevelopmentandmaintenance. However, fewstudieshave explored the efcacy of unifying them. In this paper, we propose TranS^3 , a transformer-based framework to integrate code summarization with code search. Specifcally, for code summarization,TranS^3 enables an actor-critic network, where in the actor network, we encode the collected code snippets via transformer- and tree-transformer-based encoder and decode the given code snippet to generate its comment. Meanwhile, we iteratively tune the actor network via the feedback from the critic network for enhancing the quality of the generated comments. Furthermore, we import the generated comments to code search for enhancing its accuracy. To evaluatetheefectivenessof TranS^3 , we conduct a set of experimental studies and case studies where the experimental results suggest that TranS^3 can signifcantly outperform multiple state-of-the-art approaches in both code summarization and code search and the study results further strengthen the efcacy of TranS^3 from the developers' points of view.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。