Component generation method, component generation device, and processor-readable storage medium

CN122985129APending Publication Date: 2026-10-27ZHONGQIAN SI CHUANG (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611069059.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-17
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

[0003]然而,在现有技术中,构建高保真、强交互的数字孪生应用仍面临巨大的技术挑战和成本压力,存在开发门槛高、逻辑构建复杂、研发周期长、投入成本高等诸多问题

Benefits of technology

本申请实施例提供的组件生成方法,包括意图识别、语义解析和代码生成三阶段协作架构,能够将用户输入的自然语言转换为结构化代码,降低编程门槛,实现组件的即时定制,大幅缩短组件开发周期。具体地,先对自然语言中的概念进行初步提取,再结合知识图谱对先前初步提取的概念进行深度消歧和映射,以补充在进行初步提取时未能识别的隐含概念,并建立概念与知识图谱实体之间的关联关系,从而理解用户提供的自然语言包括的真实业务意图并获得满足用户需求的组件代码。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122985129A_ABST
    Figure CN122985129A_ABST
Patent Text Reader

Abstract

The application relates to an assembly generation method, an assembly generation device and a processor readable storage medium. The assembly generation method comprises the following steps: acquiring a natural language input by a user; performing intent classification and parameter extraction on the natural language to generate an intent label and structured parameter information, wherein the intent label comprises at least one of an intent type, a target assembly type, an operation type and a constraint condition; performing entity linking, relationship reasoning and semantic disambiguation on the natural language, the intent label and the structured parameter information based on a knowledge graph to generate semantic analysis parameters, wherein the semantic analysis parameters comprise at least one of an entity list, a relationship list, a rule list and a semantic parameter; and determining a target template assembly and an attribute value based on the semantic analysis parameters, and generating an assembly code according to the target template assembly and the attribute value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of digital twin technology, and in particular to a component generation method, a component generation apparatus, and a processor-readable storage medium. Background Technology

[0002] With the deepening of digital transformation, digital twin technology has become a key link connecting the physical and digital worlds. Digital twin technology constructs virtual models of physical entities in digital space, enabling real-time mapping and bidirectional interaction between the physical entities and the virtual models. It also allows for the monitoring, diagnosis, prediction, and optimization of physical entities throughout their entire lifecycle. Currently, this technology has become one of the core supporting technologies for digital transformation in key fields such as intelligent manufacturing, smart cities, and aerospace.

[0003] However, in the existing technologies, building high-fidelity, highly interactive digital twin applications still faces huge technical challenges and cost pressures, with many problems such as high development threshold, complex logic construction, long R&D cycle, and high investment costs.

[0004] Therefore, an improved component generation method is expected to solve at least one of the above problems. Summary of the Invention

[0005] To address the aforementioned technical problems, this application provides a component generation method, a component generation apparatus, and a processor-readable storage medium.

[0006] On one hand, a component generation method is provided, comprising: acquiring natural language input from a user; classifying the natural language by intent and extracting parameters to generate intent tags and structured parameter information, wherein the intent tags include at least one of intent type, target component type, operation type, and constraint conditions; performing entity linking, relation reasoning, and semantic disambiguation on the natural language, intent tags, and structured parameter information based on a knowledge graph to generate semantic parsing parameters, wherein the semantic parsing parameters include at least one of entity list, relation list, rule list, and semantic parameters; determining a target template component and attribute values ​​based on the semantic parsing parameters, and generating component code based on the target template component and the attribute values.

[0007] In one feasible embodiment, the step of performing entity linking, relation reasoning, and semantic disambiguation on the natural language, the intent tags, and the structured parameter information based on the knowledge graph to generate semantic parsing parameters includes: establishing a mapping relationship between the concepts included in the natural language and standard entities in the knowledge graph to obtain the entity list; generating the relation list based on the relation network of the knowledge graph and the natural language, the relation list being used to represent the implicit relations included in the natural language; and generating the rule list based on the rule base of the knowledge graph, according to the entity list and the relation list, the rule list including business rules and / or constraints.

[0008] In one feasible embodiment, the step of performing entity linking, relational reasoning, and semantic disambiguation on the natural language, the intent tags, and the structured parameter information based on the knowledge graph to generate semantic parsing parameters further includes: determining the target data type according to the constraints of the natural language and the knowledge graph.

[0009] In one feasible embodiment, the knowledge graph includes: knowledge units for standardizing the definition of entities; a relationship network for defining the relationships between entities; and a rule base for defining component usage rules, data binding rules, and interaction response rules.

[0010] In one feasible embodiment, determining the target template component and attribute value based on the semantic parsing parameters, and generating component code based on the target template component and the attribute value includes: selecting one or more target template components from the template library of the component code generation engine based on the semantic parsing parameters; the target template component includes placeholders; determining the attribute value based on the semantic parameters; and replacing the placeholders in the target template component with the attribute value to generate the component code.

[0011] In one feasible embodiment, the target template component includes multiple placeholders; multiple attribute values ​​are determined based on multiple semantic parameters; and the multiple placeholders in the target template component are replaced with their corresponding attribute values ​​to generate the component code.

[0012] In one feasible embodiment, the step of determining the target template component and attribute value based on the semantic parsing parameters, and generating component code based on the target template component and the attribute value, further includes: determining the association information of multiple target template components based on the entity list and the relationship list, wherein the association information includes at least one of reference relationship, nested structure, event binding relationship and data dependency relationship; and determining the constraint conditions of the code combination of multiple target template components based on the rule list.

[0013] In one feasible embodiment, the step of determining the target template component and attribute values ​​based on the semantic parsing parameters, and generating component code based on the target template component and the attribute values, further includes performing at least one of the following on the component code: syntax checking, style checking, integrity checking, and logic checking; the syntax checking includes at least one of variable checking, function checking, and class checking; the style checking includes at least one of naming convention checking, format checking, and comment checking; the integrity checking includes component registration checking and / or data definition checking; and the logic checking includes data flow checking and / or boundary condition checking.

[0014] On the other hand, a component generation apparatus is provided, comprising: an interaction module configured to acquire natural language input by a user; an intent recognition module configured to classify and extract parameters from the natural language to generate intent tags and structured parameter information, wherein the intent tags include at least one of intent type, target component type, operation type, and constraint conditions; a semantic parsing module configured to perform entity linking, relation reasoning, and semantic disambiguation on the natural language, intent tags, and structured parameter information based on a knowledge graph to generate semantic parsing parameters, wherein the semantic parsing parameters include at least one of an entity list, a relation list, a rule list, and semantic parameters; and a code generation module configured to determine a target template component and attribute values ​​based on the semantic parsing parameters, and generate component code based on the target template component and the attribute values.

[0015] On the other hand, a processor-readable storage medium is provided, the processor-readable storage medium storing a program for causing the processor to perform the above-described method.

[0016] The technical solution provided in this application has the following advantages compared with the prior art: The component generation method provided in this application includes a three-stage collaborative architecture of intent recognition, semantic parsing, and code generation. This architecture can convert user-input natural language into structured code, lowering the programming threshold, enabling real-time component customization, and significantly shortening the component development cycle. Specifically, it first extracts concepts from the natural language, then combines a knowledge graph to perform deep disambiguation and mapping on the previously extracted concepts. This supplements implicit concepts that were not identified during the initial extraction and establishes associations between concepts and entities in the knowledge graph. This allows the system to understand the true business intent contained in the user-provided natural language and obtain component code that meets the user's needs. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

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

[0019] Figure 1 This is a flowchart of a component generation method provided according to some embodiments; Figure 2 This is a flowchart of another component generation method provided according to some embodiments; Figure 3 This is a flowchart illustrating another component generation method provided according to some embodiments; Figure 4 This is a flowchart illustrating another component generation method provided according to some embodiments; Figure 5 This is a schematic diagram of a component generation apparatus provided according to some embodiments. Detailed Implementation

[0020] To better understand the above-mentioned objectives, features, and advantages of this application, the solution of this application will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.

[0021] Many specific details are set forth in the following description in order to provide a full understanding of this application, but this application may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some embodiments of this application, and not all embodiments.

[0022] Unless the context otherwise requires, throughout the specification and claims, the term "comprise" and its other forms, such as the third-person singular "comprises" and the present participle "comprising," are interpreted as open-ended and encompassing, meaning "including, but not limited to." In the description of the specification, terms such as "one embodiment," "some embodiments," "exemplary embodiments," "example," "specific example," or "some examples," etc., are intended to indicate that a particular feature, structure, material, or characteristic associated with that embodiment or example is included in at least one embodiment or example of this application. The illustrative representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics mentioned may be included in any suitable manner in any one or more embodiments or examples.

[0023] In this document, the use of “configured to” implies an open and inclusive language that does not exclude devices that are configured to perform additional tasks or steps. “At least one of A, B, and C” has the same meaning as “at least one of A, B, or C”, both of which include the following combinations of A, B, and C: A only, B only, C only, a combination of A and B, a combination of A and C, a combination of B and C, and a combination of A, B, and C.

[0024] "A and / or B" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone, where A and B can be singular or plural. The use of "based on" implies openness and inclusivity, because processes, steps, calculations, or other actions "based on" one or more of the stated conditions or values ​​may in practice be based on additional conditions or values ​​beyond those stated.

[0025] With the deepening of digital transformation, digital twin technology, as a key link connecting the physical and digital worlds, has become one of the core supporting technologies for digital transformation in key fields such as intelligent manufacturing, smart cities, and aerospace. However, digital twin technology still faces many challenges, including high development barriers, complex logical construction, long R&D cycles, and high investment costs.

[0026] Traditional development models heavily rely on professional front-end developers, who not only need proficiency in complex 3D modeling to achieve high-precision reconstruction of physical entities, but also require strong graphics programming skills (such as shader writing and rendering pipeline optimization) to ensure visual presentation quality and operational performance. To achieve deep integration of physical data and virtual models, developers are also required to deeply understand and handle complex data-driven logic and real-time synchronization of multi-source heterogeneous data, further increasing development difficulty. Due to these technical barriers, the development of digital twin applications heavily depends on teams of experienced experts, resulting in lengthy development cycles and high R&D and maintenance costs, severely hindering the large-scale adoption and application of digital twin technology in more industries and SMEs. When end-users request customized modifications, the development cycle typically takes weeks or even months, and discrepancies in requirements can easily arise during multiple rounds of communication. Furthermore, the business knowledge and domain experience accumulated during component development are difficult to reuse.

[0027] In view of this, this application proposes a component generation method, such as Figure 1 As shown. Figure 1 This is a flowchart illustrating a component generation method according to some embodiments. The component generation method includes the following steps: S101. Obtain the natural language input from the user.

[0028] S102. Perform intent classification and parameter extraction on natural language to generate intent labels and structured parameter information.

[0029] The intent label includes at least one of intent type, target component type, operation type, and constraint condition. For example, step S102 can understand what operation the user wants to perform based on natural language.

[0030] In some implementations, intent types are used to indicate the major categories of operations that the user wants to perform, such as component customization, data visualization, scene configuration, and interaction settings.

[0031] In some implementations, the target component type is used to indicate the component type, such as fault highlighting engine, temperature profile, and alarm pop-up.

[0032] In some implementations, the operation type is used to indicate the specific action, such as creating, modifying, deleting, and querying.

[0033] In some implementations, constraints are used to indicate limitations, such as displaying only on mobile devices or having a response time less than or equal to a preset duration.

[0034] For example, structured parameter information exists in the form of key-value pairs.

[0035] S103. Based on the knowledge graph, perform entity linking, relational reasoning, and semantic disambiguation on natural language, intent tags, and structured parameter information to generate semantic parsing parameters.

[0036] The semantic parsing parameters include at least one of an entity list, a relationship list, a rule list, and semantic parameters. For example, step S103 can deeply understand the business requirements described by the user and combine this with a knowledge graph for semantic disambiguation to extract information such as key business entities and attributes.

[0037] In some implementations, the entity list may include information such as concepts, mapped entities, confidence levels, and entity types.

[0038] In some implementations, the relationship list includes information such as the source entity, relationship type, and target entity.

[0039] In some implementations, the rule list may include, for example, business rules and constraints. For instance, the rule list may be generated based on a knowledge graph rule base, according to mapped entities and relationships.

[0040] In some implementations, the semantic parsing parameters are normalized expressions that have been enhanced by knowledge graphs and semantic associations.

[0041] S104. Determine the target template component and attribute values ​​based on the semantic parsing parameters, and generate component code based on the target template component and attribute values.

[0042] The component generation method provided in this application includes a three-stage collaborative architecture of intent recognition, semantic parsing, and code generation. This architecture can convert user-input natural language into structured code, lowering the programming threshold, enabling real-time component customization, and significantly shortening the component development cycle. Specifically, in step S102, concepts in the natural language are initially extracted. Then, in step S103, a knowledge graph is used to perform deep disambiguation and mapping on the concepts initially extracted in step S102 to supplement implicit concepts that were not identified in step S102, and to establish the association between concepts and entities in the knowledge graph. This allows the system to understand the true business intent contained in the user-provided natural language and obtain component code that meets the user's needs.

[0043] Furthermore, the component generation method provided in this application embodiment can create or modify components in real time in the runtime environment. The WYSIWYG component generation method can reduce communication costs caused by differences in runtime environments and further improve development efficiency.

[0044] In some embodiments, such as Figure 1 Step S103 shown can be specifically implemented as follows: Figure 2 Steps S201 to S203 are shown. Figure 2This is a flowchart of another component generation method provided according to some embodiments.

[0045] S201. Establish a mapping relationship between the concepts included in natural language and the standard entities in the knowledge graph to obtain an entity list.

[0046] S202. Generate a relation list based on a knowledge graph relation network and natural language. The relation list is used to represent the implicit relations included in natural language.

[0047] S203. A rule base based on a knowledge graph generates a rule list based on the entity list and the relationship list. The rule list includes business rules and / or constraints.

[0048] The component generation method provided in this application, based on the relationship list provided in step S202, ensures that the final generated code includes not only the target component but also correct interaction logic. Furthermore, it can determine the data types expressed or implied in the user's natural language based on the constraints provided by the knowledge graph, so that these data types are reflected in the final generated code.

[0049] In some embodiments, such as Figure 1 Step S103 shown also includes: The target data type is determined based on the constraints of natural language and knowledge graphs.

[0050] In some embodiments, a knowledge graph includes knowledge units, a relational network, and a rule base.

[0051] Knowledge units are used to standardize the definition of entities. Relationship networks are used to define the relationships between entities. Rule bases are used to define component usage rules, data binding rules, and interaction response rules.

[0052] In some implementations, knowledge units are used to standardize the definition of concepts. These knowledge units include, for example, device entities, scene entities, data entities, and interaction entities. Device entities refer to various devices and apparatuses in the physical world. Scene entities refer to spatial concepts in a digital twin system, describing the geographical scope and spatial structure of the physical world. Data entities refer to various types of data flowing and processed in the digital twin system. Interaction entities refer to methods of human-computer interaction and interface elements, including charts, controls, containers, etc.

[0053] In some implementations, relationship networks are used to define the connections between entities. These networks include, for example, connection relationships, dependency relationships, mapping relationships, triggering relationships, and containment relationships. Connection relationships indicate physical or logical connections between entities. Dependency relationships indicate other entities necessary for an entity to function properly. Mapping relationships indicate the correspondence between virtual and physical entities. Triggering relationships indicate causal chains between user actions and system responses. Containment relationships indicate hierarchical affiliations between entities.

[0054] The knowledge graph relational network in this embodiment not only stores explicitly defined relations, but also determines implicit relations between entities or concepts based on preset reasoning rules such as graph theory algorithms.

[0055] In some implementations, rule lists are used to indicate business rules regarding component usage, data binding, and interactive responses, ensuring that the code generated in step S104 is not only syntactically correct but also conforms to business logic standards. Rule lists may include, for example, component composition rules, data binding rules, and interactive response rules. Component composition rules indicate which components in the template library can be combined and the conditions that must be met for combination. Most functions require multiple components to work together; component composition rules provide a standardized description of these relationships, defining not only what can be combined with what but also the parameter constraints during combination. Data binding rules indicate the connection methods between components and data, as well as the specifications for data flow. Interactive response rules indicate how user actions trigger system responses and how system responses are passed to relevant components.

[0056] The knowledge graph provided in this application can construct professional knowledge graphs based on different application scenarios such as smart cities, national defense and military industry, Geographic Information System (GIS), and Building Information Modeling (BIM), providing background knowledge support for component generation methods in corresponding fields and improving the accuracy of understanding. Furthermore, it enables reuse in the same or similar application scenarios, further improving the efficiency of component code generation.

[0057] In some embodiments, such as Figure 1 Step S104 shown can be specifically implemented as follows: Figure 3 Steps S301 to S303 are shown. Figure 3 This is a flowchart illustrating another component generation method provided according to some embodiments.

[0058] S301. Select one or more target template components from the template library of the component code generation engine based on semantic parsing parameters.

[0059] The target template component includes placeholders.

[0060] S302. Determine attribute values ​​based on semantic parameters.

[0061] S303. Replace the placeholders in the target template component with attribute values ​​to generate component code.

[0062] In this embodiment, the target template component may include multiple placeholders.

[0063] S302 can also be used to determine multiple attribute values ​​based on multiple semantic parameters.

[0064] S303 can also replace multiple placeholders in the target template component with their corresponding attribute values ​​to generate component code.

[0065] In some implementations, if it is identified that a data source needs to be bound, step S104 may also include adding data binding code.

[0066] In some implementations, the template library covers various components commonly used in digital twin systems. The templates are parameterized, and certain parts of the code are left as variables to be dynamically populated with the attribute values ​​determined in step S104. Ultimately, complete Vue single-file component code is generated, including template, script, and style parts, which can be directly used in Vue projects.

[0067] In some implementations, the template library includes basic component templates, composite component templates, interactive component templates, data display component templates, and map component templates. Basic component templates indicate basic interface elements. Composite component templates are composed of multiple basic components. Interactive component templates include user interaction logic. Data display component templates are used to display data to the user.

[0068] In some implementations, the template includes variable placeholders, which are replaced by their corresponding attribute values ​​in step S104. Template parameters include simple type parameters, object type parameters, array type parameters, and function type parameters. Simple type parameters include strings, numbers, and booleans, such as component name parameters, display text parameters, and style class name parameters. Object type parameters indicate component configuration options; for example, chart configuration parameters might include a set of related options such as chart type, color scheme, and legend position. Array type parameters indicate list-style data; for example, a table's column definition parameter is an array, where each array element describes a column's name, width, data fields, etc. Function type parameters indicate the component's method logic, such as click event handling functions and formatted display data processing functions.

[0069] In some embodiments, such as Figure 1Step S104 shown can be specifically implemented as follows: Figure 4 Steps S401 to S402 are shown. Figure 4 This is a flowchart illustrating another component generation method provided according to some embodiments.

[0070] S401. Determine the association information of multiple target template components based on the entity list and relationship list.

[0071] The associated information includes at least one of the following: reference relationships, nested structures, event binding relationships, and data dependencies.

[0072] S402. Determine the constraints for code combinations of multiple target template components based on the rule list.

[0073] After completing the entity linking in step S103, the business rules associated with the entity are queried from the rule base of the knowledge graph based on the entity type obtained from the mapping. The rule base returns these business rules to generate a rule list. The returned business rules should be followed during the code generation process.

[0074] In some implementations, the entity list is used to indicate the structural and interaction relationships between components. In step S104, these relationships are correctly translated into component references, nested structures, event bindings, and data dependencies in the code.

[0075] In some implementations, the component composition rules defined in the rule base are business constraints for code synthesis. In step S104, it is necessary to ensure that the generated code conforms to these rules to guarantee the correctness of the business logic. The transformation of composition rules first involves the selection of components.

[0076] In some implementations, the rule list defines which components can be combined. For example, a map component is often combined with a label layer, a pop-up component, and a zoom controller. The conversion of combination rules also involves parameter consistency; for instance, when a pop-up component is combined with a map component, the pop-up's style parameters should be consistent with the map's style parameters. The conversion of combination rules also involves determining the loading order. During code execution, some components need to load before others to function correctly; for example, a data source component needs to be initialized before a chart component.

[0077] For example, if mapped to the entity "temperature sensor data", the rules returned by the rule base may include: Data refresh rules stipulate that the refresh interval shall not be less than 5 seconds.

[0078] The numerical range rule specifies that the effective range of temperature values ​​is -40°C to 85°C.

[0079] In addition, there are rules for handling outliers, which stipulate that when a value exceeds the valid range, the displayed content will be set to "--".

[0080] In some embodiments, such as Figure 1 Step S104 also includes: Perform at least one of the following checks on the component code: syntax check, style check, integrity check, and logic check.

[0081] The syntax check includes at least one of variable checking, function checking, and class checking; the style check includes at least one of naming convention checking, format checking, and comment checking; the integrity check includes component registration checking and / or data definition checking; and the logic check includes data flow checking and / or boundary condition checking.

[0082] In some implementations, syntax checking ensures that the generated code can be correctly loaded, parsed, and executed by the browser, including the syntactic correctness of variables, functions, classes, etc. Style checking maintains consistency in the team's coding style, including naming conventions (focusing on the naming conventions of component names, variable names, and function names), code indentation, blank lines, line breaks, and the completeness and accuracy of code comments. Completeness checking ensures that no critical parts are missing, such as component registration checking to verify that components are correctly registered, and data definition checking to verify that components correctly define all used data. Logic checking ensures that the generated code is problem-free at the business logic level, such as data flow checking to verify the correctness of data transmission and updates, and boundary condition checking to verify that the code correctly handles boundary cases.

[0083] The component generation method provided in this application can realize the quality verification of component code, ensure that the generated component code conforms to the preset specifications, thereby reducing the workload of manual review or modification.

[0084] The component generation method provided in this application will be described below with reference to specific embodiments.

[0085] Example 1 Example 1 illustrates the process of a user wanting to generate a visualization component of a device temperature curve.

[0086] Step 1: Obtain the natural language input from the user. The natural language input includes: "Display the real-time temperature curves of all devices in Area A".

[0087] Step 2: Perform intent classification and parameter extraction on the natural language to output the intent tag and structured parameter information (parameters).

[0088] "intent_tag": { "type": "Data Visualization", "sub_type": "Timing Curve", "required": ["Device list", "Time range"] }, "parameters": { "location": "Area A", "data_type": "temperature", "time_mode": "real-time", "display_mode": "curve" } } Step 3: Based on the knowledge graph, perform entity linking, relation reasoning, and semantic disambiguation on natural language, intent tags, and structured parameter information to generate semantic parsing parameters. The semantic parsing parameters include an entity list (entity_list), a relation list (relation_list), and a rule list (rule_list).

