Target program generation method and system, computer equipment and computer program product

By generating intermediate logical representations through semantic parsing and information extraction of natural language text, this technology overcomes the reliance on engineers' experience in existing technologies, enabling efficient and high-quality automatic generation of program development, applicable to multiple target programming languages.

CN121478298APending Publication Date: 2026-02-06SHENZHEN UNIMAT AUTOMATION TECH
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202610020001.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-08
Publication Date
2026-02-06

AI Technical Summary

Technical Problem

Existing software development tools rely on human experience, resulting in complex and inefficient development processes. They struggle to parse diverse and non-standardized requirements and lack cross-domain and cross-scenario intelligent capabilities, thus limiting the improvement of development efficiency and quality.

Method used

By acquiring a set of natural language text, performing semantic parsing and information extraction, an intermediate logical representation independent of the target programming language is generated. Combined with the language specifications of the target programming language, an executable target program is automatically generated, avoiding reliance on the engineer's experience.

Benefits of technology

It improves the efficiency and quality of program development, enables accurate expression and logical transformation of user needs, lowers the development threshold, and reduces the error rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121478298A_ABST
    Figure CN121478298A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of intelligent development, and provides a target program generation method and system, computer equipment and a computer program product. Performing semantic analysis and information extraction on the natural language text to obtain an entity control element set and a logic relation set of the natural language text; generating an intermediate logic representation based on the entity control element set and the logic relationship set, wherein the intermediate logic representation is independent of the target program language; and generating an executable target program corresponding to the natural language text according to the intermediate logic representation and the language specification of the target program language. According to the method provided by the invention, dependence on experience of engineers can be avoided, and the efficiency and quality of target program development are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of intelligent development technology, and in particular relates to a target program generation method, system, computer equipment, and computer program product. Background Technology

[0002] The current software development field heavily relies on human experience, resulting in complex and inefficient development processes. Traditional tools, limited by preset rules and templates, struggle to parse diverse and non-standardized requirements (such as natural language descriptions), leading to difficulties in implementing requirements. Developers must manually complete the entire process from requirements analysis to code implementation, which presents challenges such as high technical barriers, cumbersome operations, and high error rates. Existing auxiliary tools lack sufficient intelligence, fail to anticipate logical conflicts, and are ill-suited to cross-domain and cross-scenario business needs, further limiting the improvement of development efficiency and quality.

[0003] Therefore, there is an urgent need for a program generation method to solve the above-mentioned technical problems and realize the processing of user demand data and automatic generation of target programs. Summary of the Invention

[0004] In view of this, embodiments of this application provide a target program generation method, system, computer device, and computer program product to solve the problem of reliance on engineer experience in program generation in the prior art, and to improve the efficiency and quality of program development.

[0005] The first aspect of this application provides a method for generating a target program, including: Acquire a set of natural language texts, the set of natural language texts including at least one natural language text, the natural language text being used to describe the target control logic; Semantic parsing and information extraction are performed on the natural language text to obtain a set of entity control elements and a set of logical relations of the natural language text. The set of entity control elements includes at least one entity control element, and the set of logical relations includes at least one logical relation. An intermediate logical representation is generated based on the entity control element set and the logical relationship set, and the intermediate logical representation is independent of the target programming language. An executable target program corresponding to the natural language text is generated based on the intermediate logic representation and the language specification of the target program language.

[0006] In one implementation of the first aspect, the step of performing semantic parsing and information extraction on the natural language text to obtain the entity control element set and logical relation set of the natural language text includes: The text parsing model will identify and extract entity control elements from the natural language text and construct an entity control element set based on the entity control elements. The logical relationships between control conditions and execution actions in the natural language text are analyzed and extracted using a text parsing model, and a set of logical relationships is constructed based on these relationships.

[0007] In one implementation of the first aspect, the entity control element includes a device entity, a state entity, and a parameter entity. The device entity is used to characterize the device to be controlled, the parameter entity is used to characterize the control parameters, and the state entity is used to characterize the state of the device entity or the parameter entity. The logical relationship includes the condition action pair consisting of the control condition and the execution action.

[0008] In one implementation of the first aspect, generating the executable target program corresponding to the natural language text based on the intermediate logical representation and the language specification of the target program language includes: Confirm the target programming language selected by the user and load the language specification of the target programming language; The abstract nodes in the intermediate logical representation are mapped to programming elements that conform to the language specifications of the target program language; Replace the device entity and status entity in the intermediate logical representation with the corresponding hardware address in the hardware address allocation table. The hardware address includes either an I / O address or a memory address.

[0009] In one implementation of the first aspect, the target programming language is a ladder diagram, and the intermediate logic is represented as an abstract logic tree; The step of generating the executable target program corresponding to the natural language text based on the intermediate logical representation and the language specification of the target program language further includes: Traverse the abstract logic tree using either depth-first or breadth-first search. If a serial node is encountered during the traversal, the hardware addresses corresponding to the left and right child nodes of the serial node are added as contacts from left to right on the same branch of the target ladder diagram. If parallel nodes are encountered during the traversal, two parallel branches are created in the target ladder diagram based on the left and right child nodes of the parallel nodes, respectively. If a leaf node is encountered during the traversal, the hardware address corresponding to the leaf node is added as an output coil or function instruction block at the rightmost end of the current branch of the target ladder diagram. After completing the traversal of the abstract logic tree, check whether the target ladder diagram conforms to the language specification corresponding to the ladder diagram. If the target ladder diagram conforms to the language specification, then output the target ladder diagram.

