Expression processing method, device, equipment and storage medium

By performing error detection and repair processing in the expression processing method, and combining expression calculation and image rendering to generate real-time function images, the problems of low operation efficiency and insufficient intelligence in the existing technology are solved, and a more efficient and accurate expression processing process is achieved.

CN119782656APending Publication Date: 2025-04-08XIAN SECLOVER INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411785480.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

The existing expression processing methods lack integrated, visual and interactive tools in the input and calculation of function expressions, resulting in low operation efficiency and insufficient intelligence. Especially when expression definitions are complex and variables are frequently adjusted, users need to switch tools frequently, which is time-consuming and error-prone.

Method used

An expression processing method is proposed, including obtaining the function expression input by the user, performing error detection and repair processing, analyzing and computing to obtain the target variables and operators, calculating and saving the function output value, and mapping it to the preset canvas coordinate system to generate a function image.

Benefits of technology

By combining expression calculation and image rendering, users can view calculation results and function images in real time, improving operation efficiency; at the same time, error detection and repair processing reduce input errors, and improve the accuracy and convenience of expression input.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119782656A_ABST
    Figure CN119782656A_ABST
Patent Text Reader

Abstract

The present application discloses an expression processing method, device, equipment and storage medium, including: obtaining the current function expression input by the user, performing error detection and repair processing on the current function expression, obtaining the processed target function expression, parsing and calculating the target function expression, obtaining the target variable and target operator corresponding to the target function expression, calculating and saving the function output value based on the target variable and the target operator, and mapping the function output value to a preset canvas coordinate system, and finally generating the corresponding function image. This solution combines expression calculation and image rendering by directly drawing the corresponding function image after calculating the function output value, so that the user can view the calculation results and function images in real time to improve efficiency; in addition, by performing error detection and repair processing on the current function expression, input errors can be reduced, and the accuracy and convenience of the current function expression input can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to expression processing methods, devices, equipment and storage media. Background Art

[0002] In the field of data analysis and scientific computing, users need to quickly input and calculate function expressions and intuitively understand the data trends of the functions after obtaining the results.

[0003] Currently, commonly used software tools such as spreadsheet software and programming computing environments provide calculation and charting functions, but lack integrated, visual and interactive tools. This is particularly prominent when expression definitions are complex and variables are frequently adjusted. Users often need to switch between different tools, which is not only time-consuming but also prone to errors.

[0004] Therefore, existing expression processing methods have problems of low operating efficiency and intelligence. Summary of the invention

[0005] The present application aims to at least solve the technical problems existing in the prior art. To this end, the first aspect of the present application proposes an expression processing method, which includes:

[0006] Get the current function expression entered by the user;

[0007] Perform error detection and repair processing on the current function expression to obtain the processed target function expression;

[0008] Analyze and calculate the objective function expression to obtain the objective variable and objective operator corresponding to the objective function expression;

[0009] The function output value is calculated and saved based on the target variable and the target operator, and the function output value is mapped to the preset canvas coordinate system to generate a function image corresponding to the target function expression.

[0010] In a possible implementation, error detection and repair processing is performed on the current function expression to obtain a processed target function expression, including:

[0011] Perform error detection on the current function expression and obtain the detection result;

[0012] If the current function expression is determined to be normal based on the detection result, the current function expression is used as the target function expression;

[0013] If it is determined based on the detection results that the current function expression is abnormal, the current function expression is repaired according to the preset correction rules, and the repair result is used as the target function expression.

[0014] In a possible implementation, error detection is performed on the current function expression to obtain a detection result, including:

[0015] Performing lexical analysis on the current function expression to generate a first processing result;

[0016] When it is determined based on the first processing result that the lexical correctness of the current function expression is determined, a syntax analysis process is performed on the current function expression to generate a second processing result;

[0017] A detection result is determined based on the first processing result and the second processing result.

[0018] In a possible implementation, the method further includes:

[0019] If it is determined based on the first processing result that the current function expression is lexically correct and based on the second processing result that the current function expression is grammatically correct;

[0020] If it is determined based on the first processing result that the current function expression is lexically correct, then it is determined that the current function expression is abnormal, or,