[0089] { "entity_list": [ {"concept": "Area A", "mapped_entity": "Area A", "type": "Scene Class"}, {"concept": "device", "mapped_entity": "device entity", "type": "device class"}, {"concept": "temperature", "mapped_entity": "temperature sensor data", "type": "data type"} ], "relation_list": [ {"source": "Region_A", "relation": "Contains", "target": "List of devices"}, {"source": "device list", "relation": "association", "target": "temperature sensor data"} ], "rule_list": [ {"rule": "data refresh rule", "refresh_interval": 5000}, {"rule": "curve style rule", "line_color": "#FF6B6B", "fill": false} ] } Step 4: Determine the target template component and attribute values ​​based on semantic parsing parameters, and generate component code according to the target template component and attribute values. Call the temperature curve component template to generate Vue component code containing data binding and real-time refresh logic.

[0090] This application also provides a component generation apparatus, such as Figure 5 As shown, Figure 5 This is a schematic diagram of a component generation apparatus according to some embodiments. The component generation apparatus 500 includes an interaction module 501, an intent recognition module 502, a semantic parsing module 503, and a code generation module 504.

[0091] The interaction module 501 is configured to acquire natural language input from the user.

[0092] The intent recognition module 502 is configured to classify and extract parameters from natural language to generate intent labels and structured parameter information.