[0010] In one implementation of the first aspect, after generating the executable target program corresponding to the natural language text based on the intermediate logical representation and the language specification of the target program language, the method further includes: The natural language text and the corresponding executable target program are visualized. Detect user commands; When the operation instruction representation is directly adopted, the executable target program is inserted into the designated location of the existing project; If the operation instruction includes a modification command, the executable target program is updated based on the modification command until an operation instruction directly used is detected, and the updated executable target program is inserted into the specified location of the existing project; If the operation instruction indicates that the executable target program is to be deprecated, the executable target program is deprecated and a deprecation report is generated.

[0011] In one implementation of the first aspect, the method further includes: When the operation instruction representation is directly adopted, a positive sample is constructed based on the natural language text, the intermediate logic representation, and the executable target program; In the case where the operation instructions include modification commands, a differentiated sample is constructed based on the natural language text, the original executable target program, and the final executable target program; When the operation instruction represents the abandonment of the executable target program, a negative sample is constructed based on the natural language text, the intermediate logic representation, and the abandoned executable target program; Each update cycle performs feedback optimization on the text parsing model based on the positive samples, the differentiated samples, and the negative samples.

[0012] A second aspect of this application provides a target program generation system, comprising: The requirement acquisition module is used to acquire a set of natural language texts, which includes at least one natural language text, and the natural language text is used to describe the target control logic. The parsing module is used to perform semantic parsing and information extraction on the natural language text to obtain the entity control element set and logical relation set of the natural language text. The entity control element set includes at least one entity, and the logical relation set includes at least one logical relation. An intermediate logic representation module is used to generate an intermediate logic representation based on the entity control element set and the logical relationship set, wherein the intermediate logic representation is independent of the target programming language; The program generation module is used to generate an executable target program corresponding to the natural language text based on the intermediate logical representation and the language specification of the target program language.

[0013] A third aspect of this application provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the target program generation method as described in the first aspect.

[0014] A fourth aspect of this application provides a computer program product, including a computer program, which, when run, causes the target program generation method as described in the first aspect to be executed.

[0015] The beneficial effects of the first aspect of the embodiments of this application are as follows: by acquiring a set of natural language texts and performing semantic parsing and information extraction on the natural language texts to obtain the set of entity control elements and the set of logical relations of the natural language texts, an intermediate logical representation independent of the target programming language is generated based on the set of entity control elements and the set of logical relations. The intermediate logical representation is independent of the target programming language and can accurately express the requirement logic. Finally, an executable target program corresponding to the natural language text is generated according to the intermediate logical representation and the language specification of the target programming language. This avoids dependence on the engineer's experience and improves the efficiency and quality of target program development.

[0016] It is understood that the beneficial effects of the second to fourth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a schematic diagram illustrating the implementation flow of the target program generation method provided in the embodiments of this application; Figure 2 This is a schematic diagram of the semantic parsing and information extraction process provided in the embodiments of this application; Figure 3 This is a schematic diagram of the intermediate logic representation provided in the embodiments of this application; Figure 4 This is a schematic diagram illustrating the ladder diagram generation process provided in the embodiments of this application; Figure 5 This is a schematic diagram of the target program generation system provided in the embodiments of this application; Figure 6 This is a schematic diagram of the computer device provided in an embodiment of this application; Figure 7 This is a schematic diagram of a computer program product provided in an embodiment of this application. Detailed Implementation

[0019] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0020] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0021] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0022] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."

[0023] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0024] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0025] In the field of industrial automation, programmable logic controllers (PLCs) are the core of control systems. Their programs are usually developed by programmers in a host computer environment using languages ​​such as ladder diagrams (LD), function block diagrams (FBD), or structured text (ST) as defined by the IEC 61131-3 standard.

[0026] Currently, PLC programming heavily relies on the engineer's personal experience and technical skills. Engineers must first deeply understand complex process requirements and then manually translate them into precise control logic. This process presents several significant challenges: High barrier to entry and low efficiency: Engineers need to master both process principles and programming skills. Even when faced with simple control logic, they still need to perform a lot of manual operations such as creating projects, selecting instructions, and drawing logic diagrams, resulting in low development efficiency.

[0027] Error-prone and difficult to debug: Oversights are prone to occur during manual programming, leading to problems such as double coil conflicts, timing errors, and logical contradictions. These errors are difficult to quickly identify and locate during the debugging phase, significantly slowing down the project progress.

[0028] Although some existing research has attempted to achieve code-assisted generation using templates or rule bases, their flexibility is insufficient and they are unable to accurately understand diverse and colloquial natural language descriptions, thus limiting their application in practical industrial scenarios.

[0029] Therefore, the industry urgently needs an intelligent program generation method that can understand engineers' intuitive expressions and automatically convert them into accurate control logic.

[0030] To address the aforementioned problems, this application provides a target program generation method to resolve the reliance on engineer experience in target program development and improve the efficiency and quality of target program development. The method provided in this application obtains a set of natural language text and performs semantic parsing and information extraction to obtain a set of entity control elements and a set of logical relations from the natural language text. Then, based on the set of entity control elements and the set of logical relations, an intermediate logical representation independent of the target program language is generated. This intermediate logical representation is independent of the target program language and can accurately express the requirement logic. Finally, an executable target program corresponding to the natural language text is generated according to the intermediate logical representation and the language specifications of the target program language. This avoids reliance on engineer experience and improves the efficiency and quality of target program development.

[0031] like Figure 1 As shown, this application provides a target program generation method, including: Step S1: Obtain a natural language text set, which includes at least one natural language text, used to describe the target control logic.

[0032] In the application, natural language text describing the control logic required by the user is extracted from the requirements document, or natural language text expressing the requirements is received from user input via a real-time input box. This natural language text can be text directly entered by the user, or speech containing control logic requirements input via microphone and processed through speech recognition, or a new image containing control requirements input by the user and processed through character recognition, or a sequence of control clicks constructed by the user and processed to obtain the natural language text.

