Information file generation method and device and related product
By automatically filtering target response code variables and response code variable values in the business operation code, and combining them with the information file generation model, information files in different languages are automatically generated, solving the problem of low efficiency in generating internationalized information files in traditional software development and achieving efficient information file generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-03
- Publication Date
- 2026-03-10
AI Technical Summary
In traditional software development, the generation of internationalized information documents relies on developers, resulting in a large workload and low efficiency.
By acquiring the business operation code and code filtering rules, the system automatically filters target response code variables and response code variable values. Combined with the information file generation model, it automatically generates information files in different languages.
It reduces the workload and maintenance difficulty for developers and improves the efficiency of generating information files.
Smart Images

Figure CN121635898A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software development technology, and in particular to a method, apparatus and related products for generating information files. Background Technology
[0002] In traditional software development, interfaces can return response code values and corresponding internationalized messages to the caller based on different processing logic. Typically, these response code values and messages are integrated into an internationalization file. However, this file generation often relies on developers, significantly increasing their workload and maintenance difficulty, leading to inefficient file generation.
[0003] Therefore, how to improve the efficiency of information document generation is a key issue of concern to those skilled in the art. Summary of the Invention
[0004] To address the aforementioned issues, this application provides a method, apparatus, and related products for generating information documents, thereby improving the efficiency of information document generation.
[0005] The embodiments of this application disclose the following technical solutions:
[0006] The first aspect of this application provides a method for generating an information file. This method includes:
[0007] Obtain the business execution code and code filtering rules, wherein the business execution code is used to support the operation of business in the business system;
[0008] Based on the filtering class name in the code filtering rules, multiple code class names in the business operation code are filtered to obtain target response code variables under the target class name that is the same as the filtering class name among the multiple code class names, wherein the target response code variables are used to indicate the running result of the business;
[0009] Based on the target response code variable, obtain the response code variable value corresponding to the target response code variable, and the target running code under the target class name related to the target response code variable, wherein the response code variable value is used to characterize the running result of the business;
[0010] According to the information file generation model, based on the target response code variable, the response code variable value, the target running code, and the target generation language, a target information file corresponding to the response code variable value in the target generation language is generated, wherein the information file generation model is used to support the generation of information files in different languages.
[0011] In one feasible implementation, the step of filtering multiple code class names in the business execution code based on the filtering class names in the code filtering rules to obtain target response code variables under target class names that are the same as the filtering class names among the multiple code class names includes:
[0012] Based on the filtering class name in the code filtering rules, multiple code class names in the business operation code are filtered to obtain the target class name that is the same as the filtering class name among the multiple code class names;
[0013] The multiple code variables under the target class name are filtered to obtain the target response code variable that belongs to the response code variable among the multiple code variables.
[0014] In one feasible implementation, based on the target response code variable, obtaining the target runtime code associated with the target class name and the target response code variable includes:
[0015] Based on the target response code variable, multiple lines of code under the target class name are filtered to obtain the target lines of code that contain the target response code variable.
[0016] Based on the target line of code, multiple lines of code under the target class name are filtered to obtain the context line of code that is closest to the target line of code among the multiple lines of code;
[0017] The target code line and the context code line are used as the target execution code associated with the target response code variable under the target class name.
[0018] In one feasible implementation, before generating the target information file corresponding to the response code variable value in the target generation language based on the information file generation model, the target response code variable, the response code variable value, the target runtime code, and the target generation language, the method further includes:
[0019] Obtain file description information, wherein the file description information is used to indicate the information type for the prompt information to be generated;
[0020] The step of generating a target information file based on the target response code variable, the response code variable value, the target runtime code, and the target generation language, according to the information file generation model, includes:
[0021] According to the information file generation model, based on the file description information and the target generation language, the target response code variable, the response code variable value and the target running code are generated to obtain response code prompt information corresponding to the response code variable value in the target generation language, wherein the response code prompt information is used to prompt the running result of the business to the object;
[0022] Based on the target generation language, the response code variable value, and the response code prompt information, a target information file corresponding to the response code variable value of the target generation language is obtained.
[0023] In one feasible implementation, obtaining the target information file corresponding to the response code variable value of the target generation language based on the target generation language, the response code variable value, and the response code prompt information includes:
[0024] The response code variable value and the response code prompt information are written into the information file corresponding to the target generation language to obtain the target information file.
[0025] A second aspect of this application provides an apparatus for generating an information file. The apparatus for generating an information file includes:
[0026] The code rule acquisition unit is used to acquire business execution code and code filtering rules, wherein the business execution code is used to support the operation of business in the business system;
[0027] The class name filtering processing unit is used to filter multiple code class names in the business operation code based on the filtering class names in the code filtering rules, and obtain target response code variables under the target class names that are the same as the filtering class names among the multiple code class names, wherein the target response code variables are used to indicate the operation result of the business.
[0028] The variable value code acquisition unit is used to obtain, based on the target response code variable, the response code variable value corresponding to the target response code variable, and the target running code under the target class name related to the target response code variable, wherein the response code variable value is used to characterize the running result of the business;
[0029] The information file generation unit is used to generate a target information file corresponding to the response code variable value in the target generation language based on the target response code variable, the response code variable value, the target running code, and the target generation language, according to the information file generation model. The information file generation model is used to support the generation of information files in different languages.
[0030] In one feasible implementation, the class name filtering processing unit is specifically used for:
[0031] Based on the filtering class name in the code filtering rules, multiple code class names in the business operation code are filtered to obtain the target class name that is the same as the filtering class name among the multiple code class names;
[0032] The multiple code variables under the target class name are filtered to obtain the target response code variable that belongs to the response code variable among the multiple code variables.
[0033] In one feasible implementation, the variable value code obtaining unit is specifically used for:
[0034] Based on the target response code variable, multiple lines of code under the target class name are filtered to obtain the target lines of code that contain the target response code variable.
[0035] Based on the target line of code, multiple lines of code under the target class name are filtered to obtain the context line of code that is closest to the target line of code among the multiple lines of code;
[0036] The target code line and the context code line are used as the target execution code associated with the target response code variable under the target class name.
[0037] In one feasible implementation, the device further includes:
[0038] A description information acquisition unit is used to acquire file description information, wherein the file description information is used to indicate the information type for the prompt information to be generated;
[0039] The information file generation unit includes:
[0040] The prompt information obtaining unit is used to generate the target response code variable, the response code variable value and the target running code according to the information file generation model, based on the file description information and the target generation language, to obtain response code prompt information corresponding to the response code variable value in the target generation language, wherein the response code prompt information is used to prompt the running result of the business to the object;
[0041] The target file acquisition unit is used to obtain a target information file corresponding to the response code variable value in the target generation language based on the target generation language, the response code variable value, and the response code prompt information.
[0042] In one feasible implementation, the target file obtaining unit is specifically used for:
[0043] The response code variable value and the response code prompt information are written into the information file corresponding to the target generation language to obtain the target information file.
[0044] A third aspect of this application provides a computer device. The computer device includes:
[0045] A memory on which computer programs are stored;
[0046] A processor for executing the computer program in the memory to implement the steps of the method for generating an information file provided in the first aspect.
[0047] A fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon. When executed by a processor, the program implements the steps of the information file generation method provided in the first aspect.
[0048] Compared with the prior art, this application has the following advantages:
[0049] In this application, the business operation code and code filtering rules are first obtained. Then, based on the filtering class names in the code filtering rules, multiple code class names in the business operation code are filtered to obtain target response code variables under target class names that are the same as the filtered class names. Furthermore, based on the target response code variables, the response code variable values corresponding to the target response code variables and the target operation code related to the target response code variables under the target class names are obtained. Finally, according to the information file generation model, based on the target response code variables, response code variable values, target operation code, and target generation language, a target information file corresponding to the response code variable values in the target generation language is generated. Here, the business operation code supports the operation of business processes in the business system, the target response code variables indicate the results of business operations, the response code variable values characterize the results of business operations, and the information file generation model supports the generation of information files in different languages.
[0050] As can be seen, this application can automatically filter and obtain target response code variables in the business execution code, and determine the response code variable values and target execution code based on these target response code variables. This enables the automatic generation of a target information file for the response code variable values corresponding to the target generation language, based on the target response code variable indicating the business execution result, the response code variable values representing the business execution result, the context (target execution code) related to the target response code variable, and the target generation language. Thus, this application eliminates the need for developers to pre-code internationalization information files. After the business execution code is written, the target response code variables, response code variable values, and target execution code in the business code are automatically extracted and analyzed. Combined with the information file generation model, an information file for the response code variable values in the required language is automatically generated, greatly reducing the workload and maintenance difficulty for developers and improving the efficiency of information file generation. Attached Figure Description
[0051] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0052] Figure 1 This is a flowchart of a method for generating information files in a related technical solution;
[0053] Figure 2 This is a flowchart illustrating another method for generating information files in a related technical solution.
[0054] Figure 3 A flowchart illustrating a method for generating an information file as provided in this application embodiment;
[0055] Figure 4 This is a schematic diagram illustrating the generation of an information file in an embodiment of this application.
[0056] Figure 5 A schematic diagram illustrating the generation of an information file in another method for generating an information file provided in an embodiment of this application;
[0057] Figure 6 A schematic diagram illustrating the generation of an information file in another method for generating an information file provided in an embodiment of this application;
[0058] Figure 7 This is a schematic diagram of the structure of an information file generation device provided in an embodiment of this application. Detailed Implementation
[0059] As described earlier, in traditional software development models, interfaces can return response code values and corresponding internationalized messages to the caller based on different processing logic. For example, returning a message indicating successful processing. Furthermore, response code values and corresponding internationalized messages are typically integrated into an internationalization file; however, this internationalization file often relies on the developer to generate it.
[0060] Next, combine Figure 1 and Figure 2 This section describes the process of generating internationalized information documents in relevant technical solutions. For example... Figure 1 As shown, Figure 1 This is a flowchart illustrating the generation of an information file in a related technical solution. Figure 1In this process, developers are responsible for defining response code variable values, writing interfaces and returning response code variable values, and writing internationalization information files. These internationalization information files include Chinese, English, and other language information files. In other words, developers write information files corresponding to different languages.
[0061] like Figure 2 As shown, Figure 2 This is a flowchart illustrating another method for generating information files in a related technical solution. Figure 2 In this process, developers perform operations such as defining response code variable values, writing interfaces and returning response code variable values, and writing information files in a specific language. These files are then translated using a translation engine to obtain information files in other languages. It is evident that all related technical solutions require developers to write information files, significantly increasing their workload and maintenance difficulty, thus leading to low efficiency in information file generation. Therefore, improving the efficiency of information file generation is a key issue of concern to those skilled in the art.
[0062] To address the above issues, this application provides a solution, proposing a method, apparatus, and related products for generating information files, aiming to improve the efficiency of information file generation. In this technical solution, firstly, business operation code and code filtering rules are obtained; then, based on the filtering class names in the code filtering rules, multiple code class names in the business operation code are filtered to obtain target response code variables under target class names that are the same as the filtered class names. Furthermore, based on the target response code variables, the response code variable values corresponding to the target response code variables and the target operation code related to the target response code variables under the target class names are obtained; finally, according to the information file generation model, based on the target response code variables, response code variable values, target operation code, and target generation language, a target information file with response code variable values corresponding to the target generation language is generated. Here, the business operation code is used to support the operation of business in the business system, the target response code variables are used to indicate the operation results of the business, the response code variable values are used to characterize the operation results of the business, and the information file generation model is used to support the generation of information files in different languages.
[0063] As can be seen, this application can automatically filter and obtain target response code variables in the business execution code, and determine the response code variable values and target execution code based on these target response code variables. This enables the automatic generation of a target information file for the response code variable values corresponding to the target generation language, based on the target response code variables indicating the business execution results, the response code variable values representing the business execution results, the context (target execution code) related to the target response code variables, and the target generation language. Thus, this application eliminates the need for developers to pre-code internationalization information files. After the business execution code is written, the target response code variables, response code variable values, and target execution code in the business code are automatically extracted and analyzed. Combined with the information file generation model, an information file for the required language response code variable values is automatically generated, thereby greatly reducing the workload and maintenance difficulty for developers, improving program development efficiency, and increasing the efficiency of information file generation.
[0064] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.
[0065] See Figure 3 This figure is a flowchart of an information file generation method provided in an embodiment of this application. Figure 3 The method for generating the information file shown includes steps S301-S304, which are specifically described below:
[0066] S301: Obtain the business execution code and code filtering rules.
[0067] In this step, the business logic code can be understood as a source code file that supports the operation of the entire business system, such as an e-commerce system. More specifically, this business logic code supports the operation of business processes within the system, such as the operation of an object purchasing items within an e-commerce system.
[0068] The code filtering rules are pre-configured. These rules are used to filter for class names containing response code variables in the business logic, or to filter for annotations within class names containing response code variables, or to filter for package names containing response code variables in the business logic. The class name identifies the class and reflects its function, such as UserService; the package name manages the class, such as com.example.utils; and annotations add metadata to the class and are present in the class name, such as @Override.
[0069] S302: Based on the filtering class name in the code filtering rules, filter multiple code class names in the business operation code to obtain the target response code variable under the target class name that is the same as the filtering class name among the multiple code class names.
[0070] Specifically, this application first filters multiple code class names in the business execution code based on the filter class name in the code filtering rules to obtain the target class name that is the same as the filter class name among the multiple code class names. Then, it filters multiple code variables under the target class name to obtain the target response code variable that belongs to the response code variable among the multiple code variables. It is understandable that response code variables exist under class names; therefore, based on the filter class name, it is possible to determine the target response code variable under the target class name that is the same as the filter class name in the business execution code.
[0071] Alternatively, this application first filters multiple code class names in the business execution code based on the filtering annotations in the code filtering rules to obtain the target class names containing the filtering annotations. Then, it filters multiple code variables under the target class names to obtain the target response code variables that belong to the response code variables. Understandably, since response code variables exist under class names, it's possible to determine the target class names containing the filtering annotations based on the filtering annotations, and then determine the target response code variables in the business execution code based on the target class names.
[0072] Alternatively, this application first filters multiple package names in the business logic code based on the package name filtering rules to obtain the target package name that matches the filtered package name. Then, it filters multiple class names in the business logic code based on the class name filtering rules to obtain the target class name that matches the filtered class name. Finally, it filters multiple code variables under the target class name to obtain the target response code variable that belongs to the response code variable category. Thus, this application can determine the target response code variable through automated parsing, improving the efficiency of information file generation to some extent.
[0073] It should be noted that in this application, variable annotation information of the target response code variable under the target class name can also be extracted simultaneously. The variable annotation information is used to explain the variable type of the response variable code. This variable annotation information can be input into the information file generation model to better improve the output accuracy of the information file generation model.
[0074] It should also be noted that target response code variables include constant response code variables and / or enumerated response code variables. Target response code variables are used to indicate the result of business logic execution, such as SUCCESS, BAD_REQUEST, NOT_FOUND, etc. Understandably, these target response code variables are reflected in the code and do not need to be displayed to objects (such as developers, objects that purchase items, etc.). Furthermore, a class name can have one or more target response code variables, and the number of target response code variables can be determined based on the actual application.
[0075] S303: Based on the target response code variable, obtain the response code variable value corresponding to the target response code variable, and the target running code under the target class name related to the target response code variable.
[0076] In this step, the target response code variable's value can be determined based on the target response code variable. It's understood that the target response code variable and its corresponding value appear simultaneously. Once the target response code variable is determined, its corresponding value can be identified. For example: SUCCESS: COMMON.100001, NOT_FOUND: 404; where COMMON.100001 and 404 are the response code variable values. The response code variable value is used to represent the business operation result (such as success or failure). This target response code variable is reflected in the code and does not need to be displayed to objects (such as developers, the object purchasing items, etc.).
[0077] Furthermore, the process of determining the target running code in this application is described.
[0078] First, based on the target response code variable, multiple lines of code under the target class name are filtered to obtain the target code lines that contain the target response code variable.
[0079] After this, multiple lines of code under the target class name can be filtered based on the target line of code to obtain the context lines of code that are closest to the target line of code. For example, the first 5 lines of code and the last 5 lines of code that are closest to the target line of code can be used as context lines of code. Alternatively, the lines of code before and after the target line of code can be used as context lines of code. In this case, the end node of the extracted line of code is: when a blank line is encountered.
[0080] Finally, the target code line and the context code line are taken as the target execution code associated with the target response code variable under the target class name. Understandably, this target execution code can better interpret the process of determining the response code variable value, such as checking if an item is still in stock. Thus, in this application, the target execution code can be determined through automated parsing, which improves the efficiency of information file generation to some extent.
[0081] It should be noted that in this application, code line comment information of the target code line and the context code line can also be extracted simultaneously. The code line comment information is used to explain the execution operation of the corresponding code line. This code line comment information can be input into the information file generation model to better improve the output accuracy of the information file generation model.
[0082] S304: Based on the information file generation model, and based on the target response code variable, the response code variable value, the target running code, and the target generation language, generate a target information file corresponding to the response code variable value in the target generation language.
[0083] It should be noted that before performing the target information file operation of generating a response code variable value corresponding to the target generation language based on the information file generation model, the target response code variable, the response code variable value, the target running code, and the target generation language, this application can also obtain file description information. This file description information indicates the information type of the prompt information to be generated. This file description information can be a piece of text, serving as a prompt word for the information file generation model. For example, the file description information could be: "Based on the target response code variable, the response code variable value, and the target running code, infer the response code prompt information corresponding to the response code variable value of the target generation language, and output the model inference result in the output format of target generation language - response code variable value - response code prompt information."
[0084] Specifically, this application first uses an information file generation model to generate target response code variables, response code variable values, and target execution code based on file description information and the target generation language. This generates response code prompt information corresponding to the response code variable values in the target generation language. The response code prompt information is used to display the results of the business process to the object, such as displaying a successful or failed result. The information file generation model supports the generation of information files in different languages and can be understood as a large language model of a question-and-answer type.
[0085] In one example, when the response code variable value is COMMON.100001 and the target language is Chinese, the response code message is "success"; when the response code variable value is COMMON.100001 and the target language is English, the response code message is "SUCCESS".
[0086] Finally, the model inference result of the information file generation model is: target generation language - response code variable value - response code prompt information. At this point, based on the target generation language, response code variable value, and response code prompt information, a target information file with the response code variable value corresponding to the target generation language can be obtained. Thus, this application, under the action of the information file generation model, can generate response code prompt information that conforms to the response code variable value of the target generation language by combining the target response code variable and the target running code, thereby improving the efficiency of prompt information generation.
[0087] Furthermore, in this application, the response code variable values and response code prompts can be written to the information file corresponding to the target generation language to obtain the target information file. For example, Chinese characters can be uniformly written to the messages_zh.properties file, and English characters can be uniformly written to the messages_en.properties file. In this way, the target information file can be directly applied to the business system to enable the corresponding prompts to be fed back to the object during subsequent business operations.
[0088] like Figure 4 As shown, Figure 4 This is a schematic diagram illustrating the generation of an information file in a method for generating an information file according to an embodiment of this application. Figure 4In this process, file description information, target response code variables, response code variable values, target runtime code, and target generation language are input into the information file generation model to obtain response code prompt information corresponding to the response code variable values in the target generation language. Then, the response code variable values and response code prompt information can be written to the information file corresponding to the target generation language to obtain the target information file. For example: writing the response code variable value 1 and the response code prompt information (Chinese prompt information 1) to the Chinese information file yields a Chinese information file; writing the response code variable value 1 and the response code prompt information (English prompt information 1) to the English information file yields an English information file; and writing the response code variable value 1 and the response code prompt information (other language prompt information 1) to the information file corresponding to another language yields another language information file. In other words, in this application, information files in different languages can be generated for the same response code variable value.
[0089] like Figure 5 As shown, Figure 5 This is a schematic diagram illustrating the generation of an information file in another method for generating an information file provided in an embodiment of this application. Figure 5 In this application, information files in different languages can be generated for different response code variable values. For example, response code variable value 1 and response code prompt information (Chinese prompt information 1) are written to the corresponding Chinese information file; response code variable value 2 and response code prompt information (Chinese prompt information 2) are written to the corresponding Chinese information file; and response code variable value n and response code prompt information (Chinese prompt information n) are written to the corresponding Chinese information file to obtain a Chinese information file. Write the response code variable value 1 and the response code prompt message (English prompt message 1) to the corresponding English message file. Write the response code variable value 2 and the response code prompt message (English prompt message 2) to the corresponding English message file. Write the response code variable value n and the response code prompt message (English prompt message n) to the corresponding English message file to obtain the English message file. Write the response code variable value 1 and the response code prompt message (other language prompt message 1) to the corresponding message file for the other language. Write the response code variable value 2 and the response code prompt message (other language prompt message 2) to the corresponding message file for the other language. Write the response code variable value n and the response code prompt message (other language prompt message n) to the corresponding message file for the other language to obtain the other language message file.
[0090] like Figure 6 As shown, Figure 6 This is a schematic diagram illustrating the generation of an information file in another method for generating an information file provided in an embodiment of this application. Figure 6In this application, the developer first defines the response code variable values, executes the written interface, and returns the response code variable values. Afterward, this application can be executed to automatically generate the target information file. Thus, this application eliminates the need for developers to pre-code internationalization information files, improving the efficiency of information file generation.
[0091] It should be noted that this application achieves integration through build plugins or IDE plugins. Build plugins include at least Maven and Gradle plugins, while IDE plugins include at least JetBrains Idea and VSCode plugins. This allows for rich integration options to cover diverse development environments and technical frameworks, reducing the learning curve and significantly improving the user experience.
[0092] In summary, this embodiment can automatically filter and obtain target response code variables in the business execution code, and determine the response code variable values and target execution code based on these target response code variables. This enables the automatic generation of a target information file for the response code variable values corresponding to the target generation language, based on the target response code variables indicating the business execution results, the response code variable values representing the business execution results, the context (target execution code) related to the target response code variables, and the target generation language. Thus, in this application, developers do not need to pre-code internationalization information files. After the business execution code is written, the target response code variables, response code variable values, and target execution code in the business code are automatically extracted and analyzed. Combined with the information file generation model, an information file for the response code variable values in the required language is automatically generated. This greatly reduces the workload and maintenance difficulty for developers, lowers program development efficiency, improves information file generation efficiency, and enhances developer productivity.
[0093] Based on the information file generation method provided in the foregoing embodiments, this application also provides an information file generation apparatus. Figure 7 This is a schematic diagram of the structure of an information file generation device provided in an embodiment of this application. Figure 7 As shown, the apparatus for generating this information file includes:
[0094] The code rule acquisition unit 701 is used to acquire business operation code and code filtering rules, wherein the business operation code is used to support the operation of business in the business system;
[0095] The class name filtering processing unit 702 is used to filter multiple code class names in the business operation code based on the filtering class names in the code filtering rules, and obtain target response code variables under the target class names that are the same as the filtering class names among the multiple code class names, wherein the target response code variables are used to indicate the running result of the business.
[0096] The variable value code acquisition unit 703 is used to obtain, based on the target response code variable, the response code variable value corresponding to the target response code variable, and the target running code under the target class name related to the target response code variable, wherein the response code variable value is used to characterize the running result of the service;
[0097] The information file generation unit 704 is used to generate a target information file corresponding to the response code variable value in the target generation language based on the target response code variable, the response code variable value, the target running code, and the target generation language, according to the information file generation model. The information file generation model is used to support the generation of information files in different languages.
[0098] In one feasible implementation, the class name filtering processing unit 702 is specifically used for:
[0099] Based on the filtering class name in the code filtering rules, multiple code class names in the business operation code are filtered to obtain the target class name that is the same as the filtering class name among the multiple code class names;
[0100] The multiple code variables under the target class name are filtered to obtain the target response code variable that belongs to the response code variable among the multiple code variables.
[0101] In one feasible implementation, the variable value code obtaining unit 703 is specifically used for:
[0102] Based on the target response code variable, multiple lines of code under the target class name are filtered to obtain the target lines of code that contain the target response code variable.
[0103] Based on the target line of code, multiple lines of code under the target class name are filtered to obtain the context line of code that is closest to the target line of code among the multiple lines of code;
[0104] The target code line and the context code line are used as the target execution code associated with the target response code variable under the target class name.
[0105] In one feasible implementation, the device further includes:
[0106] A description information acquisition unit is used to acquire file description information, wherein the file description information is used to indicate the information type for the prompt information to be generated;
[0107] The information file generation unit 704 includes:
[0108] The prompt information obtaining unit is used to generate the target response code variable, the response code variable value and the target running code according to the information file generation model, based on the file description information and the target generation language, to obtain response code prompt information corresponding to the response code variable value in the target generation language, wherein the response code prompt information is used to prompt the running result of the business to the object;
[0109] The target file acquisition unit is used to obtain a target information file corresponding to the response code variable value in the target generation language based on the target generation language, the response code variable value, and the response code prompt information.
[0110] In one feasible implementation, the target file obtaining unit is specifically used for:
[0111] The response code variable value and the response code prompt information are written into the information file corresponding to the target generation language to obtain the target information file.
[0112] The information file generation apparatus provided in this application embodiment has the same beneficial effects as the information file generation method provided in the above embodiments, and can improve the efficiency of information file generation, which will not be described again here.
[0113] This application also provides a computer device. The computer device includes:
[0114] A memory that stores computer programs.
[0115] A processor is used to execute a computer program in memory to implement some or all of the steps in the information file generation method described in the foregoing embodiments.
[0116] This application also provides a computer-readable storage medium having a computer program stored thereon. When executed by a processor, the program implements some or all of the steps in the information file generation method described in the foregoing embodiments.
[0117] It should be noted that the "first" and "second" in the names mentioned in the embodiments of this application are only used as name identifiers and do not represent the first and second in order.
[0118] It should also be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for the device and equipment embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments. The device and equipment embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components indicated as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the solution in this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0119] The above description is merely one specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method of generating an information file, characterized by, The method comprises the following steps: obtaining a business running code and a code screening rule, wherein the business running code is used to support the running of a business in a business system; screening a plurality of code class names in the business running code based on a screening class name in the code screening rule, to obtain a target response code variable under a target class name in the plurality of code class names which is the same as the screening class name, wherein the target response code variable is used to indicate the running result of the business; based on the target response code variable, obtaining a response code variable value corresponding to the target response code variable and target running code related to the target response code variable under the target class name, wherein the response code variable value is used to represent the running result of the business; generating a target information file corresponding to the response code variable value in a target generation language based on the target response code variable, the response code variable value, the target running code and the target generation language according to an information file generation model, wherein the information file generation model is used to support the generation of information files in different languages.
2. The method of claim 1, wherein, The step of screening a plurality of code class names in the business running code based on a screening class name in the code screening rule, to obtain a target response code variable under a target class name in the plurality of code class names which is the same as the screening class name, comprises the following steps: screening a plurality of code class names in the business running code based on a screening class name in the code screening rule, to obtain a target class name in the plurality of code class names which is the same as the screening class name; screening a plurality of code variables under the target class name, to obtain a target response code variable belonging to the response code variable in the plurality of code variables.
3. The method of claim 1, wherein, The step of obtaining target running code related to the target response code variable under the target class name based on the target response code variable, comprises the following steps: screening a plurality of code lines under the target class name based on the target response code variable, to obtain a target code line in which the target response code variable exists in the plurality of code lines; screening a plurality of code lines under the target class name based on the target code line, to obtain a context code line which is closest to the target code line in the plurality of code lines; taking the target code line and the context code line as the target running code related to the target response code variable under the target class name.
4. The method of claim 1, wherein, Before the step of generating a target information file corresponding to the response code variable value in a target generation language based on the target response code variable, the response code variable value, the target running code and the target generation language according to an information file generation model, the method further comprises the following step: obtaining file description information, wherein the file description information is used to indicate the information type of the prompt information to be generated; the step of generating a target information file corresponding to the response code variable value in a target generation language based on the target response code variable, the response code variable value, the target running code and the target generation language according to an information file generation model, comprises the following steps: According to the information file generation model, based on the file description information and the target generation language, the target response code variable, the response code variable value and the target running code are generated, and the response code prompt information of the response code variable value corresponding to the target generation language is obtained, wherein the response code prompt information is used to prompt the running result of the business to the object; Based on the target generation language, the response code variable value and the response code prompt information, the target information file corresponding to the response code variable value of the target generation language is obtained.
5. The method of claim 4, wherein, The target information file corresponding to the response code variable value of the target generation language is obtained based on the target generation language, the response code variable value and the response code prompt information, including: The response code variable value and the response code prompt information are written into the information file corresponding to the target generation language to obtain the target information file.
6. An information file generating apparatus characterized by comprising: Including: The code rule acquisition unit is used to acquire the business running code and the code screening rule, wherein the business running code is used to support the running of the business in the business system; The class name screening processing unit is used to screen the multiple code class names in the business running code based on the screening class name in the code screening rule, and obtain the target response code variable under the target class name which is the same as the screening class name in the multiple code class names, wherein the target response code variable is used to indicate the running result of the business; The variable value code obtaining unit is used to obtain the response code variable value corresponding to the target response code variable and the target running code related to the target response code variable under the target class name based on the target response code variable, wherein the response code variable value is used to represent the running result of the business; The information file generation unit is used to generate the target information file corresponding to the response code variable value of the target generation language according to the information file generation model based on the target response code variable, the response code variable value, the target running code and the target generation language, wherein the information file generation model is used to support the generation of information files in different languages.
7. The apparatus of claim 6, wherein, The class name screening processing unit is specifically used to: Screen the multiple code class names in the business running code based on the screening class name in the code screening rule, and obtain the target class name which is the same as the screening class name in the multiple code class names; Screen the multiple code variables under the target class name, and obtain the target response code variable which belongs to the response code variable in the multiple code variables.
8. The apparatus of claim 6, wherein, The variable value code obtaining unit is specifically used to: Screen the multiple code lines under the target class name based on the target response code variable, and obtain the target code line in which the target response code variable exists in the multiple code lines; Screen the multiple code lines under the target class name based on the target code line, and obtain the context code line which is closest to the target code line in the multiple code lines; The target code line and the context code line are used as the target running code related to the target response code variable under the target class name.
9. A computer device, comprising: Including: a memory having stored thereon a computer program; a processor for executing the computer program in the memory to implement the steps of the method of claim 1-7 for generating an information file.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The program, when executed by the processor, implements the steps of the method of claim 1-7 for generating an information file.