[0093] The intent label includes at least one of intent type, target component type, operation type, and constraint condition.

[0094] The semantic parsing module 503 is configured to perform entity linking, relational reasoning, and semantic disambiguation on natural language, intent tags, and structured parameter information based on the knowledge graph to generate semantic parsing parameters.

[0095] The semantic parsing parameters include at least one of the following: entity list, relation list, rule list, and semantic parameters.

[0096] The code generation module 504 is configured to determine the target template component and attribute values ​​based on semantic parsing parameters, and generate component code based on the target template component and attribute values.

[0097] In some implementations, the code generation module 504 calls the component code generation engine 506, which is configured to execute specific code generation logic to output component code. For example, the component code is the complete Vue single-file component code.

[0098] In some embodiments, the component generation apparatus 500 further includes a control module 505, which is connected to the interaction module 501, the intent recognition module 502, the semantic parsing module 503, and the code generation module 504 to adjust the workflow of the above modules.

[0099] The component generation apparatus 500 provided in this application embodiment includes an intent recognition module 502, a semantic parsing module 503, and a code generation module 504. Through the collaborative work of these three modules, end-to-end intelligent conversion from user natural language descriptions to executable Vue component code is achieved. A collaborative, sequential working architecture is adopted: the intent recognition module 502, the semantic parsing module 503, and the code generation module 504 each undertake independent professional responsibilities, handling a specific stage, and information is transmitted between the modules through standardized data structures. Specifically, the intent recognition module 502 is used to understand the user's intent, that is, to analyze the operation the user wants to perform. The semantic parsing module 503 is used to perform in-depth analysis of the business meaning contained in the user's description. The code generation module 504 is used to convert the parsing results into actual executable code.