[0033] In applications, for scenarios involving the migration of existing programs, the functional logic of the existing program is extracted and natural language text containing the functional logic of the existing program is generated.

[0034] Step S2: Semantic parsing and information extraction are performed on the natural language text to obtain the entity control element set and logical relation set of the natural language text. The entity control element set includes at least one entity control element, and the logical relation set includes at least one logical relation.

[0035] In this application, before semantic parsing and information extraction from natural language text, a logical consistency check is performed on the natural language text to examine for logical contradictions, infinite loops, missing parameters, and other issues. If any of these issues are found, a list of issues to be corrected for that natural language text is generated and provided to the user. This list includes all issues to be corrected in the natural language text. Replacement text is obtained from the user's input based on the list of issues to be corrected, and the corresponding natural language text in the natural language text set is updated based on the replacement text. In this application, each piece of natural language text in the set has a unique text identifier. The list of issues to be corrected has the same text identifier as the corresponding natural language text, and the replacement text has the same text identifier as the list of issues to be corrected. The natural language text, the list of issues to be corrected, and the replacement text are associated through unique text identifiers.

[0036] In some embodiments, the replacement text is a complete representation of the corresponding natural language text, and the natural language text can be directly replaced entirely with the replacement text.

[0037] In some embodiments, each problematic text in the natural language text is assigned a unique problem number, which includes the problem text's position information within the natural language text. Each problem to be corrected in the list of problems to be corrected corresponds to a problem text (e.g., a sentence or a few words) in the natural language text and has the same problem index as the original problem text. The system receives replacement subtexts corresponding to each problem to be corrected, input by the user based on the list of problems to be corrected. Each replacement subtext has a corresponding problem index for the problem to be corrected. Based on the index information of the replacement subtexts, the position information of the problem text containing the corresponding problem to be corrected in the natural language text is determined, and the problem text is deleted at the corresponding position in the natural language text, and a replacement subtext is inserted. This method eliminates the need for users to input the complete text description corresponding to the problem text; they only need to input the replacement subtext, reducing input volume, enabling more logical problem correction, and improving problem correction efficiency. In the application, after inserting the replacement subtext into the natural language text, the replacement text is highlighted to facilitate user review of the corrected natural language text.

[0038] In applications, during the process of semantic parsing and information extraction from natural language text, vague expressions in natural language text are transformed into precise intent expressions. For example, a vague time expression of about 30 seconds is transformed into 30±5 seconds.

[0039] In one embodiment, the entity control element includes a device entity, a state entity, and a parameter entity. The device entity is used to characterize the device to be controlled, the parameter entity is used to characterize the control parameters, and the state entity is used to characterize the state of the device entity or the parameter entity.

[0040] In the application, the device entity is the device to be controlled in the control logic corresponding to the natural language text, such as "water tank", "inlet valve", "low liquid level switch" and "motor"; the parameter entity is the control parameter in the control logic corresponding to the natural language text, such as time parameter ("10 seconds"), numerical parameter ("100 degrees") and water level parameter (2 meters); the state parameter is the parameter in the natural language text that represents the state of the device entity or parameter entity, such as "higher than", "equal to", "lower than", "open", "closed" and "connected".

[0041] The logical relationship includes the condition action pair consisting of the control condition and the execution action.

[0042] In applications, logical relationships include control conditions in natural text (control conditions may include multiple self-conditions, i.e., condition groups) and condition action pairs consisting of actions or action sequences that need to be executed when the control conditions are met. Both can be stored in the form of key-value pairs.

[0043] Step S3: Generate an intermediate logical representation based on the entity control element set and the logical relationship set. The intermediate logical representation is independent of the target programming language.

[0044] In applications, intermediate logical representations are generated based on the set of entity elements and logical relations in natural language text. These intermediate logical representations are independent of the target programming language, allowing the same natural language text intermediate logical representation to be applied to different types of target program development, such as Python scripts, PLC ladder diagrams, and Java code.

[0045] In applications, intermediate logic representations clearly characterize logical structures such as conditional judgments, action execution, parallelism, and selection, possessing the following characteristics: language independence, containing no programming language keywords (such as Python's `if` or Java's `public`), describing only the "logic itself"; structured and unambiguous, employing strict grammatical rules (such as standardized logical operators and unified element naming) to avoid the ambiguity of natural language; and resolvability, allowing machines to directly recognize logical structures (condition → action, temporal dependencies, interrupt logic), facilitating subsequent mapping to the target language. Specifically, intermediate logic representations can be abstract logic trees, control flow diagrams, or state machines, chosen based on the specific application scenario. For example, for control logic scenarios with strong temporal requirements, state machines can be chosen as the intermediate logic representation.

[0046] In application, taking an abstract logic tree as an example, the process of generating an intermediate logic representation based on the set of entity elements and logical relations in natural language text is as follows: Parse logical relations, convert the connectives in the control conditions of the logical relations into logical operators, and create the root node of the logic tree based on the logical operators in the logical relations. For example, convert "and" into AND logic and "or" into OR logic. Construct conditional branches, create leaf nodes or branches for each sub-condition and use them as child nodes or subtrees of the root node corresponding to the logical operator. For simple conditions (such as "the water tank level is lower than the low level switch"), directly create comparison nodes. For complex conditions (such as "the inlet valve has been closed for more than 10 seconds"), create a subtree (timer + status detection). Action nodes are created based on the actions performed in the logical relationship and serve as leaf nodes of the logic tree. These leaf nodes then become the leaf nodes of the right subtree of the logic tree. A control condition can be associated with multiple actions, forming an action sequence, which is represented by multiple leaf nodes in the logic tree.

