Problem solving method and apparatus
By performing semantic analysis on the end-to-end model solution formulas and constructing formula semantic trees, the problem of insufficient detail in the solution steps in existing technologies is solved, improving the visualization and interpretability of the solution, and enhancing user experience and solution accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-14
- Publication Date
- 2026-04-07
AI Technical Summary
In existing technologies, when answering questions using end-to-end models, detailed solution steps cannot be obtained, resulting in poor interpretability of the answers and affecting user experience. Sequence-to-sequence models, on the other hand, require a large amount of high-quality training data and have difficulty learning fixed solution patterns, resulting in limited accuracy of solution steps.
After obtaining the solution formula for the problem to be solved through an end-to-end model, semantic analysis is performed on it to construct a semantic tree of the formula and determine the solution steps. This avoids dependence on training data and improves the visualization of the solution process and the interpretability of the answer.
It provides detailed visualization of the problem-solving process, improving the user experience and increasing the efficiency and accuracy of the solution steps.
Smart Images

Figure CN115809319B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present specification relates to the technical field of computer, and particularly relates to a problem solving method. The present specification also relates to a problem solving device, a computing device, and a computer readable storage medium. BACKGROUND
[0002] With the continuous development of computer and artificial intelligence technology, more and more work and learning tasks can be automatically processed, and computer technology has been gradually applied to various daily education and learning activities, for example, using computer technology to automatically analyze the answer to some problems, thereby greatly saving human resources.
[0003] In the prior art, when a problem needs to be solved, the problem to be solved can be input into an end-to-end model, and the end-to-end model can output the final calculation formula of the problem, thereby automatically obtaining the final answer of the problem. However, through the end-to-end model, only the final answer of the problem can be directly obtained, and the detailed solving steps of the problem cannot be obtained, the visualization of the problem solving process of the device is poor, which leads to poor explainability of the problem answer, greatly affecting the user experience, and thus there is an urgent need for a problem solving method that can improve the visualization of the problem solving process of the device. SUMMARY
[0004] Therefore, the embodiments of the present specification provide a problem solving method. The present specification also relates to a problem solving device, a computing device, and a computer readable storage medium to solve the technical defects existing in the prior art.
[0005] According to a first aspect of the embodiments of the present specification, a problem solving method is provided, comprising:
[0006] inputting a problem to be solved into a problem solving model to obtain a solving formula of the problem to be solved;
[0007] performing semantic analysis on the problem to be solved and the solving formula, determining a semantic structure corresponding to each formula factor included in the solving formula, and constructing a formula semantic tree corresponding to the solving formula;
[0008] determining a solving step of the problem to be solved according to the formula semantic tree.
[0009] According to a second aspect of the embodiments of the present specification, a problem solving device is provided, comprising:
[0010] The obtaining module is configured to input a problem to be solved into a problem solving model to obtain a solving formula of the problem to be solved;
[0011] The construction module is configured to perform semantic analysis on the problem to be solved and the solution formula, determine the semantic structure corresponding to each formula factor included in the solution formula, and construct the formula semantic tree corresponding to the solution formula.
[0012] The determination module is configured to determine the solution steps for the problem to be solved based on the semantic tree of the formula.
[0013] According to a third aspect of the embodiments of this specification, a computing device is provided, comprising:
[0014] Memory and processor;
[0015] Memory is used to store computer-executable instructions, and processor is used to execute computer-executable instructions to implement the steps of any problem-solving method.
[0016] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed by a processor, implement the steps of an arbitrary problem-solving method.
[0017] The problem-solving method provided in this manual allows you to input a problem into a problem-solving model, obtain a solution formula, and then perform semantic analysis on the problem and the solution formula to determine the semantic structure of each formula factor. This constructs a formula semantic tree for the solution formula, and based on this semantic tree, the solution steps for the problem are determined. In this case, semantic analysis of the problem and the obtained solution formula determines the semantic structure of each formula factor, constructing a formula semantic tree that represents each solution step. Therefore, based on the constructed formula semantic tree, the detailed solution steps for the problem can be determined, making the device's problem-solving process more detailed and visual. This improves the visualization of problem-solving through the device, thereby enhancing the interpretability of the automatically obtained answers and significantly improving the user experience. Attached Figure Description
[0018] Figure 1 This is a flowchart of a problem-solving method provided in one embodiment of this specification;
[0019] Figure 2 This is a schematic diagram of a solution formula for a binary tree structure provided in one embodiment of this specification;
[0020] Figure 3 This is a schematic diagram illustrating the construction process of an arithmetic semantic tree provided in one embodiment of this specification;
[0021] Figure 4 This is a schematic diagram of an arithmetic semantic tree provided in one embodiment of this specification;
[0022] Figure 5 This is a schematic diagram illustrating the processing steps of a problem-solving method provided in one embodiment of this specification;
[0023] Figure 6 This is a schematic diagram of another binary tree structure solution formula provided in one embodiment of this specification;
[0024] Figure 7 This is a schematic diagram of the structure of a problem-solving device provided in one embodiment of this specification;
[0025] Figure 8 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation
[0026] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.
[0027] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0028] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0029] It should be noted that, in one possible approach to answering a question, the question can be input into an end-to-end model, which can then output the final calculation formula, thus automatically obtaining the answer. However, the end-to-end model only provides the final calculation formula and does not offer detailed solution steps. This results in poor visualization of the problem-solving process, leading to poor interpretability of the answer and significantly impacting the user experience.
[0030] Another possible implementation involves inputting the question to be solved into a sequence model, which then outputs the solution steps. However, since the solution steps are relatively long, training the sequence-to-sequence model requires massive amounts of high-quality training data, i.e., <question, solution steps> text pairs. Even with such a large amount of data, the solution steps may come from different people (e.g., teachers, students, or others), potentially resulting in different formats and writing styles. This makes it difficult for the sequence-to-sequence model to learn a fixed solution pattern, significantly increasing the training difficulty. Furthermore, the correctness of the solution steps in the massive amount of <question, solution steps> text pairs is not guaranteed. Incorrect solution steps may mislead the model's learning, further increasing the training difficulty. Additionally, the accuracy of the solution steps output by the sequence-to-sequence model is limited, greatly affecting the efficiency and accuracy of solving subsequent questions.
[0031] Therefore, this specification provides a text-based solution method. It first obtains the solution formula for the problem to be solved using an end-to-end model, then performs semantic analysis on the problem and the obtained solution formula to determine the semantic structure of each formula factor, constructing a formula semantic tree. This formula semantic tree represents each solution step corresponding to the solution formula. Based on the constructed formula semantic tree, the detailed solution steps for the problem to be solved can be determined. In this way, the detailed solution steps for the problem to be solved can be automatically obtained, making the problem-solving process on the device more detailed and visual, improving the visualization of problem-solving through the device, and thus improving the interpretability of the automatically obtained answers to the problem to be solved, greatly enhancing the user experience. Furthermore, it eliminates the need for model training and does not rely on <problem, solution steps> text pairs, significantly improving the efficiency and accuracy of obtaining the solution steps for the problem to be solved.
[0032] This specification provides a problem-solving method, and also relates to a problem-solving apparatus, a computing device, and a computer-readable storage medium, which will be described in detail in the following embodiments.
[0033] Figure 1A flowchart of a problem-solving method according to an embodiment of this specification is shown, which specifically includes the following steps:
[0034] Step 102: Input the question to be answered into the question-solving model to obtain the solution formula for the question to be answered.
[0035] It should be noted that the problem to be solved can be one that requires detailed solution steps, and this problem can be within the field of mathematics, such as simple geometry. Furthermore, the solution formula can refer to the calculation formula for the answer to the problem to be solved, that is, the method of calculating the answer to the problem. Moreover, the problem-solving model can be a pre-trained model capable of recognizing and analyzing the input problem and outputting the corresponding calculation formula.
[0036] For example, the question to be solved could be "The perimeter of a square is 8 centimeters. What is the area of the square?". Inputting this question into the problem-solving model will output the corresponding solution formula: "(8 ÷ 4)". 2 ".
[0037] In this manual, after obtaining the question to be answered, the question can be input into a pre-trained question-solving model to obtain the corresponding solution formula. The solution formula can then be analyzed to obtain detailed solution steps, providing a data foundation for subsequent analysis.
[0038] In practical applications, the above problem-solving model can be trained using the following method:
[0039] Obtain a sample of problems, which includes the corresponding formula labels;
[0040] Input the problem sample into the initial model to obtain the prediction formula;
[0041] The loss value is determined based on the prediction formula and formula label. The initial model is then trained based on the loss value until the training stops, resulting in a problem-solving model.
[0042] Specifically, the cross-entropy loss function can be calculated based on the predicted formula and the formula label to generate the loss value. Here, the formula label refers to the actual result that the question-answering model wants to output, that is, the formula label is the true result. When the question sample is input into the initial model, the output predicted formula is the predicted result. When the difference between the predicted result and the true result is small enough, it means that the predicted result is close enough to the true result. At this time, the initial model training is completed, and the question-answering model is obtained.
[0043] This manual demonstrates the difference between the model's predictions and the actual results by calculating the loss value. Targeted training of the initial model and adjustment of parameters can effectively improve the training speed and effectiveness.
[0044] Training the initial model based on the loss value until the training stopping condition is met can include:
[0045] Determine whether the loss value is less than a preset threshold;
[0046] If not, return to the steps described above for obtaining problem samples and continue training;
[0047] If so, then the training cessation condition has been met.
[0048] The preset threshold is a critical value for the loss. If the loss value is greater than or equal to the preset threshold, it indicates that there is still a certain deviation between the prediction result of the initial model and the actual result. The parameters of the initial model still need to be adjusted, and more problem samples need to be obtained to continue training the initial model. If the loss value is less than the preset threshold, it indicates that the prediction result of the initial model is close enough to the actual result, and training can be stopped. The value of the preset threshold can be determined according to the actual situation, and this manual does not impose any restrictions on it.
[0049] This manual allows you to determine the specific training status of the initial model based on the loss value, and adjust the parameters of the initial model in reverse based on the loss value if the training is unsatisfactory, thereby improving the model's analytical capabilities. It features a high training rate and good training results.
[0050] Step 104: Perform semantic analysis on the problem to be solved and the solution formula, determine the semantic structure corresponding to each formula factor included in the solution formula, and construct the formula semantic tree corresponding to the solution formula.
[0051] Specifically, after inputting the problem to be solved into the problem-solving model and obtaining the solution formula, the next step is to perform semantic analysis on the problem and the solution formula to determine the semantic structure corresponding to each formula factor included in the solution formula, and construct the formula semantic tree corresponding to the solution formula. Here, the semantic structure can represent the physical meaning of the corresponding formula factor, and the formula semantic tree can be a binary tree, where each node in the formula semantic tree corresponds to each formula factor included in the solution formula, and each node has a corresponding semantic structure.
[0052] It should be noted that the solution formula can refer to the calculation method of the problem to be solved. Therefore, the solution formula can include numerical values and operators, and each numerical value and operator included in the solution formula is a formula factor. In actual implementation, semantic analysis can be performed on the problem to be solved. Combining the obtained solution formula, the physical meaning represented by each formula factor can be analyzed to obtain the corresponding semantic structure. Then, based on the semantic structure of each formula factor, the formula semantic tree corresponding to the solution formula can be constructed.
[0053] In one possible implementation, the solution formula obtained through the problem-solving model can be an expression structure. After obtaining the solution formula, it can be converted from the expression structure into a binary tree structure. Each formula factor included in the expression structure corresponds to a node in the binary tree structure. Then, the semantic structure of each node in the binary tree structure is analyzed and determined, and the semantic structure is added to the corresponding node to construct the formula semantic tree.
[0054] In another possible implementation, after obtaining the solution formula of the expression structure through the problem-solving model, the semantic structure of each formula factor in the expression structure can be analyzed and determined first. Then, each formula factor can be converted into a node in a binary tree, and the corresponding semantic structure can be added to the node to construct the formula semantic tree.
[0055] In this manual, the solution formulas can be represented in two ways: an expression structure and a binary tree structure. These two expression structures can be converted into each other, and each factor in the expression structure corresponds one-to-one with each node in the binary tree structure.
[0056] In one optional implementation of this embodiment, taking the solution formula as a binary tree structure as an example, the formula factors included in the solution formula are nodes in the binary tree structure; in this case, semantic analysis is performed on the problem to be solved and the solution formula to determine the semantic structure corresponding to each formula factor included in the solution formula, and the formula semantic tree corresponding to the solution formula is constructed. The specific implementation process can be as follows:
[0057] For each node in the solution formula of the binary tree structure, determine the semantic structure corresponding to the node based on the node type;
[0058] Based on the solution formula of the binary tree structure and the semantic structure of each node, the formula semantic tree corresponding to the solution formula is constructed.
[0059] Specifically, the node type can be the position type of a node in a binary tree structure, such as leaf nodes, intermediate nodes, and root nodes. A leaf node can be the lowest level node in the binary tree structure, i.e., a node that does not include child nodes; an intermediate node can be a node in the middle layer of the binary tree structure, i.e., a node that includes child nodes below and parent nodes above; and a root node can be the highest level node in the binary tree structure, i.e., a node that includes child nodes but not parent nodes.
[0060] Example, Figure 2 This is a schematic diagram of a solution formula for a binary tree structure provided in one embodiment of this specification, as shown below. Figure 2 The solution is shown in the equation "(8÷4)". 2 The binary tree structure is as follows: nodes "8", "4", and "2" are leaf nodes, node "÷" is an intermediate node, and node "^" is the root node.
[0061] It should be noted that the nodes in the solution formula of a binary tree structure can be divided into different node types, and different methods can be used to determine the corresponding semantic structure for different node types. Therefore, for each node in the solution formula of a binary tree structure, we can first determine the node type, and then determine the corresponding semantic structure based on the determined node type.
[0062] In practical applications, since the solution formula has been converted into a binary tree structure, once the semantic structure corresponding to each node in the solution formula of the binary tree structure is determined, it is only necessary to add the determined semantic structure to the corresponding node to construct the formula semantic tree corresponding to the solution formula.
[0063] In one optional implementation of this embodiment, different node types can be determined using different methods to determine their corresponding semantic structures. Therefore, the semantic structure of a node is determined based on its node type. The specific implementation process can be as follows:
[0064] For leaf nodes, the semantic structure of the leaf nodes is determined from the semantic analysis results of the questions to be answered and the answer formulas, according to the preset semantic extraction rules.
[0065] For intermediate nodes, determine the semantic structure of the intermediate nodes based on the child nodes they include;
[0066] For the root node, determine its semantic structure based on its child nodes; or, determine the semantic structure of the root node from the semantic analysis results of the question to be answered and the solution formula based on preset semantic extraction rules.
[0067] Specifically, the preset semantic extraction rule can refer to the rule for obtaining the corresponding physical meaning of the leaf node (i.e., the formula factor) from the problem to be solved and the solution formula. The preset semantic extraction rule can be defined in advance to determine the semantic structure of the leaf node.
[0068] It should be noted that leaf nodes are generally numbers included in the unsolved question or the solution formula. Therefore, the corresponding physical meaning of leaf nodes can be directly analyzed from the unsolved question or the solution formula. In other words, for leaf nodes, the semantic structure of leaf nodes can be determined from the semantic analysis results of the unsolved question and the solution formula according to the preset semantic extraction rules.
[0069] Furthermore, intermediate nodes are generally operators included in the solution formula, and therefore their corresponding physical meaning cannot be directly analyzed from the problem to be solved or the solution formula. Since intermediate nodes include child nodes, their semantic structure can be deduced from the child nodes they include.
[0070] Furthermore, the root node also includes child nodes, so its semantic structure can be deduced based on its child nodes. Alternatively, since the root node is the top-level node in a binary tree structure, it often represents the final answer to the problem to be solved. Therefore, its corresponding physical meaning can be directly analyzed from the problem to be solved or the solution formula. That is, the semantic structure of the root node can be determined from the semantic analysis results of the problem to be solved and the solution formula according to the preset semantic extraction rules.
[0071] This specification allows for the determination of the corresponding semantic structure using different methods based on the characteristics of different types of nodes, ensuring the correctness of the determined semantic structure and thus guaranteeing the correctness of the final constructed formula semantic tree.
[0072] In one optional implementation of this embodiment, the semantic structure of the leaf nodes is determined from the semantic analysis results of the question to be answered and the solution formula according to preset semantic extraction rules. The specific implementation process can be as follows:
[0073] If the leaf node is constant, set the semantic structure of the leaf node to the first preset word;
[0074] When the leaf nodes are variables, the subject, predicate, and unit of the leaf node are determined from the semantic analysis results of the unanswered question and the answer formula according to the preset semantic extraction rules, and the subject, predicate, and unit are used as the semantic structure of the leaf node.
[0075] It should be noted that leaf nodes are generally numbers included in the problem to be solved or the solution formula. These numbers may be variables or constants. For constants, the leaf node has no special physical meaning, so its semantic structure can be directly set as the first preset word. The first preset word can refer to a pre-defined word representing a constant without physical meaning, such as the word "constant" or "meaningless word." This specification uses the word "constant" as the first preset word for illustration.
[0076] In addition, for variables, the variable generally represents a certain physical meaning in the question to be solved. Therefore, when the leaf node is a variable, the subject, predicate and unit of the leaf node can be determined from the semantic analysis results of the question to be solved and the solution formula according to the preset semantic extraction rules, and the subject, predicate and unit are used as the semantic structure of the leaf node.
[0077] It should be noted that the subject can refer to the main body described by the variable, such as a square, triangle, or circle; the predicate can refer to the physical meaning that the variable represents corresponding to the main body, such as side length, perimeter, or area; and the unit can refer to the unit of the variable, such as centimeter, meter, gram, or kilogram.
[0078] In practical applications, when distinguishing whether a leaf node is a constant or a variable, we can determine whether the leaf node appears in both the problem to be solved and the solution formula. If it only appears in the solution formula, then the leaf node is a constant; if it appears in the problem to be solved, then the leaf node is a variable.
[0079] In one optional implementation of this embodiment, the subject, predicate, and unit of the leaf node are determined from the semantic analysis results of the question to be answered and the solution formula according to preset semantic extraction rules. The specific implementation process can be as follows:
[0080] The question to be answered is segmented into words to obtain at least one word included in the question.
[0081] Extract the subject, predicate, and unit of a leaf node from at least one word.
[0082] It should be noted that if a leaf node is a variable, it means that the leaf node appears in the question to be answered. Therefore, the question to be answered can be segmented, and the subject, predicate, and unit of the leaf node can be extracted from the segmentation result.
[0083] In practical applications, when segmenting a question into words to obtain at least one word included in the question, the symbols in the obtained words can be removed, and the resulting segmented words can be used as the final segmentation result for subsequent extraction.
[0084] Using the previous example, the question to be answered is "The perimeter of a square is 8 centimeters. What is the area of the square?". By segmenting the question (removing symbols), we can obtain the words "square", "perimeter", "8", "centimeter", "find", "square", "area", "is", and "how much".
[0085] In one optional implementation of this embodiment, the predicate of the leaf node is extracted from at least one word. The specific implementation process can be as follows:
[0086] Get the first word of the preset number of terms adjacent to the leaf node in the question to be answered;
[0087] Select words from the first word that are included in the preset predicate set, and determine the selected words as the predicates of the leaf nodes. The preset predicate set is a set of pre-collected words that includes at least one predicate.
[0088] Specifically, preset values can be set in advance, such as 2, 3, 4, etc. A node adjacent to a leaf node can be left-adjacent, right-adjacent, or both.
[0089] It should be noted that the predicates included in the domain to which the problem to be solved belongs can be collected in advance, and the collected predicates can be combined into a predefined predicate set. For example, for the domain of simple geometry, since the domain of simple geometry is a closed set, the predicates included in the domain of simple geometry can be enumerated and combined into a predicate set.
[0090] Using the previous example, suppose we obtain the two first words that are adjacent to the leaf node in the question to be solved. The leaf node is "8". At this time, we can obtain the two words before "8" and the two words after "8". The obtained first words are "square", "perimeter" and "centimeter" and "find". Assuming that the preset predicate set includes "perimeter", we can determine that the predicate of the leaf node "8" is "perimeter".
[0091] In an optional implementation of this embodiment, after obtaining a preset number of first words adjacent to the leaf nodes in the question to be answered, the process may further include:
[0092] If no words included in the preset predicate set are selected from the first words, determine the word characteristics of each first word;
[0093] Use words in the first word that have the same characteristics as the preset words as the predicates of the leaf nodes.
[0094] It should be noted that since there may be different expressions for the same thing, if no words included in the preset predicate set are selected from the first word, it is still possible to determine whether the selected first word is a word with preset characteristics. These preset characteristics can be the characteristics that a predicate may possess, thereby identifying the words that may be predicates among the selected first words and using them as the determined predicates.
[0095] Following the previous example, suppose the first words obtained are "square", "perimeter" and "centimeter" and "find". None of the first words are included in the preset predicate set. Suppose the word characteristics include words related to describing the sides, base and height of the polygon. Since "perimeter" is a word related to describing the sides of the polygon, "perimeter" can be determined as the predicate of the leaf node "8".
[0096] In one optional implementation of this embodiment, extracting leaf node units from at least one word includes:
[0097] Retrieve the second word in the unsolved question that is located after and adjacent to a leaf node;
[0098] The second word is designated as the unit of the leaf node.
[0099] It should be noted that the word that follows and is adjacent to the leaf node is very likely to be a leaf node unit. Therefore, the second word that follows and is adjacent to the leaf node can be identified as the leaf node unit.
[0100] Using the previous example, the word following and adjacent to the leaf node "8" is "centimeter". Therefore, we can determine that the unit of the leaf node "8" is "centimeter".
[0101] Furthermore, since the same unit can be expressed in multiple ways, such as centimeter or cm, it is possible to pre-collect all units within the domain of the problem to be solved and combine them into a pre-defined unit set. For example, for the domain of simple geometry, since it is a closed set, it is possible to exhaustively enumerate all units within the domain and combine them into a unit set.
[0102] In practical applications, after extracting the unit of the leaf node from at least one word, the extracted unit can be normalized according to the preset unit set to obtain a unit consistent with the preset unit set, which can then be used as the unit of the leaf node. For example, if the unit of the leaf node extracted from at least one word is "cm", and the preset unit set includes the unit "centimeter", then the extracted "cm" can be converted to "centimeter" and used as the unit of the leaf node.
[0103] In one optional implementation of this embodiment, the subject of the leaf node is extracted from at least one word. The specific implementation process can be as follows:
[0104] Retrieve the noun closest to the leaf node in the unsolved question;
[0105] The words that are not repeated from the predicate or the unit among the obtained nouns are determined as the subjects of the leaf nodes.
[0106] It should be noted that the noun closest to a leaf node may be the subject described by that leaf node, but the noun closest to a leaf node may also be the predicate or unit of the leaf node. Therefore, the word closest to the leaf node that does not overlap with the predicate or unit can be identified as the subject of the leaf node.
[0107] Continuing with the previous example, the nouns closest to the leaf node "8" are "perimeter" and "centimeter". Since "perimeter" is the predicate of the leaf node and "centimeter" is the unit of the leaf node, they cannot be used as the subject. Continuing to determine, in addition to "perimeter" and "centimeter", the noun closest to the leaf node "8" is "square". Since "square" does not repeat the predicate and unit, we can determine that the subject of the leaf node "8" is "square".
[0108] It should be noted that the above method can be used to determine the subject, predicate, and unit of each leaf node, thereby obtaining the semantic structure of each leaf node.
[0109] In one optional implementation of this embodiment, after obtaining the semantic structure of each leaf node, the semantic structure of the intermediate node can be deduced. That is, the semantic structure of the intermediate node is determined based on the child nodes included in the intermediate node. The specific implementation process can be as follows:
[0110] Based on the preset knowledge base, determine the matching formulas corresponding to the child nodes included in the intermediate nodes;
[0111] Based on the matching formula, determine the predicate and unit of the intermediate node;
[0112] Use the subject of the child nodes included in the intermediate node as the subject of the intermediate node;
[0113] The subject, predicate, and unit of the intermediate node are determined as the semantic structure of the intermediate node.
[0114] Specifically, a pre-set knowledge base can refer to a pre-established knowledge base that includes most of the calculation formulas within the domain to which the problem to be solved belongs. For example, for the domain of simple geometry, since the domain of simple geometry is a closed set, all the formulas included in the domain of simple geometry can be enumerated and combined to form a pre-set knowledge base.
[0115] It should be noted that the matching formulas corresponding to the child nodes included in the intermediate nodes can be determined based on the preset knowledge base. Then, the predicate and unit of the intermediate node can be calculated based on the matching formula. The subject of the intermediate node can inherit the subject of the leaf node.
[0116] In practical applications, if only one of the two child nodes of an intermediate node has a subject in its semantic structure, then the intermediate node can inherit the subject of that child node; if both of the two child nodes of an intermediate node have subjects in their semantic structures and the subjects are the same, then the intermediate node can inherit the same subject; if both of the two child nodes of an intermediate node have subjects in their semantic structures and the subjects are different, then the intermediate node can inherit the subject of either child node.
[0117] Continuing with the previous example, the intermediate node is “÷”, and its child nodes are “8” and “4”. The semantic structure of child node “8” is “subject: square, predicate: perimeter, unit: centimeters”, and the semantic structure of child node “4” is “constant”. Assuming that the pre-defined knowledge base contains matching formulas corresponding to the child nodes of the intermediate node, such as “square side length = perimeter ÷ 4” and “centimeter ÷ centimeter = centimeters”, we can determine that the physical meaning of the intermediate node “÷” is “the side length of a square”, with the unit being “centimeter”. Therefore, we can conclude that the subject of the intermediate node “÷” is “square”, the predicate is “side length”, and the unit is “centimeter”.
[0118] Furthermore, if the matching formula corresponding to the child nodes included in the intermediate node cannot be determined based on the preset knowledge base, the semantic structure of the intermediate result can be obtained by aggregating the semantic structure of the child nodes included in the intermediate node through preset aggregation rules. These aggregation rules can refer to pre-set rules, such as adding or subtracting identical predicates (child nodes), where the parent node inherits this identical predicate, or dividing identical predicates where the parent node's predicate is a "multiple," etc.
[0119] Furthermore, if the matching formula corresponding to the child nodes included in the intermediate node cannot be determined based on the preset knowledge base, the intermediate node can be directly identified as an intermediate result without physical meaning, and the semantic structure of the intermediate node can be set as a meaningless identifier.
[0120] It should be noted that when determining the semantic structure of the root node, since the root node often represents the final answer to the problem to be solved, the same method as for determining the semantic structure of the leaf nodes can be used. This involves analyzing the physical meaning of the root node from the problem to be solved or the solution formula, thereby determining the corresponding semantic structure. Furthermore, since the root node also includes child nodes, the same method as for determining the semantic structure of the intermediate nodes can be used. Based on the child nodes included in the root node, the semantic structure of the root node can be deduced.
[0121] In practical applications, when using the method of analyzing the physical meaning of the root node from the problem to be solved or the solution formula to determine the corresponding semantic structure, since the root node is related to the final answer to the problem to be solved, a preset number of first words adjacent to the question word in the problem to be solved can be obtained. From the first words, words included in the preset predicate set are selected, and the selected words are determined as the predicates of the root node; the unit corresponding to the predicate is determined as the unit of the root node; the noun closest to the question word in the problem to be solved is obtained, and the word among the obtained nouns that does not repeat the predicate or the unit is determined as the subject of the root node.
[0122] In addition, the method of deriving the semantic structure of the root node based on its child nodes is the same as the process of determining the semantic structure of the intermediate nodes described above, and will not be repeated here.
[0123] Furthermore, since there are two ways to determine the semantic structure of the root node, either one method can be chosen to determine the semantic structure of the root node, or both methods can be used to determine the two semantic structures. These two semantic structures can then be verified against each other. If the two determined semantic structures are the same, it means that the determined semantic structure of the root node is correct, thereby improving the accuracy rate.
[0124] In one possible implementation, Figure 3 This is a schematic diagram illustrating the construction process of an arithmetic semantic tree according to an embodiment of this specification, as shown below. Figure 3 As shown, we can first determine the semantic structure of each leaf node in the solution formula based on the semantic analysis results, and then determine whether the semantic structure of all leaf nodes has been determined. If not, it means that some leaf nodes cannot be determined, and we can return no result. If yes, it means that the semantic structure of each leaf node in the solution formula has been determined, and we can deduce the semantic structure of the intermediate node based on the child nodes included in the intermediate node.
[0125] Next, it can be determined whether the intermediate node from which the semantic structure is derived is the root node. If not, the semantic structure of the intermediate node is further derived based on its child nodes to determine the semantic structure of the next intermediate node. If it is, then the intermediate node from which the semantic structure is derived is the root node. At this point, it can be determined whether the semantic structure determined based on the semantic analysis results is the same as the derived semantic structure. The semantic structure of the root node (i.e., the semantic structure determined based on the semantic analysis results) can be determined beforehand, and then the determination is made. If they are the same, a complete semantic tree of the formula is obtained; if they are different, it indicates that the semantic structure of the root node is incorrect, and no result is returned.
[0126] Continuing with the previous example, for example... Figure 2The solution formula for the binary tree structure shown can be determined using the method described above. The semantic structure of leaf node "8" is "Subject: square, Predicate: perimeter, unit: centimeters"; the semantic structures of leaf nodes "4" and "2" are "constant"; the semantic structure of the middle node "÷" is "Subject: square, Predicate: side length, unit: centimeters"; and the semantic structure of the root node "^" is "Subject: square, Predicate: area, unit: centimeters". 2 By adding the determined semantic structure of each node to the corresponding node, we can obtain, for example: Figure 4 The semantic tree of the formula is shown.
[0127] This manual can analyze the solution formulas obtained through the problem-solving model, determine the semantic structure of each node in the binary tree structure of the solution formula, and thus construct a semantic formula tree. The semantic formula tree can represent the solution steps of the problem to be solved, which makes it easier to determine each solution step of the problem to be solved based on the constructed formula semantic tree.
[0128] Step 106: Determine the solution steps for the problem to be solved based on the semantic tree of the formula.
[0129] It should be noted that an arithmetic semantic tree can include multiple nodes of different types, thus forming at least one semantic subtree. Each semantic subtree consists of child nodes and a parent node. That is, according to the order of operations, an arithmetic semantic tree can be divided into at least one semantic subtree, and each semantic subtree can represent one step in solving the problem.
[0130] In an optional implementation of this embodiment, the formula semantic tree includes at least one semantic subtree, and each semantic subtree consists of child nodes and a parent node; in this case, the solution steps for the problem to be solved are determined based on the formula semantic tree, and the specific implementation process can be as follows:
[0131] For each semantic subtree included in the semantic tree of the formula, the semantic structure of the child nodes and parent nodes included in the semantic subtree is substituted into the preset step template to obtain the solution steps corresponding to the semantic subtree;
[0132] The solution steps of each semantic subtree are used as the solution steps of the question to be solved.
[0133] It should be noted that the preset step template can be a template pre-set based on the semantic structure. By inputting the semantic structure of the child nodes and parent nodes of a semantic subtree into the preset step template, one solution step corresponding to that semantic subtree can be obtained. In this way, the solution steps corresponding to each semantic subtree included in the formula semantic tree can be obtained, and these solution steps are the detailed solution steps for the problem to be solved.
[0134] Example, Figure 5This is a schematic diagram illustrating the processing steps of a problem-solving method provided in one embodiment of this specification, as shown below. Figure 5 As shown, when the question "The perimeter of a square is 8 centimeters, what is the area of the square?" is input into the problem-solving model, the solution formula is "(8÷4)". 2 , convert the solution formula into such Figure 5 The binary tree structure shown is followed by semantic analysis of the problem to be solved and the solution formula. This determines the semantic structure corresponding to each node in the solution formula of the binary tree structure, and constructs the formula semantic tree corresponding to the solution formula, as shown below. Figure 5 As shown.
[0135] Assuming the preset step template is to find the parent node predicate of the parent node subject, the parent node predicate = left child node predicate, parent node corresponding operator, and right child node predicate. Therefore, the parent node predicate of the parent node subject = the formula for this step = the result and the parent node unit. Figure 5 As shown, the semantic tree of the equation for the problem to be solved includes two semantic subtrees. Semantic subtree 1 includes nodes “÷”, “8”, and “4”, and semantic subtree 2 includes nodes “^”, “÷”, and “2”.
[0136] For semantic subtree 1, the parent node is node "÷", and the child nodes are nodes "8" and "4". Substituting the semantic structure of the parent and child nodes into the above preset step template, we can obtain the solution steps corresponding to semantic subtree 1 as follows: Find the side length of the square. The side length = perimeter ÷ constant 4 (since the predicate of the right child node is a constant, there is no predicate, so we directly substitute the constant value). Therefore, the side length of the square = 8 ÷ 4 = 2 cm.
[0137] For semantic subtree 2, the parent node is node "^", and the child nodes are nodes "÷" and node "2". Substituting the semantic structures of the parent and child nodes into the preset step template above, we can obtain the solution steps for semantic subtree 2 as follows: Calculate the area of the square. Area = side length ^ constant 2 (since the predicate of the right child node is a constant, there is no predicate, so we directly substitute the constant value). Therefore, the area of the square = 2^2 = 4 centimeters. 2 】
[0138] Therefore, as Figure 5 As shown, the problem to be solved includes two steps: Step 1: Find the side length of the square. Side length = perimeter ÷ constant 4, so the side length of the square = 8 ÷ 4 = 2 centimeters; Step 2: Find the area of the square. Area = side length^2, so the area of the square = 2^2 = 4 centimeters. 2 .
[0139] In addition, when deriving the physical meaning of intermediate nodes based on leaf nodes to determine the semantic structure of intermediate nodes, the intermediate nodes may not have a corresponding physical meaning. That is, the intermediate nodes only represent intermediate results of the operation and have no practical meaning. Therefore, the semantic structure of the intermediate nodes may be a meaningless identifier and does not include subject, predicate, and unit.
[0140] Therefore, when taking the semantic structure of the child nodes and parent nodes of each semantic subtree included in the semantic tree of the formula and inputting it into the preset step template to obtain the solution steps corresponding to the semantic subtree, if the semantic structure of the parent node of a certain semantic subtree is a meaningless identifier, then instead of generating the corresponding solution steps separately based on that semantic subtree, the intermediate node is also taken as a child node, and the corresponding parent node (not a meaningless node) is found upwards to form a new semantic subtree, thereby obtaining the corresponding solution steps.
[0141] For example, suppose the problem to be solved is "The area of the triangle is 6 centimeters". 2 Given a triangle with a base of 3, find the height of the triangle. Using the problem-solving model, the solution is: 6 × 2 ÷ 3. The semantic tree for this solution is as follows: Figure 6 As shown, the semantic structure of node "6" is: Subject: triangle, Predicate: area, Unit: centimeters. 2 The semantic structure of node “2” is “constant”, the semantic structure of node “3” is “subject: triangle, predicate: base, unit: centimeters”, the semantic structure of node “×” is “meaningless identifier”, and the semantic structure of node “÷” is “subject: triangle, predicate: height, unit is centimeters”.
[0142] like Figure 6 As shown, since the semantic structure of the intermediate node "×" is a "meaningless identifier", this intermediate node and its included child nodes "6" and "2" do not constitute a separate semantic subtree. Instead, nodes "6", "2", "×", and "3" are all treated as child nodes, and node "÷" is treated as the parent node, forming a semantic subtree. When generating the corresponding solution steps, this intermediate node can be inserted between its included child nodes.
[0143] Assuming the preset step template is to find the parent node predicate of the parent node subject, the parent node predicate = left child node predicate, parent node corresponding operator, and right child node predicate. Therefore, the parent node predicate of the parent node subject = the formula for this step = the result and the parent node unit. Substituting the semantic structure of the parent and child nodes of this semantic subtree into the above preset step template, we can find the height of the triangle. Height = area × constant 2 ÷ base (since the node "×" is meaningless, "×" is inserted between the included child nodes). Therefore, the height of the triangle = 6 × 2 ÷ 3 = 4 centimeters.
[0144] Therefore, the problem to be solved includes one solution step. Step 1: Find the height of the triangle. Height = area × constant 2 ÷ base. So the height of the triangle = 6 × 2 ÷ 3 = 4 centimeters.
[0145] The problem-solving method provided in this manual allows you to input a problem into a problem-solving model, obtain a solution formula, and then perform semantic analysis on the problem and the solution formula to determine the semantic structure of each formula factor. This constructs a formula semantic tree for the solution formula, and based on this semantic tree, the solution steps for the problem are determined. In this case, semantic analysis of the problem and the obtained solution formula determines the semantic structure of each formula factor, constructing a formula semantic tree that represents each solution step. Therefore, based on the constructed formula semantic tree, the detailed solution steps for the problem can be determined, making the device's problem-solving process more detailed and visual. This improves the visualization of problem-solving through the device, thereby enhancing the interpretability of the automatically obtained answers and significantly improving the user experience.
[0146] Corresponding to the above method embodiments, this specification also provides embodiments of a problem-solving device. Figure 7 A schematic diagram of a problem-solving device according to an embodiment of this specification is shown. Figure 7 As shown, the device includes:
[0147] Module 702 is configured to input the question to be answered into the question-solving model and obtain the solution formula for the question to be answered.
[0148] The construction module 704 is configured to perform semantic analysis on the problem to be solved and the solution formula, determine the semantic structure corresponding to each formula factor included in the solution formula, and construct the formula semantic tree corresponding to the solution formula.
[0149] Module 706 is configured to determine the solution steps for the problem to be solved based on the semantic tree of the formula.
[0150] Optionally, the solution formula is a binary tree structure, and the formula factors included in the solution formula are nodes in the binary tree structure; the construction module 704 is further configured as follows:
[0151] For each node in the solution formula of the binary tree structure, determine the semantic structure corresponding to the node based on the node type;
[0152] Based on the solution formula of the binary tree structure and the semantic structure of each node, the formula semantic tree corresponding to the solution formula is constructed.
[0153] Optionally, the construction module 704 is further configured as follows:
[0154] For leaf nodes, the semantic structure of the leaf nodes is determined from the semantic analysis results of the questions to be answered and the answer formulas, according to the preset semantic extraction rules.
[0155] For intermediate nodes, determine the semantic structure of the intermediate nodes based on the child nodes they include;
[0156] For the root node, determine its semantic structure based on its child nodes; or, determine the semantic structure of the root node from the semantic analysis results of the question to be answered and the solution formula based on preset semantic extraction rules.
[0157] Optionally, the construction module 704 is further configured as follows:
[0158] If the leaf node is constant, set the semantic structure of the leaf node to the first preset word;
[0159] When the leaf nodes are variables, the subject, predicate, and unit of the leaf node are determined from the semantic analysis results of the unanswered question and the answer formula according to the preset semantic extraction rules, and the subject, predicate, and unit are used as the semantic structure of the leaf node.
[0160] Optionally, the construction module 704 is further configured as follows:
[0161] Based on the preset knowledge base, determine the matching formula corresponding to the leaf nodes included in the intermediate nodes;
[0162] Based on the matching formula, determine the predicate and unit of the intermediate node;
[0163] Use the subject of the leaf nodes included in the intermediate node as the subject of the intermediate node;
[0164] The subject, predicate, and unit of the intermediate node are determined as the semantic structure of the intermediate node.
[0165] Optionally, the construction module 704 is further configured as follows:
[0166] The question to be answered is segmented into words to obtain at least one word included in the question.
[0167] Extract the subject, predicate, and unit of a leaf node from at least one word.
[0168] Optionally, the construction module 704 is further configured as follows:
[0169] Get the first word of the preset number of terms adjacent to the leaf node in the question to be answered;
[0170] Select words from the first word that are included in the preset predicate set, and determine the selected words as the predicates of the leaf nodes. The preset predicate set is a set of pre-collected words that includes at least one predicate.
[0171] Optionally, the construction module 704 is further configured as follows:
[0172] If no words included in the preset predicate set are selected from the first words, determine the word characteristics of each first word;
[0173] Use words in the first word that have the same characteristics as the preset words as the predicates of the leaf nodes.
[0174] Optionally, the construction module 704 is further configured as follows:
[0175] Retrieve the noun closest to the leaf node in the unsolved question;
[0176] The words that are not repeated from the predicate or the unit among the obtained nouns are determined as the subjects of the leaf nodes.
[0177] Optionally, the construction module 704 is further configured as follows:
[0178] Retrieve the second word in the unsolved question that is located after and adjacent to a leaf node;
[0179] The second word is designated as the unit of the leaf node.
[0180] Optionally, the formula semantic tree includes at least one semantic subtree, each semantic subtree consisting of child nodes and a parent node; the determination module 706 is further configured to:
[0181] For each semantic subtree included in the semantic tree of the formula, the semantic structure of the child nodes and parent nodes included in the semantic subtree is substituted into the preset step template to obtain the solution steps corresponding to the semantic subtree;
[0182] The solution steps of each semantic subtree are used as the solution steps of the question to be solved.
[0183] The problem-solving device provided in this manual can perform semantic analysis on the problem to be solved and the obtained solution formula, determine the semantic structure of each formula factor, and construct a formula semantic tree. This formula semantic tree can represent each solution step corresponding to the solution formula. Therefore, based on the constructed formula semantic tree, the detailed solution steps of the problem to be solved can be determined, making the problem-solving process of the device more detailed and visual, improving the visualization of problem-solving through the device, thereby improving the interpretability of the automatically obtained answers to the problem to be solved, and greatly improving the user experience.
[0184] The above is a schematic scheme of a question-answering device according to this embodiment. It should be noted that the technical solution of this question-answering device and the technical solution of the question-answering method described above belong to the same concept. For details not described in detail in the technical solution of the question-answering device, please refer to the description of the technical solution of the question-answering method described above.
[0185] Figure 8 A structural block diagram of a computing device 800 according to an embodiment of this specification is shown. The components of the computing device 800 include, but are not limited to, a memory 810 and a processor 820. The processor 820 is connected to the memory 810 via a bus 830, and a database 850 is used to store data.
[0186] The computing device 800 also includes an access device 840, which enables the computing device 800 to communicate via one or more networks 860. Examples of these networks include a Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 840 may include one or more of any type of wired or wireless network interface (e.g., a Network Interface Card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) interface, a Wi-MAX interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.
[0187] In one embodiment of this specification, the above-described components of the computing device 800 and Figure 8 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 8 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0188] The computing device 800 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. The computing device 800 can also be a mobile or stationary server.
[0189] The processor 820 is used to execute the following computer-executable instructions to implement the steps of any problem-solving method.
[0190] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the problem-solving method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the problem-solving method described above.
[0191] An embodiment of this specification also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, are used to implement steps of any problem-solving method.
[0192] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the problem-solving method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the problem-solving method described above.
[0193] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0194] Computer instructions include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. Computer-readable media can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in computer-readable media can be appropriately added to or removed according to the requirements of legislation and patent practice in a jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0195] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this specification is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this specification. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this specification.
[0196] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0197] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. These embodiments have been selected and specifically described in this specification to better explain the principles and practical applications of this specification, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.
Claims
1. A problem-solving method, characterized in that, The method includes: The problem to be solved is input into the problem-solving model to obtain the solution formula for the problem to be solved; the representation structure of the solution formula includes an expression structure and a binary tree structure; If the solution formula is an expression structure, then the solution formula is converted into a binary tree structure, and the formula factors included in the expression structure correspond to the nodes in the binary tree structure; the formula factors include the numerical values and operators included in the solution formula; Semantic analysis is performed on the unsolved problem and the solution formula. Based on the node type of the node, the semantic structure corresponding to each formula factor included in the solution formula is determined, including: For leaf nodes, the semantic structure of the leaf nodes is determined from the semantic analysis results of the unsolved question and the solution formula according to preset semantic extraction rules. For intermediate nodes, the semantic structure of the intermediate nodes is determined based on the child nodes they include. For the root node, the semantic structure of the root node is determined based on the child nodes it includes; or, the semantic structure of the root node is determined from the semantic analysis results of the question to be answered and the solution formula according to a preset semantic extraction rule. Based on the solution formula of the binary tree structure and the semantic structure of each node, the formula semantic tree corresponding to the solution formula is constructed. Based on the semantic tree of the formula, the solution steps for the problem to be solved are determined.
2. The problem-solving method according to claim 1, characterized in that, The step of determining the semantic structure of the leaf node from the semantic analysis results of the unsolved question and the solution formula according to preset semantic extraction rules includes: If the leaf node is constant, the semantic structure of the leaf node is set to a first preset word; When the leaf node is a variable, the subject, predicate, and unit of the leaf node are determined from the semantic analysis results of the unsolved question and the solution formula according to the preset semantic extraction rules, and the subject, predicate, and unit are used as the semantic structure of the leaf node.
3. The problem-solving method according to claim 1, characterized in that, Determining the semantic structure of the intermediate node based on its child nodes includes: Based on a preset knowledge base, determine the matching formulas corresponding to the child nodes included in the intermediate nodes; Based on the matching formula, determine the predicate and unit of the intermediate node; The subject of the child nodes included in the intermediate node shall be used as the subject of the intermediate node; The subject, predicate, and unit of the intermediate node are determined as the semantic structure of the intermediate node.
4. The problem-solving method according to claim 2, characterized in that, The step of determining the subject, predicate, and unit of the leaf node from the semantic analysis results of the unsolved question and the solution formula according to the preset semantic extraction rules includes: The question to be answered is segmented into words to obtain at least one word included in the question to be answered; Extract the subject, predicate, and unit of the leaf node from the at least one word.
5. The problem-solving method according to claim 4, characterized in that, The predicate for extracting the leaf node from the at least one word includes: Obtain a preset number of first words adjacent to the leaf node in the question to be answered; Words included in a preset predicate set are selected from the first word, and the selected words are determined as the predicates of the leaf nodes. The preset predicate set is a collection of words collected in advance that includes at least one predicate.
6. The problem-solving method according to claim 5, characterized in that, After obtaining the preset number of first words adjacent to the leaf node in the question to be answered, the method further includes: If no words included in the preset predicate set are selected from the first words, determine the word characteristics of each of the first words; The words in the first word that have the same characteristics as the preset words are used as the predicates of the leaf nodes.
7. The problem-solving method according to claim 4, characterized in that, Extracting the subject of the leaf node from the at least one word includes: Obtain the noun closest to the leaf node in the unsolved question; The words in the obtained nouns that do not repeat the predicate or the unit are determined as the subjects of the leaf nodes.
8. The problem-solving method according to claim 4, characterized in that, The unit for extracting the leaf node from the at least one word includes: Obtain the second word in the question to be answered that is located after the leaf node and adjacent to the leaf node; The second word is determined as the unit of the leaf node.
9. The problem-solving method according to any one of claims 1-8, characterized in that, The formula semantic tree includes at least one semantic subtree, and each semantic subtree consists of a child node and a parent node; The steps for determining the solution to the problem based on the semantic tree of the formula include: For each semantic subtree included in the formula semantic tree, the semantic structure of the child nodes and parent nodes included in the semantic subtree is substituted into a preset step template to obtain the solution steps corresponding to the semantic subtree; The solution steps of each semantic subtree are used as the solution steps of the question to be solved.
10. A question-answering device, characterized in that, The device includes: The module is configured to input the question to be solved into the question-solving model and obtain the solution formula for the question to be solved; the representation structure of the solution formula includes an expression structure and a binary tree structure. The construction module is configured to convert the solution formula into a binary tree structure if the solution formula is an expression structure, wherein the formula factors included in the expression structure correspond to the nodes in the binary tree structure; the formula factors include the numerical values and operators included in the solution formula. Semantic analysis is performed on the unsolved problem and the solution formula. Based on the node type of the node, the semantic structure corresponding to each formula factor included in the solution formula is determined, including: For leaf nodes, the semantic structure of the leaf nodes is determined from the semantic analysis results of the unsolved question and the solution formula according to preset semantic extraction rules. For intermediate nodes, the semantic structure of the intermediate nodes is determined based on the child nodes they include. For the root node, the semantic structure of the root node is determined based on the child nodes it includes; or, the semantic structure of the root node is determined from the semantic analysis results of the question to be answered and the solution formula according to a preset semantic extraction rule. Based on the solution formula of the binary tree structure and the semantic structure of each node, the formula semantic tree corresponding to the solution formula is constructed. The determination module is configured to determine the solution steps for the problem to be solved based on the formula semantic tree.
11. A computing device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the problem-solving method according to any one of claims 1-9.
12. A computer-readable storage medium storing computer instructions that, when executed by a processor, implement the steps of the problem-solving method according to any one of claims 1-9.
Citation Information
Patent Citations
Application question solving method and device, medium and electronic equipment
CN112907409A