[0100] The control module 505, for example, acts as a coordinator, configured to manage the execution order of the intent recognition module 502, semantic parsing module 503, and code generation module 504, monitor the execution status of each agent, and transmit processing results between processing stages. This architecture assigns specialized processing tasks to specialized modules for execution. Compared to the problem of a single model needing to possess multiple capabilities such as intent understanding, domain knowledge mastery, and code generation simultaneously, thus limiting processing depth, the multi-module architecture of this application decomposes complex tasks into three relatively simple sub-tasks. Each module only needs to focus on a single processing objective, and then these are linked together by an orchestration engine to form a complete functional processing chain. For example, the modules communicate with each other through a standardized message format.

[0101] Specifically, the control module 505 is configured to instruct the intent recognition module 502 to process the user input, then pass the output of the intent recognition module 502 to the semantic parsing module 503, and finally pass the output of the semantic parsing module 503 to the code generation module 504. This sequential process ensures that the processing results of each stage can be correctly used by the next stage. The control module 505 is also configured to manage the state information and context information generated during the processing. Furthermore, the control module 505 is configured to perform flow control based on context conditions at preset decision points.

[0102] Based on the same concept, embodiments of this application also provide a processor-readable storage medium storing a program for causing a processor to perform the steps involved in the above-described method embodiments. The processor-readable storage medium can be any available medium or data storage device accessible to a processor, including but not limited to RAM, ROM, EEPROM, CD-ROM or other optical storage (e.g., CD, DVD, BD, HVD, etc.), disk storage media or other magnetic storage devices (e.g., floppy disk, hard disk, magnetic tape, magneto-optical disk (MO), or any other medium capable of carrying or storing desired program code having an instruction or data structure form and accessible by a computer).