[0047] In applications, for complex systems containing multiple states, the logic tree evolves into a state transition network, where each state is an independent subtree, the state transition conditions are connecting edges, and the current state variable is a global control node.

[0048] Step S4: Generate an executable target program corresponding to the natural language text based on the intermediate logic representation and the language specification of the target program language.

[0049] In applications, different target programming languages ​​have different language specifications. For example, scripting languages ​​(such as Python) have language specifications including indentation rules, conditional statement format (if-elif-else), function call format (device.start()), variable naming conventions (underscore naming), etc.; industrial control languages ​​(such as PLC ladder diagrams) have language specifications including contact / coil logic (condition = contact, action = coil), timing instructions (TON timer), device address mapping (such as humidifier = I0.0), etc.; object-oriented languages ​​(such as Java) have language requirements including class definition (class Device), method encapsulation (startHumidifier()), exception handling (try-catch), etc.

[0050] In applications, comments or annotations are inserted into the executable program based on natural language text to make the executable program readable, making it easier for engineers to understand and check, and facilitating subsequent upgrades and maintenance.

[0051] In one embodiment, step S2, which involves performing semantic parsing and information extraction on the natural language text to obtain the entity control element set and logical relation set of the natural language text, includes: Step S21 involves using a text parsing model to identify and extract entity control elements from the natural language text and constructing an entity control element set based on these elements.

[0052] Step S22: Analyze and extract the logical relationship between control conditions and execution actions in the natural language text using a text parsing model, and construct a logical relationship set based on the logical relationship.

[0053] In this application, the text parsing model is a pre-trained NLP (Natural Language Processing) model, and the specific process is as follows: Figure 2 The semantic parsing and information extraction process shown involves inputting natural language text into a trained NLP model. The NLP model identifies and extracts key element information (entity control elements) from the natural language text to obtain device entities, state entities, and parameter entities. Then, logical relationships are extracted by analyzing conjunctions (such as "when," "and," "or") and conditional adverbs in the text to extract the logical relationship between control conditions and execution actions, forming "condition-action" pairs.

[0054] like Figure 3 The above is a modeling diagram of intermediate logic representation. For the natural language text "When the water level in the tank is lower than the low level switch and the inlet valve is closed for more than 10 seconds, open the inlet valve", the intermediate logic tree (intermediate logic representation) is generated after NLP model processing. The root node (condition) of the logic tree is AND (AND logic), the left child node (condition 1) of the root node is comparison (the water level in the tank is less than the low level switch), the right child node (condition 2) is timer (the inlet valve state is closed, reaching 10s), and the leaf node (action) is assignment (the inlet valve is opened).

[0055] In one embodiment, step S4, generating an executable target program corresponding to the natural language text based on the intermediate logical representation and the language specification of the target program language, includes: Step S41: Confirm the target programming language selected by the user and load the language specification of the target programming language.

[0056] Step S42: Map the abstract nodes in the intermediate logical representation to programming elements that conform to the language specifications of the target programming language.

[0057] Step S43: Replace the device entity and status entity in the intermediate logical representation with the corresponding hardware address in the hardware address allocation table. The hardware address includes either an I / O address or a memory address.

[0058] In applications, taking the control scenario of programmable logic controllers (PLCs) in the field of industrial automation as an example, based on the target programming language (such as ladder diagram-LD) selected by the user, the corresponding syntax specifications and graphical representation rules are called from the PLC programming knowledge base. Taking the abstract logic tree as an example, the abstract nodes in the intermediate logic representation are mapped to specific programming elements that conform to the language specifications. For example, the logical "AND" is mapped to a series contact in the ladder diagram, the logical "OR" is mapped to a parallel branch in the ladder diagram, conditional judgments are mapped to **IF...THEN...** statements in structured text (ST), and timer / counter functions are mapped to specific instruction blocks, such as TON (on-delay timer) or OUT T0 K10.

[0059] In application, the device entities and status entities in the intermediate logic representation are replaced with their corresponding hardware addresses in the hardware address allocation table to enable the program to connect with the physical device. Specifically, by querying the project-specific hardware address allocation table configured at the beginning of the project, the "device entities" and "status entities" in the intermediate logic representation are replaced with actual I / O addresses or memory addresses. For example, by querying the address allocation table, the abstract variable inlet valve (device entity) in the abstract logic tree is bound to the specific output point Q0.0 (Siemens format) or Y0 (Mitsubishi format), and the low liquid level switch in the abstract logic tree is bound to the input point I0.1.

[0060] In applications, the PLC programming knowledge base stores a wealth of rules, including but not limited to: Instruction sets, including the instructions supported by different PLC brands; programming standards, such as rules prohibiting direct connections between the right bus and the left side of the coil in ladder diagrams to avoid generating illegal logic; best practices, such as how to efficiently use timers and counters, and how to avoid common errors like dual-coil outputs. It's understandable that a PLC programming knowledge base can ensure that the generated target program (such as a ladder diagram) is not only syntactically correct but also conforms to industrial practices, possessing high quality and reliability.

[0061] In one embodiment, the target programming language is a ladder diagram, and the intermediate logic is represented as an abstract logic tree; Step S4, which generates an executable target program corresponding to the natural language text based on the intermediate logical representation and the language specification of the target program language, further includes: Step S44: Traverse the abstract logic tree in a depth-first or breadth-first manner.

[0062] Step S45: If a serial relationship node is encountered during the traversal, the hardware addresses corresponding to the left and right child nodes of the serial relationship node are added as contacts from left to right on the same branch of the target ladder diagram.

