Patent ID: 11934815
Assignee: TATA CONSULTANCY SERVICES LIMITED
Field: Computer technology (Electrical engineering)
Classification: CPC G | IPC G

Claim 8:
9. One or more non-transitory machine-readable information storage mediums comprising one or more instructions which when executed by one or more hardware processors cause:
providing, via a user interface, a source code for translation as an input;
parsing, the source code using a parser;
creating, via the one or more hardware processors, a program flow graph using the parsed source code, wherein the program flow graph is used to establish a set of relations between a plurality of statements present in the source code;
creating, via the one or more hardware processors, a matrix of the established set of relations between the plurality of statements;
splitting, via the one or more hardware processors, the source code into a plurality of blocks using the created matrix, wherein the statements in one block out of the plurality of blocks are closer to each other as compared to other statements irrespective of their physical presence in the source code;
vectorizing, via the one or more hardware processors, the plurality of blocks to get a plurality of vectorized blocks;
training, via the one or more hardware processors, a semantically enhanced encoder with a context of a semantic equivalence between the plurality of blocks of the source code irrespective of a manner in which the plurality of blocks is syntactically coded;
identifying, via the one or more hardware processors, semantically similar statements out of the plurality of blocks using the trained model;
selecting, via the user interface, a target language in which the source code needs to be translated;
translating, via the one or more hardware processors, the source code into the target language using a decoder based on the identified semantically similar statements, wherein the decoder is a pretrained machine learning model, wherein the pretrained machine learning model is fine-tuned on a supervised data set to generate one or more vectors that are similar in nature and wherein the pretrained machine learning model understands and encapsulates code semantics and translates a semantic equivalent code, and wherein an attention mechanism in a transformer model learns patterns to produce one or more mathematically closer vectors; and
eliminating, via the one or more hardware processors, at least one of unused and duplicate codes from the source code using the set of relations and removing technical debt and the duplicate codes by semantic equivalence analysis.