Pyscribe - Learning to Describe Python Code
Résumé
Code comment generation, which aims to describe the functionality of source code in natural language, plays an important role in automatic software development. Currently, several structural neural networks have been exploited to preserve the syntax structure of source code based on Abstract Syntax Trees (ASTs). However, they can not well capture both the long-distance and local relations between nodes while retaining the overall structural information of AST. To mitigate this problem, we present to the community a prototype tool called PYSCRIBE, which expands the Transformer model to a new encoder-decoder architecture to incorporate triplet positions into the node-level and edge-level features of AST towards automatically generating comments for Python code. To the best of our knowledge, this paper makes the first attempt to consider the edges of AST as an explicit component for better code representation, as to generate higher qualified comments. By specifying triplet positions for each node and edge, the overall structural information can be well preserved in the learning process. In the decoder, we perform a two-stage decoding process over the extracted node and edge features to generate comments. To evaluate the effectiveness of PYSCRIBE, we resort to a large dataset of code-comment pairs by mining Jupyter notebooks from GitHub, for which we have made it publicly available to support further studies. The evaluation results show that PYSCRIBE is indeed effective, outperforming the state-of-the-art by achieving an average BLEU score (i.e., av-BLEU) of ≈0.28.
Mots-clés
Aucun mot-clé renseigné.