[0021] If it is determined based on the first processing result that the current function expression is lexically correct and based on the second processing result that the current function expression is syntactically incorrect, then it is determined that the current function expression is abnormal.

[0022] In a possible implementation, the objective function expression is parsed and calculated to obtain the objective variable and the objective operator corresponding to the objective function expression, including:

[0023] When it is determined based on the second processing result that the syntax of the current function expression is correct, obtaining a current syntax tree corresponding to the current function expression;

[0024] Recursively traverse the syntax tree, and for each operator node in the current syntax tree, perform parsing processing based on the type of the operator node to obtain the target variable and target operator corresponding to the target function expression.

[0025] In a possible implementation, the method further includes:

[0026] Obtain the user's current operation instructions for each character in the current function expression; wherein the current operation instructions include input operation instructions and delete operation instructions;

[0027] For the current operation instructions corresponding to each character, the historical syntax tree is updated in sequence to generate the current syntax tree.

[0028] In a possible implementation, the method further includes:

[0029] Based on each current operation instruction, a current syntax tree corresponding to the current operation instruction is obtained in real time;

[0030] Based on the current syntax tree, predict the function expression template corresponding to the current operation instruction;

[0031] Based on the function expression template, the error prediction of the current function expression is performed to obtain the prediction result.

[0032] The second aspect of the present application provides an expression processing device, which includes:

[0033] The acquisition module is used to obtain the current function expression input by the user;

[0034] A processing module is used to perform error detection and repair processing on the current function expression to obtain a processed target function expression;

[0035] A calculation module is used to parse and calculate the objective function expression to obtain the target variable and target operator corresponding to the objective function expression;

[0036] The generation module is used to calculate the function output value based on the target variable and the target operator, and map the function output value to a preset canvas coordinate system to generate a function image corresponding to the target function expression.

[0037] In a possible implementation manner, the processing module is specifically used to:

[0038] Perform error detection and repair on the current function expression to obtain the processed target function expression, including:

[0039] Perform error detection on the current function expression and obtain the detection result;

[0040] If the current function expression is determined to be normal based on the detection result, the current function expression is used as the target function expression;

[0041] If it is determined based on the detection results that the current function expression is abnormal, the current function expression is repaired according to the preset correction rules, and the repair result is used as the target function expression.

[0042] In a possible implementation manner, the processing module is further used to:

[0043] Performing lexical analysis on the current function expression to generate a first processing result;

[0044] When it is determined based on the first processing result that the lexical correctness of the current function expression is determined, a syntax analysis process is performed on the current function expression to generate a second processing result;

[0045] A detection result is determined based on the first processing result and the second processing result.

[0046] In a possible implementation manner, the expression processing device is further used for:

[0047] If it is determined based on the first processing result that the current function expression is lexically correct and based on the second processing result that the current function expression is grammatically correct;

[0048] If it is determined based on the first processing result that the current function expression is lexically correct, then it is determined that the current function expression is abnormal, or,

[0049] If it is determined based on the first processing result that the current function expression is lexically correct and based on the second processing result that the current function expression is syntactically incorrect, then it is determined that the current function expression is abnormal.

[0050] In a possible implementation manner, the above-mentioned calculation module is specifically used for:

[0051] When it is determined based on the second processing result that the syntax of the current function expression is correct, obtaining a current syntax tree corresponding to the current function expression;

[0052] Recursively traverse the syntax tree, and for each operator node in the current syntax tree, perform parsing processing based on the type of the operator node to obtain the target variable and target operator corresponding to the target function expression.

[0053] In a possible implementation manner, the expression processing device is further used for:

[0054] Obtain the user's current operation instructions for each character in the current function expression; wherein the current operation instructions include input operation instructions and delete operation instructions;

[0055] For the current operation instructions corresponding to each character, the historical syntax tree is updated in sequence to generate the current syntax tree.

[0056] In a possible implementation manner, the expression processing device is further used for:

[0057] Based on each current operation instruction, a current syntax tree corresponding to the current operation instruction is obtained in real time;

[0058] Based on the current syntax tree, predict the function expression template corresponding to the current operation instruction;

[0059] Based on the function expression template, the error prediction of the current function expression is performed to obtain the prediction result.

