Code Editing from Few Exemplars by Adaptive Multi-Extent CompositionDownload PDF

Mar 04, 2022 (edited Apr 21, 2022)DL4C 2022Readers: Everyone
  • Keywords: Code Editing, Exemplar, Compositional Learning
  • Abstract: This paper considers the computer source code editing with a few exemplars. The editing exemplar, containing the original and modified support code snippets, showcases a certain editorial pattern, and code editing adapts the common pattern derived from a few support exemplars to a query code snippet. In this work, we propose a compositional deep learning approach to solve this code editing problem automatically. Our learning approach combines edit representations extracted from support exemplars and compositionally generalizes them to the query code snippet editing via multi-extent similarities ensemble. Specifically, we parse the support and query code snippets using language-specific grammar into abstract syntax trees. We apply the similarities measurement in multiple extents from individual nodes to collective tree representations for query and support sample matching, and ensemble the matching results through a similarity-ranking error estimator. We evaluate the proposed method on C\# and Python datasets, and show up to 8.6\% accuracy improvements compared to non-composition baselines.
1 Reply

Loading