Method and apparatus for determining information
1. A method for determining information, comprising:
in response to receiving a calculation request for a target formula set, storing the target formula set in a target storage space, pointing a pointer to a first formula in the target storage space, and performing the following iterative operations:
taking the formula pointed by the pointer as a current formula, and identifying each function in expressions in the current formula;
for each functional expression in the expressions, determining a function value of the functional expression by adopting the operation logic of the function indicated by the functional expression and the input parameter in the functional expression, and replacing the functional expression in the expressions by adopting the function value;
determining the result of the expression based on each function value, pointing the pointer to the next formula of the current formula, and taking the result of the expression as the input parameter of the function formula in the iteration operation of the next round;
and in response to determining that the preset field exists in the current formula, stopping the iteration operation, and determining the result of the expression determined in the last iteration operation as target information.
2. The method of claim 1, wherein the method further comprises:
for each of the expressions, in response to determining that sub-expressions are included in the expressions, identifying and obtaining ones of the sub-expressions.
3. The method of claim 1, wherein said identifying each of the expressions in the current formula comprises:
identifying characters in an expression in the current formula;
and determining the functional expression contained in the expression according to a character string formed by the characters in the expression.
4. The method of claim 1, wherein determining the function value of the functional formula using the operational logic of the function indicated by the functional formula and the input parameter in the functional formula comprises:
identifying characters in the functional expression, and determining parameters in the functional expression according to the characters;
and determining the function value of the functional formula by adopting the operation logic of the function indicated by the functional formula and the parameters in the functional formula.
5. The method of any one of claims 1-5, wherein the input parameters in the functional formula include data associated with a target item, and the target information includes attribute information of the target item.
6. An apparatus for determining information, comprising:
a receiving unit configured to, in response to receiving a calculation request for a target formula set, store the target formula set in a target storage space, point a pointer to a first formula in the target storage space, and perform the following iterative operations:
a first identifying unit configured to identify each of expressions in a current formula, taking a formula pointed to by the pointer as the current formula;
a first calculation unit configured to determine, for each of the expressions, a function value of the function expression using an operation logic of a function indicated by the function expression and an input parameter in the function expression, and replace the function expression in the expression with the function value;
a second calculation unit configured to determine a result of the expression based on each function value, point the pointer to a formula next to the current formula, and take the result of the expression as an input parameter of the function formula in the iteration operation of the subsequent round;
a determining unit configured to stop the iterative operation in response to determining that a preset field exists in the current formula, and determine a result of the expression determined in a last iteration as target information.
7. The apparatus of claim 6, wherein the apparatus further comprises:
a second identifying unit configured to identify and acquire, for each of the expressions, a function expression of the sub-expressions in response to determining that the function expression includes the sub-expressions.
8. The apparatus of claim 6, wherein the first identifying unit comprises:
a first identification module configured to identify, for an expression in the current formula, a character in the expression;
the first determining module is configured to determine the functional expression contained in the expression according to a character string formed by characters in the expression.
9. The apparatus of claim 6, wherein the first computing unit comprises:
a second identification module configured to identify characters in the functional expression, and determine parameters in the functional expression according to the characters;
a second determining module configured to determine a function value of the functional formula using the operation logic of the function indicated by the functional formula and the parameter in the functional formula.
10. The method of any one of claims 6-9, wherein the input parameters in the functional formula include data associated with a target item, and the target information includes attribute information of the target item.
11. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5.
12. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-5.
Background
The formula edited by the user is input into the application program, and the data in the application program is calculated based on the formula edited by the user, so that the information meeting the requirements of the user can be determined. The existing method for calculating data in an application program based on a formula edited by a user is as follows: and constructing a syntax tree based on a formula edited by a user, wherein each node in the syntax tree is used for representing an operator, a function value or a numerical value, corresponding calculation is performed on each node when the syntax tree is executed, and the value of the node is transmitted to a father node for recalculation until the root node is calculated.
However, the existing method for calculating the formula edited by the user by constructing the syntax tree has the problems of low efficiency and waste of storage space.
Disclosure of Invention
The present disclosure provides a method, an apparatus, an electronic device, and a computer-readable storage medium for determining information.
According to a first aspect of the present disclosure, there is provided a method for determining information, comprising: in response to receiving a calculation request for a target formula set, storing the target formula set in a target storage space, pointing a pointer to a first formula in the target storage space, and performing the following iterative operations: taking a formula pointed by the pointer as a current formula, and identifying each function in expressions in the current formula; for each functional expression in the expression, determining a function value of the functional expression by adopting the operation logic of the function indicated by the functional expression and the input parameter in the functional expression, and replacing the functional expression in the expression by adopting the function value; determining the result of the expression based on each function value, pointing the pointer to the next formula of the current formula, and taking the result of the expression as the input parameter of the function formula in the iteration operation of the next round; and stopping the iteration operation in response to the fact that the preset field exists in the current formula, and determining the result of the expression determined in the last iteration operation as the target information.
In some embodiments, the method for determining information further comprises: for each of the expressions, in response to determining that the sub-expressions are included in the function, identifying and obtaining a function of the sub-expressions.
In some embodiments, identifying each of the expressions in the current formula includes: identifying characters in an expression in a current formula; and determining the functional expression contained in the expression according to the character string formed by the characters in the expression.
In some embodiments, determining the function value of the functional formula using the operation logic of the function indicated by the functional formula and the input parameter in the functional formula includes: identifying characters in the functional expression, and determining parameters in the functional expression according to the characters; and determining the function value of the functional formula by adopting the operation logic of the function indicated by the functional formula and the parameters in the functional formula.
In some embodiments, the input parameters in the functional formula include data associated with the target item, and the target information includes attribute information of the target item.
According to a second aspect of the present disclosure, there is provided an apparatus for determining information, comprising: a receiving unit configured to, in response to receiving a calculation request for a target formula set, store the target formula set in a target storage space, point a pointer to a first formula in the target storage space, and perform the following iterative operations: a first identifying unit configured to identify each of expressions in a current formula, taking a formula pointed to by a pointer as the current formula; a first calculation unit configured to determine, for each of the expressions, a function value of the function expression using an operation logic of a function indicated by the function expression and an input parameter in the function expression, and replace the function expression in the expression with the function value; a second calculation unit configured to determine a result of the expression based on each function value, point the pointer to a formula next to the current formula, and take the result of the expression as an input parameter of the functional formula in the iteration operation of the subsequent round; and the determining unit is configured to respond to the fact that the preset field exists in the current formula, stop iteration operation and determine the result of the expression determined in the last iteration operation as the target information.
In some embodiments, the means for determining information further comprises: a second identifying unit configured to identify and acquire, for each of the expressions, a function expression of the sub-expressions in response to determining that the sub-expression is included in the function expression.
In some embodiments, the first identification unit comprises: the first identification module is configured to identify characters in expressions in the current formula; the first determining module is configured to determine the functional expression contained in the expression according to a character string formed by characters in the expression.
In some embodiments, the first computing unit comprises: the second recognition module is configured to recognize characters in the functional expression and determine parameters in the functional expression according to the characters; and the second determination module is configured to determine the function value of the functional formula by adopting the operation logic of the function indicated by the functional formula and the parameter in the functional formula.
In some embodiments, the input parameters in the functional formula include data associated with the target item, and the target information includes attribute information of the target item.
According to a third aspect of the present disclosure, an embodiment of the present disclosure provides an electronic device, including: one or more processors: a storage device for storing one or more programs which, when executed by one or more processors, cause the one or more processors to implement a method for determining information as provided in the first aspect.
According to a fourth aspect of the present disclosure, embodiments of the present disclosure provide a computer readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method for determining information as provided by the first aspect.
The method and the device for determining the information provided by the disclosure comprise the following steps: in response to receiving a calculation request for a target formula set, storing the target formula set in a target storage space, pointing a pointer to a first formula in the target storage space, and performing the following iterative operations: taking a formula pointed by the pointer as a current formula, and identifying each function in expressions in the current formula; for each functional expression in the expression, determining a function value of the functional expression by adopting the operation logic of the function indicated by the functional expression and the input parameter in the functional expression, and replacing the functional expression in the expression by adopting the function value; determining the result of the expression based on each function value, pointing the pointer to the next formula of the current formula, and taking the result of the expression as the input parameter of the function formula in the iteration operation of the next round; in response to determining that the preset field exists in the current formula, the iteration operation is stopped, and the result of the expression determined in the last iteration operation is determined as the target information, so that the efficiency of calculating the formula group edited by the user can be improved, and the waste of storage space can be avoided.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:
FIG. 1 is an exemplary system architecture diagram in which embodiments of the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a method for determining information according to the present application;
FIG. 3 is an example of a set of formulas in a method for determining information according to the present application;
FIG. 4 is a flow diagram of another embodiment of a method for determining information according to the present application;
FIG. 5 is a schematic illustration of an application scenario of a method for determining information according to the present application;
FIG. 6 is a flow chart of the steps performed by the expression parsing module in a method for determining information according to the present application;
FIG. 7 is a flow chart of the steps performed by a functional parser module in a method for determining information according to the present application;
FIG. 8 is a schematic block diagram illustrating one embodiment of an apparatus for determining information according to the present application;
fig. 9 is a block diagram of an electronic device for implementing a method for determining information according to an embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 shows an exemplary system architecture 100 to which embodiments of the service processing method or service processing apparatus of the present application may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may be user terminal devices on which various client applications may be installed, such as a formula editing type application, an office software type application, an image recognition type application, a video recognition type application, a play type application, a search type application, a financial type application, and the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting receiving server messages, including but not limited to smartphones, tablets, e-book readers, electronic players, laptop portable computers, desktop computers, and the like.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, and 103 are hardware, various electronic devices may be used, and when the terminal devices 101, 102, and 103 are software, the electronic devices may be installed in the above-listed electronic devices. It may be implemented as multiple pieces of software or software modules (e.g., multiple software modules to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
When the server 105 receives a calculation request for a target formula group, the target formula group is stored in the target storage space, a pointer is pointed to a first formula in the target storage space, and the following iteration operations are performed: the method comprises the steps of taking a formula pointed by a pointer as a current formula, identifying each function in an expression in the current formula, determining a function value of the function by adopting the operation logic of the function pointed by the function and an input parameter in the function for each function in the expression, replacing the formula in the expression by adopting the function value, determining a result of the expression based on each function value, pointing the pointer to the next formula of the current formula, taking the result of the current expression as an input parameter of the function in the iteration operation of the next round, stopping the iteration operation if a preset field exists in the current formula, and determining the result of the expression determined in the last iteration operation as target information.
It should be noted that the service processing method provided by the embodiment of the present disclosure may be executed by the terminal devices 101, 102, and 103, or may be executed by the server 105, and accordingly, the service processing apparatus may be disposed in the terminal devices 101, 102, and 103, or may be disposed in the server 105.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of a method for determining information in accordance with the present disclosure is shown, including the steps of:
step 201, in response to receiving a calculation request for a target formula group, storing the target formula group in a target storage space, pointing a pointer to a first formula in the target storage space, and performing an iterative operation.
In the present embodiment, when an execution subject (e.g., the server 105 shown in fig. 1) of the method for determining information receives a calculation request for a target formula set, the target formula set is stored in a target storage space, and a pointer for extracting data/information is pointed to a first formula in the target storage space.
The iterative operation includes step 2021, step 2022, and step 2023.
Step 2021, using the formula pointed by the pointer as the current formula, and identifying each functional expression in the current formula.
In this embodiment, the formula pointed to by the pointer is taken as the current formula, and each of the expressions in the current formula is identified. The formula group refers to a complete calculation process edited by a user, and each formula in the formula group is each assignment statement in the calculation process; the expression refers to the statement/content/information on the right side of the equal sign in each assignment statement; the functional expression comprises a function identification and a parameter, and the execution subject can call the function corresponding to the function identification and calculate the result of the functional expression based on the parameter. For example, in the formula group shown in fig. 3, each row is an assignment statement, i.e., each row is a formula, and the right side of the equal sign in each formula is an expression, i.e.: "(f) (a), h (b), g (c),. · t", "trimean (y, 2/8)" and "k (y, z) + l (3)" are expressions, each of which includes a functional formula, that is: "f (a)", "" h (b) "," "g (c)", "" trimean (y, 2/8) "," k (y, z) "," l (3) "are all functional expressions, and in the functional expressions, the information outside the parentheses represents the function name or the function identifier, and the information inside the parentheses represents the input parameters of the functional expressions. It is understood that the parameter in the functional expression may also be an expression, and one expression may include a plurality of functional expressions. The arithmetic logic of each functional expression may be stored in advance in the execution main body, or may be stored in advance in another device communicatively connected to the execution main body.
Step 2022, for each functional expression in the expression, determining a function value of the functional expression by using the operation logic of the function indicated by the functional expression and the input parameter in the functional expression, and replacing the functional expression in the expression by using the function value.
In this embodiment, for an expression in the formula pointed by the pointer in the current iteration round, for each functional expression in the expression, the operation logic of the function pointed by the functional expression and the input parameter in the functional expression are used to determine the function value of the functional expression, and the functional expression in the expression is replaced by the function value.
Step 2023, determining the result of the expression based on each function value, pointing the pointer to the next formula of the current formula, and using the result of the expression as the input parameter of the function in the iteration operation of the next round.
In this embodiment, in the expression in the formula in the current iteration round, all the function expressions have been replaced by function values corresponding to the function expressions, and according to each function value and the operation logic between the function values in the expression, the calculation result of the expression, that is, the calculation result of the formula in the current iteration round is calculated, and the result is used as the input parameter of the function expression in the iteration operation of the subsequent round.
And step 203, in response to determining that the preset field exists in the current formula, stopping iteration operation, and determining the result of the expression determined in the last iteration operation as target information.
In this embodiment, when it is determined that a preset field exists in the formula pointed by the pointer in the current iteration round, the iteration operation is stopped, and the result of the expression determined in the last iteration round is determined as the target information. Here, the preset field may exist on the left side of the equation equal sign, that is, the label of the current equation calculation result, such as "result" in fig. 3, and the preset label may also exist on the right side of the equation equal sign, such as marking the preset symbol at the end of the right expression. "or a preset flag" End ", etc.
In response to receiving a calculation request for a target formula set, the method for determining information stores the target formula set in a target storage space, points a pointer to a first formula in the target storage space, and performs the following iterative operations: taking a formula pointed by the pointer as a current formula, and identifying each function in expressions in the current formula; for each functional expression in the expression, determining a function value of the functional expression by adopting the operation logic of the function indicated by the functional expression and the input parameter in the functional expression, and replacing the functional expression in the expression by adopting the function value; determining the result of the expression based on each function value, pointing the pointer to the next formula of the current formula, and taking the result of the expression as the input parameter of the function formula in the iteration operation of the next round; in response to the fact that the preset field exists in the current formula, the iteration operation is stopped, the result of the expression determined in the last iteration operation is determined as target information, the formula group edited by the user is identified as a model of formula, expression and functional formula, the expression execution is triggered by formula execution in the formula calculation process, the functional formula execution is triggered by expression execution, the expression execution and the functional formula execution are continuously triggered by functional formula execution, execution logic of recursive iteration is formed among the three, and the efficiency of determining the target information according to the formula group edited by the user can be improved.
With continued reference to FIG. 4, a flow 400 of another embodiment of a method for determining information in accordance with the present disclosure is shown, comprising the steps of:
in step 401, in response to receiving a calculation request for a target formula group, the target formula group is stored in a target storage space, a pointer is pointed to a first formula in the target storage space, and the following iteration operations are performed.
Step 4021, using the formula pointed by the pointer as the current formula, and identifying each function in the expressions in the current formula.
Step 4022, for each of the expressions, in response to determining that the sub-expressions are included in the function, identifying and obtaining the function of the sub-expressions.
In this embodiment, for each of the expressions, if other sub-expressions are included in the expression (the expressions nested in the expressions may be referred to as sub-expressions), the function in the sub-expressions is identified and obtained.
Step 4023, determining a function value of the function formula by adopting the operation logic of the function indicated by the function formula and the input parameter in the function formula for each function formula in the expression, and replacing the function formula in the expression by adopting the function value.
Step 4024, determining the result of the expression based on each function value, pointing the pointer to the next formula of the current formula, and taking the result of the expression as the input parameter of the function formula in the iteration operation of the next round.
And step 403, in response to determining that the preset field exists in the current formula, stopping iteration operation, and determining the result of the expression determined in the last iteration operation as the target information.
In this embodiment, the descriptions of step 401, step 4021, step 4023, step 4024, and step 403 are the same as the descriptions of step 201, step 2021, step 2022, step 2023, and step 203, and are not repeated here.
In some application scenarios, as shown in fig. 5, the execution subject of the method for determining information may include a formula parsing module, an expression parsing module, and a functional parsing module, and the method for determining information may include:
after the execution main body receives a calculation request aiming at a target formula group, the formulas in the target formula group are stored in a target storage space line by line, the formula analysis module scans the formula group line by line, the equal-number right side of each line of the formulas is determined to be an expression, and the expression is sent to the expression analysis module for analysis and execution.
And the expression analysis module identifies the functional formulas in the expressions after receiving the expressions sent by the formula analysis module, and sends the analyzed functional formulas to the functional formula analysis module one by one for analysis and calculation.
And after receiving the function formula sent by the expression analysis module, the function formula analysis module identifies parameters in the function formula and detects the parameters parameter by parameter so as to detect the type of each parameter. The type of the parameter in the functional expression may be an expression, a functional expression, a numerical value or a text. If the parameter in the functional formula is an expression, the expression is sent to an expression analysis module for analysis and calculation; if the parameter is a functional expression, analyzing and calculating in the functional expression analysis module; if the parameter is a numerical value or a text, the numerical value or the text is used as an input parameter and is input into the arithmetic logic of the loaded/called function to participate in the calculation of the realization function.
After the function formula analysis module obtains parameters contained in all function formulas, calculation of the function formulas is achieved based on operation logic of the called functions, calculation results/function values are returned to the expression analysis module, the expression analysis module replaces the function formulas in the expressions by the function values corresponding to the function formulas, calculation of expression results is completed based on an expression dynamic operation mechanism, the results are returned to the formula analysis module, and the formula analysis module assigns values of the expressions to variables on the left side of the equal sign.
If the variable name of the formula in a certain row is a preset field, the formula is represented as the formula in the last row in the formula group, the result of the formula is target information required by the user, and the target information can be fed back to the user.
Compared with the embodiment described in fig. 2, the method for determining information provided by this embodiment adds the step of identifying and acquiring a function expression in sub-expressions when the sub-expression is included in the function expression, and can improve the efficiency of identifying an expression or a function expression in the case of nesting the expression in the function expression.
In some alternative implementations of the embodiments described above in connection with fig. 2 and 4, identifying each of the expressions in the current formula includes: identifying characters in an expression in a current formula; and determining the functional expression contained in the expression according to the character string formed by the characters in the expression.
In the embodiment, for an expression in a current formula, characters in the expression are identified, and a functional formula included in the expression is determined according to a character string formed by the characters in the expression.
Specifically, the recognized characters may be arranged in the order of the characters in the expression and constitute a character string, which is determined as a functional expression included in the expression.
Specifically, as shown in fig. 6, an expression parsing step is first performed, which may identify characters in an expression, determine a record item state according to a character identification result, and determine an operation to be performed according to the record item state. The entry is a temporary character string formed by splicing the currently scanned characters.
Firstly, characters in the expression are identified according to the sequence from left to right, and the characters are determined.
Secondly, in the process of sequentially identifying the characters from left to right, determining the content in the current record item according to the currently identified characters, and executing corresponding operation according to the record item state/the content of the record item.
Wherein the characters may include: operators (e.g., +, -,'s', etc.), punctuation marks (e.g., commas, dot symbols), brackets (left brackets and right brackets), and the like. The entry states include: whether the current entry is a function, whether the current entry is empty, and whether the bracketed offset for the current entry is equal to 0. The bracket skewness is used for describing the symmetrical state of the left bracket and the right bracket, if the skewness is 1 (or other preset marks), the left bracket is more than the right bracket in the record item by one, if the skewness is-1 (or other preset marks), the right bracket is more than the left bracket in the record item by one, and if the skewness is 0 (or other preset marks), the left bracket and the right bracket in the record item are equal in number. The performing operation corresponding to the entry state includes: splicing the current scanning character to a record item, splicing the current scanning character to a parameter item, marking the record item as a function, establishing a function object and caching, emptying the record item and emptying the parameter item, wherein the record item has the number of brackets of +1 and the number of brackets of-1. Wherein, the parameter item is a character string composed of parameter parts of the functional expression, such as "average ((a, medin (b))" the parameter item of the functional expression is "a, medin (b)".
After the expression is analyzed and all the functional expressions are obtained, executing the steps, and executing calculation operation on the expression: first, the calculation result of the expression already calculated in the formula is obtained. It should be noted that the formula is calculated according to the sequence of the expressions, the result of the expression calculated in the previous step is assigned to the relevant variables, these variables will be used as parameters to be transmitted to the following expression object for use, and the following expression does not necessarily use all these variables, depending on whether these variables are referred to in the following expression or not.
Secondly, analyzing and calculating the cached functional expressions one by one in the expression analysis process, namely calling a functional expression analysis module to analyze and calculate the functions. And after the function values of all the function formulas in the expression are obtained, replacing the corresponding function formulas in the expression by the function values.
And finally, calculating the result of the expression by adopting an expression dynamic operation mechanism, and returning the result to the formula analysis module, so that the calculation of the expression is finished.
In the embodiment, character recognition, entry state recognition and execution of the operation processing expression corresponding to the entry state are adopted in the analysis process of the expression, so that the efficiency of analyzing the expression can be improved, and the operation and maintenance cost can be reduced. And the result is calculated based on the expression dynamic operation mechanism, so that the generation of a temporary object instance can be avoided, and the waste of system storage resources is reduced.
In some alternative implementations of the embodiments described above in conjunction with fig. 2 and 4, determining the function value of the functional formula using the operation logic of the function indicated by the functional formula and the input parameter in the functional formula includes: identifying characters in the functional expression, and determining parameters in the functional expression according to the characters; and determining the function value of the functional formula by adopting the operation logic of the function indicated by the functional formula and the parameters in the functional formula.
In this embodiment, a character in the functional formula may be recognized, a parameter in the functional formula may be determined from the character, and a function value of the functional formula may be determined using the operation logic of the function indicated by the functional formula and the parameter in the functional formula.
Specifically, as shown in fig. 7, performing the functional formula parsing step first may identify characters in the expression, determine the entry state according to the character recognition result, and determine the execution operation according to the entry state.
Firstly, the characters in the functional expression are identified according to the sequence from left to right, and the characters are determined.
Secondly, in the process of sequentially identifying the characters from left to right, determining the content in the current record item according to the currently identified characters, and executing corresponding operation according to the record item state/the content of the record item.
This embodiment increases the state in which the entry is a parameter, compared to the previous embodiment. It should be noted that the same entry can be labeled as a function and a parameter at the same time, and when labeled as a parameter, it indicates that the currently scanned character belongs to the parameter part of the functional formula, otherwise, the currently scanned character belongs to the name part of the functional formula
In this embodiment, the performing operation corresponding to the entry state further includes: splicing the characters to parameter items, wherein the parameter items are independently used as a cached character string for storing the parameters of the function; constructing an expression object and caching; the record item is marked as a text parameter and cached; and canceling the mark of the record item, and canceling all marks on the record item, including an expression mark, a function mark or a parameter mark.
After the functional formula analysis is completed, executing the following steps: circulating all cached parameter items, if the parameter items are expression objects or function objects, analyzing and calculating values of the expressions or the function, and transmitting results serving as parameters into the function; if the parameter item is the result of the calculated expression in the formula, acquiring a numerical value corresponding to the result, and transmitting the numerical value into the function formula; if the parameter item is a text type parameter, the parameter item is directly transmitted into the functional expression. Thereafter, the functional expression is calculated based on the operation logic indicated by the functional expression and the result is returned to the expression.
In the embodiment, in the analysis process of the functional expression, character recognition, record item state recognition and execution of the operation processing expression corresponding to the record item state are adopted, so that the efficiency of analyzing the expression can be improved, and the operation and maintenance cost can be reduced. And the result is calculated based on the expression dynamic operation mechanism, so that the generation of a temporary object instance can be avoided, and the waste of system storage resources is reduced.
In some alternative implementations of the embodiments described above in connection with fig. 2 and 4, the input parameters in the functional formula include data associated with the target item, and the target information includes attribute information of the target item.
In the present embodiment, the input parameters in the functional formula include data associated with the target item, for example, the number of clicks of the target item in a certain e-commerce platform by the user, the sales number of the target item or the sales amount of the target item, and the like, and the target information may be attribute information of the target item determined based on a formula set edited by the user, such as statistical data (average value, probability distribution value, and the like) of the number of clicks of the target item, the sales amount/sales amount change of the target item, and the like.
With further reference to fig. 8, as an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of an apparatus for determining information, which corresponds to the method embodiments shown in fig. 2 and 4, and which is particularly applicable to various electronic devices.
As shown in fig. 8, the apparatus for determining information of the present embodiment includes: a receiving unit 801, a first identifying unit 8021, a first calculating unit 8022, a second calculating unit 8023, and a determining unit 803. Wherein the receiving unit is configured to respond to receiving a calculation request aiming at the target formula group, store the target formula group in the target storage space, point the pointer to the first formula in the target storage space, and execute the following iterative operations: a first identifying unit configured to identify each of expressions in a current formula, taking a formula pointed to by a pointer as the current formula; a first calculation unit configured to determine, for each of the expressions, a function value of the function expression using an operation logic of a function indicated by the function expression and an input parameter in the function expression, and replace the function expression in the expression with the function value; a second calculation unit configured to determine a result of the expression based on each function value, point the pointer to a formula next to the current formula, and take the result of the expression as an input parameter of the functional formula in the iteration operation of the subsequent round; and the determining unit is configured to respond to the fact that the preset field exists in the current formula, stop iteration operation and determine the result of the expression determined in the last iteration operation as the target information.
In some embodiments, the means for determining information further comprises: a second identifying unit configured to identify and acquire, for each of the expressions, a function expression of the sub-expressions in response to determining that the sub-expression is included in the function expression.
In some embodiments, the first identification unit comprises: the first identification module is configured to identify characters in expressions in the current formula; the first determining module is configured to determine the functional expression contained in the expression according to a character string formed by characters in the expression.
In some embodiments, the first computing unit comprises: the second recognition module is configured to recognize characters in the functional expression and determine parameters in the functional expression according to the characters; and the second determination module is configured to determine the function value of the functional formula by adopting the operation logic of the function indicated by the functional formula and the parameter in the functional formula.
In some embodiments, the input parameters in the functional formula include data associated with the target item, and the target information includes attribute information of the target item.
The units in the apparatus 800 described above correspond to the steps in the method described with reference to fig. 2 and 4. Thus, the operations, features and technical effects that can be achieved by the above-described method for generating information are also applicable to the apparatus 800 and the units included therein, and are not described herein again.
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
As shown in fig. 9, a block diagram of an electronic device 900 for determining information according to an embodiment of the application is shown. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 9, the electronic apparatus includes: one or more processors 901, memory 902, and interfaces for connecting the various components, including a high-speed interface and a low-speed interface. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). Fig. 9 illustrates an example of a processor 901.
Memory 902 is a non-transitory computer readable storage medium as provided herein. Wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the method for determining information provided herein. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to perform the method for determining information provided herein.
The memory 902, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the method for determining information in the embodiment of the present application (for example, the receiving unit 801, the first identifying unit 8021, the first calculating unit 8022, the second calculating unit 8023, and the determining unit 803 shown in fig. 8). The processor 901 executes various functional applications of the server and data processing, i.e., implements the method for determining information in the above-described method embodiments, by executing non-transitory software programs, instructions, and modules stored in the memory 902.
The memory 902 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the electronic device for extracting the video clip, and the like. Further, the memory 902 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 902 may optionally include memory located remotely from the processor 901, which may be connected to an electronic device for retrieving video clips over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device of the method for determining information may further include: an input device 903, an output device 904, and a bus 905. The processor 901, the memory 902, the input device 903, and the output device 904 may be connected by a bus 905 or in other ways, and are exemplified by the bus 905 in fig. 9.
The input device 903 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic apparatus for extracting the video clip, such as an input device of a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointing stick, one or more mouse buttons, a track ball, a joystick, or the like. The output devices 904 may include a display device, auxiliary lighting devices (e.g., LEDs), tactile feedback devices (e.g., vibrating motors), and the like. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present application can be achieved, and the present invention is not limited herein.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.