[0060] The third aspect of the present application proposes an electronic device, which includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the expression processing method described in the first aspect.

[0061] The fourth aspect of the present application proposes a computer-readable storage medium, which stores at least one instruction, at least one program, a code set or an instruction set. The at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the expression processing method described in the first aspect.

[0062] The embodiments of the present application have the following beneficial effects:

[0063] The expression processing method provided by the embodiment of the present application includes: obtaining the current function expression input by the user, performing error detection and repair processing on the current function expression to obtain the processed target function expression, parsing and calculating the target function expression to obtain the target variable and target operator corresponding to the target function expression, calculating and saving the function output value based on the target variable and the target operator, and mapping the function output value to a preset canvas coordinate system to generate a function image corresponding to the target function expression. This solution combines expression calculation and image rendering by directly drawing the corresponding function image after calculating the function output value, so that the user can view the calculation results and function images in real time to improve efficiency; in addition, by performing error detection and repair processing on the current function expression, input errors can be reduced and the accuracy and convenience of the current function expression input can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] Figure 1 A block diagram of a computer device provided in an embodiment of the present application;

[0065] Figure 2 A flowchart of a method for processing an expression provided in an embodiment of the present application;

[0066] Figure 3 A flowchart of steps for obtaining an objective function expression provided in an embodiment of the present application;

[0067] Figure 4 A flowchart of the steps for performing error detection provided in an embodiment of the present application;

[0068] Figure 5 A flowchart of the steps of analyzing and calculating the objective function expression provided in an embodiment of the present application;

[0069] Figure 6A flowchart of the steps for updating a syntax tree provided in an embodiment of the present application;

[0070] Figure 7 A flowchart of a prediction function expression provided in an embodiment of the present application;

[0071] Figure 8 A structural block diagram of an expression processing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0072] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0073] At present, commonly used software tools such as spreadsheet software and programming computing environments provide calculation and charting functions, but lack integrated, visual and interactive tools. This is particularly prominent when expression definitions are complex and variables are frequently adjusted. Users often need to switch between different tools, which is not only time-consuming but also error-prone. Specifically, existing tools are often separated in function expression calculation and image rendering. Users need to manually convert between calculation results and charts, which reduces operational efficiency. In addition, there is a lack of functions such as automatic input completion, real-time error detection and repair, which makes it easy for users to make mistakes when entering function expressions and is not convenient for debugging. In addition, existing expression calculation software usually only provides static results, lacks interactive charts and function expression preview functions, and it is difficult for users to intuitively understand and adjust input. And when performing multiple calculations, there is a lack of effective management and display methods for historical inputs and results, and it is not easy to backtrack for comparison and analysis.

[0074] Based on this, the present application proposes an expression processing method, which includes: obtaining the current function expression input by the user, performing error detection and repair processing on the current function expression, obtaining the processed target function expression, parsing and calculating the target function expression, obtaining the target variable and target operator corresponding to the target function expression, calculating and saving the function output value based on the target variable and the target operator, and mapping the function output value to a preset canvas coordinate system to generate a function image corresponding to the target function expression. This solution combines expression calculation and image rendering by directly drawing the corresponding function image after calculating the function output value, so that users can view the calculation results and function images in real time to improve efficiency; in addition, by performing error detection and repair processing on the current function expression, input errors can be reduced, and the accuracy and convenience of the current function expression input can be improved.

[0075] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present disclosure, unless otherwise specified, "multiple" means two or more. In addition, the use of "based on" or "according to" means openness and inclusiveness, because the process, steps, calculations or other actions "based on" or "according to" one or more of the conditions or values ​​may be based on additional conditions or values ​​beyond the described values ​​in practice.

[0076] The expression processing method provided in the present application can be applied to a computer device (electronic device), which can be a server or a terminal, wherein the server can be a single server or a server cluster composed of multiple servers. The embodiments of the present application do not specifically limit this. The terminal can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices.

[0077] Take the computer device as a server as an example. Figure 1 A block diagram of a server is shown, such as Figure 1 As shown, the server may include a processor and a memory connected via a system bus. The processor of the server is used to provide computing and control capabilities. The memory of the server includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. When the computer program is executed by the processor, an expression processing method is implemented.