[0063] Step S46: If a parallel relationship node is encountered during the traversal, two parallel branches are created in the target ladder diagram according to the left and right child nodes of the parallel relationship node, respectively.

[0064] Step S47: If a leaf node is encountered during the traversal, the hardware address corresponding to the leaf node is added as an output coil or function instruction block at the rightmost end of the current branch of the target ladder diagram.

[0065] In applications, each conditional action corresponds to a network. For example... Figure 4 The following is based on Figure 3 The diagram illustrates the process of generating a ladder diagram from the corresponding abstract logic tree example. The NLP model performs inference, then queries the hardware address allocation table to determine the hardware address corresponding to each entity, such as an I / O address or memory address (e.g., LowLevelSwitch, InletValve). It then traverses the abstract logic tree. For the traversed nodes representing the serial relationship of the condition (low level switch AND timer completion), it first places a normally open contact I0.1 representing the low level switch, then connects it in series with a normally open contact T001.DN representing the timer completion bit. After I0.1 and T001.DN, it places the output coil Q0.0 representing the inlet valve.

[0066] In applications, for complex functions (such as timing and counting) included in the logic, corresponding instruction blocks are generated in the current network or a new network. For example, the logic "the inlet valve has been closed for more than 10 seconds" requires a timer. Therefore, the system will automatically add a TON (On Delay Timer) instruction in another network. The timer's enable terminal IN is driven by the inlet valve's closed state, i.e., !Q0.0 (the normally closed contact of the inlet valve coil), the preset value PT is set to 10000 (milliseconds, corresponding to 10 seconds), the timer number T001 is assigned, and its completion bit is the normally open contact T001.DN of the aforementioned timer completion bit.

[0067] Step S48: After completing the traversal of the abstract logic tree, check whether the target ladder diagram conforms to the language specification corresponding to the ladder diagram. If the target ladder diagram conforms to the language specification, then output the target ladder diagram.

[0068] In the application, after the target program is generated, the built-in verifier is called to check whether the generated ladder diagram conforms to the language specifications (such as whether the branches are complete and whether there are illegal connections), to ensure the executableness of the target program.

[0069] In applications, specifically in PLC scenarios, after the ladder diagram is generated, the following multi-dimensional checks are performed on it: Spatial dimension detection includes dual-coil detection and logic loop detection. Dual-coil detection includes detecting whether the same coil is driven in different steps or whether the same coil is repeatedly driven in the same step. Logic loop detection includes identifying feedback loops using a directed graph loop detection algorithm.

[0070] Time-dimensional detection includes: timer-scan cycle conflict detection, which detects whether the timer preset value is less than the PLC scan cycle; and state maintenance contradiction detection, which detects corresponding state machine contradictions through timing reachability analysis.

[0071] Resource-level detection includes detecting hardware resource contention, such as concurrent access to the same input point at different levels, which can lead to resource deadlock; and detecting memory bit conflicts, such as whether there is mutual interference between internal flag bits at different levels.

[0072] In applications, in PLC scenarios, besides ladder diagrams, the target programming language can also be structured text (ST). The generation process of structured text is similar to that of ladder diagrams, but the forms of expression are different. For example, abstract logic trees are converted into nested IF, ELSIF, and END_IF statements, and timer operations are converted into calls to timer function blocks and status judgments.

[0073] In one embodiment, after generating the executable target program corresponding to the natural language text based on the intermediate logical representation and the language specification of the target program language in step S4, the method further includes: Step S51: Visualize the natural language text and the executable target program corresponding to the natural language text.

[0074] Step S52: Detect the user's operation command.

[0075] Step S53: If the operation instruction representation is directly adopted, the executable target program is inserted into the designated location of the existing project.

[0076] Step S54: If the operation instruction includes a modification command, update the executable target program based on the modification command until an operation instruction representing direct adoption is detected, and insert the updated executable target program into the specified location of the existing project.

[0077] Step S55: If the operation instruction indicates that the executable target program is to be deprecated, the executable target program is deprecated and a deprecation report is generated.

[0078] In the application, the generated target program is visually displayed in the editing interface of the host computer software. Users can confirm, modify, discard, or insert it into a specified position in the existing project in the editing interface. Specifically, after the user checks that there are no errors, they can click the "Insert" button, and the target program will be added to the specified network segment of the main program.

[0079] In one embodiment, the method further includes: Step S61: If the operation instruction representation is directly adopted, construct a positive sample based on the natural language text, the intermediate logic representation, and the executable target program.

[0080] In the application, the user adopted the generated result (executable target program) without making any modifications, indicating that the interaction was very successful. The natural language input and the generated program code constitute a perfectly matched high-quality training sample pair. The optimization role of positive samples is that this data is used to strengthen the model's current connection weights, consolidate its existing correct knowledge, and enable it to generate the same result with greater confidence when encountering similar expressions in the future.

[0081] Step S62: If the operation instructions include a modification command, construct a differentiated sample based on the natural language text, the original executable target program, and the final executable target program.

[0082] In applications, differentiated samples are the most valuable type of feedback. User modifications directly reveal subtle biases or knowledge gaps in the model's understanding. By recording two versions—the original executable program and the final executable program modified by the user—and comparing their differences, the system can accurately pinpoint problems. For example, if a user inputs "turn on pump A and pump B," the model generates parallel logic for the coils of pump A and pump B, but the user modifies it to be series. This indicates that in this specific context, "and" signifies sequential activation (AND logic) rather than simultaneous activation (OR logic). This sample is used to correct the model's understanding of the logical connector "and," enabling it to learn the polysemy of the word in different contexts.

[0083] Step S63: In the case where the operation instruction indicates that the executable target program is abandoned, a negative sample is constructed based on the natural language text, the intermediate logic representation, and the abandoned executable target program.

