UML (Unified Modeling Language) graph generation method and device, electronic equipment and storage medium
By obtaining the user input text and performing logical verification, determining the elements and relationships of UML graphics, the cumbersome problems of UML graphics generation in the prior art are solved, and a simple and fast method for generating UML graphics in natural language is realized.
Patent Information
- Application Number
- CN202410529763.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-29
- Publication Date
- 2025-02-07
AI Technical Summary
In the prior art, creating UML model graphics requires manual drawing, which is cumbersome, requires professional knowledge, and consumes a lot of time, and lacks a simple and fast generation method.
By obtaining the input text of the target user, determining the graphic type of the UML graphic to be generated, performing logical verification, determining the relationship between the graphic elements and elements, and generating UML graphic.
It realizes the simple and quick generation of UML graphics through natural language, reducing the tedious process of manual drawing and improving efficiency.
Smart Images

Figure CN119396391A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of natural language processing, and specifically relates to a UML graph generation method, device, electronic device and storage medium. Background Art
[0002] UML is the abbreviation of Unified Modeling Language, which is a standardized modeling language consisting of a complete set of diagrams. UML is used to help system developers clarify, display, build and record the output of software systems. It is a very important part of developing object-oriented software and software development process, and mainly uses graphical symbols to represent the design of software projects. In the existing technical solutions, creating UML model graphics requires manual drawing, which usually involves the use of dedicated modeling tools such as EnterpriseArchitect, Visual Paradigm, Lucidchart, etc., but manual drawing is a process that requires professional knowledge, is tedious and time-consuming.
[0003] Therefore, there is currently a lack of a simple and fast method for generating UML model graphics. Summary of the invention
[0004] The embodiment of the present application provides a UML graph generation method, which can generate UML graphs simply and quickly through natural language.
[0005] In a first aspect, an embodiment of the present application provides a UML graphics generation method, the method comprising: obtaining input text of a target user, and determining a graphic type of a Unified Modeling Language (UML) graphic to be generated based on the input text; performing logical verification on the input text according to a logical relationship corresponding to the graphic type; if the logical verification passes, determining graphic elements and element relationships of the UML graphic to be generated based on the input text; and generating a UML graphic based on the graphic elements and the element relationships.
[0006] In a second aspect, an embodiment of the present application provides a UML graphics generation device, which includes: a first acquisition module, used to acquire input text of a target user, and determine the graphic type of a Unified Modeling Language (UML) graphic to be generated based on the input text; a first verification module, used to perform logical verification on the input text according to the logical relationship corresponding to the graphic type; a first determination module, used to determine the graphic elements and element relationships of the UML graphic to be generated based on the input text if the logical verification passes; and a first generation module, used to generate a UML graphic based on the graphic elements and the element relationships.
[0007] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0009] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed by a processor, implements the steps of the method described in the first aspect.
[0010] In a sixth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0011] In an embodiment of the present application, the input text of the target user is obtained, and the graphic type of the Unified Modeling Language UML graphic to be generated is determined according to the input text; the input text is logically verified according to the logical relationship corresponding to the graphic type; when the logical verification passes, the graphic elements and element relationships of the UML graphic to be generated are determined based on the input text; and the UML graphic is generated based on the graphic elements and the element relationships, so that the UML graphic can be generated simply and quickly through natural language. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 It is a flowchart of a UML graphics generation method provided in an embodiment of the present application;
[0013] Figure 2 It is a flowchart of a second UML graph generation method provided in an embodiment of the present application;
[0014] Figure 3 It is a flowchart of a method for determining the type of a UML graphic to be generated provided by an embodiment of the present application;
[0015] Figure 4 It is a flowchart of a third UML graph generation method provided in an embodiment of the present application;
[0016] Figure 5 It is an information transmission schematic diagram of a UML graphics generation method provided in an embodiment of the present application;
[0017] Figure 6It is a structural schematic diagram of a UML graph generation device provided in an embodiment of the present application;
[0018] Figure 7 It is a structural schematic diagram of a UML graph generation device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0019] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0020] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0021] The UML graph generation method provided by the embodiment of the present application is described in detail below through specific embodiments and application scenarios in conjunction with the accompanying drawings.
[0022] Figure 1 A UML diagram generation method provided by an embodiment of the present invention is shown. The method can be executed by an electronic device, and the electronic device may include: a server and / or a terminal device, wherein the terminal device may be, for example, a vehicle-mounted terminal or a mobile phone terminal. In other words, the method can be executed by software or hardware installed in a UML diagram generation device, and the method includes the following steps:
[0023] Step 102: obtaining input text of the target user, and determining the type of a unified modeling language (UML) graph to be generated according to the input text;
[0024] The UML graphic generation dialogue system obtains the input text of the target user, wherein the input text of the target user is the description information of the UML graphic to be generated input by the target user. The input text of the target user includes first intention information for representing the UML graphic that the target user expects to generate, and also includes second intention information for representing the type of the UML graphic, so that the UML graphic generation dialogue system determines the graphic type of the UML graphic to be generated according to the input text.
[0025] After the UML graphics generation dialogue system obtains the input text of the target user, it can determine that the target user's intention is to generate UML graphics based on the information in the target user's input text that is used to characterize the UML graphics that the target user expects to generate, and then determine the UML graphics type that the target user intends to generate based on the information in the target user's input text that is used to characterize the UML graphics type, where the graphics types include timing diagrams, class diagrams, state diagrams, etc.
[0026] Before the UML graphic generation dialogue system obtains the input text of the target user, in order to better identify the intention of the target user, the UML graphic generation dialogue system can also show the input text sample to the target user, wherein the input text sample is a sample input text that guides the user to input the input text, thereby guiding the target user to input the described content (input text) according to the input text sample, such as the input text sample can be: I want to create a sequence diagram to represent the authorization code mode issued by 0auth2 token. This sequence diagram includes several participants: user, user agent, client, authentication login and authentication server. The process is as follows: 1. The user accesses the client to request a token; 2. The user agent redirects to the authentication login and passes the client's information, such as clientId and redirectUrl; 3. The authentication login receives the username, password, clientId and redirectUrl, and then forwards the request to the authentication server; 4. The authentication server replies with an authentication code to the authentication login; 5. The authentication login returns the authorization code to the user agent and redirects to the redirectUrl of the instruction, while passing the authorization code; 6. The user agent provides the authorization code to the client so that the client can use it to request a token; 7. The client uses the authorization code, clientId and redirectUrl to request a token from the authentication server; 8. The authentication server issues an access token and a refresh token to the client; 9. The client returns the access token and the refresh token to the user agent and completes the token issuance. Showing the user a sample of the input text can guide the user to input so that the information required to generate the UML graphics can be better determined based on the input text.
[0027] Specifically, when the UML graphic generation dialogue system obtains the input text of the target user, the input text input by the target user can be obtained through the Chatbot application of the target terminal, wherein the Chatbot is an application responsible for human-computer interaction of the target terminal. In addition, the UML graphic generation dialogue system includes a dialogue management module, which is responsible for creating and starting the dialogue process and receiving user text.
[0028] Step 104: performing logic verification on the input text according to the logical relationship corresponding to the graphic type;
[0029] After determining the graphic type of the UML graphic to be generated, the UML graphic generation dialogue system performs logic verification on the input text according to the logical relationship corresponding to the graphic type of the UML graphic to be generated, that is, verifies whether the logical relationship in the input text matches the logical relationship corresponding to the graphic type of the UML graphic to be generated. If the determined UML graphic type to be generated is a sequence diagram, the logical relationship corresponding to the sequence diagram should be "role A sends message N to role B". When the logic of the text input by the target user is the same as it, it is determined that the logic verification has passed. When the logic of the text input by the target user is different from the logic corresponding to the sequence diagram, such as "message N sends role A to role B", the logic is different from the logic corresponding to the sequence diagram, and it is determined that the logic verification has failed.
[0030] Specifically, the UML graphics generation dialogue system also includes a GPT Agent module, which is used to interact with the GPT model outside the UML graphics generation dialogue system. The UML graphics generation system interacts with the GPPT model according to the input text input by the target user, so as to determine the various information required for generating UML graphics contained in the input text, such as the type of graphics, etc. The UML graphics generation dialogue system also includes a dialogue process management module, which is used to manage the process of dialogue with the target user, and can verify the various information required for generating UML graphics contained in the input text determined by the GPT model, such as verifying the logical relationship in the determined input text.
[0031] Step 106: if the logic verification passes, determining the graphic elements and element relationships of the UML graphic to be generated based on the input text;
[0032] When the UML diagram generation dialogue system passes the logic verification, it determines the graphic elements and element relationships of the UML diagram from the input text, where the graphic elements are the information of each element required to form the UML diagram, and the element relationship is the relationship information between each element required to form the UML diagram. For example, when the input text of the target user is that system A sends message N to system B, the graphic elements obtained from the input text are system A and system B, and the element relationship obtained is the message interaction relationship; when the input text of the target user is that system B returns message N1 to system A, the graphic elements obtained from the input text are system B and system A, and the element relationship obtained is the message interaction relationship.
[0033] Specifically, the UML graphic generation dialogue system can process the input text to determine the graphic elements and element relationships in the input text, and can also determine the graphic elements and element relationships in the input text by interacting with the GPT model.
[0034] Step 108: Generate a UML graph based on the graph elements and the element relationships.
[0035] After the UML graphic generation dialogue system determines the graphic elements and element relationships of the UML graphic to be generated, the UML graphic generation dialogue system generates the UML graphic according to the determined graphic elements and element relationships.
[0036] Specifically, when the UML graphics generation dialogue system determines the graphic elements and element relationships, it means that the UML graphics generation dialogue system has determined the information required to generate the UML graphics, such as the graphic type of the UML graphics to be generated, the logical relationship of the UML graphics to be generated, the graphic elements and the element relationships. At this time, the UML graphics generation dialogue system can generate the UML graphics based on the graphic elements and the element relationships between the graphic elements.
[0037] The UML graphics generation method provided by the embodiment of the present invention obtains the input text of the target user, and determines the graphic type of the unified modeling language UML graphics to be generated according to the input text; performs logic verification on the input text according to the logical relationship corresponding to the graphic type; when the logic verification passes, determines the graphic elements and element relationships of the UML graphics to be generated based on the input text; generates the UML graphics based on the graphic elements and the element relationships, and can generate the UML graphics simply and quickly through natural language.
[0038] In one implementation, the logical verification of the input text according to the logical relationship corresponding to the graphic type (step 104) may include executing steps A1-A3:
[0039] Step A1: obtaining a first logical relationship in the input text;
[0040] After obtaining the input text and determining the type of UML graphics to be generated for the target user based on the input text, the UML graphics generation dialogue system obtains the first logical relationship in the input text, wherein the first logical relationship is used to characterize the logical relationship included in the input text of the target user. When determining the logical relationship included in the input text, the logical relationship in the text may be determined to be a correct logical relationship based on the input text, that is, "Role A sends message N to Role B", or the logical relationship determined based on the input text may be an incorrect logical relationship, such as "Role A sends message N to Role B".
[0041] Step A2: determining a second logical relationship corresponding to the graphic type from a preset logical relationship table according to the graphic type;
[0042] After the UML graphic generation dialogue system determines the graphic type of the UML graphic to be generated according to the input text, it determines the second logical relationship corresponding to the graphic type of the UML graphic to be generated from the pre-set logical relationship table, wherein the logical relationship table pre-sets the logical relationships corresponding to various types of UML graphic types, and the second logical relationship is used to characterize the logical relationship corresponding to the UML type to be generated. For example, when the graphic type of the UML graphic to be generated determined according to the input text is a sequence diagram, the second logical relationship corresponding to the sequence diagram can be determined from the pre-set logical relationship table, such as the determined second logical relationship is "role A sends message N to role B".
[0043] Step A3: Performing logical verification on the input text according to the first logical relationship and the second logical relationship.
[0044] After determining the first logical relationship and the second logical relationship, the UML graphic generation dialogue system performs logic verification according to the first logical relationship and the second logical relationship. Specifically, the UML graphic generation system determines whether the logic verification is passed by determining whether the first logical relationship and the second logical relationship are the same, that is, if the first logical relationship and the second logical relationship are the same, the logic verification is determined to be passed, and if the first logical relationship and the second logical relationship are not the same, the logic verification is determined to be failed. For example, when it is determined according to the input text of the target user that the graphic type of the UML graphic to be generated is a sequence diagram, the first logical relationship is "Role A sends message N to Role B" and the second logical relationship is "Role A sends message N to Role B", it can be determined that the logic verification is passed. When it is determined according to the input text of the target user that the graphic type of the UML graphic to be generated is a sequence diagram, the first logical relationship is "Role A sends message N to Role B" but the second logical relationship is "Role A sends message N to Role B", it can be determined that the logic verification is failed.
[0045] In one implementation, the method may further perform steps B1-B2:
[0046] Step B1: when the input text does not include target information, obtaining multi-round conversation information of the target user;
[0047] The target information includes one or more of the graphic type of the UML graphic to be generated, the first logical relationship, the graphic element and the element relationship.
[0048] The UML graph generation dialogue system can obtain multi-round dialogue information of the target user when the input text input by the target user does not include target information, wherein the target information includes one or more of the graph type, the first logical relationship, the graph element, and the element relationship of the UML graph to be generated. When obtaining the multi-round dialogue information, the multi-round dialogue information of the target user can be determined by conducting multi-round dialogues with the target user.
[0049] Specifically, the target information may include multiple target sub-information, such as the graphic type, the first logical relationship, the graphic element, and the element relationship of the UML graphic to be generated. Therefore, when the input text does not include the target information, different target sub-information can be determined through different multi-round dialogue information. That is, when the UML graphic generation dialogue system determines the graphic type of the UML graphic to be generated according to the input text, it is determined that the graphic type of the UML graphic to be generated is not included in the input text, and the multi-round dialogue information of the target user is obtained; when the UML graphic generation dialogue system determines the first logical relationship according to the input text, it is determined that the input text does not include the first logical relationship, and the multi-round dialogue information of the target user is obtained; when the UML graphic generation dialogue system determines the graphic element and the element relationship according to the input text, it is determined that the input text does not include the graphic element and the element information, and the multi-round dialogue information of the target user is obtained.
[0050] Step B2: Determine the target information from the multiple rounds of dialogue information.
[0051] The UML graph generation dialogue system can determine target information according to the multi-round dialogue information after determining the multi-round dialogue information, that is, determine the target information by conducting multi-round dialogues with the target user.
[0052] Specifically, when the UML graphic generation dialogue system cannot determine any item included in the target information based on the input text, it obtains multiple rounds of dialogue information from the target user and then determines the target information. That is, when the UML graphic generation dialogue system cannot determine any item of the graphic type, the first logical relationship, the graphic relationship, and the element relationship of the UML graphic to be generated based on the input text of the target user, it obtains multiple rounds of dialogue information from the target user and then determines any item of the graphic type, the first logical relationship, the graphic relationship, or the element relationship that is missing in the input text.
[0053] That is, when the UML graphic generation dialogue system cannot determine the graphic type of the UML graphic to be generated according to the input text, the target user's multi-round dialogue information is obtained and the graphic type of the UML graphic to be generated is determined according to the multi-round dialogue information, and then the subsequent step of performing logical verification on the input text according to the logical relationship corresponding to the graphic type is performed; when the first logical relationship cannot be determined according to the input text, the target user's multi-round dialogue information is obtained again and the first logical relationship is determined according to the multi-round dialogue information, and then the subsequent steps are performed; when the graphic element and the element relationship cannot be determined according to the input text, the target user's multi-round dialogue information is also obtained and the graphic element and the element relationship are determined according to the multi-round dialogue information, and then the subsequent steps are performed, wherein the multi-round dialogue information obtained when determining different target information is also different, such as when it is determined that the input text does not include the graphic type of the UML graphic to be generated, the graphic type is determined by obtaining the first multi-round dialogue information of the target user, when it is determined that the input text does not include the first logical relationship, the first logical relationship is determined by obtaining the second multi-round dialogue information of the target user, and when the input text does not include the graphic element and the element relationship, the graphic element and the element information are determined by obtaining the third multi-round dialogue information of the target user.
[0054] More specifically, the dialogue process management module included in the UML graphic generation dialogue system can also guide the target user to improve the description information through multiple rounds of dialogue information through the dialogue process, and determine the information required to generate the UML graphic according to the improved description information.
[0055] Figure 2 is a flow chart of a second UML graph generation method provided in an embodiment of the present application, such as Figure 2 As shown, the schematic diagram includes:
[0056] Step 202: obtaining input text of a target user, and determining the type of a unified modeling language (UML) graph to be generated according to the input text;
[0057] Step 204: when the input text does not include the graphic type of the UML graphic to be generated, obtaining first multi-round dialogue information of the target user related to determining the graphic type, and determining the graphic type of the graphic to be generated from the first multi-round dialogue information;
[0058] If the input text includes a graphic type, step 206 is directly executed.
[0059] Step 206: Obtain a first logical relationship in the input text;
[0060] Step 208: when the input text does not include the first logical relationship, obtaining second multi-round dialogue information of the target user related to determining the first logical relationship, and determining the first logical relationship from the second multi-round dialogue information;
[0061] If the input text includes the first logical relationship, step 210 is directly executed.
[0062] Step 210: determining a second logical relationship corresponding to the graphic type from a preset logical relationship table according to the graphic type;
[0063] Step 212: performing logic verification on the input text according to the first logical relationship and the second logical relationship;
[0064] Step 214: if the logic verification passes, determining the graphic elements and element relationships of the UML graphic to be generated based on the input text;
[0065] Step 216: when the input text does not include the graphic element and the element relationship, obtaining third multi-round dialogue information of the target user related to determining the graphic element and the element relationship, and determining the graphic element and the element relationship from the third multi-round dialogue information;
[0066] When the input text includes graphic elements and element relationships, step 218 is directly executed.
[0067] Step 218: Generate a UML diagram based on the graphic elements and the element relationships.
[0068] In an embodiment of the present specification, when the input text does not include any of the graphic type, the first logical relationship, the graphic element, or the element relationship of the UML graphic to be generated, the graphic type, the first logical relationship, the graphic element, or the element relationship of the UML graphic to be generated is determined by obtaining multiple rounds of conversation information of the target user, thereby determining the information required to generate the UML graphic through the natural language of the target user, thereby generating the UML graphic simply and quickly according to the information required to generate the UML graphic.
[0069] In one implementation, the determining the target information from the multi-round dialogue information (step B2) may further include performing steps C1:-C4:
[0070] Step C1: obtaining a preset output prompt instruction, and inputting the output prompt instruction and the input text into the pre-trained model to obtain an output text, wherein the output prompt instruction is used to instruct the pre-trained model to output the output text used to characterize the acquisition status of the target information;
[0071] The UML graphics generation dialogue system obtains a preset output prompt instruction, and the output prompt instruction is used to describe the information content that the target user expects to obtain, such as the information, answer, text, etc. that the target user expects to obtain from the GPT model, and the output providing instruction can be a prompt text or instruction for guiding the GPT model to generate the required response. After obtaining the output prompt instruction, the UML graphics generation dialogue system inputs the input text and the output prompt instruction into a pre-trained model (i.e., a model such as GPT) to obtain an output text, wherein the output text is the output content determined by the pre-trained model performing content analysis on the input text. The pre-trained model (such as the GPT model) can perform content analysis on the input input text to determine the information required for generating UML graphics included in the input text, such as the graphic type, logical relationship, graphic element and element relationship of the UML graphic, and the pre-trained model can also generate a reminder reply message for reminding the user to conduct multiple rounds of dialogue to obtain the target user's multiple rounds of dialogue information when the information required for generating UML graphics is not included in the input text, and has different reminder reply messages for different missing target sub-information. That is to say, the reminder reply message is a reply message of the pre-trained model to the input text, and the reminder reply message is used to represent the acquisition of the target information in the input text by the pre-trained model.
[0072] Specifically, the preset output prompt instructions and input text are input into the GPT model, and the GPT model determines the reply content, i.e., the output text, based on the prompt and the input text. For example, the original text is: "Please draw a sequence diagram, where system A sends message N to system B, and system B returns message N1 to system A". When executing the task, the complete text given to GPT is: "You will play the role of a UML graphics generator. For the question, you will answer the type of UML model that needs to be drawn. The UML model type is limited to sequence diagrams, class diagrams, and state diagrams. The answer format uses the json format {UMLType: UML type, needQuery: If it does not conform to the UML type, please give the text of how to ask the user, otherwise it is empty}. The question is: Please draw a sequence diagram, where system A sends message N to system B, and system B returns message N1 to system A". Then the GPT reply is {"UMLType":"Sequence diagram","needQuery":""}. And when the original text is "Hello", GPT will reply {"UMLType":"","needQuery":"Please provide more specific questions or requirements to determine which type of UML diagram needs to be drawn."}
[0073] Step C2: determining whether the target information exists in the input text according to the output text;
[0074] After receiving the output text, the UML graphics generation dialogue system determines whether the target information exists in the input text of the target user based on the output text, that is, the UML graphics generation dialogue system determines whether the target information exists in the input text based on the acquisition of the target information in the input text by the pre-trained model. For example, when the question is: "Please draw a timing diagram, system A sends message N to system B, and system B returns message N1 to system A", and the GPT reply is {"UMLType":"timing diagram","needQuery":""}, then it can be determined based on the GPT reply that the target information exists in the input text, and the target information that exists is the type of the UML graphics to be generated, which is the timing diagram type.
[0075] Step C3: if not, sending the output text to the target terminal, so that the target user can input supplementary text based on the output text;
[0076] The UML graph generation dialogue system determines whether the output text output by the pre-trained model includes the target information, and if so, determines the target information included in the input text, and if not, sends the output text to the target terminal so that the target user can input supplementary text based on the output text, wherein the supplementary text is used to supplement the input text and assist the pre-trained model in determining the target information.
[0077] Specifically, if the question is: "Please draw a sequence diagram, system A sends message N to system B, and system B returns message N1 to system A", and GPT replies {"UMLType":"Sequence diagram","needQuery":""}, then according to GPT's reply, it can be determined that the input text contains target information, and the target information is the type of the UML diagram to be generated, which is the sequence diagram type. If the input text does not contain target information, such as the original text is "Hello", and GPT replies {"UMLType":"","needQuery":"Please provide more specific questions or requirements, Determine which type of UML diagram needs to be drawn"}, it can be determined that there is no target information in the input text (or there is no graphic type information of the UML graphic to be generated), but it can be determined to obtain the reminder reply information of the multi-round dialogue of the target user, that is, "Please provide more specific questions or requirements to determine which type of UML diagram needs to be drawn", and at this time, the reminder reply information can be specifically used as the output text of the GPT model, and the output text is sent to the target terminal, so that the target user outputs supplementary text on the target terminal based on the output text, wherein the supplementary text is the text determined by the target user based on the output text to assist in obtaining the target information.
[0078] Step C4: Determine the target information according to the supplementary text.
[0079] After the UML diagram generation dialogue system sends the output text to the target terminal and receives the supplementary text returned by the target terminal based on the output text, the target information is determined according to the supplementary text, or the target information is determined according to the supplementary text and the input text.
[0080] Specifically, the method for the UML graphic generation dialogue system to determine the target information based on the supplementary text, or based on the supplementary text and the input text can be the same as the above-mentioned method for determining the target information based on the input text, which will not be described in detail here. More specifically, the UML graphic generation system can determine the graphic type based on the first multiple rounds of dialogue information, determine the first logical relationship based on the second multiple rounds of dialogue information, and determine the graphic elements and element relationships based on the third multiple rounds of dialogue. Therefore, it can also specifically determine the supplementary content based on the first output prompt instruction and the input text and determine the graphic relationship based on the supplementary content, and it can also determine the supplementary content based on the second output prompt instruction and the input text and determine the first logical relationship based on the supplementary content.
[0081] Figure 3 FIG. 1 is a flow chart of a method for determining the type of a UML graphic to be generated provided by an embodiment of the present specification. Figure 3 As shown, the schematic diagram includes:
[0082] Step 302: Obtain a preset first output prompt instruction, and input the output prompt instruction and the input text into a pre-trained model to obtain an output text;
[0083] Among them, the first output prompt instruction is used to instruct the pre-trained model to output the output text used to characterize the graphics type acquisition status.
[0084] Step 304: determining whether the graphic type exists in the input text according to the output text;
[0085] Step 306: If not, sending the output text to the target terminal so that the target user can input supplementary text based on the output text;
[0086] Step 308: Determine the graphic type according to the supplementary text.
[0087] In the embodiment of the present specification, the output text is determined according to the first output prompt instruction, and the supplementary text is determined according to the output text, so that when the input text lacks information, the target user is guided to supplement it through the supplementary text, thereby generating UML graphic information more accurately.
[0088] In one implementation, when the logic verification passes, determining the graphic elements and element relationships of the UML graphic to be generated based on the input text (step 106) may include executing steps D1-D2:
[0089] Step D1: determining the target graphic element and target element relationship corresponding to the graphic type of the UML graphic to be generated;
[0090] The UML graphic generation dialogue system determines the graphic elements and element relationships that should be included in the graphic type of the UML graphic, that is, the target graphic elements and target element relationships, from a preset configuration table according to the graphic type of the UML graphic to be generated, wherein the preset configuration table pre-sets the graphic elements and element relationships that should be included corresponding to the graphic types of various UML graphics.
[0091] Step D2: respectively obtaining the graphic element corresponding to the target graphic element and the element relationship corresponding to the target element relationship from the input text.
[0092] The UML graphic generation dialogue system obtains graphic elements corresponding to target graphic elements from input text, and obtains element relationships corresponding to target element relationships from the input text.
[0093] Specifically, the input text received by the UML graphic generation dialogue system is "system A sends message N to system B, and system B returns message N1 to system A", and when the extracted graphic elements and element relationships are expressed in json format, it can be expressed as:
[0094]
[0095]
[0096] In one implementation, the generating of the UML graph based on the graph elements and the element relationships (step 108) may further include performing steps E1-E2:
[0097] Step E1: Generate a UML script according to the graphic elements and the element relationships, and send the UML script to a UML graphic generation engine, so that the UML graphic generation engine generates the UML graphic based on the UML script;
[0098] After determining the graphic elements and element relationships, the UML graphic generation dialogue system determines the UML script according to the determined graphic elements and element relationships, wherein the UML graphic generation dialogue system can generate the UML script according to the GPT model, and the graphic generation engine generates the UML graphics based on the UML script. The UML graphic generation engine can be the PlantUML software or other software. The PlantUML software is an open source software that defines its own scripting language. Users can generate UML scripts to let the PlantUML software generate corresponding UML graphics.
[0099] Specifically, the UML graphics generation engine can be combined with the GPT model, that is, the GPT includes the UML graphics generation engine and can be used to generate UML graphics. The UML graphics generation engine may not be combined with the GPT model, that is, the UML graphics generation dialogue system is connected to the UML graphics generation engine and generates UML graphics through the UML graphics generation engine.
[0100] More specifically, for the graphic elements and element relationships mentioned above, the script of the json example that can be generated by the GPT model is as follows:
[0101] @startuml
[0102] Title timing diagram
[0103] participant"system A"as A
[0104] participant"system B"as B
[0105] A->B:N
[0106] B-->A:N1
[0107] note over A,B: System A sends message N to system B, and system B returns a message to system A
[0108] @enduml
[0109] Step E2: receiving the UML graph generated by the UML graph generation engine.
[0110] After the UML graph generation engine generates the UML graph, the UML graph generation engine sends the generated UML graph to the UML graph generation dialogue system. The UML graph generation dialogue system receives the generated UML graph and sends the UML graph to the target terminal.
[0111] Figure 4 is a flow chart of a third UML graph generation method provided in an embodiment of the present application, such as Figure 4 As shown, the schematic diagram includes:
[0112] Step 402: obtaining input text of a target user, and determining the type of a unified modeling language (UML) graph to be generated according to the input text;
[0113] Step 404: when the input text does not include the graphic type of the UML graphic to be generated, obtaining first multi-round dialogue information of the target user related to determining the graphic type, and determining the graphic type of the graphic to be generated from the first multi-round dialogue information;
[0114] When the input text includes the graphic type of the UML graphic to be generated, step 406 is directly executed.
[0115] Step 406: Obtain a first logical relationship in the input text;
[0116] Step 408: when the input text does not include the first logical relationship, obtaining second multi-round dialogue information of the target user related to determining the first logical relationship, and determining the first logical relationship from the second multi-round dialogue information;
[0117] When the input text includes the first logical relationship, step 410 may be directly executed.
[0118] Step 410: determining a second logical relationship corresponding to the graphic type from a preset logical relationship table according to the graphic type;
[0119] Step 412: performing logic verification on the input text according to the first logical relationship and the second logical relationship;
[0120] Step 414: when the logic verification passes, determining the target graphic element and the target element relationship corresponding to the graphic type of the UML graphic to be generated;
[0121] Step 416: respectively obtaining the graphic element corresponding to the target graphic element and the element relationship corresponding to the target element relationship from the input text;
[0122] Step 418: when the input text does not include the graphic element and the element relationship, obtaining third multi-round dialogue information of the target user related to determining the graphic element and the element relationship, and determining the graphic element and the element relationship from the third multi-round dialogue information;
[0123] When the input text includes the graphic element and the element relationship, step 420 may be directly executed.
[0124] Step 420: Generate a UML script according to the graphic elements and the element relationships, and send the UML script to a UML graphic generation engine, so that the UML graphic generation engine generates the UML graphic based on the UML script;
[0125] Step 422: Receive the UML graph generated by the UML graph generation engine.
[0126] In the embodiments of the present specification, the input text of the target user is obtained, and the graphic type of the Unified Modeling Language (UML) graphic to be generated is determined according to the input text; the input text is logically verified according to the logical relationship corresponding to the graphic type; when the logical verification passes, the graphic elements and element relationships of the UML graphic to be generated are determined based on the input text; and the UML graphic is generated based on the graphic elements and the element relationships, so that the UML graphic can be generated simply and quickly through natural language.
[0127] Figure 5 is an information transmission diagram of a UML graphics generation method provided in an embodiment of this specification, such as Figure 5As shown, the schematic diagram includes: Chatbot, UML graphics generation dialogue system, GPT model and UML graphics generation engine, wherein the UML graphics generation dialogue system includes a dialogue management module, a dialogue flow management module, and a GPT Agent module. Chatbot is a client application of the target terminal, responsible for human-computer interaction. The dialogue management module is responsible for the creation and initiation of the dialogue flow, the reception of user text, and dialogue replies. The dialogue flow management module is used to manage the dialogue flow with the target user, the goal is to guide and improve the description information of the target user through the dialogue flow, and finally output the script required to generate UML graphics. PlantUML graphics generation engine is an open source software that defines its own scripting language and can generate UML graphics according to UML scripts. GPT Agent is responsible for interacting with external GPT and other large model systems. The UML graphics generation dialogue system interacts with the large model through GPT Agent and receives the reply result determined by the large model based on the input text.
[0128] Specifically, the target user inputs text in the Chatbot application of the target terminal, and the Chatbot submits the input text and requests a dialogue from the dialogue management module. After receiving the dialogue request, the dialogue management module creates and starts a dialogue process. The dialogue process management module sends the input text to the GPT model through the GPT Agent module and receives the output text sent by the GPT model, and then determines the intention contained in the text according to the output text, that is, determines the type of UML graphics to be generated. If it cannot be determined, the dialogue management module conducts multiple rounds of dialogues with the Chatbot application through the dialogue management module, and then determines the UML graphic type according to the supplementary content in the multiple rounds of dialogue information. Finally, after determining the graphic type, the subsequent step of determining the first logical relationship is performed. Similarly, the dialogue process management module determines the graphic type, the first logical relationship, the graphic element, the element relationship, and the PlantUML script in sequence. After determining the UML script, the dialogue process management module sends the UML script to the UML graphic generation engine, and the UML graphic generation engine generates a UML diagram. The UML picture generation engine sends the generated UML graphics to the dialogue management module, and the dialogue management module returns the UML diagram to the Chatbot application of the target terminal for display.
[0129] It should be noted that the UML graphics generation method provided in the embodiment of the present application can be executed by a UML graphics generation device, or a control module in the UML graphics generation device for executing the UML graphics generation method. In the embodiment of the present application, the UML graphics generation device executing the UML graphics generation method is taken as an example to illustrate the UML graphics generation device provided in the embodiment of the present application.
[0130] Figure 6Schematic diagram of the structure of the UML graph generation device according to an embodiment of the present invention. Figure 6 As shown, the UML graph generating device includes: a first acquisition module 602 , a first verification module 604 , a first determination module 606 , and a first generation module 608 .
[0131] A first acquisition module 602 is used to acquire an input text of a target user and determine the type of a unified modeling language (UML) graph to be generated according to the input text;
[0132] A first verification module 604, configured to perform logic verification on the input text according to the logic relationship corresponding to the graphic type;
[0133] A first determination module 606, configured to determine the graphic elements and element relationships of the UML graphic to be generated based on the input text if the logic verification passes;
[0134] The first generating module 608 is configured to generate a UML graph based on the graph elements and the element relationships.
[0135] The UML graphic generation device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a palm computer, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and the non-mobile electronic device can be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0136] The UML graph generation device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0137] The UML graph generation device provided in the embodiment of the present application can achieve Figures 1 to 5 To avoid repetition, the various processes implemented in the method embodiment are not described here.
[0138] Based on the same technical concept, an embodiment of the present application further provides an electronic device, which is used to execute the above-mentioned UML graph generation method. Figure 7 A schematic diagram of the structure of an electronic device for implementing various embodiments of the present application. The electronic device may have relatively large differences due to different configurations or performances, and may include a processor (processor) 702, a communication interface (Communications Interface) 704, a memory (memory) 706 and a communication bus 708, wherein the processor 702, the communication interface 704, and the memory 706 communicate with each other through the communication bus 708. The processor 702 may call a computer program stored in the memory 706 and executable on the processor 702 to perform the following steps:
[0139] Acquire input text of a target user, and determine the graphic type of a unified modeling language (UML) graphic to be generated according to the input text;
[0140] Performing logic verification on the input text according to the logical relationship corresponding to the graphic type;
[0141] In the case where the logic verification passes, determining the graphic elements and element relationships of the UML graphic to be generated based on the input text;
[0142] A UML graph is generated based on the graph elements and the element relationships.
[0143] In one implementation, the performing logical verification on the input text according to the logical relationship corresponding to the graphic type includes:
[0144] Acquire a first logical relationship in the input text;
[0145] Determining a second logical relationship corresponding to the graphic type from a preset logical relationship table according to the graphic type;
[0146] The input text is logically verified according to the first logical relationship and the second logical relationship.
[0147] In one implementation, the method further includes:
[0148] When the input text does not include target information, obtaining multi-round dialogue information of the target user, wherein the target information includes one or more of the graphic type of the UML graphic to be generated, the first logical relationship, the graphic element, and the element relationship;
[0149] The target information is determined from the multiple rounds of dialogue information.
[0150] In one implementation, determining the target information from the multiple rounds of dialogue information includes:
[0151] Obtaining a preset output prompt instruction, and inputting the output prompt instruction and the input text into the pre-trained model to obtain an output text, wherein the output prompt instruction is used to instruct the pre-trained model to output the output text used to characterize the acquisition status of the target information;
[0152] Determining whether the target information exists in the input text according to the output text;
[0153] If not, sending the output text to the target terminal so that the target user can input supplementary text based on the output text;
[0154] The target information is determined according to the supplementary text.
[0155] In one implementation, when the logic verification passes, determining the graphic elements and element relationships of the to-be-generated UML graphic based on the input text includes:
[0156] Determine the target graphic element and target element relationship corresponding to the graphic type of the UML graphic to be generated;
[0157] The graphic element corresponding to the target graphic element and the element relationship corresponding to the target element relationship are respectively obtained from the input text.
[0158] In one implementation, the generating of a UML graph based on the graphic elements and the element relationships includes:
[0159] Generate a UML script according to the graphic elements and the element relationships, and send the UML script to a UML graphic generation engine, so that the UML graphic generation engine generates the UML graphic based on the UML script;
[0160] The specific execution steps of receiving the UML graph generated by the UML graph generation engine can refer to the various steps of the above-mentioned UML graph generation method embodiment, and can achieve the same technical effect. To avoid repetition, they are not described here.
[0161] It should be noted that the electronic devices in the embodiments of the present application include: servers, terminals, or other devices except terminals.
[0162] The above electronic device structure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, the input unit may include a graphics processing unit (GPU) and a microphone, and the display unit may be configured with a display panel in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit includes a touch panel and at least one of other input devices. The touch panel is also called a touch screen. Other input devices may include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0163] The memory can be used to store software programs and various data. The memory may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory may include a volatile memory or a non-volatile memory, or the memory may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DRRAM).
[0164] The processor may include one or more processing units; optionally, the processor integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to the operating system, user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor.
[0165] The embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned UML graphics generation method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0166] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0167] The embodiment of the present application also provides a computer program product. When the computer program product is executed by a processor, it implements the various processes of the above-mentioned UML graphics generation method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0168] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned UML graphics generation method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0169] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0170] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0171] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0172] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A UML graphics generation method, characterized in that: include: Acquire input text of a target user, and determine the graphic type of a unified modeling language (UML) graphic to be generated according to the input text; Performing logic verification on the input text according to the logical relationship corresponding to the graphic type; In the case where the logic verification passes, determining the graphic elements and element relationships of the UML graphic to be generated based on the input text; A UML graph is generated based on the graph elements and the element relationships.
2. The method according to claim 1, wherein the step of performing logical verification on the input text according to the logical relationship corresponding to the graphic type comprises: Acquire a first logical relationship in the input text; Determining a second logical relationship corresponding to the graphic type from a preset logical relationship table according to the graphic type; The input text is logically verified according to the first logical relationship and the second logical relationship.
3. The method according to claim 2, further comprising: When the input text does not include target information, obtaining multi-round dialogue information of the target user, wherein the target information includes one or more of the graphic type of the UML graphic to be generated, the first logical relationship, the graphic element, and the element relationship; The target information is determined from the multiple rounds of dialogue information.
4. The method according to claim 3, wherein determining the target information from the multi-round dialogue information comprises: Obtaining a preset output prompt instruction, and inputting the output prompt instruction and the input text into the pre-trained model to obtain an output text, wherein the output prompt instruction is used to instruct the pre-trained model to output the output text used to characterize the acquisition status of the target information; Determining whether the target information exists in the input text according to the output text; If not, sending the output text to the target terminal so that the target user can input supplementary text based on the output text; The target information is determined according to the supplementary text.
5. The method according to claim 1, wherein when the logic verification passes, determining the graphic elements and element relationships of the UML graphic to be generated based on the input text comprises: Determine the target graphic element and target element relationship corresponding to the graphic type of the UML graphic to be generated; The graphic element corresponding to the target graphic element and the element relationship corresponding to the target element relationship are respectively obtained from the input text.
6. The method according to claim 1, wherein generating a UML graph based on the graph elements and the element relationships comprises: Generate a UML script according to the graphic elements and the element relationships, and send the UML script to a UML graphic generation engine, so that the UML graphic generation engine generates the UML graphic based on the UML script; The UML graph generated by the UML graph generation engine is received.
7. A UML graph generation device, comprising: A first acquisition module is used to acquire an input text of a target user and determine a graphic type of a unified modeling language (UML) graphic to be generated according to the input text; A first verification module, used for performing logic verification on the input text according to the logical relationship corresponding to the graphic type; A first determination module, configured to determine the graphic elements and element relationships of the UML graphic to be generated based on the input text if the logic verification passes; The first generating module is used to generate a UML graph based on the graph elements and the element relationships.
8. A computer device, characterized in that: The device comprises: Processor; and A memory arranged to store computer executable instructions, wherein the executable instructions are configured to be executed by the processor, and the executable instructions include instructions for executing the steps in the UML diagram generation method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is used to store computer executable instructions, and the executable instructions enable a computer to execute the UML diagram generation method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The invention comprises a computer program, which implements the UML diagram generating method according to any one of claims 1 to 6 when being executed by a processor.
Citation Information
Cited By
Data processing method and device, and related equipment and product
CN120911589A