[0078] Those skilled in the art will understand that Figure 1 The structure shown in the figure is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the server to which the solution of the present application is applied. Optionally, the server may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0079] It should be noted that the execution subject of the embodiments of the present application may be a computer device or an expression processing device. The following method embodiments will be described using a computer device as the execution subject.

[0080] Figure 2 A flowchart of a method for processing an expression provided in an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:

[0081] Step 202: Get the current function expression input by the user.

[0082] The user can input the current function expression on the preconfigured variable input panel. Optionally, the current function expression can be a numerical expression or a variable expression. For example, the current function expression can be (2+3) / 5 or (a+b) / c.

[0083] Step 204: perform error detection and repair processing on the current function expression to obtain a processed target function expression.

[0084] After obtaining the current function expression input by the user, the current function expression can be subjected to error detection and repair processing, thereby obtaining a processed target function expression. Figure 3 As shown, Figure 3 A flowchart of steps for obtaining an objective function expression provided in an embodiment of the present application includes:

[0085] Step 302: Perform error detection on the current function expression to obtain a detection result.

[0086] Step 304: If it is determined based on the detection result that the current function expression is normal, the current function expression is used as the target function expression.

[0087] Step 306: If it is determined based on the detection result that the current function expression is abnormal, the current function expression is repaired according to a preset correction rule, and the repair result is used as the target function expression.

[0088] Among them, in some optional embodiments, such as Figure 4 As shown, Figure 4 A flowchart of the steps for performing error detection provided in an embodiment of the present application includes:

[0089] Step 402: Perform lexical analysis on the current function expression to generate a first processing result.

[0090] Step 404: When it is determined based on the first processing result that the lexical correctness of the current function expression is determined, a syntax analysis process is performed on the current function expression to generate a second processing result.

[0091] Step 406: Determine a detection result based on the first processing result and the second processing result.

[0092] Among them, when performing lexical analysis on the current function expression, optionally, a regular expression can be used to match different types of characters in the current function expression. The different types of characters can be numbers, operators, brackets, variables, constants, etc., and the operators can be +, -, *, / , etc.

[0093] Next, these matched characters can be converted into corresponding lexical units. For example, the number 5 can be converted into {type:'NUMBER',value:5}; for another example, the operator + can be converted into {type:'OPERATOR',value:'+'}.

[0094] When it is determined based on the first processing result that the lexical correctness of the current function expression is determined, the current function expression is subjected to grammatical analysis processing to generate a second processing result. Wherein, when performing grammatical analysis, optionally, different grammatical rules can be processed by recursively calling different parsing functions through a recursive descent parser, such as different grammatical rules of addition, multiplication, and expressions in brackets. Wherein, the recursive descent parser is a top-down parsing method suitable for parsing mathematical expressions. The specific implementation method can refer to the prior art and will not be repeated here.

[0095] In addition, the precedence and associativity of different operators must be handled by controlling the calling order of recursive functions. For example, the priority of multiplication is higher than that of addition.

[0096] Thus, the detection result can be determined based on the first processing result and the second processing result, wherein the first processing result can include lexical errors or lexical correctness, and the second processing result can include grammatical errors or grammatical correctness.

[0097] When it is determined based on the detection result that the current function expression is normal, optionally, if it is determined based on the first processing result that the current function expression is lexically correct and based on the second processing result that the current function expression is grammatically correct, then it is determined that the current function expression is normal.

[0098] When determining that the current function expression is abnormal based on the detection result, optionally, if it is determined that the current function expression is lexically incorrect based on the first processing result, then the current function expression is determined to be abnormal, or, if it is determined that the current function expression is lexically correct based on the first processing result and it is determined that the current function expression is syntactically incorrect based on the second processing result, then the current function expression is determined to be abnormal.

[0099] Thus, when determining the target function expression, optionally, if the current function expression is determined to be normal based on the detection result, the current function expression is used as the target function expression. If the current function expression is determined to be abnormal based on the detection result, the current function expression is repaired according to the preset correction rule, and the repair result is used as the target function expression. Among them, the preset correction rule can be to automatically generate the correct format of the current function expression or operator for repair, or recommend a suitable correction operation for repair.

