Skip to yearly menu bar Skip to main content


Poster
in
Workshop: Deep Learning for Code

Code Editing from Few Exemplars by Adaptive Multi-Extent Composition

Peizhao Li · Xuchao Zhang · Ziyu Yao · Wei Cheng · Haifeng Chen · Hongfu Liu


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.

Chat is not available.