[0103] Based on the same concept, this application also provides a computer program product, which includes a computer program or instructions that, when run on a computer, cause the computer to perform the methods provided in the above embodiments.

[0104] Based on the same concept, this application also provides a chip including a processor coupled to a memory for executing a computer program or instructions stored in the memory. When the processor executes the computer program or instructions, the method provided in the above embodiments is implemented.

[0105] It should also be understood that the memory mentioned in the embodiments of this application can be volatile memory and / or non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM). For example, RAM can be used as an external cache. By way of example and not limitation, RAM includes various forms such as: static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM). It should be noted that when the processor is a general-purpose processor, DSP, ASIC, FPGA, or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, the memory (storage module) can be integrated into the processor.

[0106] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.

[0107] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A component generation method, characterized in that, include: Obtain natural language input from the user; The natural language is classified and parameters are extracted to generate intent tags and structured parameter information. The intent tags include at least one of intent type, target component type, operation type and constraint condition. Based on the knowledge graph, entity linking, relation reasoning, and semantic disambiguation are performed on the natural language, the intent tags, and the structured parameter information to generate semantic parsing parameters. The semantic parsing parameters include at least one of an entity list, a relation list, a rule list, and semantic parameters. The target template component and attribute values ​​are determined based on the semantic parsing parameters, and component code is generated based on the target template component and the attribute values.