[0100] Step 206: parse and calculate the objective function expression to obtain the objective variable and the objective operator corresponding to the objective function expression.

[0101] Among them, in some optional embodiments, such as Figure 5 As shown, Figure 5 A flowchart of steps for parsing and calculating an objective function expression provided in an embodiment of the present application includes:

[0102] Step 502: When it is determined based on the second processing result that the syntax of the current function expression is correct, obtain a current syntax tree corresponding to the current function expression.

[0103] Step 504: recursively traverse the syntax tree, and for each operator node in the current syntax tree, perform parsing processing based on the type of the operator node to obtain the target variable and target operator corresponding to the target function expression.

[0104] The construction method of the current syntax tree corresponding to the current function expression can refer to the prior art and will not be described here. Thus, the syntax tree can be recursively traversed, and for each operator node in the current syntax tree, parsing processing is performed based on the type of the operator node to obtain the target variable and target operator corresponding to the target function expression.

[0105] Step 208: Calculate and save the function output value based on the target variable and the target operator, and map the function output value to a preset canvas coordinate system to generate a function graph corresponding to the target function expression.

[0106] After obtaining the target variable and the target operator, the corresponding calculation can be performed for each operator node in the current syntax tree according to the type of the operator, and its left and right child nodes can be recursively calculated to obtain the final function output value.

[0107] Optionally, the range of values ​​of each target variable can be determined first, and the function's rate of change, the smoothness of the graph, and performance requirements need to be considered when selecting the calculation accuracy of the function. For example, if the function changes slowly, fewer points will be obtained; if the function changes drastically, more calculation points will be obtained. Therefore, according to the range of values ​​of the target variable and the rate of change of the function, a suitable interval d can be selected. x , for example x =0.1, and then the corresponding function output value is obtained after calculation.

[0108] In some optional embodiments, after the user continuously inputs multiple target variable values, the function output value can also be updated in real time and can be displayed in a preset user interface.

[0109] In some optional embodiments, the target variable and target operator input each time for calculation, as well as the function output value obtained by calculation, can also be saved in a history record table and presented in a table form for further analysis. By saving the calculation history, the user can easily trace back, compare and analyze the input and results, and reduce repeated calculations.

[0110] In some optional embodiments, when mapping the function output value to a preset canvas coordinate system to generate a function image corresponding to the objective function expression, a canvas may be optionally used to draw a two-dimensional function image. For example, for the objective function expression z=f(x,y), the (x,y) value may be mapped to a preset canvas coordinate system to draw the function image. Among them, canvas is a technology for drawing graphics on a web page. The specific implementation method can refer to the prior art and will not be repeated here.

[0111] For three-dimensional function expressions, perspective projection technology can be used to map points in three-dimensional space to a two-dimensional canvas plane. Perspective projection technology uses depth, i.e., Z coordinates, and distance d to project objects in three-dimensional space onto a two-dimensional plane, making objects appear smaller when they are far away from the observer and larger when they are close. By using perspective projection technology to render three-dimensional graphics, accurate and dynamic visualization of mathematical functions is provided.

[0112] In perspective projection, a 3D coordinate point (X, Y, Z) is projected onto a 2D coordinate system (x, y), and the Z coordinate affects the final X and Y coordinates. It is usually assumed that the viewpoint is at the origin and the projection plane is parallel to the Z = d plane, that is, the distance d from the viewpoint.

[0113] The basic formula for perspective projection is Among them, X, Y, Z are the original coordinates in the three-dimensional space; d is the distance from the viewpoint to the projection plane; x′, y′ are the two-dimensional coordinates after projection.

[0114] In some optional embodiments, the syntax tree may also be updated in real time, such as Figure 6 As shown, Figure 6 A flowchart of the steps of updating a syntax tree provided in an embodiment of the present application includes:

[0115] Step 602: Obtain the user's current operation instructions for each character in the current function expression.

[0116] Step 604: For the current operation instructions corresponding to each character, update the historical syntax tree in sequence to generate a current syntax tree.

[0117] Among them, when the user is inputting a complex mathematical expression, the traditional expression processing method often waits until the entire current function expression is input before generating the syntax tree. When updating the syntax tree, the embodiment of the present application can first obtain the user's current operation instructions for each character in the current function expression, wherein the current operation instructions include input operation instructions and deletion operation instructions.

