Adapting existing source code snippets to new contexts

US11822909B2 · US · B2

Patent metadata
FieldValue
Publication numberUS-11822909-B2
Application numberUS-202217901128-A
CountryUS
Kind codeB2
Filing dateSep 1, 2022
Priority dateJan 27, 2021
Publication dateNov 21, 2023
Grant dateNov 21, 2023

How to read this patent

A practical reading order for non-experts. Skip the full description unless you need deep technical detail.

  1. Title

    What the patent document calls the invention.

  2. Abstract

    A short plain-language summary of the technical disclosure.

  3. Assignees and inventors

    Who owns or filed the patent and who is credited as inventor.

  4. Key dates

    Filing, priority, publication, and grant dates set the timeline.

  5. First independent claim

    The legal scope of protection — read this for what is actually claimed.

  6. CPC / IPC classifications

    Technology tags used to group this patent with similar filings.

  7. Citations and related patents

    Prior art links and similar publications in this corpus.

Abstract

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.

First claim

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.

Assignees

Inventors

Classifications

  • 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

  • G06F8/447Primary

    Target code generation · CPC title

  • Graphical or visual programming · CPC title

Patent family

Related publications grouped by family.

External sources

Frequently asked questions

Answers are generated from the same data shown on this page.

What does patent US11822909B2 cover?
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 co…
Who is the assignee on this patent?
Google Llc
What technology area does this patent fall under?
Primary CPC classification G06F8/447. Mapped technology areas include Physics.
When was this patent published?
Publication date Tue Nov 21 2023 00:00:00 GMT+0000 (Coordinated Universal Time) (B2). Legal status and post-grant events are not shown on this page.
What related patents are in patentsdb?
We list 10 related publications on this page (citations in our corpus or others sharing the same primary CPC).