2. The component generation method according to claim 1, characterized in that, The step of performing entity linking, relation reasoning, and semantic disambiguation on the natural language, intent tags, and structured parameter information based on knowledge graphs to generate semantic parsing parameters includes: Establish a mapping relationship between the concepts included in the natural language and the standard entities in the knowledge graph to obtain the entity list; The relation list is generated based on the relation network of the knowledge graph and the natural language, and the relation list is used to represent the implicit relations included in the natural language; Based on the rule base of the knowledge graph, the rule list is generated according to the entity list and the relationship list, and the rule list includes business rules and / or constraints.

3. The component generation method according to claim 2, characterized in that, The step of performing entity linking, relation reasoning, and semantic disambiguation on the natural language, intent tags, and structured parameter information based on knowledge graphs to generate semantic parsing parameters further includes: The target data type is determined based on the constraints of the natural language and the knowledge graph.

4. The component generation method according to claim 2 or 3, characterized in that, The knowledge graph includes: Knowledge unit, which is used to standardize the definition of entities; A relational network, which defines the relationships between the entities; A rule base is used to define component usage rules, data binding rules, and interaction response rules.

5. The component generation method according to claim 1, characterized in that, The step of determining the target template component and attribute values ​​based on the semantic parsing parameters, and generating component code based on the target template component and the attribute values, includes: Based on the semantic parsing parameters, one or more target template components are selected from the template library of the component code generation engine; the target template components include placeholders; The attribute value is determined based on the semantic parameters; Replace the placeholders in the target template component with the attribute values ​​to generate the component code.