[0118] Thus, the historical syntax tree can be updated in sequence for the current operation instructions corresponding to each character to generate the current syntax tree. In other words, after each character input or deletion by the user, the historical syntax tree can be updated through incremental parsing technology and real-time feedback can be given to construct the current syntax tree. In addition, error prompts can be updated in real time based on user input.

[0119] In this embodiment, the historical syntax tree can be updated in real time each time the user inputs or deletes a character, thereby effectively improving the immediacy and accuracy of error detection.

[0120] In some optional embodiments, it is also possible to predict the function expression that the user may input, such as Figure 7 As shown, Figure 7 A flowchart of a prediction function expression provided in an embodiment of the present application includes:

[0121] Step 702: Based on each current operation instruction, obtain the current syntax tree corresponding to the current operation instruction in real time.

[0122] Step 704: Based on the current syntax tree, predict and obtain a function expression template corresponding to the current operation instruction.

[0123] Step 706: perform error prediction on the current function expression based on the function expression template to obtain a prediction result.

[0124] Among them, when the user inputs each character of the current function expression, the current syntax tree corresponding to the current operation instruction can be obtained in real time based on each current operation instruction, and the function expression template corresponding to the current operation instruction can be predicted based on the current syntax tree.

[0125] Next, the current function expression can be predicted based on the function expression template to obtain a prediction result, so that errors can be predicted in advance and prompted based on the prediction result. Optionally, the current function expression can be compared with the function expression template to obtain a prediction result. This process can be targeted at complex function expressions and can more intelligently discover and predict potential errors.

[0126] In some optional embodiments, while providing an error prompt, specific repair suggestions can also be given based on the input context. For example, when a user enters an illegal function expression or operator, the system can not only prompt an error, but also automatically generate the correct format of the current function expression or operator, or recommend appropriate correction operations, thereby significantly improving the repair efficiency of the current function expression.

[0127] The present application provides an expression processing method, which includes: obtaining the current function expression input by the user, performing error detection and repair processing on the current function expression, obtaining the processed target function expression, parsing and calculating the target function expression, obtaining the target variable and target operator corresponding to the target function expression, calculating and saving the function output value based on the target variable and the target operator, and mapping the function output value to a preset canvas coordinate system to generate a function image corresponding to the target function expression. This solution combines expression calculation and image rendering by directly drawing the corresponding function image after calculating the function output value, so that the user can view the calculation results and function images in real time to improve efficiency; in addition, by performing error detection and repair processing on the current function expression, input errors can be reduced, and the accuracy and convenience of the current function expression input can be improved.

[0128] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0129] Figure 8 A structural block diagram of an expression processing device provided in an embodiment of the present application.

[0130] like Figure 8 As shown, the expression processing device 800 includes:

[0131] The acquisition module 802 is used to acquire the current function expression input by the user.

[0132] The processing module 804 is used to perform error detection and repair processing on the current function expression to obtain a processed target function expression.

[0133] The calculation module 806 is used to parse and calculate the target function expression to obtain the target variable and target operator corresponding to the target function expression.

[0134] The generation module 808 is used to calculate the function output value based on the target variable and the target operator, and map the function output value to a preset canvas coordinate system to generate a function image corresponding to the target function expression.

[0135] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here. Each module in the above expression processing device can be implemented in whole or in part by software, hardware, and a combination thereof. Each of the above modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations of each of the above modules.

[0136] In one embodiment of the present application, a computer device is provided, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program:

[0137] Get the current function expression entered by the user;

[0138] Perform error detection and repair processing on the current function expression to obtain the processed target function expression;

[0139] Analyze and calculate the objective function expression to obtain the objective variable and objective operator corresponding to the objective function expression;

[0140] The function output value is calculated and saved based on the target variable and the target operator, and the function output value is mapped to the preset canvas coordinate system to generate a function image corresponding to the target function expression.

[0141] In one embodiment of the present application, when the processor executes the computer program, the processor further implements the following steps:

[0142] Perform error detection on the current function expression and obtain the detection result;

[0143] If the current function expression is determined to be normal based on the detection result, the current function expression is used as the target function expression;