[0084] In applications, negative samples represent users' complete rejection of the generated results, indicating a serious error in the model's understanding. This data, as negative samples, helps the model "forget" or "weaken" the pattern associations that led to the error, clarifying that the mapping relationship between certain linguistic expressions and erroneous program code is undesirable.

[0085] Step S64: In each update cycle, the text parsing model is optimized based on the positive samples, the differentiated samples, and the negative samples.

[0086] In application, the text parsing model provided in this application is an NLP model pre-trained based on the following process. The main process includes the domain corpus construction and data preparation stage, the model selection and basic pre-training stage, and the task-specific fine-tuning training stage.

[0087] The domain corpus construction and data preparation phase includes raw data collection and processing: Technical documents and manuals: A large number of PLC programming manuals, equipment manuals, project requirement documents, design specifications, etc., are collected. These documents contain rich, structured descriptions of control logic. Historical project data: After anonymization, the "control requirements described in natural language" (such as process instructions and operation guides) from historical projects are extracted along with their corresponding "final PLC program code" (such as ladder diagrams and ST text), which are the most ideal training samples. Rule generation and data augmentation: Based on common PLC programming patterns (such as start-stop circuits, sequential and data preparation control, and timer / counter applications), a large number of diverse natural language description sentences and corresponding logical structures are manually written to expand the training data; and data representation: Named Entity Recognition (NER) annotation: Annotating "equipment entities" (such as "motor M1", "valve V2"), "state entities" (such as "start", "stop", "alarm"), and "parameter entities" (such as "100 degrees", "5 minutes") in the text; logical relationship annotation: Annotating condition words (such as "when", "if"), logical connectors (such as "and", "or"), and the "conditions" and "actions" they connect. This helps the model learn how to construct "condition-action" pairs.

[0088] Model selection and basic pre-training include: model selection: choosing a powerful, general-purpose pre-trained language model as the foundation, such as a model based on the Transformer architecture, which already possesses strong language understanding capabilities; domain knowledge-based pre-training: inputting a PLC domain corpus (unannotated plain text) into the base model for domain-adaptive pre-training. This process allows the model to continue learning from a large amount of industry text, thereby becoming familiar with and mastering the vocabulary, sentence structures, and knowledge background of the industrial control field. It's equivalent to having the model "read" a large amount of industry literature, laying a solid domain foundation.

[0089] Task-specific fine-tuning training includes sequence labeling task fine-tuning (for named entity recognition) and relation extraction task fine-tuning (for logical relation extraction). Sequence labeling task fine-tuning uses data with pre-labeled entity tags (e.g., labeling "low level switch" as a device entity) to fine-tune the model. The model learns to map the input text sequence to the corresponding tag sequence, aiming to train the model to accurately identify and control logic-related entities. Relation extraction task fine-tuning takes text and labeled entities as input, training the model to determine the relationships between entities. For example, for the sentence "When A targets B, execute C," the model needs to learn to recognize that "A" and "B" have an "AND" relationship and together serve as the triggering condition for action "C," aiming to train the model to understand the logical relationships between entities.

[0090] In one embodiment, model training also includes reinforcement learning and feedback optimization phases. To enable the model to continuously evolve in real-world application environments, a user feedback-based optimization mechanism is introduced. Specifically, when users perform actions such as "modify and adopt" or "deprecate" on the system-generated program, these actions are recorded as feedback signals. For each feedback signal, complete interaction data is automatically associated and stored: natural language text + intermediate logical representation + initial executable target program + final executable target program (or deprecation marker). To ensure data quality, a filtering mechanism is introduced; for example, a modified pattern is only included in the training set if it is repeatedly adopted by multiple users, thus avoiding noise from individual users' erroneous operations.

[0091] Supervised fine-tuning is a common method for model fine-tuning. This involves incrementally training the pre-trained NLP model using high-quality sample pairs (input-output pairs).

[0092] When the operation instruction representation is directly adopted, a positive sample is constructed based on natural language text, intermediate logic representation, and executable target program.

[0093] When the operational instructions include modification commands, a differentiated sample is constructed based on the natural language text, the original executable target program, and the final executable target program. This differentiated sample helps the model reverse-engineer the generated modified intermediate logical representation from the final code, which is crucial for the model to learn new knowledge.

[0094] When the operation instruction represents the abandonment of the executable target program, a negative sample can be constructed based on the natural language text, the intermediate logic representation, and the abandoned executable target program. This can be achieved during training by reducing the corresponding pattern weights or by using a specialized negative sample training technique.

[0095] In practice, to ensure system stability, fine-tuning is typically performed periodically (e.g., weekly or monthly) rather than in real-time. Each fine-tuning produces a new model version, whose performance is evaluated on an isolated test set before deployment to ensure that the new model outperforms the old version and prevents model degradation.

[0096] The target program generation method provided in this application allows engineers and even field operators to directly describe requirements using natural language, generating programs without needing in-depth knowledge of complex PLC programming techniques. This greatly liberates productivity and avoids reliance on engineers' professional knowledge. It transforms descriptive requirements into standardized code within seconds, avoiding the tediousness of manual programming and human error, shortening the development and debugging cycle, and significantly improving efficiency and accuracy. Through NLP models, it can understand the implicit logical relationships in natural language (such as "AND" representing AND logic, and "more than 10 seconds" requiring a timer to be started), rather than just keyword matching, possessing comprehension and reasoning capabilities. Through a feedback mechanism, the system can continuously optimize its comprehension and generation quality, adapting to the expression habits of different industries and users, and possessing self-learning and adaptive capabilities.

