Program text conversion method and device
By identifying and generating description text on the target system class diagram, the problem of low efficiency in program text conversion in the prior art is solved, more efficient and accurate program text conversion is achieved, and the logical stability and reliability of the business system are improved.
Patent Information
- Application Number
- CN202510179214.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-05-13
AI Technical Summary
In the prior art, the conversion efficiency of program text is low, resulting in inaccurate program text and ineffective in meeting the logical stability and reliability requirements of the business system.
By receiving a class diagram conversion request, class diagram is recognized on the target system class diagram, target description text is generated, and target program text is converted based on the description text. The method includes steps such as feature extraction, generating model output reference description text, text calibration, and code template splicing.
It improves the efficiency and accuracy of program text conversion, ensures that the converted program text can accurately reflect the business processing process, and enhances the logical stability and reliability of the program.
Smart Images

Figure CN119987775A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and more specifically, to a method and device for converting program text. Background Art
[0002] In order to cope with the pain points of increasing software complexity and rapidly changing requirements in the asset management field, domain-driven design ideas were introduced in the early stage to guide software development. The core ideas of the domain-driven design methodology include strategic design, tactical design, layered architecture tactics, etc. The core of its tactical design is the design of models in various business domains and their actual application in software code development. At present, in order to ensure the logical stability and reliability of the designed software programs, designers usually adopt a text conversion method based on system class diagrams, that is, programmers pre-design a system class diagram that records the program execution logic according to the required program logic, and then convert the system class diagram using a language model with text generation function to obtain the program code. However, due to the complex correlation between the contents recorded in the system class diagram, the technical limitations of converting the system class diagram to code are relatively large, which leads to the inaccurate code recorded in the converted program text, resulting in low conversion efficiency of the program text.
[0003] With regard to the problem of low conversion efficiency of program texts in related technologies, no effective solution has been proposed so far. Summary of the invention
[0004] The main purpose of this application is to provide a method for converting program texts to solve the problem of conversion efficiency of program texts converted for business systems in related technologies.
[0005] In order to achieve the above objective, according to one aspect of the present application, a method for converting a program text is provided.
[0006] The method includes:
[0007] Receive a class diagram conversion request, wherein the class diagram conversion request is used to request to convert the target system class diagram into a program text required to be run by the target business system during business processing, and the target system class diagram records the business processing flow required when processing the target business on the target business system;
[0008] In response to the class diagram conversion request, class diagram recognition is performed on the target system class diagram to obtain a target description text corresponding to the target system class diagram, wherein the target description text is a text recording a timing relationship of calling multiple system files deployed in the target business system, and the system file is a file used to implement the system function configured by the target business system;
[0009] According to the target description text, a target program text required to be run when handling the target business is converted for the target business system.
[0010] Optionally, performing class diagram recognition on the target system class diagram to obtain a target description text corresponding to the target system class diagram includes:
[0011] Performing feature extraction on the target system class diagram to obtain target transfer relationship features between a plurality of key fields with associated relationships recorded in the target system class diagram, wherein each of the key fields is used to indicate a corresponding system file;
[0012] Inputting the target transfer relationship feature into a first generation model to obtain a reference description text output by the first generation model, wherein the first generation model records the conversion relationship between the transfer relationship feature of the key field and the description text;
[0013] The reference description text is determined as the target description text.
[0014] Optionally, the feature extraction of the target system class diagram to obtain the target transfer relationship features between multiple key fields with associated relationships recorded in the target system class diagram includes:
[0015] Identify the target system class diagram using a target class diagram identification model to obtain an initial relationship feature corresponding to the target system class diagram, wherein the initial relationship feature is used to indicate a connection relationship between the plurality of key fields in the target system class diagram;
[0016] The initial relationship feature and the target system class diagram are feature-fused to obtain the target transfer relationship feature.
[0017] Optionally, after inputting the target transfer relationship feature into the first generation model to obtain the reference description text output by the first generation model, the method further includes:
[0018] Filtering candidate description texts whose business type has a relevance greater than or equal to a target relevance with the business type of the target business from the description texts stored in the description text library;
[0019] The candidate description text is used to perform text calibration on the reference description text to obtain the target description text.
[0020] Optionally, converting a target program text required to be run when handling the target business for the target business system according to the target description text includes:
[0021] Extracting a plurality of description statements included in the target description text, wherein each description statement is used to indicate a calling method for one of the system files in the target business system;
[0022] Filtering out a code template corresponding to the description statement from a code template library, wherein the code template records a calling code for implementing a system file calling mode indicated by the description statement;
[0023] The code templates are spliced according to the sequence relationship of the description sentences in the target description text to obtain the target program text.
[0024] Optionally, converting a target program text required to be run when handling the target business for the target business system according to the target description text includes:
[0025] The target description text is input into a second generation model to obtain the target program text output by the second generation model, wherein the second generation model records the conversion relationship between the description text and the program text.
[0026] Optionally, the method further includes:
[0027] Receive a text conversion request, wherein the text conversion request is used to request conversion of a candidate program text for handling a candidate business into a system class diagram of the target business system, wherein the candidate program text records a program code for implementing a business handling process of the candidate business;
[0028] In response to the text conversion request, the candidate program text is converted to obtain an initial description text, wherein the initial description text is a text that records the calling sequence relationship of multiple system files of the target business system in the process of the target business system handling the candidate business;
[0029] The target description text is input into a target class diagram conversion model to obtain a candidate system class diagram output by the target class diagram conversion model.
[0030] In order to achieve the above objective, according to another aspect of the present application, a program text conversion device is provided.
[0031] The device includes:
[0032] A receiving module, used for receiving a class diagram conversion request, wherein the class diagram conversion request is used for requesting to convert a target system class diagram into a program text required to be run by the target business system during business processing, wherein the target system class diagram records the business processing flow required for processing the target business on the target business system;
[0033] A response module, used to respond to the class diagram conversion request, perform class diagram recognition on the target system class diagram, and obtain a target description text corresponding to the target system class diagram, wherein the target description text is a text recording a timing relationship of calling multiple system files deployed in the target business system, and the system file is a file used to implement the system function configured by the target business system;
[0034] The conversion module is used to convert the target program text required to be run when handling the target business for the target business system according to the target description text.
[0035] Through this application, the following steps are adopted: in the process of converting the target system class diagram into a program text, the target system class diagram is firstly identified as a class diagram, so as to obtain a target description text used to describe the calling timing relationship of multiple system files deployed in the target business system. Since the calling timing relationship of multiple system files has been recorded in the target description text, the target program text can be converted according to the target description file, avoiding the problem of disordered business handling process recorded in the converted program text, making the handling process of the target business indicated by the converted target program text more accurate and reliable; solving the problem of low conversion efficiency of converting program text for business systems in related technologies. Thus, the effect of improving the conversion efficiency of converting program text for business systems is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0037] Figure 1 is a flowchart of a method for converting a program text provided in an embodiment of the present application;
[0038] Figure 2 is a schematic diagram of an optional system class diagram according to an embodiment of the present application;
[0039] Figure 3 is an optional program text schematic diagram according to an embodiment of the present application;
[0040] Figure 4 is a schematic diagram of a program text conversion device according to an embodiment of the present application;
[0041] Figure 5 This is a schematic diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0042] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0043] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only 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 should fall within the scope of protection of the present application.
[0044] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0045] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set up between this system and relevant users or institutions. Before obtaining relevant information, the user is provided with a corresponding operation entrance for the user to choose to agree or reject the automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered.
[0046] The present invention is described below in conjunction with preferred implementation steps. Figure 1 is a flowchart of a method for converting a program text according to an embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:
[0047] Step S101, receiving a class diagram conversion request, wherein the class diagram conversion request is used to request conversion of a target system class diagram into a program text required to be run by the target business system during business processing, wherein the target system class diagram records the business processing flow required for processing a target business on the target business system;
[0048] Step S102, in response to the class diagram conversion request, class diagram recognition is performed on the target system class diagram to obtain a target description text corresponding to the target system class diagram, wherein the target description text is a text recording a timing relationship of calling multiple system files deployed in the target business system, and the system file is a file used to implement the system function configured by the target business system;
[0049] Step S103, converting the target program text required to be run when handling the target business for the target business system according to the target description text.
[0050] Through the above content, in the process of converting the target system class diagram into the program text, the target system class diagram is firstly identified as a class diagram, so as to obtain the target description text used to describe the calling sequence relationship of multiple system files deployed in the target business system. Since the calling sequence relationship of multiple system files has been recorded in the target description text, the target program text can be converted according to the target description file, avoiding the problem of disordered business handling process recorded in the converted program text, making the handling process of the target business indicated by the converted target program text more accurate and reliable; solving the problem of low conversion efficiency of converting program text for business systems in related technologies. And thus achieving the effect of improving the conversion efficiency of converting program text for business systems.
[0051] In the embodiment provided in the above step S101, the system class diagram is a graph structure obtained by modeling the business process of the business system, which is used to show the static structure of the system business processing. The system class diagram mainly focuses on the classes, interfaces, collaborations and the relationships between the business system. The system class diagram includes at least the following elements: Class: represents an entity in the system, including attributes and methods. Classes are usually represented by rectangles, with the class name at the top, attributes in the middle, and methods at the bottom. Interface: defines a set of operations, but does not implement these operations. The interface is represented by a < <interface>> is represented by a rounded rectangle marked with a marker. Relationships: Dependency: Changes in one class may affect another class, represented by a dotted line with an arrow; Association: There is a connection between two classes, represented by a solid line, and there may be an arrow to indicate the direction of the association; Aggregation: Represents the relationship between the whole and the part, represented by a solid line with a hollow diamond; Composition: Represents a stronger relationship between the whole and the part, represented by a solid line with a solid diamond; Inheritance: Represents that a class (subclass) inherits the properties and methods of another class (superclass), represented by a solid line with a hollow arrow; Generalization: Represents an inheritance relationship, represented by a solid line with a hollow arrow; Realization: Represents that a class implements an interface, represented by a dotted line with a hollow arrow.
[0052] Optionally, in an embodiment of the present application, the system class diagram may be, but is not limited to, a unified modeling language class diagram.
[0053] In the embodiment provided in the above step S102, the description text is used to describe or display the business processing flow recorded in the system class diagram in a textual manner, and the description text records the calling time and calling sequence of the system files in the business system when the target business is handled by the target business system. In an embodiment of the present application, the method of identifying the target system class diagram to obtain the target description text can be: using a description text generation model to identify the target system class diagram, wherein the description text generation model records the conversion relationship between the class diagram features and the description text, and the description text generation model can be but is not limited to being obtained by training a language model with a text output function using a class diagram sample marked with the description text content. Alternatively, the target system class diagram may be identified to obtain the target description text by: performing keyword extraction on the system class diagram to obtain the target keyword corresponding to the system file, and then identifying the connection relationship between the target keywords recorded in the system class diagram to obtain the calling timing relationship between the target keywords recorded in the target system class diagram; obtaining a calling script file corresponding to the calling time sequence, wherein the calling script file records a description statement describing the calling timing relationship; adding the target keyword to the corresponding keyword position in the calling script file to obtain the target description text.
[0054] In the embodiment provided in the above step S103, the target program text may be converted from the target description text by identifying and converting the target description text using a text conversion model, wherein the text conversion model records the conversion relationship between the description text and the program text.
[0055] Optionally, in the embodiment of the present application, Figure 2 is a schematic diagram of an optional system class diagram according to an embodiment of the present application, such as Figure 2 As shown, the top layer of each rectangle represents the interface class name of the structured data, such as Figure 2 The AccountTransferServiceImpl in the example represents the interface class name; the middle layer part represents the attribute name in the interface, such as Figure 2 -busiSafeService, -accountRepository, and -account represent the attribute names in the AccountTransferServiceImpl interface, busiSafeService represents the security attribute, accountRepository represents the statistical warehouse attribute, and account represents the statistical attribute. For example, in the middle layer of the Account interface class, -id:long, -available:decimal, and -accountNumber:long represent the attribute names in the Account interface, -id:long represents the id attribute, -available:decimal represents the storage attribute, and accountNumber represents the statistical attribute. The bottom layer represents the method name in the interface, such as Figure 2 The transfer() method name in the AccountTransferService interface, transfer() represents the transfer method; withdraw() in the Account interface represents the withdrawal method, and deposit() represents the deposit method; find() in the AccountRepository interface represents the search method; checkBusi() in the BusiSafeService interface represents the check method; Figure 2 The solid arrow in represents the inheritance relationship, from the inheritor to the inherited. Figure 2 The AccountTransferServiceImpl interface in inherits the AccountTransferService interface and the Account interface, etc. Each part describes the business logic according to the above rules to form a system class diagram. In this embodiment, the system class diagram is taken as a unified modeling language class diagram as an example. In the class diagram construction stage, an online design platform for a domain model is established. The platform supports online design of domain models and unified modeling language class diagrams, and is designed through online unified modeling language class diagrams. After completing the model diagram and unified modeling language class diagram design online, it supports further analysis of the unified modeling language class diagram to obtain a set of structured data and store it in the database. The structured data includes type, name, attribute, method, and package name. The unified modeling language class diagram is converted to structured data. When converting the class diagram to code, a code compiler can be used to automatically generate a code framework for the structured data (type, name, attribute, method, package name) analyzed by the design platform, that is, the project directory, package and class file generation code, or a text conversion model can be used to automatically generate a code framework for the structured data (type, name, attribute, method, package name) analyzed by the design platform, that is, the project directory, package and class file generation description text.
[0056] As an optional embodiment, performing class diagram recognition on the target system class diagram to obtain a target description text corresponding to the target system class diagram includes:
[0057] Performing feature extraction on the target system class diagram to obtain target transfer relationship features between a plurality of key fields with associated relationships recorded in the target system class diagram, wherein each of the key fields is used to indicate a corresponding system file;
[0058] Inputting the target transfer relationship feature into a first generation model to obtain a reference description text output by the first generation model, wherein the first generation model records the conversion relationship between the transfer relationship feature of the key field and the description text;
[0059] The reference description text is determined as the target description text.
[0060] Optionally, in an embodiment of the present application, the target transfer relationship feature records the association relationship between multiple key fields in the system class diagram, including but not limited to call relationship, reference relationship, timing relationship, and inheritance relationship.
[0061] Optionally, in an embodiment of the present application, the first generation model is obtained by training a model with a text generation function using domain samples; by performing keyword relationship annotation and logic annotation on the domain samples, a large number of annotated samples are input into the initial model training with a text generation function to obtain a final description text with a corresponding relationship. By comparing the final description text with its corresponding input sample, the annotated content is adjusted to perform iterative model training to improve the accuracy of text generation, and finally the first generation model is obtained.
[0062] Optionally, in an embodiment of the present application, the first generation model may not only record the conversion relationship between the transfer relationship features of the key fields of the class diagram and the description text, but may also simultaneously record the conversion relationship between the merged features between the transfer relationship features and the image features and the description text.
[0063] By converting the class diagram into descriptive text in the above way, the direct conversion from the class diagram to code can be effectively avoided. Text is a lightweight representation form. This intermediate form of conversion can effectively reduce the demand for computing resources during the conversion process. By converting the class diagram to text and then to code, the efficiency of the overall conversion process is improved, effectively avoiding the possible jamming of large data files during the model conversion process.
[0064] As an optional embodiment, the feature extraction of the target system class diagram to obtain the target transfer relationship features between multiple key fields with associated relationships recorded in the target system class diagram includes:
[0065] Identify the target system class diagram using a target class diagram identification model to obtain an initial relationship feature corresponding to the target system class diagram, wherein the initial relationship feature is used to indicate a connection relationship between the plurality of key fields in the target system class diagram;
[0066] The initial relationship feature and the target system class diagram are feature-fused to obtain the target transfer relationship feature.
[0067] Optionally, in an embodiment of the present application, the target system class diagram includes but is not limited to a class diagram assembled based on the enterprise's existing assets, where professionals sort out metadata assets in the professional field of asset management business, such as product codes, seller codes, TA accounts, etc.
[0068] Optionally, in an embodiment of the present application, the initial characteristic relationship includes but is not limited to indicating the connection relationship, inheritance relationship, reference relationship, and call timing relationship of the multiple key fields in the target system class diagram.
[0069] Optionally, in an embodiment of the present application, feature fusion of the initial relationship features and the target system class diagram refers to fusing the extracted image features with the sequence features (i.e., initial relationship features) of the input text sequence (processed by an embedding layer), which can be achieved in a variety of ways, for example: splicing image features and text embeddings together, using an attention mechanism for weighting, etc.
[0070] Optionally, in an embodiment of the present application, the weighting using the attention mechanism can be fixed and dynamically allocated weights during the fusion process, such as allocating 50% of the weight to image features and 50% of the weight to text sequences, or automatically calculating and allocating weight values for each fusion. The specific fusion method to be used needs to be determined by the training personnel based on the text generation accuracy of the first generation model. By using the attention mechanism for weighting, the weights of each feature can be dynamically selected to find a more suitable input sample, which can improve the conversion accuracy of the first generation model.
[0071] As an optional embodiment, after inputting the target transfer relationship feature into the first generation model to obtain the reference description text output by the first generation model, the method further includes:
[0072] Filtering candidate description texts whose business type has a relevance greater than or equal to a target relevance with the business type of the target business from the description texts stored in the description text library;
[0073] The candidate description text is used to perform text calibration on the reference description text to obtain the target description text.
[0074] Optionally, in the embodiment of the present application, some similar but inaccurate texts may appear in the conversion of class diagrams to description texts, and a text accuracy enhancement mechanism is established. The accuracy of the converted description texts can be improved by searching the enterprise knowledge base through the generated texts and matching similar metadata.
[0075] Optionally, in an embodiment of the present application, the matching method may be metadata similarity matching, that is, obtaining reference metadata carried by the description text for indicating the business type of the business, performing field matching on the reference metadata and the target metadata carried by the current target description text, and when the degree of matching between the reference metadata and the target metadata is greater than or equal to the target matching degree, it is determined that the degree of association between the business type of the business to which the description text belongs and the business type of the target business is greater than or equal to the target association degree.
[0076] Optionally, in an embodiment of the present application, the text calibration method can perform sentence analysis on the reference description sentences in the reference description text to obtain the text description semantics, and filter out candidate description sentences whose semantic similarity with the reference description sentences is greater than or equal to the target similarity from the candidate description texts according to the text description semantics, and use the description characters recorded in the candidate description sentences to calibrate the description characters recorded at the corresponding character positions in the reference description sentences.
[0077] Optionally, in an embodiment of the present application, the search for keywords in the text retrieval enterprise knowledge base will be sorted according to similarity, and the one with the closest similarity will be ranked first in the search results. Designers can automatically select the results in the search list to replace, or manually modify the converted text results. This method that supports human intervention can further improve the accuracy of text conversion.
[0078] As an optional embodiment, converting the target program text required to be run when handling the target business for the target business system according to the target description text includes:
[0079] Extracting a plurality of description statements included in the target description text, wherein each description statement is used to indicate a calling method for one of the system files in the target business system;
[0080] Filtering out a code template corresponding to the description statement from a code template library, wherein the code template records a calling code for implementing a system file calling mode indicated by the description statement;
[0081] The code templates are spliced according to the sequence relationship of the description sentences in the target description text to obtain the target program text.
[0082] Optionally, multiple description statements can be extracted from the description text converted from the class diagram. These description statements are used to indicate the calling method of the system files in the business system, that is, these description statements indicate the calling method and reference relationship of each corresponding code module. The actual business code can be finally obtained by screening out the code template corresponding to each description statement from the code library and combining them according to the logical relationship of the description statements. Figure 3 is an optional program text schematic diagram according to an embodiment of the present application, such as Figure 3 As shown in the figure, the file structure is a hierarchical directory structure package name, such as ddd-app is the general directory of the business, src is the source file directory under the general directory, main is the main directory under the source file directory, java is the java code directory under the main directory, com.icbc.tjq is the actual storage directory under the java code directory, the service directory is the service layer interface directory under the actual storage directory, impl is the interface directory of the implementation layer, AccountTransferServiceImpl and AccountTransferService are the interface class names, which is consistent with Figure 2 The interface class names of the associated system class diagram correspond to each other, and the AccountTransferServiceImpl interface inherits the AccountTransferService interface. AccountTransferServiceImpl is the implementation class of the AccountTransferService interface. The pom.xml file is the configuration file of the entire system, which contains the configuration information of the project system; ddd-domain is the data table object layer directory, which is usually used to store data table objects; ddd-infrastructure is the infrastructure directory, which is usually used to store basic interface classes and factory class files. The BusiSafeService, Account, and AccountRepository service interfaces under the ddd-domain directory are Figure 2 The BusiSafeService, Account, and AccountRepository interface class names in the ddd-infrastructure directory correspond to each other. Figure 2 The BusiSafeServiceImpl and AccountRepositoryImpl interface class names correspond one to one.
[0083] As an optional embodiment, converting the target program text required to be run when handling the target business for the target business system according to the target description text includes:
[0084] The target description text is input into a second generation model to obtain the target program text output by the second generation model, wherein the second generation model records the conversion relationship between the description text and the program text.
[0085] Optionally, the second generation model is a model with text-to-code function, including but not limited to a large model, a neural network model after iterative training with annotated description text. By directly inputting the description text into the second generation model to obtain the program code, the efficiency of text-to-code conversion can be improved, and when the code template library cannot match the code corresponding to the description statement, the model can be directly used to generate the code, which improves the success rate of class diagram conversion to code and provides another option for text-to-code conversion.
[0086] As an optional embodiment, the method further includes:
[0087] Receive a text conversion request, wherein the text conversion request is used to request conversion of a candidate program text for handling a candidate business into a system class diagram of the target business system, wherein the candidate program text records a program code for implementing a business handling process of the candidate business;
[0088] In response to the text conversion request, the candidate program text is converted to obtain an initial description text, wherein the initial description text is a text that records the calling sequence relationship of multiple system files of the target business system in the process of the target business system handling the candidate business;
[0089] The target description text is input into a target class diagram conversion model to obtain a candidate system class diagram output by the target class diagram conversion model.
[0090] Optionally, the candidate program text is converted to obtain the initial description text. First, the overall candidate program text is split into small pieces of segmented code according to the reference relationship, call timing relationship, or inheritance relationship between the code modules, and then each piece of segmented code is searched in the code template library to obtain the corresponding template code; then, the text data corresponding to each template code is obtained according to the corresponding template code, that is, the text data corresponding to the code part after the overall candidate program text is segmented; through the reference relationship, call timing relationship, or inheritance relationship between the code modules, the corresponding text data is combined according to the aforementioned logic to finally obtain structured text data, that is, the initial description text.
[0091] Optionally, the code-to-text conversion may have errors or some synonymous texts, so a text accuracy enhancement mechanism is established. The generated text retrieval enterprise knowledge base is used to match similar metadata and perform replacement and completion to achieve accuracy enhancement; the matching method can be metadata similarity matching, and the calibration method can be keyword matching. The description sentences corresponding to the keywords are similarly matched. By searching the keywords in the text retrieval enterprise knowledge base, the keywords with wrong characters are modified and replaced, and the keywords with missing characters are completed.
[0092] Optionally, the target class diagram conversion model is a text-to-class diagram model, including but not limited to a large model with the same function and a neural network model iteratively trained with annotated text; through this model, the above target description text can be converted into the final class diagram.
[0093] By using the above method, the entire code file is split and then the corresponding description text is generated, which can avoid direct retrieval of large files, improve the retrieval accuracy and also improve the efficiency of file conversion.
[0094] The program text conversion method provided by the embodiment of the present application first recognizes and converts the class diagram in the process of converting the class diagram to code; thereby extracting the description text from the class diagram to describe the call logic recorded in the class diagram; and then converting the description text to the target program text, thereby solving the problem that the design of the class diagram conversion code is not accurate and the conversion efficiency is low in the related art. Thus, the accuracy of the conversion between the class diagram and the program code and the conversion efficiency are improved.
[0095] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0096] The embodiment of the present application also provides a program text conversion device. It should be noted that the program text conversion device of the embodiment of the present application can be used to execute the program text conversion method provided in the embodiment of the present application. The program text conversion device provided in the embodiment of the present application is introduced below.
[0097] Figure 4 Schematic diagram of a program text conversion device according to an embodiment of the present application. Figure 4 As shown, the device comprises:
[0098] A receiving module, used for receiving a class diagram conversion request, wherein the class diagram conversion request is used for requesting to convert a target system class diagram into a program text required to be run by the target business system during business processing, wherein the target system class diagram records the business processing flow required for processing the target business on the target business system;
[0099] A response module, used to respond to the class diagram conversion request, perform class diagram recognition on the target system class diagram, and obtain a target description text corresponding to the target system class diagram, wherein the target description text is a text recording a timing relationship of calling multiple system files deployed in the target business system, and the system file is a file used to implement the system function configured by the target business system;
[0100] The conversion module is used to convert the target program text required to be run when handling the target business for the target business system according to the target description text.
[0101] Through the above content, in the process of converting the target system class diagram into the program text, the target system class diagram is firstly identified as a class diagram, so as to obtain the target description text used to describe the calling sequence relationship of multiple system files deployed in the target business system. Since the calling sequence relationship of multiple system files has been recorded in the target description text, the target program text can be converted according to the target description file, avoiding the problem of disordered business handling process recorded in the converted program text, making the handling process of the target business indicated by the converted target program text more accurate and reliable; solving the problem of low conversion efficiency of converting program text for business systems in related technologies. And thus achieving the effect of improving the conversion efficiency of converting program text for business systems.
[0102] Optionally, the response module includes:
[0103] A first extraction unit is used to perform feature extraction on the target system class diagram to obtain target transfer relationship features between multiple key fields with associated relationships recorded in the target system class diagram, wherein each key field is used to indicate a corresponding system file;
[0104] An input unit, used to input the target transfer relationship feature into a first generation model to obtain a reference description text output by the first generation model, wherein the first generation model records the conversion relationship between the transfer relationship feature of the key field and the description text;
[0105] A determination unit is used to determine the reference description text as the target description text.
[0106] Optionally, the first extraction unit is further used for:
[0107] Identify the target system class diagram using a target class diagram identification model to obtain an initial relationship feature corresponding to the target system class diagram, wherein the initial relationship feature is used to indicate a connection relationship between the plurality of key fields in the target system class diagram;
[0108] The initial relationship feature and the target system class diagram are feature-fused to obtain the target transfer relationship feature.
[0109] Optionally, the response module further includes:
[0110] Filtering candidate description texts whose business type has a relevance greater than or equal to a target relevance with the business type of the target business from the description texts stored in the description text library;
[0111] The candidate description text is used to perform text calibration on the reference description text to obtain the target description text.
[0112] Optionally, the conversion module further includes:
[0113] A second extraction unit is used to extract a plurality of description sentences included in the target description text, wherein each description sentence is used to indicate a calling method of one of the system files in the target business system;
[0114] A screening unit, used to screen out a code template corresponding to the description statement from a code template library, wherein the code template records a calling code for implementing a system file calling mode indicated by the description statement;
[0115] The splicing unit is used to splice the code templates according to the sequence relationship of the description sentences in the target description text to obtain the target program text.
[0116] Optionally, the conversion module further includes:
[0117] An input unit is used to input the target description text into a second generation model to obtain the target program text output by the second generation model, wherein the second generation model records the conversion relationship between the description text and the program text.
[0118] Optionally, the device further includes:
[0119] A second receiving module is used to receive a text conversion request, wherein the text conversion request is used to request to convert a candidate program text for handling a candidate business into a system class diagram of the target business system, wherein the candidate program text records a program code for implementing a business handling process of the candidate business;
[0120] A second response module is used to respond to the text conversion request, convert the candidate program text, and obtain an initial description text, wherein the initial description text is a text that records the calling time sequence relationship of multiple system files of the target business system in the process of the target business system handling the candidate business;
[0121] An input module is used to input the target description text into a target class diagram conversion model to obtain a candidate system class diagram output by the target class diagram conversion model.
[0122] The program text conversion device includes a processor and a memory. The above units are stored in the memory as program units, and the processor executes the above program units stored in the memory to realize corresponding functions.
[0123] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the accuracy and efficiency of converting the class diagram into the target program file can be improved by adjusting the kernel parameters (the purpose of the present invention).
[0124] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0125] An embodiment of the present invention provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the program text conversion method is implemented.
[0126] An embodiment of the present invention provides a processor, which is used to run a program, wherein the program text conversion method is executed when the program is running.
[0127] Figure 5 is a schematic diagram of an optional electronic device according to an embodiment of the present application, such as Figure 5 As shown, an embodiment of the present invention provides an electronic device, the device includes a processor, a memory, and a program stored in the memory and executable on the processor, and the processor implements the following steps when executing the program:
[0128] Receive a class diagram conversion request, wherein the class diagram conversion request is used to request to convert the target system class diagram into a program text required to be run by the target business system during business processing, and the target system class diagram records the business processing flow required when processing the target business on the target business system;
[0129] In response to the class diagram conversion request, class diagram recognition is performed on the target system class diagram to obtain a target description text corresponding to the target system class diagram, wherein the target description text is a text recording a timing relationship of calling multiple system files deployed in the target business system, and the system file is a file used to implement the system function configured by the target business system;
[0130] According to the target description text, a target program text required to be run when handling the target business is converted for the target business system.
[0131] Optionally, performing class diagram recognition on the target system class diagram to obtain a target description text corresponding to the target system class diagram includes:
[0132] Performing feature extraction on the target system class diagram to obtain target transfer relationship features between a plurality of key fields with associated relationships recorded in the target system class diagram, wherein each of the key fields is used to indicate a corresponding system file;
[0133] Inputting the target transfer relationship feature into a first generation model to obtain a reference description text output by the first generation model, wherein the first generation model records the conversion relationship between the transfer relationship feature of the key field and the description text;
[0134] The reference description text is determined as the target description text.
[0135] Optionally, the feature extraction of the target system class diagram to obtain the target transfer relationship features between multiple key fields with associated relationships recorded in the target system class diagram includes:
[0136] Identify the target system class diagram using a target class diagram identification model to obtain an initial relationship feature corresponding to the target system class diagram, wherein the initial relationship feature is used to indicate a connection relationship between the plurality of key fields in the target system class diagram;
[0137] The initial relationship feature and the target system class diagram are feature-fused to obtain the target transfer relationship feature.
[0138] Optionally, after inputting the target transfer relationship feature into the first generation model to obtain the reference description text output by the first generation model, the method further includes:
[0139] Filtering candidate description texts whose business type has a relevance greater than or equal to a target relevance with the business type of the target business from the description texts stored in the description text library;
[0140] The candidate description text is used to perform text calibration on the reference description text to obtain the target description text.
[0141] Optionally, converting a target program text required to be run when handling the target business for the target business system according to the target description text includes:
[0142] Extracting a plurality of description statements included in the target description text, wherein each description statement is used to indicate a calling method for one of the system files in the target business system;
[0143] Filtering out a code template corresponding to the description statement from a code template library, wherein the code template records a calling code for implementing a system file calling mode indicated by the description statement;
[0144] The code templates are spliced according to the sequence relationship of the description sentences in the target description text to obtain the target program text.
[0145] Optionally, converting a target program text required to be run when handling the target business for the target business system according to the target description text includes:
[0146] The target description text is input into a second generation model to obtain the target program text output by the second generation model, wherein the second generation model records the conversion relationship between the description text and the program text.
[0147] Optionally, the method further includes:
[0148] Receive a text conversion request, wherein the text conversion request is used to request conversion of a candidate program text for handling a candidate business into a system class diagram of the target business system, wherein the candidate program text records a program code for implementing a business handling process of the candidate business;
[0149] In response to the text conversion request, the candidate program text is converted to obtain an initial description text, wherein the initial description text is a text that records the calling sequence relationship of multiple system files of the target business system in the process of the target business system handling the candidate business;
[0150] The target description text is input into a target class diagram conversion model to obtain a candidate system class diagram output by the target class diagram conversion model.
[0151] The devices in this article can be servers, PCs, PADs, mobile phones, etc.
[0152] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program for initializing the following method steps:
[0153] Receive a class diagram conversion request, wherein the class diagram conversion request is used to request to convert the target system class diagram into a program text required to be run by the target business system during business processing, and the target system class diagram records the business processing flow required when processing the target business on the target business system;
[0154] In response to the class diagram conversion request, class diagram recognition is performed on the target system class diagram to obtain a target description text corresponding to the target system class diagram, wherein the target description text is a text recording a timing relationship of calling multiple system files deployed in the target business system, and the system file is a file used to implement the system function configured by the target business system;
[0155] According to the target description text, a target program text required to be run when handling the target business is converted for the target business system.
[0156] Optionally, performing class diagram recognition on the target system class diagram to obtain a target description text corresponding to the target system class diagram includes:
[0157] Performing feature extraction on the target system class diagram to obtain target transfer relationship features between a plurality of key fields with associated relationships recorded in the target system class diagram, wherein each of the key fields is used to indicate a corresponding system file;
[0158] Inputting the target transfer relationship feature into a first generation model to obtain a reference description text output by the first generation model, wherein the first generation model records the conversion relationship between the transfer relationship feature of the key field and the description text;
[0159] The reference description text is determined as the target description text.
[0160] Optionally, the feature extraction of the target system class diagram to obtain the target transfer relationship features between multiple key fields with associated relationships recorded in the target system class diagram includes:
[0161] Identify the target system class diagram using a target class diagram identification model to obtain an initial relationship feature corresponding to the target system class diagram, wherein the initial relationship feature is used to indicate a connection relationship between the plurality of key fields in the target system class diagram;
[0162] The initial relationship feature and the target system class diagram are feature-fused to obtain the target transfer relationship feature.
[0163] Optionally, after inputting the target transfer relationship feature into the first generation model to obtain the reference description text output by the first generation model, the method further includes:
[0164] Filtering candidate description texts whose business type has a relevance greater than or equal to a target relevance with the business type of the target business from the description texts stored in the description text library;
[0165] The candidate description text is used to perform text calibration on the reference description text to obtain the target description text.
[0166] Optionally, converting a target program text required to be run when handling the target business for the target business system according to the target description text includes:
[0167] Extracting a plurality of description statements included in the target description text, wherein each description statement is used to indicate a calling method for one of the system files in the target business system;
[0168] Filtering out a code template corresponding to the description statement from a code template library, wherein the code template records a calling code for implementing a system file calling mode indicated by the description statement;
[0169] The code templates are spliced according to the sequence relationship of the description sentences in the target description text to obtain the target program text.
[0170] Optionally, converting a target program text required to be run when handling the target business for the target business system according to the target description text includes:
[0171] The target description text is input into a second generation model to obtain the target program text output by the second generation model, wherein the second generation model records the conversion relationship between the description text and the program text.
[0172] Optionally, the method further includes:
[0173] Receive a text conversion request, wherein the text conversion request is used to request conversion of a candidate program text for handling a candidate business into a system class diagram of the target business system, wherein the candidate program text records a program code for implementing a business handling process of the candidate business;
[0174] In response to the text conversion request, the candidate program text is converted to obtain an initial description text, wherein the initial description text is a text that records the calling sequence relationship of multiple system files of the target business system in the process of the target business system handling the candidate business;
[0175] The target description text is input into a target class diagram conversion model to obtain a candidate system class diagram output by the target class diagram conversion model.
[0176] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0177] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0178] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0179] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0180] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0181] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0182] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0183] It should also be noted that the term "includes", "comprising" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the existence of other identical elements in the process, method, commodity or device including the element.
[0184] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0185] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.< / interface>
Claims
1. A method for converting a program text, characterized in that: include: Receive a class diagram conversion request, wherein the class diagram conversion request is used to request to convert the target system class diagram into a program text required to be run by the target business system during business processing, and the target system class diagram records the business processing flow required when processing the target business on the target business system; In response to the class diagram conversion request, class diagram recognition is performed on the target system class diagram to obtain a target description text corresponding to the target system class diagram, wherein the target description text is a text recording a timing relationship of calling multiple system files deployed in the target business system, and the system file is a file used to implement the system function configured by the target business system; According to the target description text, a target program text required to be run when handling the target business is converted for the target business system.
2. The method according to claim 1, characterized in that: The performing class diagram recognition on the target system class diagram to obtain a target description text corresponding to the target system class diagram includes: Performing feature extraction on the target system class diagram to obtain target transfer relationship features between a plurality of key fields with associated relationships recorded in the target system class diagram, wherein each of the key fields is used to indicate a corresponding system file; Inputting the target transfer relationship feature into a first generation model to obtain a reference description text output by the first generation model, wherein the first generation model records the conversion relationship between the transfer relationship feature of the key field and the description text; The reference description text is determined as the target description text.
3. The method according to claim 2, characterized in that The feature extraction of the target system class diagram to obtain the target transfer relationship features between multiple key fields with association relationships recorded in the target system class diagram includes: Identify the target system class diagram using a target class diagram identification model to obtain an initial relationship feature corresponding to the target system class diagram, wherein the initial relationship feature is used to indicate a connection relationship between the plurality of key fields in the target system class diagram; The initial relationship feature and the target system class diagram are subjected to feature fusion to obtain the target transfer relationship feature.
4. The method according to claim 2, characterized in that: After inputting the target transfer relationship feature into the first generation model to obtain the reference description text output by the first generation model, the method further includes: Filtering candidate description texts whose business type has a relevance greater than or equal to a target relevance with the business type of the target business from the description texts stored in the description text library; The candidate description text is used to perform text calibration on the reference description text to obtain the target description text.
5. The method according to claim 2, characterized in that: The step of converting the target program text required to be run when handling the target business for the target business system according to the target description text includes: Extracting a plurality of description statements included in the target description text, wherein each description statement is used to indicate a calling method for one of the system files in the target business system; Filtering out a code template corresponding to the description statement from a code template library, wherein the code template records a calling code for implementing a system file calling mode indicated by the description statement; The code templates are spliced according to the sequence relationship of the description sentences in the target description text to obtain the target program text.
6. The method according to claim 2, characterized in that The step of converting the target program text required to be run when handling the target business for the target business system according to the target description text includes: The target description text is input into a second generation model to obtain the target program text output by the second generation model, wherein the second generation model records the conversion relationship between the description text and the program text.
7. The method according to claim 1, characterized in that The method further comprises: Receive a text conversion request, wherein the text conversion request is used to request conversion of a candidate program text for handling a candidate business into a system class diagram of the target business system, wherein the candidate program text records a program code for implementing a business handling process of the candidate business; In response to the text conversion request, the candidate program text is converted to obtain an initial description text, wherein the initial description text is a text that records the calling sequence relationship of multiple system files of the target business system in the process of the target business system handling the candidate business; The target description text is input into a target class diagram conversion model to obtain a candidate system class diagram output by the target class diagram conversion model.
8. A program text conversion device, characterized in that: include: A receiving module, used for receiving a class diagram conversion request, wherein the class diagram conversion request is used for requesting to convert a target system class diagram into a program text required to be run by the target business system during business processing, wherein the target system class diagram records the business processing flow required for processing the target business on the target business system; A response module, used to respond to the class diagram conversion request, perform class diagram recognition on the target system class diagram, and obtain a target description text corresponding to the target system class diagram, wherein the target description text is a text recording a timing relationship of calling multiple system files deployed in the target business system, and the system file is a file used to implement the system function configured by the target business system; The conversion module is used to convert the target program text required to be run when handling the target business for the target business system according to the target description text.
9. A processor, characterized in that: The processor is used to run a program, wherein the program executes the method according to any one of claims 1 to 7 when running.
10. An electronic device, characterized in that: The invention comprises one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of claims 1 to 7.