[0144] If it is determined based on the detection results that the current function expression is abnormal, the current function expression is repaired according to the preset correction rules, and the repair result is used as the target function expression.

[0145] In one embodiment of the present application, when the processor executes the computer program, the processor further implements the following steps:

[0146] Performing lexical analysis on the current function expression to generate a first processing result;

[0147] When it is determined based on the first processing result that the lexical correctness of the current function expression is determined, a syntax analysis process is performed on the current function expression to generate a second processing result;

[0148] A detection result is determined based on the first processing result and the second processing result.

[0149] In one embodiment of the present application, when the processor executes the computer program, the processor further implements the following steps:

[0150] If it is determined based on the first processing result that the current function expression is lexically correct and based on the second processing result that the current function expression is grammatically correct;

[0151] If it is determined based on the first processing result that the current function expression is lexically correct, then it is determined that the current function expression is abnormal, or,

[0152] If it is determined based on the first processing result that the current function expression is lexically correct and based on the second processing result that the current function expression is syntactically incorrect, then it is determined that the current function expression is abnormal.

[0153] In one embodiment of the present application, when the processor executes the computer program, the processor further implements the following steps:

[0154] When it is determined based on the second processing result that the syntax of the current function expression is correct, obtaining a current syntax tree corresponding to the current function expression;

[0155] Recursively traverse the syntax tree, and for each operator node in the current syntax tree, perform parsing processing based on the type of the operator node to obtain the target variable and target operator corresponding to the target function expression.

[0156] In one embodiment of the present application, when the processor executes the computer program, the processor further implements the following steps:

[0157] Obtain the user's current operation instructions for each character in the current function expression; wherein the current operation instructions include input operation instructions and delete operation instructions;

[0158] For the current operation instructions corresponding to each character, the historical syntax tree is updated in sequence to generate the current syntax tree.

[0159] In one embodiment of the present application, when the processor executes the computer program, the processor further implements the following steps:

[0160] Based on each current operation instruction, a current syntax tree corresponding to the current operation instruction is obtained in real time;

[0161] Based on the current syntax tree, predict the function expression template corresponding to the current operation instruction;

[0162] Based on the function expression template, the error prediction of the current function expression is performed to obtain the prediction result.

[0163] The computer device provided in the embodiment of the present application has similar implementation principles and technical effects to those of the above-mentioned method embodiment, and will not be described in detail here.

[0164] In one embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:

[0165] Get the current function expression entered by the user;

[0166] Perform error detection and repair processing on the current function expression to obtain the processed target function expression;

[0167] Analyze and calculate the objective function expression to obtain the objective variable and objective operator corresponding to the objective function expression;

[0168] The function output value is calculated and saved based on the target variable and the target operator, and the function output value is mapped to the preset canvas coordinate system to generate a function image corresponding to the target function expression.

[0169] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are further implemented:

[0170] Perform error detection on the current function expression and obtain the detection result;

[0171] If the current function expression is determined to be normal based on the detection result, the current function expression is used as the target function expression;

[0172] If it is determined based on the detection results that the current function expression is abnormal, the current function expression is repaired according to the preset correction rules, and the repair result is used as the target function expression.

[0173] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are further implemented:

[0174] Performing lexical analysis on the current function expression to generate a first processing result;

[0175] When it is determined based on the first processing result that the lexical correctness of the current function expression is determined, a syntax analysis process is performed on the current function expression to generate a second processing result;

[0176] A detection result is determined based on the first processing result and the second processing result.

[0177] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are further implemented:

[0178] If it is determined based on the first processing result that the current function expression is lexically correct and based on the second processing result that the current function expression is grammatically correct;

[0179] If it is determined based on the first processing result that the current function expression is lexically correct, then it is determined that the current function expression is abnormal, or,

[0180] If it is determined based on the first processing result that the current function expression is lexically correct and based on the second processing result that the current function expression is syntactically incorrect, then it is determined that the current function expression is abnormal.

[0181] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are further implemented:

[0182] When it is determined based on the second processing result that the syntax of the current function expression is correct, obtaining a current syntax tree corresponding to the current function expression;

