Table formula interpretation method and device
By obtaining table formulas and their associated data and using machine learning models to explain their meaning, the problem of difficulty in interpreting column indexes in table formulas is solved, and semantic comprehension is improved.
Patent Information
- Application Number
- CN202311400172.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-25
- Publication Date
- 2025-04-25
AI Technical Summary
The prior art is difficult to effectively explain the meaning of column indexes in table formulas, and there is a problem of poor semantic generalization.
By obtaining the target table formula and its associated tabular data, the pre-trained machine learning model is used to construct prompt data to explain the target meaning of the table formula, including formula description, function explanation and parameter explanation.
Effectively interpret the meaning of column indexes in table formulas, improve semantic generalization, and help users better understand and use table formulas.
Smart Images

Figure CN119886080A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and device for interpreting table formulas. Background Art
[0002] At present, spreadsheet software provides a variety of table formulas (or function formulas, such as SUM function, AVERAGE function, VLOOKUP function, etc.) to meet the diverse calculation needs of users. Among them, when using table formulas, users have demands such as handwriting table formulas, reviewing table formulas, and modifying table formulas. The threshold for using table formulas is relatively high, and users need to be assisted in understanding the meaning of table formulas embedded (or associated) in cells.
[0003] In the related art, in order to help users understand the meaning of table formulas embedded in cells, rules (such as enumerating the meaning of each table formula) or end-to-end translation (such as calling a model to translate the table formula) are usually used to interpret table formulas. However, the specific meaning of the column index in the table formula cannot be well explained, and there is a disadvantage of poor semantic generalization. Summary of the invention
[0004] In order to solve the above technical problems that the specific meaning of the column index in the table formula cannot be well interpreted and the semantic generalization is poor, the embodiment of the present application provides a table formula interpretation method, device, electronic device and storage medium. The specific technical solution is as follows:
[0005] In a first aspect of an embodiment of the present application, a table formula interpretation method is first provided, the method comprising:
[0006] Obtain a target table formula, and determine a target table associated with the target table formula, wherein the target table is a table involved in generating the target table formula;
[0007] Acquire table data in the target table, and interpret the target meaning of the target table formula based on the table data and the target table formula;
[0008] The target meaning of the target table formula includes at least one of the following: a formula description of the target table formula, a function explanation of the target function in the target table formula, and a parameter explanation of the target parameter in the target function.
[0009] In an optional embodiment, the target meaning of the target table formula is interpreted based on the table data and the target table formula, including: constructing first prompt data of a pre-trained first machine learning model based on the table data and the target table formula; inputting the first prompt data into the pre-trained first machine learning model to obtain the target meaning of the target table formula output by the pre-trained first machine learning model.
[0010] In an optional embodiment, the first prompt data includes instruction data, input data and output data; the construction of the first prompt data of the pre-trained first machine learning model based on the table data and the target table formula includes: combining the table data and the target table formula to obtain the instruction data, and setting the input data to blank; setting the formula description value, function interpretation value and parameter interpretation value in the output data to blank respectively; the first prompt data of the pre-trained first machine learning model is composed of the instruction data, the input data and the output data.
[0011] In an optional embodiment, the step of inputting the first prompt data into the pre-trained first machine learning model to obtain the target meaning of the target table formula output by the pre-trained first machine learning model includes: filling the first prompt data so that the filled first prompt data reaches a preset length; inputting the filled first prompt data into the pre-trained first machine learning model to obtain the target meaning of the target table formula output by the pre-trained first machine learning model.
[0012] In an optional embodiment, before interpreting the target meaning of the target table formula based on the table data and the target table formula, it also includes: obtaining a sample table formula and determining a sample table associated with the sample table formula, wherein the sample table is a table involved in generating the sample table formula; obtaining sample table data in the sample table, and constructing sample prompt data of a first machine learning model based on the sample table data and the sample table formula; inputting the sample prompt data into the first machine learning model to obtain a first meaning of the sample table formula output by the first machine learning model; determining an error between the first meaning and a second meaning of the sample table formula in the sample prompt data; training the first machine learning model according to the error, and stopping model training when the error meets a convergence condition to obtain the pre-trained first machine learning model.
[0013] In an optional embodiment, the sample prompt data includes sample instruction data, sample input data and sample output data; the sample prompt data of the first machine learning model is constructed based on the sample table data and the sample table formula, including: combining the sample table data and the sample table formula to obtain the sample instruction data, and setting the sample input data to blank; determining a second meaning of the sample table formula, the second meaning including at least one of the following: a sample formula description of the sample table formula, a sample function interpretation of the sample function in the sample table formula, and a sample parameter interpretation of the sample parameter in the sample function; setting the formula description value in the sample output data to the sample formula description, setting the function interpretation value in the sample output data to the sample function interpretation, and setting the parameter interpretation value in the sample output data to the sample parameter interpretation; the sample prompt data of the first machine learning model is composed of the sample instruction data, the sample input data and the sample output data.
[0014] In an optional embodiment, determining the second meaning of the sample table formula includes: combining the sample table data and the sample table formula to obtain second prompt data of a second machine learning model; inputting the second prompt data into the second machine learning model to obtain a sample formula description and a sample parameter explanation output by the second machine learning model; using a formula parsing class to parse the sample table formula to obtain a sample function list of the sample table formula; for any sample function identifier in the sample function list, searching for a first function identifier that is consistent with the sample function identifier from a preset function identifier set; searching for a first function interpretation corresponding to the first function identifier, and determining the first function interpretation as the sample function interpretation of the sample function corresponding to the sample function identifier.
[0015] In an optional embodiment, the method of using a formula parsing class to parse the sample table formula to obtain a sample function list of the sample table formula includes: using a formula parsing class to decompose the sample table formula to obtain multiple substrings, each of which has a corresponding type; for any of the substrings, determining whether the type of the substring is a first type; and when the type of the substring is the first type, extracting a sample function identifier from the substring and storing it in a sample function list.
[0016] In an optional embodiment, setting the formula description value in the sample output data to the sample formula description, setting the function interpretation value in the sample output data to the sample function interpretation, and setting the parameter interpretation value in the sample output data to the sample parameter interpretation, includes: judging whether the sample formula description and the sample parameter interpretation meet preset quality requirements; if the sample formula description and the sample parameter interpretation meet the preset quality requirements, setting the formula description value in the sample output data to the sample formula description, setting the function interpretation value in the sample output data to the sample function interpretation, and setting the parameter interpretation value in the sample output data to the sample parameter interpretation.
[0017] In an optional embodiment, the judging whether the sample formula description and the sample parameter interpretation meet the preset quality requirements includes: determining a first semantic fluency of the sample formula description, and generating a first table formula according to the sample table data and the sample formula description; determining a second semantic fluency of the sample parameter interpretation, and parsing the sample table formula using a formula parsing class to obtain a sample parameter list of the sample table formula; judging whether the difference between the first semantic fluency and a first preset value is less than a first preset difference threshold, whether the first table formula is consistent with the sample table formula, whether the difference between the second semantic fluency and the second preset value is less than a second preset difference threshold, and whether there is a corresponding sample parameter interpretation for each of the sample parameters in the sample parameter list; or, judging whether the difference between the first semantic fluency and the first preset value is less than the first preset difference threshold, whether the execution result of the first table formula in the sample table is consistent with the execution result of the sample table formula in the sample table, whether the difference between the second semantic fluency and the second preset value is less than the second preset difference threshold, and whether there is a corresponding sample parameter interpretation for each of the sample parameters in the sample parameter list.
[0018] In an optional embodiment, when the sample formula description and the sample parameter explanation meet the preset quality requirements, the formula description value in the sample output data is set to the sample formula description, the function explanation value in the sample output data is set to the sample function explanation, and the parameter explanation value in the sample output data is set to the sample parameter explanation, including: when the difference between the first semantic fluency and the first preset value is less than a first preset difference threshold, the first table formula is consistent with the sample table formula, the difference between the second semantic fluency and the second preset value is less than a second preset difference threshold, and each of the sample parameters in the sample parameter list has a corresponding sample parameter explanation, the formula description value in the sample output data is set to the sample formula description, and The function interpretation value in the sample output data is set to the sample function interpretation, and the parameter interpretation value in the sample output data is set to the sample parameter interpretation; or, when the difference between the first semantic fluency and the first preset numerical value is less than the first preset difference threshold, the execution result of the first table formula in the sample table is consistent with the execution result of the sample table formula in the sample table, the difference between the second semantic fluency and the second preset numerical value is less than the second preset difference threshold, and each of the sample parameters in the sample parameter list has a corresponding sample parameter explanation, the formula description value in the sample output data is set to the sample formula description, the function interpretation value in the sample output data is set to the sample function interpretation, and the parameter interpretation value in the sample output data is set to the sample parameter explanation.
[0019] In an optional embodiment, the determining of the first semantic fluency of the sample formula description includes: inputting the sample formula description into a semantic fluency evaluation model to obtain a first score, and determining the first score as the first semantic fluency of the sample formula description; the determining of the second semantic fluency of the sample parameter interpretation includes: inputting the sample parameter interpretation into a semantic fluency evaluation model to obtain a second score, and determining the second score as the second semantic fluency of the sample parameter interpretation. In an optional embodiment, the using of a formula parsing class to parse the sample table formula to obtain a sample parameter list of the sample table formula includes: using a formula parsing class to decompose the sample table formula to obtain a plurality of substrings, each of which has a corresponding type; for any of the substrings, determining whether the type of the substring is the second type; if the type of the substring is the second type, determining the substring as a sample parameter and storing it in the sample parameter list.
[0020] In an optional embodiment, the step of inputting the sample prompt data into the first machine learning model to obtain the first meaning of the sample table formula output by the first machine learning model includes: filling the sample prompt data so that the filled sample prompt data reaches a preset length; inputting the filled sample prompt data into the first machine learning model to obtain the first meaning of the sample table formula output by the first machine learning model.
[0021] In an optional embodiment, the method also includes: obtaining a test table formula and determining a test table associated with the test table formula, wherein the test table is a table involved in generating the test table formula; obtaining test table data in the test table, and constructing test prompt data for the pre-trained first machine learning model based on the test table data and the test table formula; inputting the test prompt data into the pre-trained first machine learning model to obtain a third meaning of the test table formula output by the pre-trained first machine learning model; and analyzing the prediction effect of the pre-trained first machine learning model based on the third meaning.
[0022] In an optional embodiment, the test prompt data includes test instruction data, test input data and test output data; the test prompt data of the pre-trained first machine learning model is constructed based on the test table data and the test table formula, including: combining the test table data with the test table formula to obtain the test instruction data, and setting the test input data to blank; setting the formula description value, function explanation value, and parameter explanation value in the test output data to blank respectively; the test prompt data of the pre-trained first machine learning model is composed of the test instruction data, the test input data and the test output data.
[0023] In an optional embodiment, the step of inputting the test prompt data into the pre-trained first machine learning model to obtain the third meaning of the test table formula output by the pre-trained first machine learning model includes: filling the test prompt data so that the filled test prompt data reaches a preset length; inputting the filled test prompt data into the pre-trained first machine learning model to obtain the third meaning of the test table formula output by the pre-trained first machine learning model.
[0024] In an optional embodiment, the third meaning includes at least one of the following: a test formula description of the test table formula, a test function explanation of the test function in the test table formula, and a test parameter explanation of the test parameter in the test function; analyzing the prediction effect of the pre-trained first machine learning model according to the third meaning includes: determining a third fluency of the test formula description, and determining a first correctness of the test formula description; determining a second correctness of the test function interpretation, determining a fourth fluency of the test parameter interpretation, and determining a third correctness of the test parameter interpretation; and analyzing the prediction effect of the pre-trained first machine learning model by comprehensively analyzing the third fluency, the first correctness, the second correctness, the fourth fluency and the third correctness.
[0025] In an optional embodiment, determining the third fluency of the test formula description includes: inputting the test formula description into a semantic fluency evaluation model to obtain a third score, and determining the third score as the third fluency of the test formula description; determining the fourth fluency of the test parameter interpretation includes: inputting the test parameter interpretation into a semantic fluency evaluation model to obtain a fourth score, and determining the fourth score as the fourth fluency of the test parameter interpretation.
[0026] In an optional embodiment, determining the first correctness of the test formula description includes: generating a second table formula based on the test table data and the test formula description; comparing the second table formula with the test table formula for formula consistency, and determining the first correctness of the test formula description based on the formula consistency; or, comparing the execution result of the second table formula in the test table with the result consistency of the execution result of the test table formula in the test table; determining the first correctness of the test formula description based on the result consistency.
[0027] In an optional embodiment, determining the second correctness of the test function interpretation includes: obtaining the test function identifier of the test function in the test table formula, and searching for a second function identifier that is consistent with the test function identifier from a preset function identifier set; searching for a second function interpretation corresponding to the second function identifier, and determining the degree of match between the second function interpretation and the test function interpretation; and determining the degree of match as the second correctness of the test function interpretation.
[0028] In an optional embodiment, the target table formula acquisition includes: in response to a preset operation on a cell in a table, displaying the table formula corresponding to the cell; in response to an explanation operation on the table formula corresponding to the cell, acquiring the table formula corresponding to the cell, and determining the table formula corresponding to the cell as the target table formula; after explaining the target meaning of the target table formula based on the table data and the target table formula, the method further includes: displaying a dialog box, wherein at least one of the formula description, the function explanation, and the parameter explanation is displayed in the dialog box.
[0029] In a second aspect of the embodiments of the present application, a table formula interpretation device is also provided, the device comprising:
[0030] Formula acquisition module, used to obtain the target table formula;
[0031] A table determination module, used for determining a target table associated with the target table formula, wherein the target table is a table involved in generating the target table formula;
[0032] A data acquisition module, used for acquiring table data in the target table;
[0033] A formula interpretation module, used for interpreting the target meaning of the target table formula based on the table data and the target table formula;
[0034] The target meaning of the target table formula includes at least one of the following: a formula description of the target table formula, a function explanation of the target function in the target table formula, and a parameter explanation of the target parameter in the target function.
[0035] In an optional implementation, the formula interpretation module specifically includes:
[0036] A data construction submodule, for constructing first prompt data of a pre-trained first machine learning model based on the table data and the target table formula;
[0037] A data input submodule is used to input the first prompt data into the pre-trained first machine learning model to obtain the target meaning of the target table formula output by the pre-trained first machine learning model.
[0038] In an optional implementation, the first prompt data includes instruction data, input data and output data; the data construction submodule is specifically used for:
[0039] Combine the table data and the target table formula to obtain the instruction data, and set the input data to be blank;
[0040] The formula explanation value, function explanation value and parameter explanation value in the output data are respectively set to blank;
[0041] The instruction data, the input data and the output data constitute the first prompt data of the pre-trained first machine learning model.
[0042] In an optional implementation, the data input submodule is specifically used for:
[0043] Performing padding processing on the first prompt data so that the first prompt data after padding reaches a preset length;
[0044] The filled first prompt data is input into the pre-trained first machine learning model to obtain the target meaning of the target table formula output by the pre-trained first machine learning model.
[0045] In an optional embodiment, the device further comprises:
[0046] A sample table formula acquisition module is used to acquire sample table formulas;
[0047] A sample table acquisition module, used to determine a sample table associated with the sample table formula, wherein the sample table is a table involved in generating the sample table formula;
[0048] A sample table data acquisition module, used to acquire the sample table data in the sample table;
[0049] A sample prompt data construction module, used to construct sample prompt data of a first machine learning model based on the sample table data and the sample table formula;
[0050] A sample prompt data input module, used for inputting the sample prompt data into the first machine learning model to obtain a first meaning of the sample table formula output by the first machine learning model;
[0051] an error determination module, for determining an error between the first meaning and a second meaning of the sample table formula in the sample prompt data;
[0052] A model training module is used to train the first machine learning model according to the error, and stop model training when the error meets the convergence condition to obtain the pre-trained first machine learning model.
[0053] In an optional implementation, the sample prompt data includes sample instruction data, sample input data and sample output data; the sample prompt data construction module specifically includes:
[0054] A sample table data and sample table formula combination submodule, used for combining the sample table data and the sample table formula to obtain the sample instruction data, and leaving the sample input data blank;
[0055] a meaning determination submodule, used for determining a second meaning of the sample table formula, wherein the second meaning includes at least one of the following: a sample formula description of the sample table formula, a sample function explanation of a sample function in the sample table formula, and a sample parameter explanation of a sample parameter in the sample function;
[0056] A sample output data setting submodule, used to set the formula description value in the sample output data to the sample formula description, set the function interpretation value in the sample output data to the sample function interpretation, and set the parameter interpretation value in the sample output data to the sample parameter interpretation;
[0057] The data composition submodule is used to compose sample prompt data of the first machine learning model from the sample instruction data, the sample input data and the sample output data.
[0058] In an optional implementation, the meaning determination submodule specifically includes:
[0059] A sample table data and sample table formula combining unit, used for combining the sample table data and the sample table formula to obtain second prompt data of a second machine learning model;
[0060] A sample formula description and sample parameter explanation determining unit, used for inputting the second prompt data into the second machine learning model to obtain a sample formula description and a sample parameter explanation output by the second machine learning model;
[0061] A sample table formula parsing unit, used to parse the sample table formula using a formula parsing class to obtain a sample function list of the sample table formula;
[0062] A name search unit, configured to search, for any sample function identifier in the sample function list, a first function identifier that is consistent with the sample function identifier from a preset function identifier set;
[0063] The function interpretation determining unit is used to search for a first function interpretation corresponding to the first function identifier, and determine the first function interpretation as the sample function interpretation of the sample function corresponding to the sample function identifier.
[0064] In an optional implementation, the sample table formula parsing unit is specifically used to:
[0065] Using the formula parsing class, the sample table formula is decomposed to obtain multiple substrings, each of which has a corresponding type;
[0066] For any of the substrings, determining whether the type of the substring is the first type;
[0067] When the type of the substring is the first type, a sample function identifier is extracted from the substring and stored in a sample function list.
[0068] In an optional implementation, the sample output data setting submodule specifically includes:
[0069] A sample formula description and sample parameter explanation judgment unit, used to judge whether the sample formula description and the sample parameter explanation meet preset quality requirements;
[0070] A sample output data setting unit is used to set the formula description value in the sample output data to the sample formula description, set the function explanation value in the sample output data to the sample function explanation, and set the parameter explanation value in the sample output data to the sample parameter explanation when the sample formula description and the sample parameter explanation meet the preset quality requirements.
[0071] In an optional implementation, the sample formula description and sample parameter interpretation and judgment unit specifically includes:
[0072] A first semantic fluency determination subunit, used to determine a first semantic fluency of the sample formula description;
[0073] A first table formula generating subunit, used for generating a first table formula according to the sample table data and the sample formula description;
[0074] A second semantic fluency determination subunit, used to determine a second semantic fluency of the sample parameter interpretation;
[0075] A sample table formula parsing subunit, used to parse the sample table formula using a formula parsing class to obtain a sample parameter list of the sample table formula;
[0076] The first subunit for judging sample formula description and sample parameter interpretation is used to judge whether the difference between the first semantic fluency and the first preset value is less than the first preset difference threshold, whether the first table formula is consistent with the sample table formula, whether the difference between the second semantic fluency and the second preset value is less than the second preset difference threshold, and whether there is a corresponding sample parameter interpretation for each sample parameter in the sample parameter list;
[0077] or,
[0078] The second sub-unit for judging the sample formula description and the sample parameter explanation is used to judge whether the difference between the first semantic fluency and the first preset value is less than the first preset difference threshold, whether the execution result of the first table formula in the sample table is consistent with the execution result of the sample table formula in the sample table, whether the difference between the second semantic fluency and the second preset value is less than the second preset difference threshold, and whether there is a corresponding sample parameter explanation for each sample parameter in the sample parameter list.
[0079] In an optional implementation, the sample output data setting unit is specifically used to:
[0080] When the difference between the first semantic fluency and the first preset value is less than the first preset difference threshold, the first table formula is consistent with the sample table formula, the difference between the second semantic fluency and the second preset value is less than the second preset difference threshold, and each of the sample parameters in the sample parameter list has a corresponding sample parameter explanation, the formula description value in the sample output data is set to the sample formula description, the function explanation value in the sample output data is set to the sample function explanation, and the parameter explanation value in the sample output data is set to the sample parameter explanation;
[0081] or,
[0082] When the difference between the first semantic fluency and the first preset value is less than the first preset difference threshold, the execution result of the first table formula in the sample table is consistent with the execution result of the sample table formula in the sample table, the difference between the second semantic fluency and the second preset value is less than the second preset difference threshold, and each of the sample parameters in the sample parameter list has a corresponding sample parameter explanation, the formula description value in the sample output data is set to the sample formula description, the function interpretation value in the sample output data is set to the sample function interpretation, and the parameter interpretation value in the sample output data is set to the sample parameter explanation.
[0083] In an optional implementation, the first semantic fluency determination subunit is specifically used to:
[0084] Inputting the sample formula description into a semantic fluency evaluation model to obtain a first score, and determining the first score as a first semantic fluency of the sample formula description;
[0085] The second semantic fluency determination subunit is specifically used for:
[0086] The sample parameter interpretation is input into a semantic fluency evaluation model to obtain a second score, and the second score is determined as a second semantic fluency of the sample parameter interpretation.
[0087] In an optional implementation, the sample table formula parsing subunit is specifically used for:
[0088] Using the formula parsing class, the sample table formula is decomposed to obtain multiple substrings, each of which has a corresponding type;
[0089] For any of the substrings, determining whether the type of the substring is the second type;
[0090] When the type of the substring is the second type, the substring is determined as a sample parameter and stored in a sample parameter list.
[0091] In an optional embodiment, the sample prompt data input module is specifically used for:
[0092] Perform padding processing on the sample prompt data so that the sample prompt data after padding reaches a preset length;
[0093] Input the filled sample prompt data into the first machine learning model to obtain the first meaning of the sample table formula output by the first machine learning model.
[0094] In an optional embodiment, the device further comprises:
[0095] A test table formula acquisition module is used to obtain the test table formula;
[0096] A test table determination module, used to determine a test table associated with the test table formula, wherein the test table is a table involved in generating the test table formula;
[0097] A test table data acquisition module, used to acquire the test table data in the test table;
[0098] A test prompt data construction module, used to construct the test prompt data of the pre-trained first machine learning model based on the test table data and the test table formula;
[0099] A test prompt data input module, used for inputting the test prompt data into the pre-trained first machine learning model, and obtaining a third meaning of the test table formula output by the pre-trained first machine learning model;
[0100] A prediction effect analysis module is used to analyze the prediction effect of the pre-trained first machine learning model according to the third meaning.
[0101] In an optional embodiment, the test prompt data includes test instruction data, test input data and test output data;
[0102] The test prompt data construction module is specifically used for:
[0103] Combining the test table data with the test table formula to obtain the test instruction data, and leaving the test input data blank;
[0104] The formula explanation value, function explanation value and parameter explanation value in the test output data are respectively set to blank;
[0105] The test prompt data of the pre-trained first machine learning model is composed of the test instruction data, the test input data and the test output data.
[0106] In an optional implementation, the test prompt data input module is specifically used for:
[0107] Perform padding processing on the test prompt data so that the padded test prompt data reaches a preset length;
[0108] Input the filled test prompt data into the pre-trained first machine learning model to obtain the third meaning of the test table formula output by the pre-trained first machine learning model.
[0109] In an optional embodiment, the third meaning includes at least one of the following: a test formula description of the test table formula, a test function explanation of the test function in the test table formula, and a test parameter explanation of the test parameter in the test function;
[0110] The prediction effect analysis module specifically includes:
[0111] A third fluency determination submodule, used to determine a third fluency of the test formula description;
[0112] A first correctness determination submodule, used to determine a first correctness of the test formula description;
[0113] A second correctness determination submodule, with which the user determines a second correctness of the test function interpretation;
[0114] a fourth fluency determination submodule, configured to determine a fourth fluency of the test parameter interpretation;
[0115] A third correctness determination submodule, used to determine a third correctness of the test parameter interpretation;
[0116] The prediction effect analysis submodule is used to comprehensively analyze the prediction effect of the pre-trained first machine learning model by combining the third fluency, the first accuracy, the second accuracy, the fourth fluency and the third accuracy.
[0117] In an optional implementation, the third fluency determination submodule is specifically configured to:
[0118] Inputting the test formula description into a semantic fluency evaluation model to obtain a third score, and determining the third score as a third fluency of the test formula description;
[0119] The fourth fluency determination submodule is specifically used for:
[0120] The test parameter interpretation is input into a semantic fluency evaluation model to obtain a fourth score, and the fourth score is determined as a fourth fluency of the test parameter interpretation.
[0121] In an optional implementation, the first correctness determination submodule is specifically configured to:
[0122] Generate a second table formula according to the test table data and the test formula description;
[0123] Comparing the formula consistency of the second table formula and the test table formula, and determining the first correctness of the test formula description according to the formula consistency;
[0124] or,
[0125] Comparing the consistency of the execution result of the second table formula in the test table with the execution result of the test table formula in the test table;
[0126] Based on the result consistency, a first correctness of the test formula description is determined.
[0127] In an optional implementation, the second accuracy determination submodule is specifically configured to:
[0128] Obtaining a test function identifier of a test function in the test table formula, and searching a preset function identifier set for a second function identifier that is consistent with the test function identifier;
[0129] Finding a second function interpretation corresponding to the second function identifier, and determining a matching degree between the second function interpretation and the test function interpretation;
[0130] The degree of match is determined as a second degree of correctness of the test function interpretation.
[0131] In an optional implementation, the formula acquisition module is specifically used to:
[0132] In response to a preset operation on a cell in a table, displaying a corresponding table formula in the cell;
[0133] In response to an interpretation operation on a table formula corresponding to the cell, obtaining the table formula corresponding to the cell, and determining the table formula corresponding to the cell as a target table formula;
[0134] The device also includes:
[0135] The dialog box display module is used to display a dialog box, wherein the dialog box displays at least one of the formula description, the function explanation, and the parameter explanation.
[0136] In a third aspect of the embodiments of the present application, there is further provided an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0137] Memory, used to store computer programs;
[0138] The processor is used to implement any of the table formula interpretation methods described in the first aspect above when executing a program stored in the memory.
[0139] In a fourth aspect of an embodiment of the present application, a storage medium is further provided, wherein instructions are stored in the storage medium, and when the storage medium is run on a computer, the computer executes any of the table formula interpretation methods described in the first aspect above.
[0140] In a fifth aspect of the embodiments of the present application, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute any of the above-mentioned table formula interpretation methods.
[0141] The technical solution provided by the embodiment of the present application obtains a target table formula, determines a target table associated with the target table formula, the target table is a table involved in generating the target table formula, obtains table data in the target table, and interprets the target meaning of the target table formula based on the table data and the target table formula. The target meaning of the target table formula includes at least one of the following: a formula description of the target table formula, a function interpretation of the target function in the target table formula, and a parameter interpretation of the target parameter in the target function. By obtaining the target table formula and determining the target table associated with the target table formula, the target meaning of the target table formula is interpreted based on the table data in the target table and the target table formula. In this way, the target meaning of the target table formula is interpreted based on the table data in the target table and the target table formula. The specific meaning of the column index in the target table formula can be well interpreted, and the semantic generalization is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0142] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0143] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0144] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0145] Figure 1 A schematic diagram of an implementation flow of a table formula interpretation method shown in an embodiment of the present application;
[0146] Figure 2 A schematic diagram of a formula explanation, function explanation, and parameter explanation shown in the embodiments of the present application;
[0147] Figure 3 It is a schematic diagram of the implementation process of another table formula interpretation method shown in the embodiment of the present application;
[0148] Figure 4 A schematic diagram of an explanation of a blank table formula shown in an embodiment of the present application;
[0149] Figure 5 A schematic diagram of explaining a single-table formula shown in an embodiment of the present application;
[0150] Figure 6 A schematic diagram of explaining a multi-table formula shown in an embodiment of the present application;
[0151] Figure 7 A schematic diagram of an implementation process of a first machine learning model training method shown in an embodiment of the present application;
[0152] Figure 8 A schematic diagram of an implementation flow of a method for determining meaning shown in an embodiment of the present application;
[0153] Fig. 9 A schematic diagram of an implementation flow of a first machine learning model testing method shown in an embodiment of the present application;
[0154] Fig.10It is a structural schematic diagram of a table formula interpretation device shown in an embodiment of the present application;
[0155] Fig.11 It is a schematic diagram of the structure of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION
[0156] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, 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 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 making creative work are within the scope of protection of this application.
[0157] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0158] It should be noted that the table formulas involved in the embodiments of the present application actually refer to function formulas in the table, such as the SUM function, AVERAGE function, VLOOKUP function, etc., which are different from specific calculation formulas. For example, the calculation formula may be y=ax+b, and the table formula is different from this type of calculation formula.
[0159] like Figure 1 FIG. 1 is a schematic diagram of an implementation flow of a table formula interpretation method provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:
[0160] S101, obtaining a target table formula, and determining a target table associated with the target table formula, where the target table is a table involved in generating the target table formula.
[0161] In an embodiment of the present application, a target table formula can be obtained, where the target table formula is a table formula to be explained, which can be a table formula embedded in a cell. For a table formula, it can be a single table formula, or a nested table formula, or an arithmetic operation table formula.
[0162] For the target table formula, the target table associated with the target table formula can be determined, wherein the target table is the table involved in generating the target table formula, which means that generating the target table formula needs to rely on the table, and the table on which the target table formula depends needs to be determined.
[0163] It should be noted that the target table can be an empty table, or a single table, or multiple tables, which means that it can support empty table formula interpretation, single table formula interpretation and multiple table formula interpretation, and the embodiments of the present application do not limit this.
[0164] S102, obtaining table data in the target table, and interpreting the target meaning of the target table formula based on the table data and the target table formula.
[0165] In an embodiment of the present application, for a target table, table data in the target table can be obtained, where the table data refers to data embedded in cells of the target table, which can be used to participate in the interpretation of formulas in the target table.
[0166] Therefore, in order to explain the target meaning of the target table formula, the table data in the target table is added on the basis of the target table formula, and the target meaning of the target table formula is explained based on the table data and the target table formula.
[0167] In this way, based on the table data and the target table formula in the target table, the target meaning of the target table formula is explained, the specific meaning of the column index in the target table formula (corresponding to the parameters in the target table formula, such as A1:A10) can be well explained, and the semantic generalization is improved.
[0168] It should be noted that, as for the target meaning of the target table formula, it can be understood that it includes at least one of the following: the formula description (or formula meaning) of the target table formula, the function interpretation of the target function in the target table formula, and the parameter interpretation of the target parameter in the target function.
[0169] Formula description can be understood as an explanation of the function of the formula in the target table, such as Figure 2 As shown, for the target table formula, which usually includes the target function, the function interpretation of the target function can be understood as an explanation of the role of the target function, such as Figure 2 As shown in , parameter explanation can be understood as an explanation of the target parameters in the target function, such as Figure 2 shown.
[0170] Through the above description of the technical solution provided in the embodiment of the present application, the target table formula is obtained, the target table associated with the target table formula is determined, the target table is the table involved in generating the target table formula, the table data in the target table is obtained, and based on the table data and the target table formula, the target meaning of the target table formula is explained, and the target meaning of the target table formula includes at least one of the following: a formula description of the target table formula, a function interpretation of the target function in the target table formula, and a parameter interpretation of the target parameter in the target function.
[0171] By obtaining the target table formula and determining the target table associated with the target table formula, the target meaning of the target table formula is interpreted based on the table data in the target table and the target table formula. In this way, the target meaning of the target table formula is interpreted based on the table data in the target table and the target table formula. The specific meaning of the column index in the target table formula can be well explained and the semantic generalization is improved.
[0172] In addition, in the embodiment of the present application, the first machine learning model can be used to interpret the target meaning of the target table formula. Figure 3 FIG. 1 is a schematic diagram of an implementation flow of another table formula interpretation method provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:
[0173] S301, in response to a preset operation on a cell in a table, displaying a corresponding table formula in the cell.
[0174] In an embodiment of the present application, a user can open a spreadsheet software, thereby displaying a table in the spreadsheet software, and the user can perform preset operations on cells in the table, such as a double-click operation or a single-click operation.
[0175] The cell here has a table formula embedded in it, so that in response to a preset operation on the cell in the table, the corresponding table formula in the cell is activated, and then the corresponding table formula in the cell can be displayed in the navigation bar of the spreadsheet software.
[0176] S302, in response to the interpretation operation on the corresponding table formula in the cell, obtain the corresponding table formula in the cell, and determine the corresponding table formula in the cell as the target table formula.
[0177] In an embodiment of the present application, for the corresponding table formula in the cell, the user can perform a corresponding interpretation operation, so that in response to the interpretation operation on the corresponding table formula in the cell, the corresponding table formula in the cell can be obtained, and the corresponding table formula in the cell can be determined as the target table formula, so as to facilitate the subsequent interpretation of the corresponding table formula in the cell.
[0178] Among them, for spreadsheet software, a table formula explanation button is set in the navigation bar. The user can click this table formula explanation button to trigger the explanation operation of the corresponding table formula in the cell, and then respond to the explanation operation of the corresponding table formula in the cell, obtain the corresponding table formula in the cell, and determine the corresponding table formula in the cell as the target table formula.
[0179] S303, determining a target table associated with the target table formula, where the target table is a table involved in generating the target table formula.
[0180] In the embodiment of the present application, this step is similar to the above-mentioned step S101, and the embodiment of the present application will not be described one by one here.
[0181] S304, obtaining table data in the target table, and constructing first prompt data of a pre-trained first machine learning model based on the table data and the target table formula.
[0182] In an embodiment of the present application, the table data in the target table is obtained, and based on the table data and the target table formula, the first prompt data of the pre-trained first machine learning model is constructed. The pre-trained first machine learning model here can be a deep learning model, such as a large language model, specifically StarCoder (a language model trained on source code and natural language text).
[0183] StarCoder is a large-scale code language model (CodeLLM) trained on GitHub licensed data, including more than 80 programming languages, Git commits, GitHub issues, and Jupyter notebooks. With a context length of more than 8,000 tokens, the StarCoder model can handle more inputs than any other open LLM, enabling a variety of interesting applications.
[0184] Starcoder needs to indicate the task details during training for different tasks, which can better enable the model to utilize different tasks; in the tokenizer processing stage, the BPE method in transformers is used to count the vocabulary; for the model structure of starcoder, it is based on the GPT2 structure, using absolute position encoding processing, multi-queryattention and flaskattention as the attention method, and the training method is Fill-in-the-middle. The final training length is determined to be 8K.
[0185] For the pre-trained first machine learning model, it has certain format requirements for input, that is, the first prompt data includes three parts: instruction data, input data and output data. Among them, the instruction data is constructed by adding the table data to the target table formula, the input data is left blank, and the output data is a json string in the form of key-value, where the key is the formula description key, function explanation key and parameter explanation key, and the value is the corresponding formula description value, function explanation value and parameter explanation value.
[0186] Thus, the table data and the target table formula can be combined to obtain the instruction data, and the input data can be left blank (here, since the input data is already included in the instruction data, the input data here can be left blank). In addition, this is the model prediction stage, the key in the corresponding output data remains unchanged, and the value needs to be left blank. To this end, the formula description value, function explanation value, and parameter explanation value in the output data are left blank respectively, while the formula description key, function explanation key, and parameter explanation key remain unchanged. Finally, the instruction data, input data, and output data constitute the first prompt data of the pre-trained first machine learning model.
[0187] It should be noted that the key and value in the output data can be adjusted according to the target meaning of the target table formula of the final output. If the target meaning only includes the formula description of the target table formula, then the output data only includes the formula description key and the formula description value, and only the formula description value is set to blank. The embodiment of the present application does not limit this.
[0188] S305: Input the first prompt data into a pre-trained first machine learning model to obtain a target meaning of a target table formula output by the pre-trained first machine learning model.
[0189] In an embodiment of the present application, for the first prompt data, the first prompt data can be input into a pre-trained first machine learning model to obtain the target meaning of the target table formula output by the pre-trained first machine learning model.
[0190] As for the target meaning of the target table formula, it can be understood that it includes at least one of the following: a formula description of the target table formula, a function explanation of the target function in the target table formula, and a parameter explanation of the target parameter in the target function.
[0191] In addition, in the embodiment of the present application, the target meaning for the table formula interpretation is limited in length, and the first prompt data can be padded so that the padded first prompt data reaches a preset length, and the padded first prompt data is input into the pre-trained first machine learning model to obtain the target meaning of the target table formula output by the pre-trained first machine learning model. Experiments have proved the limited nature of the above-mentioned transformation scheme, which can improve the quality of the target meaning of the target table formula generated by the pre-trained first machine learning model.
[0192] It should be noted that the first prompt data may be padded with blank characters, and the padded blank characters may be at the end of the first prompt data without affecting the valid data in the first prompt data.
[0193] S306, displaying a dialog box, wherein the dialog box displays at least one of a formula explanation, a function explanation, and a parameter explanation.
[0194] In an embodiment of the present application, the target meaning of the target table formula, including at least one of the following: the formula description of the target table formula, the function explanation of the target function in the target table formula, and the parameter explanation of the target parameter in the target function, can be displayed in a dialog box, so that the dialog box is displayed in the spreadsheet software, which can help users understand the table formula more friendly and reduce the learning cost of the table formula.
[0195] Among them, after the explanation operation for the corresponding table formula in the cell is triggered, the target meaning of the target table formula can be explained based on the table data and the target table formula in the target table, so as to be displayed in the dialog box, and then the dialog box is displayed, such as Figure 4 In addition, the present application also supports single-table table formula interpretation, which means that the table formula involves only one table, such as Figure 5 The schematic diagram of single-table table formula interpretation shown in the figure also supports multi-table table formula interpretation, which means that the table formula involves multiple tables, such as Figure 6 Schematic diagram of the multi-table formula explanation shown.
[0196] In this way, based on the table data and the target table formula, the first prompt data of the pre-trained first machine learning model is constructed, and the first prompt data is input into the pre-trained first machine learning model to obtain the target meaning of the target table formula output by the pre-trained first machine learning model. The specific meaning of the column index in the target table formula can be well explained, and the semantic generalization is improved. In addition, the target meaning of the target table formula is displayed in the form of a dialog box, which can help users understand the table formula in a more friendly way and reduce the learning cost of the table formula.
[0197] In addition, before using the first machine learning model to interpret the target meaning of the target table formula, the first machine learning model needs to be fine-tuned. Figure 7 FIG. 1 is a schematic diagram of an implementation flow of a first machine learning model training method provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:
[0198] S701, obtaining a sample table formula, and determining a sample table associated with the sample table formula, where the sample table is a table involved in generating the sample table formula.
[0199] In an embodiment of the present application, a sample table formula is obtained, where the sample table formula is an accumulated historical table formula, and it is necessary to determine the sample table associated with the sample table formula. The sample table is the table involved in generating the sample table formula, that is, determine the sample table on which the sample table formula depends.
[0200] S702, obtaining sample table data in the sample table, and constructing sample prompt data of the first machine learning model based on the sample table data and the sample table formula.
[0201] In an embodiment of the present application, for a sample table, sample table data in the sample table can be obtained, where the sample table data refers to data embedded in a cell of the sample table, and based on the sample table data and the sample table formula, sample prompt data of a first machine learning model is constructed. The first machine learning model here can be a deep learning model, such as a large language model, specifically StarCoder.
[0202] For the first machine learning model, it has certain format requirements for input, that is, the sample prompt data includes three parts: sample instruction data, sample input data and sample output data. Among them, the sample instruction data is constructed by using the sample table data plus the sample table formula, the sample input data is left blank, and the sample output data is a json string in the form of key-value, where the key is the formula description key, function explanation key and parameter explanation key, and the value is the corresponding formula description value, function explanation value and parameter explanation value.
[0203] Thus, the sample table data and the sample table formula are combined to obtain the sample instruction data, and the sample input data is left blank. In addition, this is the model training stage, the key in the corresponding sample output data remains unchanged, and the value needs to be filled. For this purpose, the second meaning of the sample table formula is determined, and the second meaning includes at least one of the following: the sample formula description of the sample table formula, the sample function explanation of the sample function in the sample table formula, and the sample parameter explanation of the sample parameter in the sample function. The formula description value in the sample output data is set to the sample formula description, the function explanation value in the sample output data is set to the sample function explanation, and the parameter explanation value in the sample output data is set to the sample parameter explanation. Finally, the sample instruction data, the sample input data, and the sample output data constitute the sample prompt data of the first machine learning model.
[0204] It should be noted that the key and value in the sample output data can be adjusted according to the first meaning of the sample table formula that is finally output. If the first meaning only includes the formula description of the sample table formula, then the sample output data only includes the formula description key and the formula description value, thereby determining the sample formula description of the sample table formula, and setting the formula description value in the sample output data to the sample formula description. The embodiment of the present application does not limit this.
[0205] The second meaning of the sample table formula can be determined by means of a second machine learning model and an expert system. Here, the second meaning includes a sample formula description of the sample table formula, a sample function explanation of the sample function in the sample table formula, and a sample parameter explanation of the sample parameter in the sample function. Specifically, Figure 8 FIG. 1 is a schematic diagram of an implementation flow of a method for determining meaning provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:
[0206] S801, combining the sample table data and the sample table formula to obtain second prompt data of the second machine learning model.
[0207] S802, input the second prompt data into the second machine learning model to obtain the sample formula description and sample parameter explanation output by the second machine learning model.
[0208] In an embodiment of the present application, a second machine learning model can be used, and the second machine learning model can be a deep learning model, such as a generative pre-trained Transformer model (GPT), to obtain a sample formula description and a sample parameter explanation. GPT is an Internet-based, data-available, text-generated deep learning model. The Transformer neural network architecture uses a self-attention mechanism to focus on different parts of the input text in each processing step. The Transformer model can capture more context and improve the performance of natural language processing (NLP) tasks.
[0209] Based on this, for the sample table data and sample table formulas, the sample table data and the sample table formulas can be combined to construct a reasonable prompt, that is, the second prompt data of the second machine learning model, and the second prompt data is input into the second machine learning model to obtain the sample formula description and sample parameter explanation output by the second machine learning model.
[0210] It should be noted that the sample formula description and sample parameter explanation output by the second machine learning model can be adjusted according to the first meaning of the sample table formula finally output. If the first meaning only includes the formula description of the sample table formula, then the second machine learning model outputs the sample formula description, or steps S801 and S802 here can be omitted, which means that the first meaning only includes the function explanation. The embodiments of the present application are not limited to this.
[0211] In addition, the first machine learning model and the second machine learning model differ in the generated content. The generated content of the first machine learning model includes one more function explanation of the sample function in the sample table formula than the generated content of the second machine learning model. In addition, the sample formula description and sample parameter explanation generated by the second machine learning model are used to construct the training data of the first machine learning model for fine-tuning the first machine learning model.
[0212] S803, using the formula parsing class to parse the sample table formula to obtain a sample function list of the sample table formula.
[0213] S804: For any sample function identifier in the sample function list, search for a first function identifier that is consistent with the sample function identifier from a preset function identifier set.
[0214] S805 , searching for a first function interpretation corresponding to the first function identifier, and determining the first function interpretation as a sample function interpretation of the sample function corresponding to the sample function identifier.
[0215] In the embodiment of the present application, the sample function interpretation is processed by an expert system. The design of the expert system is to parse the table formula through openpyxl.formula.Tokenizer and output the function list of the table formula. For the functions supported by the spreadsheet software, there are corresponding descriptions inside these functions. The field form of the function name and function interpretation can be constructed through internal data. Subsequently, the corresponding function interpretation can be output by the expert system for different functions.
[0216] Based on this, the sample table formula is parsed using a formula parsing class (such as the openpyxl.formula.Tokenizer mentioned above) to obtain a sample function list of the sample table formula. For any sample function identifier in the sample function list, a first function identifier consistent with the sample function identifier is searched from a preset function identifier set, and a first function interpretation corresponding to the first function identifier is searched, and the first function interpretation is determined as the sample function interpretation of the sample function corresponding to the sample function identifier.
[0217] Among them, for the formula parsing class, the sample table formula can be decomposed to obtain multiple substrings, each substring has a corresponding type, and for any substring, it is determined whether the type of the substring is the first type, wherein the first type is a function tag (for example, a FUNC tag, a function call is decomposed with parameters as tags, for example, the formula SUM(a, b) will be decomposed into "SUM(", "parameters", and then the closure, i.e. ")". The function name and the left bracket together constitute a FUNC tag, such as "SUM(", and the matching right bracket constitutes another FUNC tag, such as ")"). When the type of the substring is the first type, the sample function identifier is extracted from the substring and stored in the sample function list.
[0218] For example, for the sample table formula: =IF($A$1, "then True", MAX(DEFAULT_VAL, 'Sheet2'!B1)), the sample table formula can be decomposed into its constituent tokens using the formula parsing class, that is, multiple substrings are decomposed, and each substring has a corresponding type and subtype, as shown in Table 1 below.
[0219]
[0220]
[0221] Table 1
[0222] For the substring "IF(", its type is a FUNC tag, which consists of the function name "IF" and the left bracket "(", and the function name "IF" can be extracted and stored in the sample function list. In addition, for the substring ")", although its type is a FUNC tag, it only consists of the right bracket ")" and does not contain the function name "IF", so it can be filtered out.
[0223] In addition, for the sample formula description and sample parameter explanation output by the second machine learning model, it is necessary to test their data quality. Only after the data quality is qualified can it be used to construct the sample prompt data of the first machine learning model. To this end, it is necessary to determine whether the sample formula description and the sample parameter explanation meet the preset quality requirements. If the sample formula description and the sample parameter explanation meet the preset quality requirements, the formula description value in the sample output data is set to the sample formula description, the function explanation value in the sample output data is set to the sample function explanation, and the parameter explanation value in the sample output data is set to the sample parameter explanation. It should be noted that if the first meaning of the final output only includes the function explanation, there is no need to perform quality inspection on the sample formula description and the sample parameter explanation.
[0224] Specifically, determine the first semantic fluency of the sample formula description, and generate a first table formula based on the sample table data and the sample formula description (here the sample table data and the sample formula description can be input into the formula generation service to obtain the first table formula), determine the second semantic fluency of the sample parameter interpretation, and use the formula parsing class to parse the sample table formula to obtain a sample parameter list of the sample table formula, and judge whether the difference between the first semantic fluency and a first preset value (for example, 0) is less than a first preset difference threshold, whether the first table formula is consistent with the sample table formula, whether the difference between the second semantic fluency and the second preset value is less than the second preset difference threshold, and whether there is a corresponding sample parameter interpretation for each sample parameter in the sample parameter list.
[0225] When the difference between the first semantic fluency and the first preset value is less than the first preset difference threshold, the first table formula is consistent with the sample table formula, the difference between the second semantic fluency and the second preset value is less than the second preset difference threshold, and each sample parameter in the sample parameter list has a corresponding sample parameter explanation (meaning that in the sample parameter explanation output by the second machine learning model, each sample parameter can find the corresponding sample parameter explanation), the formula description value in the sample output data is set to the sample formula description, the function explanation value in the sample output data is set to the sample function explanation, and the parameter explanation value in the sample output data is set to the sample parameter explanation.
[0226] Alternatively, determine whether the difference between the first semantic fluency and the first preset value is less than the first preset difference threshold, whether the execution result of the first table formula in the sample table (referring to the result generated by executing the first table formula, such as executing the SUM function, which can be summed, and this sum is the execution result) is consistent with the execution result of the sample table formula in the sample table, whether the difference between the second semantic fluency and the second preset value is less than the second preset difference threshold, and whether there is a corresponding sample parameter explanation for each sample parameter in the sample parameter list.
[0227] When the difference between the first semantic fluency and the first preset value is less than the first preset difference threshold, the execution result of the first table formula in the sample table is consistent with the execution result of the sample table formula in the sample table, the difference between the second semantic fluency and the second preset value is less than the second preset difference threshold, and each sample parameter in the sample parameter list has a corresponding sample parameter explanation, the formula description value in the sample output data is set to the sample formula description, the function explanation value in the sample output data is set to the sample function explanation, and the parameter explanation value in the sample output data is set to the sample parameter explanation.
[0228] The semantic fluency of the sample formula description and the sample parameter explanation is evaluated by the semantic fluency evaluation model. Specifically, the sample formula description is input into the semantic fluency evaluation model to obtain a first score, which is determined as the first semantic fluency of the sample formula description, and the sample parameter explanation is input into the semantic fluency evaluation model to obtain a second score, which is determined as the second semantic fluency of the sample parameter explanation.
[0229] It should be noted that for the semantic fluency evaluation model, such as ngrams, GPT, masked BERT or KENLM, its input is a sentence of formula description and parameter explanation, and its output is a score. There are two scoring functions, namely score and perplexity. For the score function, its value is negative. The larger the value, the higher the quality of sample formula description and sample parameter explanation generation. For the perplexity function, its value is positive. The smaller the value, the higher the quality of sample formula description and sample parameter explanation generation. This means that no matter which scoring function is used, the score approaches 0, which means that the sample formula description and sample parameter explanation generation quality is higher, and the sample formula description and sample parameter explanation are available. Therefore, it is necessary to judge whether the difference between the first semantic fluency and the first preset value is less than the first preset difference threshold, and whether the difference between the second semantic fluency and the second preset value is less than the second preset difference threshold.
[0230] In addition, the formula parsing class is used to decompose the sample table formula to obtain multiple substrings, each of which has a corresponding type; for any substring, it is determined whether the type of the substring is the second type, and the second type is a parameter marker (such as the OPERAND marker, a general term for any value in the table formula); when the type of the substring is the second type, the substring is determined as a sample parameter and stored in the sample parameter list.
[0231] For example, for the sample table formula: =IF($A$1, "then True", MAX(DEFAULT_VAL, 'Sheet2'!B1)), the sample table formula can be decomposed into its constituent tokens using the formula parsing class, that is, multiple substrings are decomposed, and each substring has a corresponding type and subtype, as shown in Table 1 above. For the substring "$A$1", its type is the OPERAND token, and the substring "$A$1" can be determined as a sample parameter and stored in the sample parameter list.
[0232] After the above data quality detection and processing, the available sample formula descriptions and sample parameter explanations can be retained. The available sample formula descriptions and sample parameter explanations can also be manually verified. After the manual verification is passed, the formula description value in the sample output data is set to the sample formula description, the function explanation value in the sample output data is set to the sample function explanation, and the parameter explanation value in the sample output data is set to the sample parameter explanation. If the verification fails, it needs to be modified.
[0233] It should be noted that, for the sample prompt data, the second meaning of the sample table formula included therein includes at least one of the following: the sample formula description of the sample table formula, the sample function explanation of the sample function in the sample table formula, and the sample parameter explanation of the sample parameter in the sample function.
[0234] S703, input the sample prompt data into the first machine learning model to obtain the first meaning of the sample table formula output by the first machine learning model.
[0235] In an embodiment of the present application, the sample prompt data can be input into the first machine learning model to obtain the first meaning of the sample table formula output by the first machine learning model. The first meaning, as can be understood, includes at least one of the following: a formula description of the sample table formula, a function explanation of the sample function in the sample table formula, and a parameter explanation of the sample parameter in the sample function.
[0236] In addition, the generation length of the first machine learning model is limited, and 1024 is set as the generation upper limit, so the sample prompt data of the first machine learning model is padded according to the length of 1024. Therefore, the sample prompt data is padded so that the padded sample prompt data reaches a preset length, and the padded sample prompt data is input into the first machine learning model to obtain the first meaning of the sample table formula output by the first machine learning model, so as to improve the quality of the first meaning of the sample table formula output by the first machine learning model.
[0237] S704, determining an error between the first meaning and the second meaning of the sample table formula in the sample prompt data.
[0238] In an embodiment of the present application, the error between the first meaning of the sample table formula output by the first machine learning model and the second meaning of the sample table formula in the sample prompt data can be determined.
[0239] Specifically, the first meaning can be understood to include at least one of the following: a formula description of a sample table formula, a function explanation of a sample function in a sample table formula, and a parameter explanation of a sample parameter in a sample function.
[0240] The second meaning, as can be understood, includes at least one of the following: a sample formula description of a sample table formula, a sample function explanation of a sample function in a sample table formula, and a sample parameter explanation of a sample parameter in a sample function.
[0241] Thus, the first error between the formula description and the sample formula description is determined, the second error between the function interpretation and the sample function interpretation is determined, and the third error between the parameter interpretation and the sample parameter interpretation is determined. The above error can be obtained by weighted summing at least one of the three errors.
[0242] S705: Train the first machine learning model according to the error, and stop the model training when the error meets the convergence condition to obtain the pre-trained first machine learning model.
[0243] In an embodiment of the present application, the first machine learning model can be trained based on the error, and when the error meets the convergence condition (for example, the error is less than a certain threshold), the model training is stopped. At this time, the fine-tuning of the first machine learning model is completed, and the pre-trained first machine learning model can be obtained.
[0244] In addition, for the pre-trained first machine learning model, it is necessary to make predictions through the test set and analyze its prediction effect. Since the pre-trained first machine learning model is a generative task, it is necessary to analyze the prediction effect from multiple aspects, namely: the semantic fluency of the formula description, the correctness of the formula description, the correctness of the function interpretation, the fluency of the parameter interpretation, and the correctness of the parameter interpretation. Based on this, Fig. 9 As shown, it is a schematic diagram of an implementation process of a first machine learning model testing method provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:
[0245] S901, obtaining a test table formula, and determining a test table associated with the test table formula, where the test table is a table involved in generating the test table formula.
[0246] In an embodiment of the present application, a test table formula is obtained, and a test table associated with the test table formula is determined, wherein the test table is a table involved in generating the test table formula, which means that the table on which the test table formula depends needs to be determined.
[0247] S902, obtaining test table data in the test table, and constructing test prompt data of the pre-trained first machine learning model based on the test table data and the test table formula.
[0248] In an embodiment of the present application, for a test table, test table data in the test table is obtained, wherein the test table data refers to data embedded in a cell of the test table. And based on the test table data and the test table formula, test prompt data of a pre-trained first machine learning model is constructed.
[0249] Among them, for the pre-trained first machine learning model, it has certain format requirements for input, that is, the test prompt data includes three parts: test instruction data, test input data, and test output data. Among them, the test instruction data is constructed by using the test table data plus the test table formula, the test input data is left blank, and the test output data is a json string in the form of key-value, where the key is the formula description key, function explanation key, and parameter explanation key, and the value is the corresponding formula description value, function explanation value, and parameter explanation value.
[0250] Thus, the test table data is combined with the test table formula to obtain the test instruction data, and the test input data is set to blank. In addition, this is the model testing stage, the key in the corresponding test output data remains unchanged, and the value needs to be set to blank. For this purpose, the formula description value, function explanation value, and parameter explanation value in the test output data are set to blank respectively, and the test instruction data, test input data, and test output data constitute the test prompt data of the pre-trained first machine learning model.
[0251] It should be noted that the key and value in the test output data can be adjusted according to the third meaning of the test formula finally output. If the third meaning only includes the formula description of the test formula, then the test output data only includes the formula description key and the formula description value, thereby setting the formula description value in the test output data to blank. The embodiments of the present application do not limit this.
[0252] S903, input the test prompt data into the pre-trained first machine learning model, and obtain the third meaning of the test table formula output by the pre-trained first machine learning model.
[0253] In an embodiment of the present application, for test prompt data, the test prompt data can be input into a pre-trained first machine learning model to obtain a third meaning of the test table formula output by the pre-trained first machine learning model.
[0254] Among them, the test prompt data is padded so that the padded test prompt data reaches a preset length, and the padded test prompt data is input into the pre-trained first machine learning model to obtain the third meaning of the test table formula output by the pre-trained first machine learning model.
[0255] It should be noted that the third meaning of the test table formula includes at least one of the following: the test formula description of the test table formula, the test function explanation of the test function in the test table formula and the test parameter explanation of the test parameter in the test function.
[0256] S904: Analyze the prediction effect of the pre-trained first machine learning model according to the third meaning.
[0257] In an embodiment of the present application, the prediction effect of the pre-trained first machine learning model is analyzed according to the third meaning. The third meaning of the test table formula includes at least one of the following: a test formula description of the test table formula, a test function explanation of the test function in the test table formula, and a test parameter explanation of the test parameter in the test function.
[0258] Therefore, the third fluency of the test formula description is determined, as well as the first correctness of the test formula description, the second correctness of the test function explanation is determined, the fourth fluency of the test parameter explanation is determined, as well as the third correctness of the test parameter explanation is determined, and the third fluency, first correctness, second correctness, fourth fluency and third correctness are comprehensively analyzed to analyze the prediction effect of the pre-trained first machine learning model.
[0259] Among them, the test formula description is input into the semantic fluency evaluation model to obtain a third score, and the third score is determined as the third fluency of the test formula description. The test parameter interpretation is input into the semantic fluency evaluation model to obtain a fourth score, and the fourth score is determined as the fourth fluency of the test parameter interpretation.
[0260] Generate a second table formula based on the test table data and the test formula description; compare the second table formula with the test table formula for formula consistency, and determine the first correctness of the test formula description based on the formula consistency; or, compare the execution result of the second table formula in the test table with the execution result of the test table formula in the test table for result consistency; determine the first correctness of the test formula description based on the result consistency.
[0261] Obtain the test function identifier of the test function in the test table formula, and search for a second function identifier that is consistent with the test function identifier from a preset function identifier set; search for a second function interpretation corresponding to the second function identifier, and determine the degree of match between the second function interpretation and the test function interpretation; and determine the degree of match as the second correctness of the test function interpretation.
[0262] The third accuracy of the test parameter interpretation can be determined manually. In addition, the third fluency, the first accuracy, the second accuracy, the fourth fluency and the third accuracy can be weighted and summed to determine whether the value of the weighted sum exceeds the threshold. If it exceeds, the test table formula can be marked, and the proportion of the marked test table formula in the overall test table formula is subsequently statistically calculated. If this proportion exceeds a certain proportion, it means that the prediction effect of the pre-trained first machine learning model is good, and it can be used to interpret the table formula.
[0263] Corresponding to the above method embodiment, the present application embodiment also provides a table formula interpretation device, such as Fig.10 As shown, the device may include: a formula acquisition module 1010, a table determination module 1020, a data acquisition module 1030, and a formula interpretation module 1040.
[0264] The formula acquisition module 1010 is used to acquire the target table formula;
[0265] A table determination module 1020, configured to determine a target table associated with the target table formula, wherein the target table is a table involved in generating the target table formula;
[0266] The data acquisition module 1030 is used to acquire the table data in the target table;
[0267] A formula interpretation module 1040, configured to interpret the target meaning of the target table formula based on the table data and the target table formula;
[0268] The target meaning of the target table formula includes at least one of the following: a formula description of the target table formula, a function explanation of the target function in the target table formula, and a parameter explanation of the target parameter in the target function.
[0269] In an optional implementation, the formula interpretation module specifically includes:
[0270] A data construction submodule, for constructing first prompt data of a pre-trained first machine learning model based on the table data and the target table formula;
[0271] A data input submodule is used to input the first prompt data into the pre-trained first machine learning model to obtain the target meaning of the target table formula output by the pre-trained first machine learning model.
[0272] In an optional implementation, the first prompt data includes instruction data, input data and output data; the data construction submodule is specifically used for:
[0273] Combine the table data and the target table formula to obtain the instruction data, and set the input data to be blank;
[0274] The formula explanation value, function explanation value and parameter explanation value in the output data are respectively set to blank;
[0275] The instruction data, the input data and the output data constitute the first prompt data of the pre-trained first machine learning model.
[0276] In an optional implementation, the data input submodule is specifically used for:
[0277] Performing padding processing on the first prompt data so that the first prompt data after padding reaches a preset length;
[0278] The filled first prompt data is input into the pre-trained first machine learning model to obtain the target meaning of the target table formula output by the pre-trained first machine learning model.
[0279] In an optional embodiment, the device further comprises:
[0280] A sample table formula acquisition module is used to acquire sample table formulas;
[0281] A sample table acquisition module, used to determine a sample table associated with the sample table formula, wherein the sample table is a table involved in generating the sample table formula;
[0282] A sample table data acquisition module, used to acquire sample table data in the sample table;
[0283] A sample prompt data construction module, used to construct sample prompt data of a first machine learning model based on the sample table data and the sample table formula;
[0284] A sample prompt data input module, used for inputting the sample prompt data into the first machine learning model to obtain a first meaning of the sample table formula output by the first machine learning model;
[0285] an error determination module, for determining an error between the first meaning and a second meaning of the sample table formula in the sample prompt data;
[0286] A model training module is used to train the first machine learning model according to the error, and stop model training when the error meets the convergence condition to obtain the pre-trained first machine learning model.
[0287] In an optional implementation, the sample prompt data includes sample instruction data, sample input data and sample output data; the sample prompt data construction module specifically includes:
[0288] A sample table data and sample table formula combination submodule, used for combining the sample table data and the sample table formula to obtain the sample instruction data, and setting the sample input data to be blank;
[0289] a meaning determination submodule, used to determine a second meaning of the sample table formula, wherein the second meaning includes at least one of the following: a sample formula description of the sample table formula, a sample function explanation of a sample function in the sample table formula, and a sample parameter explanation of a sample parameter in the sample function;
[0290] A sample output data setting submodule, used to set the formula description value in the sample output data to the sample formula description, set the function interpretation value in the sample output data to the sample function interpretation, and set the parameter interpretation value in the sample output data to the sample parameter interpretation;
[0291] The data composition submodule is used to compose sample prompt data of the first machine learning model from the sample instruction data, the sample input data and the sample output data.
[0292] In an optional implementation, the meaning determination submodule specifically includes:
[0293] A sample table data and sample table formula combining unit, used for combining the sample table data and the sample table formula to obtain second prompt data of a second machine learning model;
[0294] A sample formula description and sample parameter explanation determining unit, used for inputting the second prompt data into the second machine learning model to obtain a sample formula description and a sample parameter explanation output by the second machine learning model;
[0295] A sample table formula parsing unit, used to parse the sample table formula using a formula parsing class to obtain a sample function list of the sample table formula;
[0296] A name search unit, configured to search, for any sample function identifier in the sample function list, a first function identifier that is consistent with the sample function identifier from a preset function identifier set;
[0297] The function interpretation determining unit is used to search for a first function interpretation corresponding to the first function identifier, and determine the first function interpretation as the sample function interpretation of the sample function corresponding to the sample function identifier.
[0298] In an optional implementation, the sample table formula parsing unit is specifically used to:
[0299] Using the formula parsing class, the sample table formula is decomposed to obtain multiple substrings, each of which has a corresponding type;
[0300] For any of the substrings, determining whether the type of the substring is the first type;
[0301] When the type of the substring is the first type, a sample function identifier is extracted from the substring and stored in a sample function list.
[0302] In an optional implementation, the sample output data setting submodule specifically includes:
[0303] A sample formula description and sample parameter explanation judgment unit, used to judge whether the sample formula description and the sample parameter explanation meet preset quality requirements;
[0304] A sample output data setting unit is used to set the formula description value in the sample output data to the sample formula description, set the function explanation value in the sample output data to the sample function explanation, and set the parameter explanation value in the sample output data to the sample parameter explanation when the sample formula description and the sample parameter explanation meet the preset quality requirements.
[0305] In an optional implementation, the sample formula description and sample parameter interpretation and judgment unit specifically includes:
[0306] A first semantic fluency determination subunit, used to determine a first semantic fluency of the sample formula description;
[0307] A first table formula generating subunit, used for generating a first table formula according to the sample table data and the sample formula description;
[0308] A second semantic fluency determination subunit, used to determine a second semantic fluency of the sample parameter interpretation;
[0309] A sample table formula parsing subunit, used to parse the sample table formula using a formula parsing class to obtain a sample parameter list of the sample table formula;
[0310] The first subunit for judging sample formula description and sample parameter interpretation is used to judge whether the difference between the first semantic fluency and the first preset value is less than the first preset difference threshold, whether the first table formula is consistent with the sample table formula, whether the difference between the second semantic fluency and the second preset value is less than the second preset difference threshold, and whether there is a corresponding sample parameter interpretation for each sample parameter in the sample parameter list;
[0311] or,
[0312] The second sub-unit for judging the sample formula description and the sample parameter explanation is used to judge whether the difference between the first semantic fluency and the first preset value is less than the first preset difference threshold, whether the execution result of the first table formula in the sample table is consistent with the execution result of the sample table formula in the sample table, whether the difference between the second semantic fluency and the second preset value is less than the second preset difference threshold, and whether there is a corresponding sample parameter explanation for each sample parameter in the sample parameter list.
[0313] In an optional implementation, the sample output data setting unit is specifically used to:
[0314] When the difference between the first semantic fluency and the first preset value is less than the first preset difference threshold, the first table formula is consistent with the sample table formula, the difference between the second semantic fluency and the second preset value is less than the second preset difference threshold, and each of the sample parameters in the sample parameter list has a corresponding sample parameter explanation, the formula description value in the sample output data is set to the sample formula description, the function explanation value in the sample output data is set to the sample function explanation, and the parameter explanation value in the sample output data is set to the sample parameter explanation;
[0315] or,
[0316] When the difference between the first semantic fluency and the first preset value is less than the first preset difference threshold, the execution result of the first table formula in the sample table is consistent with the execution result of the sample table formula in the sample table, the difference between the second semantic fluency and the second preset value is less than the second preset difference threshold, and each of the sample parameters in the sample parameter list has a corresponding sample parameter explanation, the formula description value in the sample output data is set to the sample formula description, the function interpretation value in the sample output data is set to the sample function interpretation, and the parameter interpretation value in the sample output data is set to the sample parameter explanation.
[0317] In an optional implementation, the first semantic fluency determination subunit is specifically used to:
[0318] Inputting the sample formula description into a semantic fluency evaluation model to obtain a first score, and determining the first score as a first semantic fluency of the sample formula description;
[0319] The second semantic fluency determination subunit is specifically used for:
[0320] The sample parameter interpretation is input into a semantic fluency evaluation model to obtain a second score, and the second score is determined as a second semantic fluency of the sample parameter interpretation.
[0321] In an optional implementation, the sample table formula parsing subunit is specifically used for:
[0322] Using the formula parsing class, the sample table formula is decomposed to obtain multiple substrings, each of which has a corresponding type;
[0323] For any of the substrings, determining whether the type of the substring is the second type;
[0324] When the type of the substring is the second type, the substring is determined as a sample parameter and stored in a sample parameter list.
[0325] In an optional embodiment, the sample prompt data input module is specifically used for:
[0326] Perform padding processing on the sample prompt data so that the sample prompt data after padding reaches a preset length;
[0327] Input the filled sample prompt data into the first machine learning model to obtain the first meaning of the sample table formula output by the first machine learning model.
[0328] In an optional embodiment, the device further comprises:
[0329] A test table formula acquisition module is used to obtain the test table formula;
[0330] A test table determination module, used to determine a test table associated with the test table formula, wherein the test table is a table involved in generating the test table formula;
[0331] A test table data acquisition module, used to acquire the test table data in the test table;
[0332] A test prompt data construction module, used to construct the test prompt data of the pre-trained first machine learning model based on the test table data and the test table formula;
[0333] A test prompt data input module, used for inputting the test prompt data into the pre-trained first machine learning model, and obtaining a third meaning of the test table formula output by the pre-trained first machine learning model;
[0334] A prediction effect analysis module is used to analyze the prediction effect of the pre-trained first machine learning model according to the third meaning.
[0335] In an optional embodiment, the test prompt data includes test instruction data, test input data and test output data;
[0336] The test prompt data construction module is specifically used for:
[0337] Combining the test table data with the test table formula to obtain the test instruction data, and leaving the test input data blank;
[0338] The formula explanation value, function explanation value and parameter explanation value in the test output data are respectively set to blank;
[0339] The test prompt data of the pre-trained first machine learning model is composed of the test instruction data, the test input data and the test output data.
[0340] In an optional implementation, the test prompt data input module is specifically used for:
[0341] Perform padding processing on the test prompt data so that the padded test prompt data reaches a preset length;
[0342] Input the filled test prompt data into the pre-trained first machine learning model to obtain the third meaning of the test table formula output by the pre-trained first machine learning model.
[0343] In an optional embodiment, the third meaning includes at least one of the following: a test formula description of the test table formula, a test function explanation of the test function in the test table formula, and a test parameter explanation of the test parameter in the test function;
[0344] The prediction effect analysis module specifically includes:
[0345] A third fluency determination submodule, used to determine a third fluency of the test formula description;
[0346] A first correctness determination submodule, used to determine a first correctness of the test formula description;
[0347] A second correctness determination submodule, with which the user determines a second correctness of the test function interpretation;
[0348] a fourth fluency determination submodule, configured to determine a fourth fluency of the test parameter interpretation;
[0349] A third correctness determination submodule, used to determine a third correctness of the test parameter interpretation;
[0350] The prediction effect analysis submodule is used to comprehensively analyze the prediction effect of the pre-trained first machine learning model by combining the third fluency, the first accuracy, the second accuracy, the fourth fluency and the third accuracy.
[0351] In an optional implementation, the third fluency determination submodule is specifically configured to:
[0352] Inputting the test formula description into a semantic fluency evaluation model to obtain a third score, and determining the third score as a third fluency of the test formula description;
[0353] The fourth fluency determination submodule is specifically used for:
[0354] The test parameter interpretation is input into a semantic fluency evaluation model to obtain a fourth score, and the fourth score is determined as a fourth fluency of the test parameter interpretation.
[0355] In an optional implementation, the first correctness determination submodule is specifically configured to:
[0356] Generate a second table formula according to the test table data and the test formula description;
[0357] Comparing the formula consistency of the second table formula and the test table formula, and determining the first correctness of the test formula description according to the formula consistency;
[0358] or,
[0359] Comparing the consistency of the execution result of the second table formula in the test table with the execution result of the test table formula in the test table;
[0360] Based on the result consistency, a first correctness of the test formula description is determined.
[0361] In an optional implementation, the second accuracy determination submodule is specifically configured to:
[0362] Obtaining a test function identifier of a test function in the test table formula, and searching a preset function identifier set for a second function identifier that is consistent with the test function identifier;
[0363] Finding a second function interpretation corresponding to the second function identifier, and determining a matching degree between the second function interpretation and the test function interpretation;
[0364] The degree of match is determined as a second degree of correctness of the test function interpretation.
[0365] In an optional implementation, the formula acquisition module is specifically used to:
[0366] In response to a preset operation on a cell in a table, displaying a corresponding table formula in the cell;
[0367] In response to an interpretation operation on a table formula corresponding to the cell, obtaining the table formula corresponding to the cell, and determining the table formula corresponding to the cell as a target table formula;
[0368] The device also includes:
[0369] The dialog box display module is used to display a dialog box, wherein the dialog box displays at least one of the formula description, the function explanation, and the parameter explanation.
[0370] The present application also provides an electronic device, such as Fig.11 As shown, it includes a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.
[0371] Memory 113, used for storing computer programs;
[0372] The processor 111 is used to execute the program stored in the memory 113 to implement the following steps:
[0373] Obtain a target table formula, and determine a target table associated with the target table formula, wherein the target table is a table involved in generating the target table formula; obtain table data in the target table, and interpret the target meaning of the target table formula based on the table data and the target table formula; the target meaning of the target table formula includes at least one of the following: a formula description of the target table formula, a function interpretation of the target function in the target table formula, and a parameter interpretation of the target parameter in the target function.
[0374] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0375] The communication interface is used for communication between the above electronic device and other devices.
[0376] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0377] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0378] In another embodiment provided in the present application, a storage medium is also provided, in which instructions are stored. When the storage medium is run on a computer, the computer executes the table formula interpretation method described in any of the above embodiments.
[0379] In another embodiment provided in the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the table formula interpretation method described in any of the above embodiments.
[0380] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a storage medium, or transmitted from one storage medium to another storage medium, for example, the computer instructions may be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.
[0381] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article 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, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0382] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0383] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A method for interpreting a table formula, characterized in that: The method comprises: Obtain a target table formula, and determine a target table associated with the target table formula, wherein the target table is a table involved in generating the target table formula; Acquire table data in the target table, and interpret the target meaning of the target table formula based on the table data and the target table formula; Among them, the target meaning of the target table formula includes at least one of the following: the formula description of the target table formula, the function explanation of the target function in the target table formula, and the parameter explanation of the target parameter in the target function.
2. The method according to claim 1, characterized in that The step of interpreting the target meaning of the target table formula based on the table data and the target table formula includes: Based on the table data and the target table formula, construct first prompt data of a pre-trained first machine learning model; The first prompt data is input into the pre-trained first machine learning model to obtain the target meaning of the target table formula output by the pre-trained first machine learning model.
3. The method according to claim 2, characterized in that The first prompt data includes instruction data, input data and output data; The step of constructing first prompt data of a pre-trained first machine learning model based on the table data and the target table formula includes: Combine the table data and the target table formula to obtain the instruction data, and set the input data to be blank; The formula explanation value, function explanation value and parameter explanation value in the output data are respectively set to blank; The instruction data, the input data and the output data constitute the first prompt data of the pre-trained first machine learning model.
4. The method according to claim 2, characterized in that: The step of inputting the first prompt data into the pre-trained first machine learning model to obtain the target meaning of the target table formula output by the pre-trained first machine learning model includes: Performing padding processing on the first prompt data so that the first prompt data after padding reaches a preset length; The filled first prompt data is input into the pre-trained first machine learning model to obtain the target meaning of the target table formula output by the pre-trained first machine learning model.
5. The method according to any one of claims 2 to 4, characterized in that: Before the target meaning of the target table formula is interpreted based on the table data and the target table formula, the method further includes: Obtaining a sample table formula, and determining a sample table associated with the sample table formula, wherein the sample table is a table involved in generating the sample table formula; Acquire sample table data in the sample table, and construct sample prompt data of a first machine learning model based on the sample table data and the sample table formula; Inputting the sample prompt data into the first machine learning model to obtain a first meaning of the sample table formula output by the first machine learning model; determining an error between the first meaning and a second meaning of the sample table formula in the sample prompt data; The first machine learning model is trained according to the error, and when the error meets a convergence condition, the model training is stopped to obtain the pre-trained first machine learning model.
6. The method according to claim 5, characterized in that The sample prompt data includes sample instruction data, sample input data and sample output data; The constructing the sample prompt data of the first machine learning model based on the sample table data and the sample table formula includes: The sample table data and the sample table formula are combined to obtain the sample instruction data, and the sample input data is left blank; Determine a second meaning of the sample table formula, the second meaning comprising at least one of the following: a sample formula description of the sample table formula, a sample function explanation of a sample function in the sample table formula, and a sample parameter explanation of a sample parameter in the sample function; Set the formula description value in the sample output data to the sample formula description, set the function interpretation value in the sample output data to the sample function interpretation, and set the parameter interpretation value in the sample output data to the sample parameter interpretation; The sample instruction data, the sample input data and the sample output data constitute sample prompt data of the first machine learning model.
7. The method according to claim 6, characterized in that The determining the second meaning of the sample table formula includes: Combining the sample table data and the sample table formula to obtain second prompt data of a second machine learning model; Inputting the second prompt data into the second machine learning model to obtain a sample formula description and a sample parameter explanation output by the second machine learning model; Utilizing the formula parsing class, the sample table formula is parsed to obtain a sample function list of the sample table formula; For any sample function identifier in the sample function list, searching for a first function identifier that is consistent with the sample function identifier from a preset function identifier set; A first function interpretation corresponding to the first function identifier is searched, and the first function interpretation is determined as the sample function interpretation of the sample function corresponding to the sample function identifier.
8. The method according to claim 7, characterized in that The formula parsing class is used to parse the sample table formula to obtain a sample function list of the sample table formula, including: Using the formula parsing class, the sample table formula is decomposed to obtain multiple substrings, each of which has a corresponding type; For any of the substrings, determining whether the type of the substring is the first type; When the type of the substring is the first type, a sample function identifier is extracted from the substring and stored in a sample function list.
9. The method according to claim 6, characterized in that The step of setting the formula description value in the sample output data to the sample formula description, setting the function interpretation value in the sample output data to the sample function interpretation, and setting the parameter interpretation value in the sample output data to the sample parameter interpretation comprises: Determine whether the sample formula description and the sample parameter explanation meet the preset quality requirements; When the sample formula description and the sample parameter explanation meet the preset quality requirements, the formula description value in the sample output data is set to the sample formula description, the function explanation value in the sample output data is set to the sample function explanation, and the parameter explanation value in the sample output data is set to the sample parameter explanation.
10. The method according to claim 9, characterized in that The determining whether the sample formula description and the sample parameter explanation meet preset quality requirements includes: Determining a first semantic fluency of the sample formula description, and generating a first table formula according to the sample table data and the sample formula description; Determine the second semantic fluency of the sample parameter interpretation, and parse the sample table formula using a formula parsing class to obtain a sample parameter list of the sample table formula; Determine whether the difference between the first semantic fluency and the first preset value is less than a first preset difference threshold, whether the first table formula is consistent with the sample table formula, whether the difference between the second semantic fluency and the second preset value is less than a second preset difference threshold, and whether each of the sample parameters in the sample parameter list has a corresponding sample parameter explanation; or, Determine whether the difference between the first semantic fluency and the first preset value is less than the first preset difference threshold, whether the execution result of the first table formula in the sample table is consistent with the execution result of the sample table formula in the sample table, whether the difference between the second semantic fluency and the second preset value is less than the second preset difference threshold, and whether there is a corresponding sample parameter explanation for each sample parameter in the sample parameter list.
11. The method according to claim 10, characterized in that When the sample formula description and the sample parameter explanation meet the preset quality requirement, setting the formula description value in the sample output data to the sample formula description, setting the function explanation value in the sample output data to the sample function explanation, and setting the parameter explanation value in the sample output data to the sample parameter explanation, comprises: When the difference between the first semantic fluency and the first preset value is less than the first preset difference threshold, the first table formula is consistent with the sample table formula, the difference between the second semantic fluency and the second preset value is less than the second preset difference threshold, and each of the sample parameters in the sample parameter list has a corresponding sample parameter explanation, the formula description value in the sample output data is set to the sample formula description, the function explanation value in the sample output data is set to the sample function explanation, and the parameter explanation value in the sample output data is set to the sample parameter explanation; or, When the difference between the first semantic fluency and the first preset value is less than the first preset difference threshold, the execution result of the first table formula in the sample table is consistent with the execution result of the sample table formula in the sample table, the difference between the second semantic fluency and the second preset value is less than the second preset difference threshold, and each of the sample parameters in the sample parameter list has a corresponding sample parameter explanation, the formula description value in the sample output data is set to the sample formula description, the function interpretation value in the sample output data is set to the sample function interpretation, and the parameter interpretation value in the sample output data is set to the sample parameter explanation.
12. The method according to claim 10, characterized in that The determining the first semantic fluency of the sample formula description includes: Inputting the sample formula description into a semantic fluency evaluation model to obtain a first score, and determining the first score as a first semantic fluency of the sample formula description; The determining the second semantic fluency of the sample parameter interpretation comprises: The sample parameter interpretation is input into a semantic fluency evaluation model to obtain a second score, and the second score is determined as a second semantic fluency of the sample parameter interpretation.
13. The method according to claim 10, characterized in that The formula parsing class is used to parse the sample table formula to obtain a sample parameter list of the sample table formula, including: Using the formula parsing class, the sample table formula is decomposed to obtain multiple substrings, each of which has a corresponding type; For any of the substrings, determining whether the type of the substring is the second type; When the type of the substring is the second type, the substring is determined as a sample parameter and stored in a sample parameter list.
14. The method according to claim 5, characterized in that The step of inputting the sample prompt data into the first machine learning model to obtain the first meaning of the sample table formula output by the first machine learning model includes: Perform padding processing on the sample prompt data so that the sample prompt data after padding reaches a preset length; Input the filled sample prompt data into the first machine learning model to obtain the first meaning of the sample table formula output by the first machine learning model.
15. The method according to claim 1, characterized in that The formula for obtaining the target table includes: In response to a preset operation on a cell in a table, displaying a corresponding table formula in the cell; In response to an interpretation operation on a table formula corresponding to the cell, obtaining the table formula corresponding to the cell, and determining the table formula corresponding to the cell as a target table formula; After interpreting the target meaning of the target table formula based on the table data and the target table formula, the method further includes: A dialog box is displayed, wherein at least one of the formula description, the function explanation, and the parameter explanation is displayed in the dialog box.
16. A table formula interpretation device, characterized in that: The device comprises: Formula acquisition module, used to obtain the target table formula; A table determination module, used for determining a target table associated with the target table formula, wherein the target table is a table involved in generating the target table formula; A data acquisition module, used for acquiring table data in the target table; A formula interpretation module, used for interpreting the target meaning of the target table formula based on the table data and the target table formula; The target meaning of the target table formula includes at least one of the following: a formula description of the target table formula, a function explanation of the target function in the target table formula, and a parameter explanation of the target parameter in the target function.