Method and device for generating steps for solving application problems
By obtaining the equation tree of application problems, using rule matching and model prediction to determine candidate semantics, and combining the formula library for aggregation and screening, the reliability problem generated by the problem-solving steps of application problems is solved, and the accuracy and reliability of the problem-solving steps are improved.
Patent Information
- Application Number
- CN202111272467.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-29
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2041-10-29
AI Technical Summary
In the prior art, the generation method of application problem-solving steps relies on a large amount of training data, resulting in errors in the generated problem-solving steps and it is difficult to ensure reliability.
By obtaining the equation tree corresponding to the application problem, using rule matching and model prediction to determine the candidate semantics of the node, combining the preset formula library for aggregation and screening, determining the target semantics of each node, and finally generating problem-solving steps.
The accuracy and reliability of determining the problem-solving steps are improved, the candidate semantic range of each node in the equation tree is expanded, and the accuracy of the problem-solving steps is enhanced.
Smart Images

Figure CN116070636B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a method and device for generating steps for solving an application problem. Background Art
[0002] Influenced by the continuous development of artificial intelligence technology, the way students learn and the way teachers teach in education have changed. In mathematics, word problems are one of the key and difficult subjects. Students' understanding of word problems mainly depends on the teacher's explanation. If AI-based methods can accurately and effectively generate the steps to solve word problems, it will not only facilitate students' independent learning, but also greatly reduce the teaching pressure of teachers.
[0003] Related technologies typically use model-based methods to generate word problem-solving steps. This method relies on large amounts of training data. However, due to the difficulty in obtaining training datasets, the generated word problem-solving steps may contain errors. Therefore, finding a reliable method for generating word problem-solving steps is an urgent problem that needs to be solved. Summary of the Invention
[0004] The present disclosure provides a method and device for generating steps for solving word problems, which are used to solve the problem of low reliability of generating steps for solving word problems.
[0005] In one aspect, an embodiment of the present disclosure provides a method for generating steps for solving a word problem, including:
[0006] Get the equation tree corresponding to the application problem to be processed;
[0007] Performing semantic extraction on the equation tree and the word problem based on preset rules and a semantic generation model, respectively, to determine a candidate semantic set corresponding to each node in the equation tree;
[0008] Based on a preset formula library, from leaf nodes to root nodes, the candidate semantic sets corresponding to each node in the formula tree are aggregated to determine the aggregated semantics corresponding to each node and the association relationship between the aggregated semantics of each node;
[0009] When the root node in the equation tree corresponds to one aggregated semantic, from the root node to the leaf nodes, based on the association relationship between the aggregated semantics of each node, the semantics associated with the target semantics corresponding to the upper-level node in the aggregated semantics corresponding to each node are determined as the target semantics corresponding to each node;
[0010] According to the target semantics corresponding to each node in the equation tree, problem-solving steps corresponding to the word problem are generated.
[0011] Another embodiment of the present disclosure provides a device for generating steps for solving a word problem, including:
[0012] The acquisition module is used to obtain the equation tree corresponding to the application problem to be processed;
[0013] A first determination module is configured to perform semantic extraction on the equation tree and the word problem based on preset rules and a semantic generation model, respectively, to determine a candidate semantic set corresponding to each node in the equation tree;
[0014] A second determination module is configured to aggregate the candidate semantic sets corresponding to each node in the formula tree from the leaf node to the root node based on a preset formula library to determine the aggregated semantics corresponding to each node and the association relationship between the aggregated semantics of each node;
[0015] A third determining module, when the root node in the equation tree corresponds to one aggregated semantic, determines, from the root node to the leaf nodes, the semantics associated with the target semantics corresponding to the upper-level node in the aggregated semantics corresponding to each node as the target semantics corresponding to the node;
[0016] A generation module is used to generate the problem-solving steps corresponding to the application problem according to the target semantics corresponding to each node in the equation tree.
[0017] The method for generating problem-solving steps proposed in this disclosure, after determining the equation tree corresponding to the problem, first uses rule matching and model prediction methods to determine the candidate semantics corresponding to each node in the equation tree. Then, based on a preset formula library, the candidate semantics corresponding to each node are aggregated and screened to determine the target semantics corresponding to each node. Then, based on the target semantics corresponding to each node in the equation tree, the corresponding problem-solving steps are generated. Thus, by expanding the range of candidate semantics for each node in the equation tree, the probability of determining the correct semantics for each node is increased, thereby improving the accuracy and reliability of the determined problem-solving steps.
[0018] An embodiment of the present disclosure provides a computing device, the computing device comprising:
[0019] a memory storing executable program code;
[0020] a processor coupled to a memory;
[0021] The processor calls the executable program code stored in the memory to execute the method for generating the application problem-solving steps as described in the first aspect above.
[0022] An embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the method for generating steps for solving a word problem as described in the first aspect above is implemented.
[0023] Additional aspects and advantages of the present disclosure will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The above and / or additional aspects and advantages of the present disclosure will become apparent and readily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0025] Figure 1 A flowchart of a method for generating steps for solving a word problem provided by an embodiment of the present disclosure;
[0026] Figure 2 A schematic diagram of an algorithm tree proposed in the present disclosure;
[0027] Figure 3 A schematic diagram of a semantic tree of an equation provided by the present disclosure;
[0028] Figure 4 Shown is a schematic diagram of a semantic aggregation process in the present disclosure;
[0029] Figure 5 A flowchart of another method for generating steps for solving a word problem provided by an embodiment of the present disclosure;
[0030] Figure 6 A schematic diagram of candidate semantics and aggregated semantics provided by the present disclosure;
[0031] Figure 7 Shown is a schematic diagram of the structure of a semantic tree in the present disclosure;
[0032] Figure 8 A flowchart of a method for generating steps for solving a word problem provided by an embodiment of the present disclosure;
[0033] Figure 9 A schematic diagram of the structure of a device for generating steps for solving an application problem provided by an embodiment of the present disclosure.
[0034] Figure 10 A schematic diagram of the structure of a computing device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0035] The following describes in detail embodiments of the present disclosure, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.
[0036] Figure 1 A flowchart of a method for generating steps for solving an application problem provided in an embodiment of the present disclosure.
[0037] like Figure 1 As shown, the method for generating the steps for solving the word problem includes:
[0038] Step 101: Obtain the equation tree corresponding to the word problem to be processed.
[0039] In the present disclosure, the word problem to be processed can be input into a pre-trained end-to-end problem-solving model to obtain the formula of the word problem, and then a formula tree is constructed based on the formula.
[0040] For example, if the equation of a word problem output by the problem-solving model is: "2*2*3.14*3", then the equation tree constructed by it can be as follows: Figure 2 As shown. Figure 2 It can be seen that the expression tree can include mathematical operators and operands.
[0041] Step 102 : performing semantic extraction on the equation tree and the word problem based on preset rules and the semantic generation model, respectively, to determine a candidate semantic set corresponding to each node in the equation tree.
[0042] From above Figure 2 It can be seen that the nodes in the expression tree can be operators, operands, etc. In addition, in the application problem, each node in the expression tree can also be assigned a semantics to construct the expression semantic tree. Figure 3 As shown, Figure 3 This is a schematic diagram of a semantic tree of an equation provided by the present disclosure. Figure 3 It can be seen that if Figure 2 The application problem corresponding to the equation tree shown is: The base radius of a cylinder is 2 cm and the height is 3 cm. Find the volume of this cylinder. Then Figure 2 The semantics of each node in the expression tree shown are as follows Figure 3 As stated.
[0043] Depend on Figure 3 It can be seen that the semantics of each node includes: subject (such as cylinder, circle, rectangle, etc.), predicate (such as length, area, volume, etc.), and unit.
[0044] In this disclosure, nodes in the equation tree can be divided into three categories based on their position: leaf nodes, intermediate nodes, and root nodes. The semantics of each node in the equation tree can be extracted based on the problem stem and the corresponding equation tree using methods such as rule matching and model prediction.
[0045] Alternatively, a rule-matching approach can be used to extract valid semantics for the root node and each leaf node. In this implementation, the question stem can be matched against pre-set rules. If part of the question stem successfully matches a rule, the semantics of the corresponding node can be determined based on the part of the question stem.
[0046] For example, when the question "The radius of the base of the cylinder is 2cm" matches any rule, we can determine the Figure 2 In the expression tree, the semantics of the node with the value "2" are: subject: cylinder, predicate: radius, unit: centimeter.
[0047] Alternatively, model prediction methods can be used to extract semantic meanings for all nodes. For example, the stem and equation tree of a word problem to be processed can be fed into a trained model to obtain multiple semantic pieces of information with varying confidence levels for each node. Because semantics with lower confidence levels are less valuable for solving the problem, semantics with a confidence level below the threshold can be discarded to reduce computational effort, while those with a confidence level above the threshold can be retained.
[0048] In addition, since some numbers in the formula tree may be constants, in the present disclosure, it is also possible to further determine whether the operands in the formula tree are potential constants to determine the semantics of the nodes in the formula tree. For example, the values of the leaf nodes can be compared with the constants extracted from the formula library. If there is a value in the formula tree that is the same as the constant in the formula library, it can be considered that the node where this value is located may be a potential constant. Among them, the mathematical formulas in the formula library can be obtained by manual enumeration, or they can be generated by statistically analyzing various known mathematical formulas. This disclosure does not limit this.
[0049] For example, if the formula library contains the formula "diameter = radius * 2", then Figure 3 Comparing the nodes in with the constants in the formula library, we can see that Figure 3 If there is a leaf node with a value of 2, then this leaf node may be a constant.
[0050] Finally, the semantics extracted by the three methods of rule, model, and constant matching are combined by nodes to obtain the candidate semantic set corresponding to each node.
[0051] Step 103, based on the preset formula library, aggregates the candidate semantic sets corresponding to each node in the formula tree from the leaf node to the root node to determine the aggregated semantics corresponding to each node and the association relationship between the aggregated semantics of each node.
[0052] Specifically, since each node may have multiple candidate semantics, and the correct problem-solving steps may only correspond to one combination of node semantics, the semantics of each node can be screened to obtain an optimal solution.
[0053] Optionally, the candidate semantics corresponding to the nodes in each sub-formula tree can be aggregated from the leaf node to the root node, using the sub-formula tree as a unit. For example, the candidate semantics of the leaf nodes in the sub-formula tree can be combined and then aggregated according to the combination scheme. In this scheme, the operators of the root node of the sub-formula tree and the predicates of the leaf nodes can be combined and queried in the formula library. If the query can be found, the combination is valid and the semantic association relationship is recorded; if the query cannot be found, the combination is invalid.
[0054] For example, Figure 4 The diagram shows a process diagram of semantic aggregation in the present disclosure, such as Figure 4 As shown in the figure, when the sub-equation tree "2*2" is aggregated, the leaf node with a value of 2 may be a potential constant and has a candidate semantics (subject: cylinder, predicate: radius, unit: centimeter). Then the sub-equation tree has 4 candidate semantic combination schemes. Figure 4 Take b as an example. The result of the combination of the leaf node predicate and the parent node operator is: radius*2. If "diameter=radius*2" is found in the formula library, the aggregation is successful, and the semantics of the root node of the child formula tree after aggregation is (subject: cylinder, predicate: diameter, unit: centimeter). In this case, the semantic association relationship between nodes is: "diameter=radius*2". If no formula related to "radius*2" is found in the formula library, the combination of "radius*2" is invalid. Similarly, we can get Figure 4 Aggregation results of the other three candidate semantic combinations in .
[0055] In addition, when there are many candidate semantics for each node, the number of candidate semantic combinations also increases accordingly, and there are repeated, invalid, and low-reliability combinations in the combinations. In order to increase the correctness of the problem-solving steps, the candidate semantic combinations can be further screened.
[0056] In this implementation, all combinations can be traversed based on a deep learning method to obtain the best combination solutions, and then the combinations whose semantics are meaningless after aggregation or whose semantics are the same after aggregation in the best combination solutions are deleted. Optionally, the combination to be removed can be determined based on the source of the semantics of each node in the candidate semantic combination corresponding to the sub-formula tree. Usually, based on the principle of retaining the semantics that are predicted by the model to the greatest extent, the combinations with fewer semantics that are predicted by the model are deleted. If the number of semantics that are predicted by the model is the same in the candidate semantic combination, the combination whose left node is the semantics predicted by the model is retained.
[0057] For example, if each node in the 2*2 sub-equation tree has 3 candidate semantics, then 9 candidate semantic combinations can be formed. Using the pre-trained deep learning network, the candidate semantic combinations are scored according to the aggregated semantic association relationship, and the 4 best combinations with the highest scores are selected, such as Figure 4 shown. Figure 4 The semantic association relationships after the four optimal combinations are shown. Figure 4 In the combination of c, the parent node is meaningless after aggregation and can be directly removed. Figure 4 b and Figure 4 The semantic predicates of the aggregated parent nodes of d are all "diameter", so it can be considered that Figure 4 b and Figure 4 The two combinations corresponding to d have the same semantics after aggregation, so they can be removed. Figure 4 b and Figure 4 One of the combinations shown in d. Figure 4 b and Figure 4 As shown in d, the two combinations each include a model-predicted semantic "subject: cylinder, predicate: radius, unit: centimeter", and a constant, that is, the number of model-predicted semantics contained in the two combinations is the same. At this time, due to Figure 4 The semantics of the left node in the reference semantic combination corresponding to b is predicted by the model, while Figure 4 The semantics of the right leaf node in d is predicted by the model, so the reference semantic group corresponding to 4b can be retained and the reference semantic group corresponding to 4d can be deleted.
[0058] Step 104, when the aggregated semantics corresponding to the root node in the formula tree is one, from the root node to the leaf node, according to the association relationship between the aggregated semantics of each node, the semantics associated with the target semantics corresponding to the upper-level node in the aggregated semantics corresponding to each node are determined as the target semantics corresponding to each node.
[0059] Specifically, after a bottom-up aggregation of all nodes in the equation tree, there may still be multiple candidate semantics for each node. In this case, the top-down verification of the aggregation results based on the semantic associations is performed to determine the target semantics for each node. The target semantics is the unique semantics corresponding to each node when the solution steps are finally generated.
[0060] During implementation, after determining the target semantics of the parent node, the association relationship corresponding to the target semantics of the parent node can be selected from the semantic association relationships after the parent node aggregation. Then, based on the association relationship, the target semantics of the child node can be determined. Similarly, the target semantics of each node can be determined from top to bottom.
[0061] For example, Figure 3 As shown, the aggregated semantics corresponding to the root node is simply "Subject: Cylinder, Predicate: Volume, Unit: Cubic Centimeters." Then, based on the relationship "Volume = Base Area * Height" corresponding to this semantics, we can determine the semantics of the node with a value of 3 (Subject: Cylinder, Predicate: Height, Unit: Centimeters) and the semantics of the node with the operator * at the same level as the node with a value of 3 (Subject: Cylinder, Predicate: Base Area, Unit: Square Centimeters). Similarly, we determine the semantics of each node in the sub-expression trees "**3.14" and "2*2" layer by layer.
[0062] Step 105: Generate the corresponding problem-solving steps for the word problem according to the target semantics corresponding to each node in the equation tree.
[0063] After determining the target semantics of each node, the problem-solving steps are gradually generated from bottom to top according to the formula tree, combining the target semantics and operators corresponding to the nodes.
[0064] For example: If Figure 3 For the equation semantic tree composed of the target semantics of each node, the first problem-solving step generated from the bottom up is: radius squared = radius * radius, the second step is: base area = radius squared * 3.14, and the third step is: volume = base area * height.
[0065] In this disclosure, after determining the equation tree corresponding to the word problem, rule matching and model prediction methods are first used to determine the candidate semantics corresponding to each node in the equation tree. Then, based on a preset formula library, the candidate semantics corresponding to each node are aggregated and screened to determine the target semantics corresponding to each node. Then, based on the target semantics corresponding to each node in the equation tree, the corresponding solution steps for the word problem are generated. Thus, by expanding the range of candidate semantics for each node in the equation tree, the probability of determining the correct semantics for each node is increased, thereby improving the accuracy and reliability of the determined solution steps.
[0066] In practical applications, each node may have multiple candidate semantics. In this disclosure, in order to obtain the best solution steps for the application problem, the candidate semantics can be screened based on the priority corresponding to each candidate semantic to obtain an optimal solution step. Figure 5 The above process is described in detail. Figure 5 A flowchart of another method for generating steps for solving an application problem provided in an embodiment of the present disclosure.
[0067] like Figure 5 As shown, the method for generating the steps for solving the word problem includes:
[0068] Step 501: Obtain the equation tree corresponding to the word problem to be processed.
[0069] In the present disclosure, the word problem to be processed can be input into a pre-trained end-to-end problem-solving model to obtain the formula of the word problem, and then a formula tree is constructed based on the formula.
[0070] Step 502 : Match the application problem with each semantics in the preset rule base to determine the first candidate semantics corresponding to each node in the equation tree.
[0071] In this embodiment, semantics can be extracted for equation tree nodes based on preset rules. During implementation, the problem stem can be broken down into sentences, and each clause can be matched against the preset rules one by one. If a rule is successfully matched, the semantics of the corresponding node can be extracted from the portion of the problem stem.
[0072] It should be noted that the preset rules are usually manually designed and verified, and their correctness is guaranteed to a certain extent. Therefore, the priority of the first candidate semantics extracted based on the rules can be set to a higher value.
[0073] Step 503: Input the word problem and the equation tree into a preset semantic generation model to determine the second candidate semantics corresponding to each node in the equation tree.
[0074] In this embodiment, the stem of the word problem to be processed and the equation tree can be input into the trained model to obtain multiple semantic information with different confidence levels for each node. The correctness of the semantics predicted by the model depends on the quality of the training data. Due to the difficulty in obtaining training data, the predicted semantics may be incorrect. Therefore, the priority of the second candidate semantics is generally lower than that of the first candidate semantics.
[0075] It should be noted that the model usually outputs multiple second candidate semantics, and each second candidate semantics corresponds to a confidence level. In the present disclosure, the confidence level corresponding to each second candidate semantics can be first calculated, and then several second candidate semantics with higher confidence levels can be selected from multiple second candidate semantics as candidate semantics corresponding to the node.
[0076] Step 504: Determine the candidate semantic group corresponding to the first sub-expression tree based on the candidate semantic set corresponding to each node in the first sub-expression tree in the expression tree, wherein the first sub-expression tree is an expression tree composed of leaf nodes, and each candidate semantic group includes a candidate semantic corresponding to each node in the first sub-expression tree.
[0077] In this embodiment, the candidate semantics corresponding to the nodes in the first sub-equation tree are combined to determine the candidate semantic group corresponding to the first sub-equation tree, wherein the first sub-equation tree is an equation tree in which all child nodes are leaf nodes.
[0078] for example, Figure 2 This is a schematic diagram of an algorithm tree proposed in this disclosure. Figure 2 As shown, "2*2" is the first sub-equation tree. Assuming that the node with the value "2" is likely a constant and has one candidate semantics (subject: cylinder, predicate: radius, unit: centimeters), the candidate semantic groups corresponding to the sub-equation tree "2*2" are: "radius, 2", "radius, radius", "2, radius", and "2, 2". In this candidate semantic group, "radius" represents the semantics with the predicate "radius" in the candidate semantics, and "2" represents the constant in the candidate semantics.
[0079] Step 505 : Based on a preset formula library, traverse each candidate semantic group corresponding to the first sub-formula tree to determine a reference semantic group corresponding to the first sub-formula tree.
[0080] Since candidate semantic combinations without practical meaning are meaningless for generating problem-solving steps, after determining the candidate semantic combinations, the candidate semantic combinations can be screened to determine the practical combinations and use them as reference semantic groups for the sub-equation tree.
[0081] The process of screening candidate semantic combinations corresponding to the self-formula tree based on the formula library can be referred to the detailed description of any embodiment of the present disclosure, and will not be repeated here.
[0082] Step 506: Aggregate the semantics in each of the reference semantic groups to determine the aggregated semantics corresponding to the parent node in the first sub-equation tree.
[0083] In the present disclosure, the semantics in each reference semantic group can be aggregated to determine the aggregated semantics of the parent node in the corresponding sub-formula tree. Figure 4 In, assuming Figure 4 There are four reference semantic groups for the neutron expression tree “2*2”. The semantics after aggregation for each reference semantic group are as follows: Figure 4 shown.
[0084] Among them, Figure 4 As shown in c, the aggregated semantics of the parent node is meaningless and can be deleted directly, such as Figure 4 As shown in b and 4d, the semantics of the parent nodes after aggregation are the same, and one of the semantics and the corresponding reference semantic group can be deleted, for example, Figure 4 d shows the reference semantic group.
[0085] In the present disclosure, there may be only one or more aggregated semantics corresponding to the parent node. In the case that there are multiple aggregated semantics of the parent node, different priorities can be assigned to different semantics. For example, the aggregated semantics of the parent node can be compared with the candidate semantics obtained by the model prediction corresponding to the node. If the same semantics exist, the aggregated semantics are assigned priorities according to the confidence of the semantics predicted by the model. If the confidence is high, a higher priority can be assigned to the corresponding aggregated semantics. If the confidence is low, a lower priority can be assigned to the aggregated semantics. If there are no same semantics, the priority of the aggregated semantics can be set to the lowest.
[0086] for example, Figure 6 This is a schematic diagram of candidate semantics and aggregated semantics provided by the present disclosure. Figure 6 As shown, Figure 6 a is the three candidate semantics predicted by the model, Figure 6 b represents the two semantics after aggregation. In this disclosure, semantics with the same predicate can be determined as the same semantics. Figure 6 a and Figure 6 The semantics in b can be seen, Figure 6 The first semantic Figure 6 The first one in b has the same semantics, Figure 6 The second semantics in a is the same as Figure 6 The second one in b has the same semantics, so we can use Figure 6 The confidence level in a, set Figure 6 The first semantics in b takes precedence over the second semantics.
[0087] Step 507 : Based on the aggregated semantics corresponding to the parent node, return to the operation of determining the candidate semantic groups corresponding to the child expression trees, until the aggregated semantics corresponding to each node in the expression tree and the reference semantic groups corresponding to each child expression tree are determined.
[0088] In this embodiment, since the aggregated semantics of the parent node rely on the results of a formula library query and are therefore highly reliable, the aggregated semantics of the parent node can be used to replace the candidate semantics corresponding to the parent node. Subsequently, each sub-equation tree is retrieved layer by layer, and the reference semantic group filter operation is performed on each sub-equation tree until the aggregated semantics corresponding to each node in the equation tree and the reference semantic group corresponding to each sub-equation tree are determined.
[0089] for example, Figure 6 The first semantic unit in a is: centimeters, Figure 6 The unit of the first semantic in b is: square centimeters. Because the aggregation is obtained by comparing with the formula library, the accuracy is higher, so Figure 6 The two semantics shown in b are used as candidate semantics for the node and are used to perform aggregation operations on the previous sub-expression tree. Figure 3 For example, after determining the reference semantics corresponding to the "2*2" sub-formula tree and the semantics after aggregation of the corresponding parent node, based on the semantics after aggregation of the parent node, steps 504 to 505 are performed on the sub-formula trees "**3.14" and "**3" in sequence to determine the semantics after aggregation corresponding to each node in the formula tree and the reference semantic group corresponding to each sub-formula tree.
[0090] In addition, if the semantics of the parent nodes are the same after aggregation, the priority of the operator node semantics in the child nodes can be used to determine which combination to retain. In this solution, the combination with the highest priority semantics can be retained. If the priorities are the same, the semantic combination obtained first is retained.
[0091] For example, Figure 7 As shown, in Figure 7 a and Figure 7 In the child expression tree "**5" of b, the predicates of the semantics after the parent node aggregation are all "volume". Assuming that among the candidate semantics of the operator "*" in the child node, the priority of the candidate semantics with the predicate "base area" is higher than the priority of the candidate semantics with the predicate "side area", then retain Figure 7 The combination shown in a is discarded Figure 7 The combination shown in b.
[0092] Step 508 : Determine the association relationship between the aggregated semantics of each node according to the reference semantic group corresponding to each sub-formula tree.
[0093] In the present disclosure, after determining the reference semantic group corresponding to each sub-equation tree, each reference semantic group is aggregated to determine the association relationship between the aggregated semantics of each node in each sub-equation tree. The aggregation method can be referred to the detailed description of the above embodiment and will not be repeated here.
[0094] Step 509, when the aggregated semantics corresponding to the root node in the formula tree is one, from the root node to the leaf node, according to the association relationship between the aggregated semantics of each node, the semantics associated with the target semantics corresponding to the upper-level node in the aggregated semantics corresponding to each node are determined as the target semantics corresponding to each node.
[0095] Step 510: Generate the corresponding problem-solving steps for the word problem according to the target semantics corresponding to each node in the equation tree.
[0096] In this embodiment, steps 509 to 510 may refer to the detailed description of the above embodiment and will not be repeated here.
[0097] In this disclosure, after determining the equation tree corresponding to the word problem, rule matching and model prediction methods are first used to determine the candidate semantics corresponding to each node in the equation tree. Then, based on a preset formula library, the candidate semantic combinations corresponding to each sub-equation tree are aggregated and screened to determine the target semantics corresponding to each node. Then, based on the target semantics corresponding to each node in the equation tree, the corresponding problem-solving steps are generated. Thus, by expanding the range of candidate semantics for each node in the equation tree, the probability of determining the correct semantics for each node is increased, thereby improving the accuracy and reliability of the determined problem-solving steps.
[0098] In practical applications, after determining the aggregated semantics corresponding to each node and the semantic association relationship of each node, verification can be performed from top to bottom to determine the target semantics of each node. When the root node has multiple aggregated semantics, it is impossible to rely on the semantic association relationship to determine the target semantics of the root node. In this disclosure, the target semantics of the root node can be determined by using the candidate semantic sources of the root node. Figure 8 To explain, Figure 8 A flowchart of another method for generating steps for solving an application problem provided in an embodiment of the present disclosure.
[0099] like Figure 8 As shown, the method for generating the steps for solving the word problem includes:
[0100] Step 801: Obtain the equation tree corresponding to the word problem to be processed.
[0101] Step 802 : performing semantic extraction on the equation tree and the word problem based on preset rules and the semantic generation model, respectively, to determine a candidate semantic set corresponding to each node in the equation tree.
[0102] Step 803, based on the preset formula library, aggregate the candidate semantic sets corresponding to each node in the formula tree from the leaf node to the root node to determine the aggregated semantics corresponding to each node and the association relationship between the aggregated semantics of each node.
[0103] In this embodiment, steps 801 to 803 can refer to the detailed description of the above embodiment and will not be repeated here.
[0104] Step 804 : When there are multiple semantics after the root node is aggregated, determine the target semantics of the root node.
[0105] Typically, the candidate semantics generated based on the model include a confidence attribute, and the target semantics of the root node can be determined based on the confidence of the candidate semantics. In this embodiment, if the semantics of the root node after aggregation are the same as the candidate semantics extracted based on the rule of the root node, the candidate semantics extracted based on the rule can be determined as the target semantics of the root node. Alternatively, if the semantics of the root node after aggregation do not include the candidate semantics extracted based on the rule, but are the same as the candidate semantics predicted by the model, the confidence of the corresponding aggregated semantics can be determined according to the semantic confidence predicted by the model.
[0106] When the confidence of any aggregated semantics corresponding to the root node is higher than that of the other aggregated semantics, the aggregated semantics is determined as the target semantics corresponding to the root node.
[0107] For example, Figure 3 In the semantic tree, the predicate of a candidate semantic extracted for the root node based on the rule is "volume". If the aggregated semantics corresponding to the root node contains the semantics with the predicate "volume", the semantics with the predicate "volume" can be determined as the target semantics of the root node.
[0108] In this embodiment, the priority of the aggregated semantics can also be determined based on whether the predicates in the aggregated semantics are in the predicate library. For example, when the aggregated semantics contains the first candidate semantics, and the predicate of the first candidate semantics is in the predicate library, the first candidate semantics can be determined as the target semantics corresponding to the root node. In addition, the predicates in the predicate library are called valid predicates, and the predicates not in the predicate library are called invalid predicates. The semantics containing valid predicates can be considered as valid semantics, and the semantics containing invalid predicates are invalid semantics. Among them, the predicates in the predicate library can be obtained by manual enumeration, or can also be generated by statistics of the formula tree of known semantics, and this disclosure does not limit this.
[0109] In addition, when the semantics after the root node aggregation does not include the first candidate semantics nor the second candidate semantics, it can be considered that the problem-solving steps have failed to be generated and the program ends.
[0110] Step 805, from the root node to the leaf node, according to the association relationship between the aggregated semantics of each node, the semantics associated with the target semantics corresponding to the upper-level node in the aggregated semantics corresponding to each node are determined as the target semantics corresponding to each node.
[0111] Step 806: Generate the corresponding problem-solving steps for the word problem based on the target semantics corresponding to each node in the equation tree.
[0112] In this embodiment, step 805 and step 806 can refer to the detailed description of the above embodiment and will not be repeated here.
[0113] In the present disclosure, after determining the formula tree corresponding to the word problem, the candidate semantics corresponding to each node in the formula tree are first determined using rule matching and model prediction methods. Then, based on the preset formula library, the candidate semantic combinations corresponding to each sub-formula tree are aggregated and screened to determine the target semantics corresponding to each node. In the case of multiple aggregated semantics, the confidence of the aggregated semantics is determined based on the source of the aggregated semantics, and the semantics with the highest confidence is determined as the target semantics of the node. Then, based on the target semantics corresponding to each node in the formula tree, the problem-solving steps corresponding to the word problem are generated. This ensures the accuracy of the target semantics of each node, thereby improving the accuracy and reliability of the generated problem-solving steps.
[0114] like Figure 9 As shown, the apparatus 900 for generating the application problem-solving steps includes: an acquisition module 910 , a first determination module 920 , a second determination module 930 , a third determination module 940 and a generation module 950 .
[0115] An acquisition module 910 is used to acquire an equation tree corresponding to the word problem to be processed;
[0116] A first determination module 920 is configured to perform semantic extraction on the equation tree and the word problem based on preset rules and a semantic generation model, respectively, to determine a candidate semantic set corresponding to each node in the equation tree;
[0117] A second determining module 930 is configured to aggregate the candidate semantic sets corresponding to each node in the formula tree from the leaf node to the root node based on a preset formula library to determine the aggregated semantics corresponding to each node and the association relationship between the aggregated semantics of each node;
[0118] A third determining module 940 is configured to, when the aggregated semantics corresponding to the root node in the equation tree is one, determine, from the root node to the leaf nodes, the semantics associated with the target semantics corresponding to the upper-level node in the aggregated semantics corresponding to each node as the target semantics corresponding to the node;
[0119] The generation module 950 is used to generate the problem-solving steps corresponding to the word problem according to the target semantics corresponding to each node in the equation tree.
[0120] In a possible implementation of the embodiment of the present disclosure, the first determining module 920 is configured to:
[0121] Matching the word problem with each semantic in a preset rule base to determine a first candidate semantic corresponding to each node in the equation tree;
[0122] The word problem and the equation tree are input into a preset semantic generation model to determine a second candidate semantic corresponding to each node in the equation tree.
[0123] In a possible implementation of the embodiment of the present disclosure, the second determining module 930 includes:
[0124] a first determining unit, configured to determine a candidate semantic group corresponding to a first sub-equation tree in the equation tree based on a candidate semantic set corresponding to each node in the first sub-equation tree, wherein the first sub-equation tree is an equation tree composed of leaf nodes, and each candidate semantic group includes a candidate semantic corresponding to each node in the first sub-equation tree;
[0125] a traversal unit, configured to traverse each candidate semantic group corresponding to the first sub-formula tree based on the preset formula library to determine a reference semantic group corresponding to the first sub-formula tree;
[0126] an aggregation unit, configured to aggregate the semantics in each of the reference semantic groups to determine the aggregated semantics corresponding to the parent node in the first sub-equation tree;
[0127] A second determining unit is configured to return to executing the operation of determining the candidate semantic group corresponding to the child expression tree based on the aggregated semantics corresponding to the parent node, until the aggregated semantics corresponding to each node in the expression tree and the reference semantic group corresponding to each of the child expression trees are determined;
[0128] The third determining unit is configured to determine the association relationship between the aggregated semantics of the nodes according to the reference semantic group corresponding to each of the sub-formula trees.
[0129] In a possible implementation of the embodiment of the present disclosure, the traversal unit is configured to:
[0130] Determining a reference formula corresponding to each candidate semantic group according to the predicates in each candidate semantic group and the operators included in the first sub-formula tree;
[0131] Matching each of the reference formulas with each formula in the preset formula library to determine a reference formula that matches any formula in the formula library;
[0132] The candidate semantic group corresponding to the reference formula is determined as the reference semantic group corresponding to the first sub-formula tree.
[0133] In a possible implementation of the embodiment of the present disclosure, the apparatus may further include:
[0134] a fourth determining module, configured to determine the confidence level of each aggregated semantics corresponding to the root node in the equation tree when there are multiple aggregated semantics corresponding to the root node;
[0135] The fifth determining module is configured to determine any aggregated semantics corresponding to the root node as the target semantics corresponding to the root node if the confidence of the any aggregated semantics corresponding to the root node is higher than that of the other aggregated semantics.
[0136] In a possible implementation of the embodiment of the present disclosure, the apparatus may further include:
[0137] a sixth determining module, configured to determine, when there are multiple aggregated semantics corresponding to the root node in the equation tree, whether the multiple aggregated semantics corresponding to the root node include the first candidate semantic determined based on the preset rule;
[0138] A seventh determination module, configured to determine whether a predicate in a first candidate semantics is valid when the plurality of aggregated semantics include the first candidate semantics;
[0139] An eighth determining module, configured to determine the first candidate semantics as the target semantics corresponding to the root node if the predicate is valid;
[0140] The ninth determination module is used to determine the second candidate semantics generated based on the preset semantic generation model in the aggregated semantics as the target semantics corresponding to the root node when the first candidate semantics is not included in the multiple aggregated semantics or the predicate is invalid.
[0141] It should be noted that the above explanation of the embodiment of the method for generating the steps for solving a word problem is also applicable to the device for generating the steps for solving a word problem in this embodiment, so it will not be repeated here.
[0142] The apparatus for generating the steps for solving a word problem in the disclosed embodiment, after determining the equation tree corresponding to the word problem, first uses rule matching and model prediction methods to determine the candidate semantics corresponding to each node in the equation tree. Then, based on a preset formula library, the candidate semantic combinations corresponding to each sub-equation tree are aggregated and screened to determine the target semantics corresponding to each node. Then, based on the target semantics corresponding to each node in the equation tree, the problem-solving steps corresponding to the word problem are generated. Thus, by expanding the range of candidate semantics for each node in the equation tree, the probability of determining the correct semantics of each node is increased, thereby improving the correctness and reliability of the determined problem-solving steps.
[0143] In order to implement the above embodiment, the present disclosure further provides a computer device including a processor and a memory;
[0144] A memory 1001 storing executable program code;
[0145] a processor 1002 coupled to the memory 1001;
[0146] The processor 1002 calls the executable program code stored in the memory 1001 to execute the method for generating the application problem-solving steps provided in any embodiment of the present disclosure.
[0147] The computing device embodiment and the above method embodiment are embodiments based on the same inventive concept, and relevant parts can be referenced to each other. The above computing device embodiment corresponds to the method embodiment and has the same technical effects as the method embodiment. For detailed description, please refer to the method embodiment.
[0148] In order to implement the above embodiment, the embodiment of the present disclosure further proposes a non-transitory computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method for generating the application problem-solving steps as described in the above embodiment is implemented.
[0149] In the description of this specification, the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of the technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of such features. In the description of this disclosure, the meaning of "plurality" is at least two, for example, two, three, etc., unless otherwise specifically defined.
[0150] Although the embodiments of the present disclosure have been shown and described above, it is understood that the above embodiments are illustrative and are not to be construed as limitations on the present disclosure. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present disclosure.
Claims
1. A method for generating steps for solving a word problem, characterized in that: include: Get the equation tree corresponding to the application problem to be processed; Performing semantic extraction on the equation tree and the word problem based on preset rules and a semantic generation model, respectively, to determine a candidate semantic set corresponding to each node in the equation tree; Based on a preset formula library, from leaf nodes to root nodes, the candidate semantic sets corresponding to each node in the formula tree are aggregated to determine the aggregated semantics corresponding to each node and the association relationship between the aggregated semantics of each node; When the root node in the equation tree corresponds to one aggregated semantic, from the root node to the leaf nodes, based on the association relationship between the aggregated semantics of each node, the semantics associated with the target semantics corresponding to the upper-level node in the aggregated semantics corresponding to each node are determined as the target semantics corresponding to each node; Generating the problem-solving steps corresponding to the word problem according to the target semantics corresponding to each node in the equation tree; Based on the preset formula library, the candidate semantic sets corresponding to each node in the formula tree are aggregated from the leaf node to the root node to determine the aggregated semantics corresponding to each node and the association relationship between the aggregated semantics of each node, including: Determining a candidate semantic group corresponding to a first sub-equation tree according to a candidate semantic set corresponding to each node in a first sub-equation tree in the equation tree, wherein the first sub-equation tree is an equation tree composed of leaf nodes, and each candidate semantic group includes a candidate semantic corresponding to each node in the first sub-equation tree; Based on the preset formula library, traverse each candidate semantic group corresponding to the first sub-formula tree to determine a reference semantic group corresponding to the first sub-formula tree; Aggregating the semantics in each of the reference semantic groups to determine the aggregated semantics corresponding to the parent node in the first sub-equation tree; Based on the aggregated semantics corresponding to the parent node, returning to the operation of determining the candidate semantic groups corresponding to the child expression trees, until the aggregated semantics corresponding to each node in the expression tree and the reference semantic groups corresponding to each of the child expression trees are determined; According to the reference semantic group corresponding to each of the sub-formula trees, the association relationship between the semantics after the aggregation of the nodes is determined.
2. The method according to claim 1, wherein The semantic extraction of the equation tree and the word problem based on preset rules and semantic generation models to determine a candidate semantic set corresponding to each node in the equation tree includes: Matching the word problem with each semantic in a preset rule base to determine a first candidate semantic corresponding to each node in the equation tree; The word problem and the equation tree are input into a preset semantic generation model to determine a second candidate semantic corresponding to each node in the equation tree.
3. The method according to claim 1, wherein The traversing each candidate semantic group corresponding to the first sub-formula tree based on the preset formula library to determine a reference semantic group corresponding to the first sub-formula tree includes: Determining a reference formula corresponding to each candidate semantic group according to the predicates in each candidate semantic group and the operators included in the first sub-formula tree; Matching each of the reference formulas with each formula in the preset formula library to determine a reference formula that matches any formula in the formula library; The candidate semantic group corresponding to the reference formula is determined as the reference semantic group corresponding to the first sub-formula tree.
4. The method according to claim 1, wherein After determining the aggregated semantics corresponding to each node and the association relationship between the aggregated semantics of each node, the method further includes: When there are multiple aggregated semantics corresponding to a root node in the equation tree, determining the confidence level of each aggregated semantics corresponding to the root node; In the case that the confidence of any aggregated semantics corresponding to the root node is higher than that of the other aggregated semantics, the any aggregated semantics is determined as the target semantics corresponding to the root node.
5. The method according to any one of claims 1 to 4, characterized in that: After determining the aggregated semantics corresponding to each node and the association relationship between the aggregated semantics of each node, the method further includes: In a case where there are multiple aggregated semantics corresponding to a root node in the equation tree, determining whether the multiple aggregated semantics corresponding to the root node include a first candidate semantic determined based on the preset rule; In a case where the plurality of aggregated semantics include a first candidate semantic, determining whether a predicate in the first candidate semantic is valid; If the predicate is valid, determining the first candidate semantics as the target semantics corresponding to the root node; When the first candidate semantics is not included in the multiple aggregated semantics or the predicate is invalid, the second candidate semantics generated based on a preset semantic generation model in the aggregated semantics is determined as the target semantics corresponding to the root node.
6. A device for generating steps for solving a word problem, characterized in that: include: The acquisition module is used to obtain the equation tree corresponding to the application problem to be processed; A first determination module is configured to perform semantic extraction on the equation tree and the word problem based on preset rules and a semantic generation model, respectively, to determine a candidate semantic set corresponding to each node in the equation tree; A second determination module is configured to aggregate the candidate semantic sets corresponding to each node in the formula tree from the leaf node to the root node based on a preset formula library to determine the aggregated semantics corresponding to each node and the association relationship between the aggregated semantics of each node; A third determining module, when the root node in the equation tree corresponds to one aggregated semantic, determines, from the root node to the leaf nodes, the semantics associated with the target semantics corresponding to the upper-level node in the aggregated semantics corresponding to each node as the target semantics corresponding to the node; A generation module, configured to generate the corresponding problem-solving steps of the word problem according to the target semantics corresponding to each node in the equation tree; The second determining module includes: a first determining unit, configured to determine a candidate semantic group corresponding to a first sub-equation tree in the equation tree based on a candidate semantic set corresponding to each node in the first sub-equation tree, wherein the first sub-equation tree is an equation tree composed of leaf nodes, and each candidate semantic group includes a candidate semantic corresponding to each node in the first sub-equation tree; a traversal unit, configured to traverse each candidate semantic group corresponding to the first sub-formula tree based on the preset formula library to determine a reference semantic group corresponding to the first sub-formula tree; an aggregation unit, configured to aggregate the semantics in each of the reference semantic groups to determine the aggregated semantics corresponding to the parent node in the first sub-equation tree; A second determining unit is configured to return to executing an operation of determining a candidate semantic group corresponding to a child expression tree based on the aggregated semantics corresponding to the parent node, until the aggregated semantics corresponding to each node in the expression tree and the reference semantic group corresponding to each child expression tree are determined; The third determining unit is configured to determine the association relationship between the aggregated semantics of the nodes according to the reference semantic group corresponding to each of the sub-formula trees.
7. The device according to claim 6, characterized in that The first determining module is used for: Matching the word problem with each semantic in a preset rule base to determine a first candidate semantic corresponding to each node in the equation tree; The word problem and the equation tree are input into a preset semantic generation model to determine a second candidate semantic corresponding to each node in the equation tree.
8. The device according to claim 7, wherein The above traversal unit is used to: Determining a reference formula corresponding to each candidate semantic group according to the predicates in each candidate semantic group and the operators included in the first sub-formula tree; Matching each of the reference formulas with each formula in the preset formula library to determine a reference formula that matches any formula in the formula library; The candidate semantic group corresponding to the reference formula is determined as the reference semantic group corresponding to the first sub-formula tree.
9. The device according to claim 6, wherein Also includes: a fourth determining module, configured to determine the confidence level of each aggregated semantics corresponding to a root node in the equation tree when there are multiple aggregated semantics corresponding to the root node; The fifth determining module is configured to determine any aggregated semantics corresponding to the root node as the target semantics corresponding to the root node if the confidence of the any aggregated semantics corresponding to the root node is higher than that of the other aggregated semantics.
10. The device according to any one of claims 6 to 9, characterized in that: Also includes: a sixth determining module, configured to determine, when there are multiple aggregated semantics corresponding to the root node in the equation tree, whether the multiple aggregated semantics corresponding to the root node include the first candidate semantic determined based on the preset rule; A seventh determining module, configured to determine whether a predicate in a first candidate semantics is valid when the plurality of aggregated semantics include the first candidate semantics; An eighth determining module, configured to determine the first candidate semantics as the target semantics corresponding to the root node if the predicate is valid; The ninth determination module is used to determine the second candidate semantics generated based on the preset semantic generation model in the aggregated semantics as the target semantics corresponding to the root node when the first candidate semantics is not included in the multiple aggregated semantics or the predicate is invalid.
Citation Information
Patent Citations
Semantic parsing of natural language query
CN110727839A
Tree structure mathematics application question solving method and system based on semantic alignment
CN111259632A