[0183] Recursively traverse the syntax tree, and for each operator node in the current syntax tree, perform parsing processing based on the type of the operator node to obtain the target variable and target operator corresponding to the target function expression.

[0184] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are further implemented:

[0185] Obtain the user's current operation instructions for each character in the current function expression; wherein the current operation instructions include input operation instructions and delete operation instructions;

[0186] For the current operation instructions corresponding to each character, the historical syntax tree is updated in sequence to generate the current syntax tree.

[0187] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are further implemented:

[0188] Based on each current operation instruction, a current syntax tree corresponding to the current operation instruction is obtained in real time;

[0189] Based on the current syntax tree, predict the function expression template corresponding to the current operation instruction;

[0190] Based on the function expression template, the error prediction of the current function expression is performed to obtain the prediction result.

[0191] The computer-readable storage medium provided in this embodiment has similar implementation principles and technical effects to those of the above method embodiments, and will not be described in detail here.

[0192] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0193] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0194] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. An expression processing method, characterized in that: The method comprises: Get the current function expression entered by the user; Performing error detection and repair processing on the current function expression to obtain a processed target function expression; Analyze and calculate the objective function expression to obtain the objective variable and the objective operator corresponding to the objective function expression; The function output value is calculated and saved based on the target variable and the target operator, and the function output value is mapped to a preset canvas coordinate system to generate a function image corresponding to the target function expression.

2. The method according to claim 1, characterized in that: The performing error detection and repair processing on the current function expression to obtain a processed target function expression includes: Performing error detection on the current function expression to obtain a detection result; If it is determined based on the detection result that the current function expression is normal, the current function expression is used as the target function expression; If it is determined based on the detection result that the current function expression is abnormal, the current function expression is repaired according to a preset correction rule, and the repair result is used as the target function expression.

3. The method according to claim 2, characterized in that The performing error detection on the current function expression to obtain a detection result includes: Performing lexical analysis on the current function expression to generate a first processing result; In the case where it is determined based on the first processing result that the lexical correctness of the current function expression is determined, performing syntax analysis processing on the current function expression to generate a second processing result; The detection result is determined based on the first processing result and the second processing result.

4. The method according to claim 3, characterized in that The method further comprises: If it is determined based on the first processing result that the current function expression is lexically correct and based on the second processing result that the current function expression is grammatically correct; If it is determined based on the first processing result that the current function expression is lexically correct, then it is determined that the current function expression is abnormal, or, If it is determined based on the first processing result that the current function expression is lexically correct and it is determined based on the second processing result that the current function expression is syntactically incorrect, then it is determined that the current function expression is abnormal.

5. The method according to any one of claims 2 to 4, characterized in that: The step of performing analytical calculation on the objective function expression to obtain the objective variable and the objective operator corresponding to the objective function expression includes: In a case where it is determined based on the second processing result that the syntax of the current function expression is correct, obtaining a current syntax tree corresponding to the current function expression; The syntax tree is recursively traversed, and for each operator node in the current syntax tree, parsing processing is performed based on the type of the operator node to obtain a target variable and a target operator corresponding to the target function expression.

6. The method according to claim 5, characterized in that The method further comprises: Obtaining the user's current operation instructions for each character in the current function expression; wherein the current operation instructions include input operation instructions and delete operation instructions; For the current operation instructions corresponding to each character, the historical syntax tree is updated in sequence to generate the current syntax tree.

7. The method according to claim 6, characterized in that The method further comprises: Based on each of the current operation instructions, obtaining in real time a current syntax tree corresponding to the current operation instruction; Based on the current syntax tree, predict and obtain a function expression template corresponding to the current operation instruction; Based on the function expression template, error prediction is performed on the current function expression to obtain a prediction result.

8. An expression processing device, characterized in that: The device comprises: The acquisition module is used to obtain the current function expression input by the user; A processing module, used for performing error detection and repair processing on the current function expression to obtain a processed target function expression; A calculation module, used for analyzing and calculating the objective function expression to obtain the objective variable and the objective operator corresponding to the objective function expression; A generation module is used to calculate a function output value based on the target variable and the target operator, and map the function output value to a preset canvas coordinate system to generate a function image corresponding to the target function expression.

9. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the expression processing method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the expression processing method as described in any one of claims 1-7.