[0097] In one embodiment, this application treats the entire interaction process as a reinforcement learning problem.

[0098] The agent is an NLP model, the action is to generate intermediate logical representations, and the environment is a code generator and a user.

[0099] The reward rules are as follows: users who "directly adopt" the technology receive a high positive reward; those who "adopt after modification" receive a neutral or slightly negative reward depending on the extent of the modification; and those who "discard" the technology receive a high negative reward. Through this method, the model learns to optimize its generation strategy in the direction that yields higher user rewards (i.e., satisfaction).

[0100] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0101] This application also provides a target program generation system for performing the steps described in the target program generation method embodiments above. The target program generation system can be a virtual appliance in a computer device, run by the computer device's processor, or it can be the computer device itself.

[0102] like Figure 5 As described above, this application provides a target program generation system 500, comprising: The requirement acquisition module 501 is used to acquire a set of natural language texts, the set of natural language texts includes at least one natural language text, the natural language text is used to describe the target control logic; The parsing module 502 is used to perform semantic parsing and information extraction on the natural language text to obtain the entity control element set and logical relation set of the natural language text. The entity control element set includes at least one entity, and the logical relation set includes at least one logical relation. The intermediate logic representation module 503 is used to generate an intermediate logic representation based on the entity control element set and the logical relationship set, wherein the intermediate logic representation is independent of the target programming language. The program generation module 504 is used to generate an executable target program corresponding to the natural language text based on the intermediate logical representation and the language specification of the target program language.

[0103] In one embodiment, the demand acquisition module 501 is used for: The text parsing model will identify and extract entity control elements from the natural language text and construct an entity control element set based on the entity control elements. The logical relationships between control conditions and execution actions in the natural language text are analyzed and extracted using a text parsing model, and a set of logical relationships is constructed based on these relationships.

[0104] In one embodiment, the entity control element includes a device entity, a state entity, and a parameter entity. The device entity is used to characterize the device to be controlled, the parameter entity is used to characterize the control parameters, and the state entity is used to characterize the state of the device entity or the parameter entity. The logical relationship includes the condition action pair consisting of the control condition and the execution action.

[0105] In one embodiment, the program generation module 504 is configured to: Confirm the target programming language selected by the user and load the language specification of the target programming language; The abstract nodes in the intermediate logical representation are mapped to programming elements that conform to the language specifications of the target program language; Replace the device entity and status entity in the intermediate logical representation with the corresponding hardware address in the hardware address allocation table. The hardware address includes either an I / O address or a memory address.

[0106] In one embodiment, the target programming language is a ladder diagram, and the intermediate logic is represented as an abstract logic tree; The program generation module 504 is further configured to: Traverse the abstract logic tree using either depth-first or breadth-first search. If a serial node is encountered during the traversal, the hardware addresses corresponding to the left and right child nodes of the serial node are added as contacts from left to right on the same branch of the target ladder diagram. If parallel nodes are encountered during the traversal, two parallel branches are created in the target ladder diagram based on the left and right child nodes of the parallel nodes, respectively. If a leaf node is encountered during the traversal, the hardware address corresponding to the leaf node is added as an output coil or function instruction block at the rightmost end of the current branch of the target ladder diagram. After completing the traversal of the abstract logic tree, check whether the target ladder diagram conforms to the language specification corresponding to the ladder diagram. If the target ladder diagram conforms to the language specification, then output the target ladder diagram.

[0107] In one embodiment, the target program generation system 500 further includes an interaction module 505, used for: The natural language text and the corresponding executable target program are visualized. Detect user commands; When the operation instruction representation is directly adopted, the executable target program is inserted into the designated location of the existing project; If the operation instruction includes a modification command, the executable target program is updated based on the modification command until an operation instruction directly used is detected, and the updated executable target program is inserted into the specified location of the existing project; If the operation instruction indicates that the executable target program is to be deprecated, the executable target program is deprecated and a deprecation report is generated.

[0108] In one embodiment, the target program generation system 500 further includes a feedback optimization module 506, used for: When the operation instruction representation is directly adopted, a positive sample is constructed based on the natural language text, the intermediate logic representation, and the executable target program; In the case where the operation instructions include modification commands, a differentiated sample is constructed based on the natural language text, the original executable target program, and the final executable target program; When the operation instruction represents the abandonment of the executable target program, a negative sample is constructed based on the natural language text, the intermediate logic representation, and the abandoned executable target program; Each update cycle performs feedback optimization on the text parsing model based on the positive samples, the differentiated samples, and the negative samples.

[0109] Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 6 As shown, the computer device 6 of this embodiment includes: at least one processor 60 ( Figure 6 (Only one is shown in the diagram) a processor, a memory 61, and a computer program 62 stored in the memory 61 and executable on the at least one processor 60, wherein the processor 60 executes the computer program 62 to implement the steps in any of the above-described embodiments of the target program generation method.

[0110] The computer device may include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art will understand that... Figure 6 The computer device 6 is merely an example and does not constitute a limitation on the computer device 6. It may include more or fewer components than shown, or combine certain components, or different components, such as input / output devices, network access devices, etc.

[0111] The processor 60 can be a Central Processing Unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.

[0112] In some embodiments, the memory 61 may be an internal storage unit of the computer device 6, such as a hard disk or memory of the computer device 6. In other embodiments, the memory 61 may be an external storage device of the computer device 6, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 6. Furthermore, the memory 61 may include both internal and external storage units of the computer device 6. The memory 61 is used to store the operating system, applications, bootloader, data, and other programs, such as the program code of the computer program. The memory 61 can also be used to temporarily store data that has been output or will be output.

[0113] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0114] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0115] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various method embodiments above.

