Adapting existing source code snippets to new contexts
US-2022236971-A1 · Jul 28, 2022 · US
US11822909B2 · US · B2
| Field | Value |
|---|---|
| Publication number | US-11822909-B2 |
| Application number | US-202217901128-A |
| Country | US |
| Kind code | B2 |
| Filing date | Sep 1, 2022 |
| Priority date | Jan 27, 2021 |
| Publication date | Nov 21, 2023 |
| Grant date | Nov 21, 2023 |
A practical reading order for non-experts. Skip the full description unless you need deep technical detail.
What the patent document calls the invention.
A short plain-language summary of the technical disclosure.
Who owns or filed the patent and who is credited as inventor.
Filing, priority, publication, and grant dates set the timeline.
The legal scope of protection — read this for what is actually claimed.
Technology tags used to group this patent with similar filings.
Prior art links and similar publications in this corpus.
Official abstract text for this publication.
Implementations are described herein for adapting existing source code snippets to new contexts. In various implementations, a command may be detected to incorporate an existing source code snippet into destination source code. An embedding may be generated based on the existing source code snippet, e.g., by processing the existing source code snippet using an encoder. The destination source code may be processed to identify one or more decoder constraints. Subject to the one or more decoder constraints, the embedding may be processed using a decoder to generate a new version of the existing source code snippet that is adapted to the destination source code.
Opening claim text (preview).
What is claimed is: 1. A method implemented using one or more processors, comprising: detecting a command to incorporate an existing source code snippet into destination source code; generating an embedding based on the existing source code snippet, wherein the generating includes processing the existing source code snippet using an encoder; processing the destination source code to identify one or more decoder constraints, wherein the one or more decoder constraints comprise a dictionary of variable names or function names extracted from the destination source code; subject to the one or more decoder constraints, processing the embedding using a decoder to generate a new version of the existing source code snippet that is adapted to the destination source code, wherein processing the embedding using the decoder includes biasing the decoder towards the variable names or function names in the dictionary. 2. The method of claim 1 , wherein the existing source code snippet includes a function call, and processing the embedding using the decoder includes generating glue code to adapt the function call to the destination source code. 3. The method of claim 1 , wherein the command comprises a paste command. 4. The method of claim 1 , wherein the command comprises a command to drag-and-drop a graphical element that includes the existing source code snippet into the destination source code. 5. The method of claim 1 , wherein the generating includes processing at least a portion of the destination source code using the encoder. 6. A method implemented using one or more processors, comprising: detecting a command to incorporate an existing source code snippet into destination source code; generating a first embedding based on the existing source code snippet, wherein the generating includes processing data indicative of the existing source code snippet using one or more encoders; generating a second embedding based on the destination source code snippet, wherein the generating includes processing data indicative of the destination source code snippet using one or more of the encoders; combining the first and second embeddings into a combined embedding; and processing the combined embedding using a decoder to generate a new version of the existing source code snippet that is adapted to the destination source code. 7. The method of claim 6 , wherein the combining comprises concatenating the first and second embeddings. 8. The method of claim 6 , wherein generating the first and second embeddings include processing the existing and destination source code snippets to generate, respectively, first and second abstract syntax trees. 9. The method of claim 8 , wherein the first and second abstract syntax trees are processed using one or more of the encoders to generate, respectively, the first and second embeddings. 10. The method of claim 6 , wherein the existing source code snippet includes a function call. 11. The method of claim 10 , wherein processing the embedding using the decoder includes generating glue code to adapt the function call to the destination source code. 12. The method of claim 6 , wherein the command comprises a paste command. 13. The method of claim 6 , wherein the command comprises a command to drag-and-drop a graphical element that includes the existing source code snippet into the destination source code. 14. A system comprising one or more processors and memory storing instructions that, in response to execution by the one or more processors, cause the one or more processors to: detect a command to incorporate an existing source code snippet into destination source code; generate a first embedding based on the existing source code snippet, wherein the generating includes processing data indicative of the existing source code snippet using one or more encoders; generate a second embedding based on the destination source code snippet, wherein the instructions to generate include instructions to process data indicative of the destination source code snippet using one or more of the encoders; combine the first and second embeddings into a combined embedding; and process the combined embedding using a decoder to generate a new version of the existing source code snippet that is adapted to the destination source code. 15. The system of claim 14 , wherein the instructions to combine include instructions to concatenate the first and second embeddings. 16. The system of claim 14 , wherein the instructions to generate the first and second embeddings include instructions to process the existing and destination source code snippets to generate, respectively, first and second abstract syntax trees. 17. The system of claim 16 , wherein the first and second abstract syntax trees are processed using one or more of the encoders to generate, respectively, the first and second embeddings. 18. The system of claim 14 , wherein the existing source code snippet includes a function call, and the instructions to process include instructions to process the embedding using the decoder includes generating glue code to adapt the function call to the destination source code. 19. The system of claim 14 , wherein the command comprises a paste command. 20. The system of claim 14 , wherein the command comprises a command to drag-and-drop a graphical element that includes the existing source code snippet into the destination source code.
Auto-encoder networks; Encoder-decoder networks · CPC title
characterised by memory or gating, e.g. long short-term memory [LSTM] or gated recurrent units [GRU] · CPC title
Creation or generation of source code · CPC title
Target code generation · CPC title
Graphical or visual programming · CPC title
Related publications grouped by family.
Answers are generated from the same data shown on this page.