-
公开(公告)号:US11693637B1
公开(公告)日:2023-07-04
申请号:US17319739
申请日:2021-05-13
Applicant: Google LLC
Inventor: Rishabh Singh , Hanjun Dai , Manzil Zaheer , Artem Goncharuk , Karen Davis , David Andre
CPC classification number: G06F8/436 , G06F40/279 , G06F40/40 , G06N3/08 , G06N7/01
Abstract: Using a natural language (NL) latent presentation in the automated conversion of source code from a base programming language (e.g., C++) to a target programming language (e.g., Python). A base-to-NL model can be used to generate an NL latent representation by processing a base source code snippet in the base programming language. Further, an NL-to-target model can be used to generate a target source code snippet in the target programming language (that is functionally equivalent to the base source code snippet), by processing the NL latent representation. In some implementations, output(s) from the NL-to-target model indicate canonical representation(s) of variables, and in generating the target source code snippet, technique(s) are used to match those canonical representation(s) to variable(s) of the base source code snippet. In some implementations, multiple candidate target source code snippets are generated, and a subset (e.g., one) is selected based on evaluation(s).
-
公开(公告)号:US11960867B1
公开(公告)日:2024-04-16
申请号:US18198674
申请日:2023-05-17
Applicant: GOOGLE LLC
Inventor: Rishabh Singh , Hanjun Dai , Manzil Zaheer , Artem Goncharuk , Karen Davis , David Andre
CPC classification number: G06F8/436 , G06F40/279 , G06F40/40 , G06N3/08 , G06N7/01
Abstract: Using a natural language (NL) latent presentation in the automated conversion of source code from a base programming language (e.g., C++) to a target programming language (e.g., Python). A base-to-NL model can be used to generate an NL latent representation by processing a base source code snippet in the base programming language. Further, an NL-to-target model can be used to generate a target source code snippet in the target programming language (that is functionally equivalent to the base source code snippet), by processing the NL latent representation. In some implementations, output(s) from the NL-to-target model indicate canonical representation(s) of variables, and in generating the target source code snippet, technique(s) are used to match those canonical representation(s) to variable(s) of the base source code snippet. In some implementations, multiple candidate target source code snippets are generated, and a subset (e.g., one) is selected based on evaluation(s).
-
公开(公告)号:US11775271B1
公开(公告)日:2023-10-03
申请号:US17316331
申请日:2021-05-10
Applicant: Google LLC
Inventor: Rishabh Singh , Artem Goncharuk , Karen Davis , David Andre
Abstract: Techniques are described herein for translating source code in one programming language to source code in another programming language using machine learning. A method includes: receiving first source code in a first higher-level programming language; processing the first source code, or an intermediate representation thereof, using a sequence-to-sequence neural network model to generate a sequence of outputs, each including a probability distribution; generating second source code in a second higher-level programming language by, for each output in the sequence of outputs: determining a highest probability in the probability distribution associated with the output; in response to the highest probability exceeding a first threshold, generating a predicted portion of the second source code based on a token that corresponds to the highest probability; and in response to the highest probability not exceeding the first threshold, generating a placeholder; and outputting the second source code.
-
-