[0116] This application provides a computer program product 70, including a computer program 62, which, when run, causes the steps in the above-described object program generation method embodiments to be executed.

[0117] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a device / computer equipment, a recording medium, a computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.

[0118] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0119] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0120] In the embodiments provided in this application, it should be understood that the disclosed computer devices and methods can be implemented in other ways. For example, the computer device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0121] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0122] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A method for generating a target program, characterized in that, include: Acquire a set of natural language texts, the set of natural language texts including at least one natural language text, the natural language text being used to describe the target control logic; Semantic parsing and information extraction are performed on the natural language text to obtain a set of entity control elements and a set of logical relations of the natural language text. The set of entity control elements includes at least one entity control element, and the set of logical relations includes at least one logical relation. An intermediate logical representation is generated based on the entity control element set and the logical relationship set, and the intermediate logical representation is independent of the target programming language. An executable target program corresponding to the natural language text is generated based on the intermediate logic representation and the language specification of the target program language.

2. The target program generation method as described in claim 1, characterized in that, The step of performing semantic parsing and information extraction on the natural language text to obtain the entity control element set and logical relation set of the natural language text includes: The text parsing model will identify and extract entity control elements from the natural language text and construct an entity control element set based on the entity control elements. The logical relationships between control conditions and execution actions in the natural language text are analyzed and extracted using a text parsing model, and a set of logical relationships is constructed based on these relationships.

3. The target program generation method as described in claim 2, characterized in that, The entity control element includes a device entity, a status entity, and a parameter entity. The device entity is used to represent the device to be controlled, the parameter entity is used to represent the control parameters, and the status entity is used to represent the status of the device entity or the parameter entity. The logical relationship includes the condition action pair consisting of the control condition and the execution action.

4. The target program generation method as described in claim 1, characterized in that, The step of generating the executable target program corresponding to the natural language text based on the intermediate logical representation and the language specification of the target program language includes: Confirm the target programming language selected by the user and load the language specification of the target programming language; The abstract nodes in the intermediate logical representation are mapped to programming elements that conform to the language specifications of the target program language; Replace the device entity and status entity in the intermediate logical representation with the corresponding hardware address in the hardware address allocation table. The hardware address includes either an I / O address or a memory address.

5. The target program generation method as described in claim 4, characterized in that, The target programming language is a ladder diagram, and the intermediate logic is represented as an abstract logic tree; The step of generating the executable target program corresponding to the natural language text based on the intermediate logical representation and the language specification of the target program language further includes: Traverse the abstract logic tree using either depth-first or breadth-first search. If a serial node is encountered during the traversal, the hardware addresses corresponding to the left and right child nodes of the serial node are added as contacts from left to right on the same branch of the target ladder diagram. If parallel nodes are encountered during the traversal, two parallel branches are created in the target ladder diagram based on the left and right child nodes of the parallel nodes, respectively. If a leaf node is encountered during the traversal, the hardware address corresponding to the leaf node is added as an output coil or function instruction block at the rightmost end of the current branch of the target ladder diagram. After completing the traversal of the abstract logic tree, check whether the target ladder diagram conforms to the language specification corresponding to the ladder diagram. If the target ladder diagram conforms to the language specification, then output the target ladder diagram.

6. The target program generation method according to any one of claims 1 to 5, characterized in that, After generating the executable target program corresponding to the natural language text based on the intermediate logical representation and the language specification of the target program language, the method further includes: The natural language text and the corresponding executable target program are visualized. Detect user commands; When the operation instruction representation is directly adopted, the executable target program is inserted into the designated location of the existing project; If the operation instruction includes a modification command, the executable target program is updated based on the modification command until an operation instruction directly used is detected, and the updated executable target program is inserted into the specified location of the existing project; If the operation instruction indicates that the executable target program is to be deprecated, the executable target program is deprecated and a deprecation report is generated.

7. The target program generation method as described in claim 6, characterized in that, The method further includes: When the operation instruction representation is directly adopted, a positive sample is constructed based on the natural language text, the intermediate logic representation, and the executable target program; In the case where the operation instructions include modification commands, a differentiated sample is constructed based on the natural language text, the original executable target program, and the final executable target program; When the operation instruction represents the abandonment of the executable target program, a negative sample is constructed based on the natural language text, the intermediate logic representation, and the abandoned executable target program; Each update cycle performs feedback optimization on the text parsing model based on the positive samples, the differentiated samples, and the negative samples.

8. A target program generation system, characterized in that, include: The requirement acquisition module is used to acquire a set of natural language texts, which includes at least one natural language text, and the natural language text is used to describe the target control logic. The parsing module is used to perform semantic parsing and information extraction on the natural language text to obtain the entity control element set and logical relation set of the natural language text. The entity control element set includes at least one entity, and the logical relation set includes at least one logical relation. An intermediate logic representation module is used to generate an intermediate logic representation based on the entity control element set and the logical relationship set, wherein the intermediate logic representation is independent of the target programming language; The program generation module is used to generate an executable target program corresponding to the natural language text based on the intermediate logical representation and the language specification of the target program language.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the target program generation method as described in any one of claims 1 to 7.

10. A computer program product, characterized in that, Includes a computer program, which, when run, causes the target program generation method as described in any one of claims 1 to 7 to be executed.

Citation Information

Patent Citations

  • Method for converting PLC instruction list into ladder diagram based on generator set controller

    CN104460489A

  • Method and system for converting natural language into program code

    CN112306497A

  • LLM-based industrial control programming ladder diagram generation method

    CN120469680A

  • Business process analysis method and device based on natural language, equipment and medium

    CN120743243A

  • Robot programming method and device, storage medium, demonstrator and program product

    CN120791742A