6. The component generation method according to claim 5, characterized in that, The target template component includes multiple placeholders; Multiple attribute values ​​are determined based on multiple semantic parameters; The multiple placeholders in the target template component are replaced with their corresponding attribute values ​​to generate the component code.

7. The component generation method according to claim 5, characterized in that, The step of determining the target template component and attribute values ​​based on the semantic parsing parameters, and generating component code based on the target template component and the attribute values, further includes: Based on the entity list and the relationship list, the association information of multiple target template components is determined, and the association information includes at least one of the following: reference relationship, nested structure, event binding relationship and data dependency relationship; Constraints are determined for the code combination of multiple target template components based on the rule list.

8. The component generation method according to claim 5, characterized in that, The step of determining the target template component and attribute values ​​based on the semantic parsing parameters, and generating component code based on the target template component and the attribute values, further includes: Perform at least one of the following checks on the component code: syntax check, style check, integrity check, and logic check; The syntax check includes at least one of variable check, function check, and class check; the style check includes at least one of naming convention check, format check, and comment check; the integrity check includes component registration check and / or data definition check; the logic check includes data flow check and / or boundary condition check.

9. A component generation apparatus, characterized in that, include: The interaction module is configured to acquire natural language input from the user; The intent recognition module is configured to classify and extract parameters from the natural language to generate intent tags and structured parameter information. The intent tags include at least one of intent type, target component type, operation type, and constraint condition. The semantic parsing module is configured to perform entity linking, relation reasoning, and semantic disambiguation on the natural language, the intent tags, and the structured parameter information based on the knowledge graph, so as to generate semantic parsing parameters, which include at least one of an entity list, a relation list, a rule list, and semantic parameters. The code generation module is configured to determine the target template component and attribute values ​​based on the semantic parsing parameters, and generate component code based on the target template component and the attribute values.

10. A processor-readable storage medium, characterized in that, The processor-readable storage medium stores a program for causing the processor to perform the method as described in any one of claims 1 to 8.