A unified method for solving mathematical word problems integrating structural information
By constructing a data set containing equation expressions and knowledge point annotations, using the Math-BERT model and the bidirectional gating cycle unit combined with the graph encoder and the cross attention module, a unified analogy solution for mathematical application problems is realized, and the current solution is solved There are complex equations and various problems in technology to solve problems, which improve the accuracy of problem-solving and analogical solutions.
Patent Information
- Application Number
- CN202411305801.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2044-09-19
AI Technical Summary
The existing mathematical application problem solving methods are difficult to deal with complex equations and solve simple arithmetic problems and equation application problems at the same time, and the analogy solution performance is poor, and it fails to effectively utilize the problem structure information and mathematical knowledge points.
Using a unified problem-solving method of mathematical application problems that integrate structural information, the solution is constructed by constructing a data set containing equation expressions and knowledge point annotations, and using the Math-BERT model and a bidirectional gating cycle unit combined with a graph encoder and a cross attention module. The problem feature encoder and analogy solver realize the fusion of semantic dependencies and numerical relationships, and searches similar questions with the same knowledge points for unified analogy solutions.
It improves the problem-solving accuracy of mathematical application problems and the model's ability to process expressions of various equations, enhances the problem-solving ability of complex problems, and improves the analogy solution performance.
Smart Images

Figure CN118821934B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of neural network technology, and in particular to a unified method for solving mathematical word problems integrating structural information. Background Art
[0002] Solving math word problems (MWP) is an important and fundamental research in natural language processing (NLP), which is crucial to fields such as machine translation, machine reading, and machine question answering. Since the 1960s, the field of math word problem solving has been widely studied, from regular matching problem solving methods with low intelligence to automatic problem solving models. In recent years, with the rise of online smart education, math word problem solving has achieved good results. However, existing artificial intelligence algorithms still face challenges in logical thinking and mathematical reasoning, especially in application scenarios that require mathematical logic deduction capabilities. The matching degree and accuracy of intelligent algorithm solutions with actual needs still need to be improved. Therefore, the research on automatic problem solving algorithms for math word problems has become a key task to promote the improvement of artificial intelligence algorithms in mathematical reasoning and logical thinking. Through in-depth research on automatic problem solving algorithms for math word problems, we can inject new impetus into the development of artificial intelligence technology, promote the application and development of artificial intelligence technology in more fields, and lay a solid foundation for the future development of intelligent technology.
[0003] Existing methods for solving math word problems, such as rule-based and statistical methods, usually consume a lot of time and human resources, cannot handle uncertainty in data, and have significant limitations. In recent years, most math word problem solving methods are based on deep learning, and most of them focus on learning a single math problem or introducing additional prompt information to improve the performance of math word problem solving. It is difficult to solve by analogy with existing problems.
[0004] In the field of analogy solving of math word problems, some existing deep learning methods still retrieve similar problems by calculating the similarity between math word problems to achieve the purpose of analogy solving. Few works explore the deep semantics of words or sentences from the perspective of the structural information and mathematical knowledge points contained in the problem itself, which leads to poor analogy solving performance.
[0005] The equation expression of mathematical word problems is often not single. Mathematical word problems can be divided into simple arithmetic problems and equation word problems. However, most of the existing deep learning-based mathematical word problem solving methods can only handle simple arithmetic problems or equation word problems. However, few people have studied models that can solve simple arithmetic problems and equation word problems at the same time. There are currently almost no models that can use similar problems with the same knowledge to unify the solution of simple arithmetic problems and equation word problems. Summary of the invention
[0006] In view of the shortcomings of the prior art, the present invention provides a unified method for solving mathematical word problems that integrates structural information. The purpose is to integrate the problem structure information and mathematical knowledge point information into the mathematical word problem solving model, and enable the model to perform unified analogical solutions to simple arithmetic problems and equation word problems through similar problems with the same knowledge points like humans, thereby improving the performance of the solver.
[0007] To achieve the above object, the present invention provides the following technical solution: a unified method for solving mathematical word problems integrating structural information, comprising the following steps:
[0008] Step S1: construct a data set, which includes a number of math word problems and the equation expressions and answers corresponding to the math word problems, and each math word problem is marked with knowledge points;
[0009] Step S2: Define the mathematical word problem to be solved; set the length to The mathematical application problem to be solved is ,according to The generated length is The equation expression is , by calculating get The answer ,in, Represents a mathematical word problem to be solved Middle The text corresponding to the position, Represents an equation expression Middle The symbol corresponding to each position;
[0010] Step S3: construct a math word problem solution model, the math word problem solution model is composed of a problem solution feature encoder, a similar question retriever and a math word problem analogy solver; the problem solution feature encoder includes a math word problem feature encoder and an equation expression feature encoder, the math word problem feature encoder is composed of a pre-trained Math-BERT model, and the equation expression feature encoder is composed of a bidirectional gated recurrent unit; the similar question retriever includes a semantic dependency graph construction module, a numerical relationship graph construction module, a graph encoding layer composed of a graph encoder, a knowledge point weight construction module and a cosine similarity calculation module; the math word problem analogy solver includes a similar solution purpose question retriever composed of a text feature extractor, a gating module, a semantic fusion layer composed of a cross attention module and a tree decoder;
[0011] Step S4: input the mathematical word problems to be solved and the mathematical word problems in the data set into the mathematical word problem feature encoder to obtain semantic embedding vectors of the mathematical word problems to be solved and the mathematical word problems in the data set;
[0012] Obtain the semantic dependency relationship set and numerical relationship set of the mathematical word problem to be solved and the mathematical word problem in the data set, and construct the mathematical word problem to be solved through the semantic dependency relationship graph construction module and the numerical relationship graph construction module respectively and the semantic dependency graph and numerical relationship graph of the math word problems in the dataset;
[0013] Inputting the semantic dependency graph and the numerical relationship graph of the mathematical word problems to be solved and the mathematical word problems in the data set into the graph encoding layer, and obtaining the semantic dependency feature vector and the numerical relationship feature vector of the mathematical word problems to be solved and the mathematical word problems in the data set respectively;
[0014] The semantic dependency feature vectors and numerical relationship feature vectors of the mathematical word problems to be solved and the mathematical word problems in the data set are respectively fused to obtain the feature representation of the mathematical word problems to be solved and the feature representation of the mathematical word problems in the data set;
[0015] The feature representation is combined with its own corresponding knowledge point and then input into the cosine similarity calculation module for similarity calculation, and the mathematical word problems with the same knowledge point as the mathematical word problem to be solved in the data set are retrieved as candidate mathematical word problems;
[0016] Step S5: obtaining the semantic embedding vector of the candidate mathematical word problem and the global feature vector of the equation expression of the candidate mathematical word problem; inputting the semantic embedding vector of the mathematical word problem to be solved, the semantic embedding vector of the candidate mathematical word problem and the global feature vector of the equation expression of the candidate mathematical word problem into a similar problem-solving purpose retriever to obtain the semantic embedding vector of the similar purpose word problem and the global feature vector of the equation expression of the similar purpose word problem;
[0017] Step S6: average the semantic embedding vectors of the mathematical word problems to be solved to obtain the global feature vector of the mathematical word problems to be solved, input the global feature vector of the mathematical word problems to be solved and the semantic embedding vectors of the word problems with similar purposes into the semantic fusion layer to obtain the deep-level feature representation, cascade the deep-level feature representation with the global feature vectors of the equation expressions of the word problems with similar purposes and input them into the gating module to obtain the initial node;
[0018] Step S7: Input the initial node into the tree decoder for decoding to obtain the final equation expression, and then calculate the loss of the math word problem analogy solver by minimizing the negative log-likelihood loss function, and optimize and update the model parameters of the problem-solving feature encoder and the tree decoder.
[0019] Furthermore, the specific process of obtaining the semantic dependency set and the numerical relationship set of the mathematical word problem is: extracting the relationship between the words in the mathematical word problem to obtain the semantic dependency set; obtaining multiple numerical relationship triplets contained in the mathematical word problem to form the numerical relationship set of the mathematical word problem.
[0020] Furthermore, the specific process of constructing the semantic dependency graph and the numerical relationship graph through the semantic dependency graph construction module and the numerical relationship graph construction module is as follows:
[0021] Constructing a semantic dependency graph: When the first Words with location and Words with location If there is a dependency relationship, and There is an edge between ;
[0022] Construct a numerical relationship graph: Establish a directed connection edge between two numerical values that have a numerical relationship in the mathematical word problem to obtain a greater than relationship graph. and less than relationship diagram , for the first The value of the position and The value of the position ,when ,but and There is an edge between ,when ,but and There is an edge between .
[0023] Further, in step S4, the specific process of obtaining the feature representation of the mathematical word problem to be solved and the feature representation of the mathematical word problem in the data set is: using the graph encoder GCN to respectively capture the relationship between each word and adjacent words in the mathematical word problem and the relationship between each numerical value, and obtaining the feature representation of the mathematical word problem to be solved and the feature representation of the mathematical word problem in the data set; specifically:
[0024] Semantic dependency feature aggregation: First, the mathematical word problem feature encoder is used to obtain the semantic embedding vector of the mathematical word problem to be solved as the initial feature vector of each node in the semantic dependency graph of the mathematical word problem to be solved. Then, the information of each node in the semantic dependency graph is aggregated through the graph encoder GCN to obtain the N-th layer of aggregated information matrix. Then, each node in the semantic dependency graph updates its own embedding vector from the domain node to obtain the semantic dependency feature vector after the N-th layer embedding update, that is, the semantic dependency feature vector of the mathematical word problem to be solved.
[0025] For the math word problems in the dataset, firstly, the semantic embedding vector of the math word problems in the dataset is obtained through the math word problem feature encoder as the initial feature vector of the semantic dependency graph node of the math word problems in the dataset, and then the information aggregated from each node of the Nth layer from its own adjacent nodes and the semantic dependency feature vector after the Nth layer node embedding is updated are obtained;
[0026] Numerical relationship aggregation: Use the graph encoder GCN to treat the numerical relationship graph of solving mathematical word problems separately and the greater than relationship graph and less than relationship diagram Perform feature aggregation to obtain a larger than relationship graph Aggregate information at level N and less than relationship diagram Aggregate information at level N , and then combine them through the aggregation mechanism and Get the combined feature vector , and finally After linear transformation and Sigmoid nonlinear activation, the numerical relationship feature vector of the mathematical word problem to be solved is obtained. , expressed as:
[0027] ;
[0028] ;
[0029] ;
[0030] ;
[0031] ;
[0032] In the formula, Indicates element-by-element multiplication; ReLU activation function; Sigmoid represents nonlinear activation function; Indicates that the mathematical word problem to be solved is greater than the relationship diagram and less than relationship diagram The number of iterations during feature aggregation; and Respectively represent the greater than relationship diagrams of the mathematical application problems to be solved and less than relationship diagram Information aggregated from neighboring nodes at level N; and Respectively represent the greater than relationship diagrams of the mathematical application problems to be solved and less than relationship diagram The corresponding degree matrix; and Respectively represent the greater than relationship diagrams of the mathematical application problems to be solved and less than relationship diagram Corresponding adjacency matrix; and Respectively represent the greater than relationship diagrams of the mathematical application problems to be solved and less than relationship diagram The corresponding identity matrix; represents the aggregation weight matrix obtained through the aggregation mechanism; and Represent the feature vectors of nodes in layer N and layer N-1 respectively; , , , , , , All are learnable weight matrices;
[0033] Obtained by adopting The same calculation method is used to obtain the numerical relationship feature vector of the mathematical word problem in the data set. ;
[0034] Feature fusion: The semantic dependency feature vector of the mathematical word problem to be solved and numerical relationship feature vector Fusion is performed to obtain the characteristic representation of the mathematical application problem to be solved ;
[0035] The semantic dependency feature vector of the mathematical word problems in the data set and numerical relationship feature vector Fusion is performed to obtain the feature representation of the mathematical word problems in the data set .
[0036] Further, in step S4, the feature representation After combining its own corresponding knowledge points with feature representation Input the cosine similarity calculation module to perform similarity calculation and retrieve the data set that matches the mathematical word problem to be solved. The specific process of selecting math word problems with the same knowledge points as candidate math word problems is as follows:
[0037] Assign different weight information to different levels of knowledge points in the math word problems in the data set, and obtain the weight matrix of the math word problems in the data set , represents the characteristics of mathematical word problems in the data set The weight matrix of the mathematical word problems in the corresponding data set Multiply them to get the mathematical word problem representation in the data set ;
[0038] Among them, the levels of knowledge points in math word problems are divided into primary, secondary, and tertiary levels. When the math word problems in the data set and the math word problems to be solved have the same third-level knowledge points, the distance is 1; when the math word problems in the data set and the math word problems to be solved have the same second-level knowledge points, the distance is 2; when the math word problems in the data set and the math word problems to be solved have the same primary knowledge points, the distance is 4; when the math word problems in the data set and the math word problems to be solved do not have the same knowledge points, the distance is 0;
[0039] Based on the representation of mathematical word problems in the data set , calculate the similarity score between the mathematical word problem to be solved and the mathematical word problems in the dataset through cosine similarity ;
[0040] Will Input the mean square error loss function to calculate the loss of the similar title retriever ;
[0041] Based on similarity score , retrieve the mathematical word problems to be solved in the data set Mathematical word problems with the same knowledge points are taken as candidate mathematical word problems.
[0042] Furthermore, in step S5, the specific process of obtaining the semantic embedding vector of the candidate mathematical word problem and the global feature vector of the equation expression of the candidate mathematical word problem is as follows:
[0043] Input all candidate math word problems into the math word problem feature encoder to obtain the semantic embedding vector set of candidate math word problems , express The first candidate math word problem The semantic embedding vectors of candidate mathematical word problems are input into the equation expression feature encoder to obtain the global feature vector set of the equation expressions of the candidate mathematical word problems. , express The first candidate math word problem The global eigenvectors of the candidate mathematical word problem equation expressions;
[0044] set up The first candidate math word problem The equation expression corresponding to the candidate mathematical word problem is , express Middle symbol, get the The calculation process of the global eigenvector of the equation expression of the candidate mathematical word problem is expressed as:
[0045] ;
[0046] ;
[0047] ;
[0048] In the formula, and Respectively represent the forward sequence time step and The hidden layer state at time steps; and Respectively represent the backward sequence time step and The hidden layer state at time steps; The expression of the equation Symbol embedding, Represents the forward sequence The hidden state of time steps; Represents the hidden state of the 0th time step of the backward sequence; Represents a bidirectional gated recurrent unit, Bi-GRU.
[0049] Further, in step S5, the semantic embedding vector of the application questions with similar purpose is obtained And similar purpose word problems equation expression global eigenvector The specific process is:
[0050] The first The semantic embedding vectors of the candidate math word problems and the semantic embedding vectors of the math word problems to be solved They are input into the text feature extractor respectively, and the Semantic features of candidate mathematical word problems and semantic features of mathematical word problems to be solved ,in, The calculation process is expressed as:
[0051] ;
[0052] ;
[0053] ;
[0054] In the formula, ReLU activation function. , Respectively The weight matrix and bias term of the convolution kernel; Represents the maximum pooling operation; Indicates The pooling result of convolution kernels; Represents matrix concatenation; express Strategy; Represents the characteristic matrix obtained by randomly setting zeros with a certain probability; and Represent the weight matrix and bias term of the fully connected layer respectively;
[0055] No. Semantic features of candidate mathematical word problems Adopt and Calculated in the same way;
[0056] Will and After performing the vector inner product and normalizing, we can get the similarity probability between the mathematical word problem to be solved and the candidate mathematical word problem. , and then sort them according to the similarity probability , from the semantic embedding vector set of candidate mathematical word problems and the global eigenvector set of candidate mathematical word problem equation expressions Get semantic embedding vectors of word problems with similar purposes and similar purpose word problems equation expression global eigenvector .
[0057] Furthermore, the specific process of obtaining the deep feature representation in step S6 is as follows:
[0058] Through the cross-attention module, the mathematical word problems to be solved are The global eigenvector of Semantic embedding vectors of word problems with similar purposes Fusion to obtain deep feature representation , the calculation process is expressed as:
[0059] ;
[0060] ;
[0061] In the formula, , , Represent query vector, key vector and value vector respectively; Softmax is a normalized exponential function; for and The size of the second dimension of , , Represents the query vector of the self-attention mechanism , key vector Sum value vector The projection parameter matrix of , ,in, is the learnable parameter matrix of the linear layer in the cross-attention mechanism; express The transpose of represents the cross attention mechanism;
[0062] In step S6, the deep feature representation is combined with the global feature vector of the expression of the word problem equation of similar purpose After cascading, the gate control module is input to obtain the specific process of the initial node:
[0063] The deep features are represented by the gating mechanism, i.e., the gating module. and Fusion, get the initial node , expressed as:
[0064] ;
[0065] ;
[0066] ;
[0067] In the formula, represents the candidate value of the initial hidden state; is the hyperbolic tangent activation function; is the gating signal; is the Sigmoid activation function; , They are all weight matrices of the gating modules; , are the bias items of the gating module; , express and The concatenated vector.
[0068] Furthermore, the specific process of step S7 is as follows:
[0069] Will Input tree decoder, through top-down tree structure decoding and bottom-up subtree semantic transformation, using the semantic information of generated symbols to determine the generated symbols; specifically:
[0070] Word embedding definition: Mathematical word problems to be solved Target vocabulary It consists of 4 parts: mathematical operators , unknown ,constant , as well as in the mathematical word problems to be solved Numbers in , for the target vocabulary Each token in Embed It is expressed as:
[0071] ;
[0072] In the formula, , , , They represent the mapping function for embedding mathematical operators, the mapping function for embedding unknown numbers, the mapping function for embedding constants, and the mapping function for embedding mathematical word problems to be solved. A function that embeds local information of numbers in the context of
[0073] Node status update: In the process of generating symbols, the tree decoder is structurally adjusted, which is expressed as:
[0074] ;
[0075] In the formula, Indicates The state vector of each tree node; Indicates The node state vector after the tree node is updated; Indicates The symbol generated by each tree node; It is The embedding representation of the symbol generated by each tree node; Represents the semantic representation of the left subtree in the tree structure; , They represent the state update function of the left part of the subtree nodes in the tree structure and the state update function of the right part of the subtree nodes in the tree structure respectively;
[0076] Negative log-likelihood loss: by calculating the equation expression of the mathematical word problem to be solved Middle The symbols in the positions of the given mathematical word problems to be solved The conditional probability under , and then the loss of the mathematical word problem analogy solver is obtained by minimizing the negative log-likelihood loss function It is expressed as;
[0077] ;
[0078] ;
[0079] In the formula, is the equation expression of the mathematical word problem to be solved Total length; Indicates The tree node generates The symbol of the position The scoring function of Indicates The tree node generates The symbol of the position The scoring function of and Respectively represent The target vector of the tree node and the The context vector of a tree node.
[0080] Furthermore, the specific process of constructing the data set is:
[0081] 16,112 elementary school math word problems were collected from math test papers and learning websites. The collected math word problems included simple arithmetic problems and equation word problems.
[0082] Preprocess the collected mathematical word problems:
[0083] 1. Remove repeated math word problems;
[0084] 2. Use the mathematics knowledge point dictionary to automatically mark mathematics word problems, and use a semi-manual method to mark the knowledge points for each mathematics word problem; the mathematics knowledge point dictionary is constructed based on the People's Education Press textbook;
[0085] 3. Perform label consistency check on the results of knowledge point annotation, that is, perform similarity calculation on the results of the same knowledge point annotation, and select the results of knowledge point annotation with high similarity;
[0086] Finally, the preprocessed math word problems were manually checked and corrected, and 15,000 math word problems were retained to form the data set.
[0087] Compared with the existing technology, the present invention has the following beneficial effects: the present invention adopts a method of fusing the structural information of mathematical word problems and the hierarchical information of knowledge points to solve the problem of poor retrieval effect of similar mathematical word problems; in view of the complex semantic structure of mathematical word problems and the complex and diverse equation expressions, a gating module is used to semantically fuse mathematical word problems with the same knowledge points, which can better fuse the expression information of similar mathematical word problems, thereby improving the accuracy of the model in solving problems and enhancing the model's ability to draw inferences about mathematical word problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0088] Figure 1 The present invention is a flow chart of a mathematical word problem solving model. DETAILED DESCRIPTION
[0089] like Figure 1 As shown, the present invention provides a technical solution: a unified method for solving mathematical word problems integrating structural information, comprising the following steps:
[0090] Step S1: construct a data set, which includes a number of math word problems and the equation expressions and answers corresponding to the math word problems, and each math word problem is marked with knowledge points.
[0091] Step S2: Define the mathematical word problem to be solved; set the length to The mathematical application problem to be solved is ,according to The generated length is The equation expression is , by calculating get The answer ,in, Represents a mathematical word problem to be solved Middle The text corresponding to the position, Represents an equation expression Middle The symbol corresponding to the position.
[0092] Step S3: construct a mathematical word problem solving model, which is composed of a problem solving feature encoder, a similar question retriever and a mathematical word problem analogy solver, and has a serial structure of the problem solving feature encoder, the similar question retriever and the mathematical word problem analogy solver.
[0093] The problem-solving feature encoder includes a mathematical word problem feature encoder and an equation expression feature encoder. The mathematical word problem feature encoder is composed of a pre-trained Math-BERT model, and the equation expression feature encoder is composed of a bidirectional gated recurrent unit (Bi-GRU).
[0094] The similar topic retriever includes a semantic dependency graph construction module, a numerical relationship graph construction module, a graph encoding layer composed of a graph encoder (GCN), a knowledge point weight construction module and a cosine similarity calculation module.
[0095] The mathematical word problem analogy solver includes a similar problem-solving purpose searcher composed of a text feature extractor, a gating module, a semantic fusion layer composed of a cross-attention module, and a tree decoder.
[0096] Step S4: The mathematical word problem to be solved The mathematical word problems in the data set are input into the mathematical word problem feature encoder to obtain the mathematical word problems to be solved. and the semantic embedding vectors of the math word problems in the dataset; get the math word problems to be solved The semantic dependency relationship set and numerical relationship set of the mathematical word problems in the data set are constructed, and the mathematical word problems to be solved are constructed through the semantic dependency relationship graph construction module and the numerical relationship graph construction module respectively. The semantic dependency graph and numerical relationship graph of the mathematical word problems in the data set are used to solve the mathematical word problems. The semantic dependency graph and numerical relationship graph of the mathematical word problems in the data set are input into the graph encoding layer to obtain the mathematical word problems to be solved. The semantic dependency feature vector and numerical relationship feature vector of the mathematical word problems in the data set are used to solve the mathematical word problems. The semantic dependency feature vector and numerical relationship feature vector of the mathematical word problem in the data set are merged to obtain the mathematical word problem to be solved. The feature representation And the characteristic representation of mathematical word problems in the data set , the feature is represented After combining its own corresponding knowledge points with feature representation Input the cosine similarity calculation module to perform similarity calculation and retrieve the data set with the mathematical word problem to be solved. Mathematical word problems with the same knowledge points are taken as candidate mathematical word problems.
[0097] Step S5: Obtain the semantic embedding vector of the candidate mathematical word problem and the global feature vector of the equation expression of the candidate mathematical word problem; The semantic embedding vector of the candidate mathematical word problem, the semantic embedding vector of the candidate mathematical word problem, and the global feature vector of the equation expression of the candidate mathematical word problem are input into the similarity solving purpose question retriever to obtain the candidate mathematical word problem that is similar to the mathematical word problem to be solved. Semantic embedding vectors of word problems with similar purposes and the word problems to be solved in the candidate math word problem equation expressions Equation expressions have similar purposes with similar purposes word problems equation expressions global eigenvectors.
[0098] Step S6: Solve the math problem The semantic embedding vectors of the mathematical problem to be solved are averaged. The global eigenvector of the mathematical word problem to be solved The global feature vector and the semantic embedding vector of similar purpose application problems are input into the semantic fusion layer to obtain the deep feature representation. The deep feature representation is cascaded with the global feature vector of the equation expression of similar purpose application problems and then input into the gating module to obtain the initial node.
[0099] Step S7: Initial node Input into the tree decoder for decoding to obtain the final equation expression, and then calculate the loss of the mathematical word problem analogy solver by minimizing the negative log-likelihood loss function , optimize and update the model parameters of the problem-solving feature encoder and tree decoder.
[0100] The specific process of constructing the data set is as follows:
[0101] Since the existing public data sets are composed of questions, equation expressions and corresponding answers, and lack the knowledge points corresponding to the math word problems, we collected 16,112 elementary school math word problems from math test papers and learning websites. The collected math word problems include simple arithmetic problems and equation word problems.
[0102] Preprocess the collected mathematical word problems:
[0103] 1. Eliminate repeated math word problems.
[0104] 2. Use the mathematics knowledge point dictionary to automatically mark mathematics word problems, and at the same time use a semi-manual method to mark the knowledge points for each mathematics word problem; the mathematics knowledge point dictionary is constructed based on the People's Education Press textbook.
[0105] 3. Perform label consistency check on the results of knowledge point annotation, that is, perform similarity calculation on the results of the same knowledge point annotation, and take the results of knowledge point annotation with high similarity to ensure the rationality of knowledge point annotation.
[0106] Finally, the preprocessed math word problems were manually checked and corrected, and 15,000 math word problems were retained to form the data set.
[0107] Among them, we get the mathematical application problem to be solved The semantic embedding vector and the global eigenvector The calculation process is expressed as:
[0108] (1);
[0109] (2);
[0110] In the formula, Represents the pre-trained Math-BERT model; Indicates an averaging operation.
[0111] Semantic embedding vectors for math word problems And the semantic embedding vector of the candidate math word problem It can also be calculated in the same way as formula (1).
[0112] Among them, the semantic dependency relationship set is obtained by extracting the relationship between each word in the mathematical word problem by the semantic dependency analysis model in the Language Technology Platform (LTP) of Harbin Institute of Technology. The extraction result is expressed as a semantic dependency triple, which means the semantic association between each language unit of the sentence, that is, (the position index number of a word, a relationship type, and the position index number of a word). Usually, a mathematical word problem contains multiple semantic dependency relationship triplets, which constitute the semantic dependency relationship set of the mathematical word problem.
[0113] Among them, the numerical relationship set is the size relationship between the numerical values in the mathematical word problem, that is, (the position index number of a certain numerical value, the size relationship, the position index number of a certain numerical value). Usually, a mathematical word problem contains multiple numerical relationship triplets, thus constituting the numerical relationship set of the mathematical word problem.
[0114] Among them, the mathematical application problems to be solved are constructed by using the semantic dependency graph construction module and the numerical relationship graph construction module. The specific process of the semantic dependency graph and numerical relationship graph of the mathematical word problems in the data set is as follows:
[0115] Constructing a semantic dependency graph: Semantic dependency information is the key information for representing the syntactic structure of mathematical word problems. It is not affected by the syntactic structure and is conducive to understanding the deep semantics of mathematical texts. Words with location and Words with location , if there is a dependency, then and There is an edge between .
[0116] Constructing a numerical relationship graph: The numerical relationship can help the model retrieve mathematical word problems with the same expression. In order to ensure that the numerical relationship information in the mathematical word problems can be known, a directed connection edge is established between two numerical values with numerical relationship in the mathematical word problems to obtain a greater than relationship graph. and less than relationship diagram ; For the first The value of the position and The value of the position ,if ,but and There is an edge between ,if ,but and There is an edge between .
[0117] Among them, we get the mathematical application problem to be solved The feature representation And the characteristic representation of mathematical word problems in the data set The specific process is:
[0118] In order to make the graph encoding layer aggregate the semantic dependency feature vectors and numerical relationship feature vectors corresponding to the mathematical word problems to be solved and the mathematical word problems in the dataset, the graph encoder (GCN) is used to capture the relationship between each word and adjacent words in the mathematical word problems and the relationship between each numerical value to obtain the feature representation of the mathematical word problems to be solved. and the feature representation of mathematical word problems in the dataset Specific:
[0119] Semantic dependency feature aggregation: First, use the math word problem feature encoder to obtain the semantic embedding vector of the math word problem to be solved As the initial feature vector of each node in the semantic dependency graph of the mathematical word problem to be solved , and then aggregate the information of each node in the semantic dependency graph through the graph encoder (GCN) to obtain the aggregated information matrix of the Nth layer , then each node in the semantic dependency graph updates its own embedding vector from the domain node to obtain the semantic dependency feature vector after the Nth layer embedding update , that is, the semantic dependency feature vector of the mathematical word problem to be solved; it is expressed as:
[0120] (3);
[0121] (4);
[0122] In the formula, ReLU activation function. is the aggregate information matrix, which indicates the information that each node aggregates from its neighboring nodes in the Nth layer; M indicates the information that the Nth layer node aggregates from its neighboring nodes; and They represent the degree matrix and adjacency matrix of the semantic dependency graph of the mathematical word problem to be solved respectively; is the identity matrix; and Represent the node feature vectors of the N-1 layer and the Nth layer respectively; is the semantic dependency feature vector, which represents the feature vector obtained after the embedding update of each node in the Nth layer; , , These are all learnable weight matrices for the math word problem feature encoder.
[0123] Similarly, for the math word problems in the dataset, we first use the math word problem feature encoder to obtain the semantic embedding vector of the math word problems in the dataset. As the initial feature vector of the nodes in the semantic dependency graph of mathematical word problems in the dataset Then, the information obtained by aggregating each node from its own adjacent nodes in the Nth layer of the mathematical word problem in the data set is obtained by using the same method as formula (3) and formula (4). and the semantic dependency feature vector after the N-th layer node embedding update .
[0124] Numerical relation aggregation: Using the graph encoder (GCN) to treat the numerical relation graph of solving mathematical word problems separately from the greater than relation graph and less than relationship diagram Perform feature aggregation to obtain a larger than relationship graph Aggregate information at level N and less than relationship diagram Aggregate information at level N , and then combine them through the aggregation mechanism and To obtain the combined eigenvector , and finally After linear transformation and Sigmoid nonlinear activation, the numerical relationship feature vector of the mathematical word problem to be solved is obtained. , expressed as:
[0125] (5);
[0126] (6);
[0127] (7);
[0128] (8);
[0129] (9);
[0130] In the formula, Indicates element-by-element multiplication; ReLU activation function; Sigmoid represents nonlinear activation function; and Respectively represent the greater than relationship diagrams of the mathematical application problems to be solved and less than relationship diagram Aggregate information at level N, Indicates that the mathematical word problem to be solved is greater than the relationship diagram and less than relationship diagram The number of iterations during feature aggregation; and Respectively represent the greater than relationship diagrams of the mathematical application problems to be solved and less than relationship diagram Information aggregated from neighboring nodes at level N; and Respectively represent the greater than relationship diagrams of the mathematical application problems to be solved and less than relationship diagram The corresponding degree matrix; and Respectively represent the greater than relationship diagrams of the mathematical application problems to be solved and less than relationship diagram The corresponding adjacency matrix; and Respectively represent the greater than relationship diagrams of the mathematical application problems to be solved and less than relationship diagram The corresponding identity matrix; represents the aggregation weight matrix obtained through the aggregation mechanism; A greater than relationship diagram representing the mathematical word problem to be solved and less than relationship diagram The numerical relationship feature vector obtained after the Nth layer node embedding update; and Represent the feature vectors of the N-th layer and the N-1-th layer nodes, respectively, and are both represented by Iteration after initialization; , , , , , , are all learnable weight matrices.
[0131] Similarly, the numerical relationship feature vector of the mathematical word problem in the data set is obtained by using the same method as Equation (5)-Equation (9): .
[0132] Feature fusion: In order to make full use of structural information and numerical size information, the semantic dependency feature vector of the mathematical word problem to be solved is and numerical relationship feature vector Fusion is performed to obtain the characteristic representation of the mathematical application problem to be solved , expressed as:
[0133] (10);
[0134] Similarly, the feature representation of the mathematical word problems in the data set is calculated in the same way as formula (10): .
[0135] Among them, the feature is represented After combining its own corresponding knowledge points with feature representation Input the cosine similarity calculation module to perform similarity calculation and retrieve the data set with the mathematical word problem to be solved. The specific process of selecting math word problems with the same knowledge points as candidate math word problems is as follows:
[0136] The levels of knowledge points in math word problems are divided into primary, secondary, and tertiary levels. In order to make the distance between math word problems in the data set with different knowledge points from the math word problems to be solved farther away, and the distance between math word problems in the data set with similar knowledge points to the math word problems to be solved closer, different weight information is assigned to knowledge points of different levels in the math word problems in the data set, and the weight matrix of the math word problems in the data set is obtained. , represents the characteristics of mathematical word problems in the data set The weight matrix of the mathematical word problems in the corresponding data set Multiply them to get the mathematical word problem representation in the data set with knowledge point level information , the calculation process is expressed as:
[0137] (11);
[0138] (12);
[0139] In the formula, Represents the distance between the math word problems in the data set and the knowledge points of the math word problems to be solved; Indicates if.
[0140] When the math word problem in the data set and the math word problem to be solved have the same third-level knowledge points, the distance is 1; when the math word problem in the data set and the math word problem to be solved have the same second-level knowledge points, the distance is 2; when the math word problem in the data set and the math word problem to be solved have the same first-level knowledge points, the distance is 4; when the math word problem in the data set and the math word problem to be solved do not have the same knowledge points, the distance is 0.
[0141] Based on the representation of mathematical word problems in the data set , calculate the similarity score between the mathematical word problem to be solved and the mathematical word problems in the dataset through cosine similarity :
[0142] (13);
[0143] In the formula, , Respectively represent feature representation Representation of mathematical word problems in the data set The length of the vector; Represents the multiplication of the lengths of two vectors.
[0144] Will Input the mean square error loss function to calculate the loss of the similar title retriever :
[0145] (14);
[0146] In the formula, Indicates the number of math word problems in the data set; The golden similarity score represents the adjustment of the similarity between the mathematical word problem to be solved and the mathematical word problems in the dataset to an appropriate degree; Represents the similarity score between the math word problem to be solved and the math word problems in the dataset.
[0147] Based on similarity score , retrieve the mathematical word problems to be solved in the data set Mathematical word problems with the same knowledge points are taken as candidate mathematical word problems.
[0148] Among them, in step S5, the specific process of obtaining the semantic embedding vector of the candidate mathematical word problem and the global feature vector of the equation expression of the candidate mathematical word problem is:
[0149] Input all candidate math word problems into the math word problem feature encoder to obtain the semantic embedding vector set of candidate math word problems , express The first candidate math word problem The semantic embedding vectors of candidate mathematical word problems are input into the equation expression feature encoder to obtain the global feature vector set of the equation expressions of the candidate mathematical word problems. , express The first candidate math word problem The global eigenvectors of the candidate mathematical word problem equation expressions.
[0150] Among them, setting The first candidate math word problem The equation expression corresponding to the candidate mathematical word problem is , express Middle symbol, get the The calculation process of the global eigenvector of the equation expression of the candidate mathematical word problem is expressed as:
[0151] (15);
[0152] (16);
[0153] (17);
[0154] In the formula, and Represent the forward sequence time step and The hidden layer state at time steps; and Respectively represent the backward sequence time step and The hidden layer state at time steps; The expression of the equation Symbol embedding, Represents the forward sequence The hidden state of time steps; Represents the hidden state of the 0th time step of the backward sequence; Represents a bidirectional gated recurrent unit (Bi-GRU).
[0155] Among them, in step S5, the candidate mathematical word problems that are related to the mathematical word problem to be solved are obtained. Semantic embedding vectors of similar purpose word problems with similar purpose and the equation expressions of the candidate mathematical word problems that are related to the mathematical word problems to be solved Equation expressions with similar purposes Similar purposes Word problems Equation expressions Global eigenvectors The specific process is:
[0156] Similar title search results Among the candidate math word problems, the most similar candidate math word problem may be the most similar in semantics, but its solution purpose may be different; in order to find a math word problem with a similar solution purpose as the math word problem to be solved from the candidate math word problems, first we need to The semantic embedding vectors of the candidate math word problems and the semantic embedding vectors of the math word problems to be solved are respectively input into the text feature extractor to obtain the first Semantic features of candidate mathematical word problems and semantic features of mathematical word problems to be solved ,in, The calculation process is shown in equations (18) to (20):
[0157] (18);
[0158] (19);
[0159] (20);
[0160] In the formula, ReLU activation function. , Respectively The weight matrix and bias term of the convolution kernel; Represents the maximum pooling operation; Indicates The pooling result of convolution kernels; Represents matrix concatenation; express Strategies to prevent overfitting; Represents the characteristic matrix obtained by randomly setting zeros with a certain probability; and They represent the weight matrix and bias term of the fully connected layer respectively.
[0161] Similarly, It is obtained by adopting the same method as equation (18)-equation (20).
[0162] Will and After performing the vector inner product and normalizing, we can get the similarity probability between the mathematical word problem to be solved and the candidate mathematical word problem. , and then sort them according to the similarity probability , from the semantic embedding vector set of candidate mathematical word problems and the global eigenvector set of candidate mathematical word problem equation expressions Get semantic embedding vectors of word problems with similar purposes and similar purpose word problems equation expression global eigenvector , similarity probability The calculation process is expressed as:
[0163] (twenty one);
[0164] In the formula, express The transpose of represents the vector inner product; express; Indicates Semantic features of candidate mathematical word problems.
[0165] The specific process of obtaining the deep feature representation in step S6 is as follows:
[0166] When integrating information about similar math word problems, in order to learn common problem-solving strategies and steps from math word problems with similar solution purposes, help the model capture important information, learn problem-solving strategies, and improve the adaptability and generalization ability to new math word problems, the math word problems to be solved are integrated through the cross-attention module, namely the cross-attention mechanism. The global eigenvector of Semantic embedding vectors of word problems with similar purposes Fusion to obtain a deep feature representation containing both information , the calculation process is expressed as:
[0167] (twenty two);
[0168] (twenty three);
[0169] In the formula, , , Represent query vector, key vector and value vector respectively; Softmax is a normalized exponential function; for and The size of the second dimension of , , Represents the query vector of the self-attention mechanism , key vector Sum value vector The projection parameter matrix of , ,in, is the learnable parameter matrix of the linear layer in the cross-attention mechanism; express The transpose of Represents the cross attention mechanism.
[0170] In step S6, the deep feature representation is combined with the global feature vector of the expression of the word problem equation of similar purpose After cascading, the gate control module is input to obtain the specific process of the initial node:
[0171] A good initial hidden state is very important for the tree decoder to represent the deep features through the gating mechanism, i.e., the gating module. and Fusion can provide the decoder with an initial node with prior information , thus guiding the subsequent generation process, the calculation process is shown in Equation (24)-Equation (26);
[0172] (twenty four);
[0173] (25);
[0174] (26);
[0175] In the formula, represents the candidate value of the initial hidden state; is the hyperbolic tangent activation function; is the gating signal; is the Sigmoid activation function; , They are all weight matrices of the gating modules; , are the bias items of the gating module; , express and The concatenated vector.
[0176] The specific process of step S7 is as follows:
[0177] Will Input tree decoder, through top-down tree structure decoding and bottom-up subtree semantic transformation, fully utilize the semantic information of generated symbols to determine the generated symbols; specifically:
[0178] Word embedding definition: For a mathematical word problem to be solved , its target vocabulary It consists of 4 parts: mathematical operators , unknown ,constant , as well as in the mathematical word problems to be solved Numbers in , for the target vocabulary Each token in , whose token is embedded in The definition is shown in formula (27);
[0179] (27);
[0180] In the formula, , , , They represent the mapping function for embedding mathematical operators, the mapping function for embedding unknown numbers, the mapping function for embedding constants, and the mapping function for embedding mathematical word problems to be solved. The function of embedding local information of numbers in the context.
[0181] Node state update: In order to ensure that the generated mathematical expression can accurately reflect the semantics of the problem description through the dynamic information transmission and semantic integration of the tree structure of the tree decoder, in the process of generating symbols, the tree decoder can make correct symbol selection and structural adjustment through target decomposition and semantic alignment, thereby improving the accuracy and flexibility of expression generation. The calculation process is shown in formula (28);
[0182] (28);
[0183] In the formula, Indicates The state vector of each tree node; Indicates The node state vector after the tree node is updated; Indicates The symbol generated by each tree node; It is The embedding representation of the symbol generated by each tree node; Represents the semantic representation of the left subtree in the tree structure; , They respectively represent the state update function of the subtree nodes on the left side of the tree structure and the state update function of the subtree nodes on the right side of the tree structure.
[0184] Negative log-likelihood loss: First, calculate the equation expression of the mathematical word problem to be solved Middle The symbols in the positions of the given mathematical word problems to be solved The conditional probability under , and then the loss of the mathematical word problem analogy solver is obtained by minimizing the negative log-likelihood loss function , the calculation process is shown in formula (29) and formula (30);
[0185] (29);
[0186] (30);
[0187] In the formula, is the equation expression of the mathematical word problem to be solved Total length; Indicates The tree node generates The symbol of the position The scoring function of Indicates The tree node generates The symbol of the position The scoring function of and Respectively represent The target vector and its context vector for each tree node.
[0188] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A unified method for solving mathematical word problems integrating structural information, characterized in that: The steps include: Step S1: construct a data set, which includes a number of math word problems and the equation expressions and answers corresponding to the math word problems, and each math word problem is marked with knowledge points; Step S2: Define the mathematical word problem to be solved; set the length to The mathematical application problem to be solved is ,according to The generated length is The equation expression is , by calculating get The answer ,in, Represents a mathematical word problem to be solved Middle The text corresponding to the position, Represents an equation expression Middle The symbol corresponding to each position; Step S3: construct a math word problem solution model, the math word problem solution model is composed of a problem solution feature encoder, a similar question retriever and a math word problem analogy solver; the problem solution feature encoder includes a math word problem feature encoder and an equation expression feature encoder, the math word problem feature encoder is composed of a pre-trained Math-BERT model, and the equation expression feature encoder is composed of a bidirectional gated recurrent unit; the similar question retriever includes a semantic dependency graph construction module, a numerical relationship graph construction module, a graph encoding layer composed of a graph encoder, a knowledge point weight construction module and a cosine similarity calculation module; the math word problem analogy solver includes a similar solution purpose question retriever composed of a text feature extractor, a gating module, a semantic fusion layer composed of a cross attention module and a tree decoder; Step S4: input the mathematical word problems to be solved and the mathematical word problems in the data set into the mathematical word problem feature encoder to obtain semantic embedding vectors of the mathematical word problems to be solved and the mathematical word problems in the data set; Obtain the semantic dependency relationship set and numerical relationship set of the mathematical word problem to be solved and the mathematical word problem in the data set, and construct the mathematical word problem to be solved through the semantic dependency relationship graph construction module and the numerical relationship graph construction module respectively and the semantic dependency graph and numerical relationship graph of the math word problems in the dataset; Inputting the semantic dependency graph and the numerical relationship graph of the mathematical word problems to be solved and the mathematical word problems in the data set into the graph encoding layer, and obtaining the semantic dependency feature vector and the numerical relationship feature vector of the mathematical word problems to be solved and the mathematical word problems in the data set respectively; The semantic dependency feature vectors and numerical relationship feature vectors of the mathematical word problems to be solved and the mathematical word problems in the data set are respectively fused to obtain the feature representation of the mathematical word problems to be solved and the feature representation of the mathematical word problems in the data set; The feature representation is combined with its own corresponding knowledge point and then input into the cosine similarity calculation module for similarity calculation, and the mathematical word problems with the same knowledge point as the mathematical word problem to be solved in the data set are retrieved as candidate mathematical word problems; Step S5: obtaining the semantic embedding vector of the candidate mathematical word problem and the global feature vector of the equation expression of the candidate mathematical word problem; inputting the semantic embedding vector of the mathematical word problem to be solved, the semantic embedding vector of the candidate mathematical word problem and the global feature vector of the equation expression of the candidate mathematical word problem into a similar problem-solving purpose retriever to obtain the semantic embedding vector of the similar purpose word problem and the global feature vector of the equation expression of the similar purpose word problem; Step S6: average the semantic embedding vectors of the mathematical word problems to be solved to obtain the global feature vector of the mathematical word problems to be solved, input the global feature vector of the mathematical word problems to be solved and the semantic embedding vectors of the word problems with similar purposes into the semantic fusion layer to obtain the deep-level feature representation, cascade the deep-level feature representation with the global feature vectors of the equation expressions of the word problems with similar purposes and input them into the gating module to obtain the initial node; Step S7: Input the initial node into the tree decoder for decoding to obtain the final equation expression, and then calculate the loss of the math word problem analogy solver by minimizing the negative log-likelihood loss function, and optimize and update the model parameters of the problem-solving feature encoder and the tree decoder.
2. A unified method for solving mathematical word problems integrating structural information according to claim 1, characterized in that: The specific process of obtaining the semantic dependency relationship set and the numerical relationship set of the mathematical word problem is as follows: extracting the relationship between each word in the mathematical word problem to obtain the semantic dependency relationship set; A plurality of numerical relationship triplets included in the math word problem are obtained to form a numerical relationship set of the math word problem.
3. A unified method for solving mathematical word problems integrating structural information according to claim 2, characterized in that: The specific process of constructing the semantic dependency graph and the numerical relationship graph through the semantic dependency graph construction module and the numerical relationship graph construction module is as follows: Constructing a semantic dependency graph: When the first Words with location and Words with location If there is a dependency relationship, and There is an edge between ; Construct a numerical relationship graph: Establish a directed connection edge between two numerical values that have a numerical relationship in the mathematical word problem to obtain a greater than relationship graph. and less than relationship diagram , for the first The value of the position and The value of the position ,when ,but and There is an edge between ,when ,but and There is an edge between .
4. A unified method for solving mathematical word problems integrating structural information according to claim 3, characterized in that: In step S4, the specific process of obtaining the feature representation of the mathematical word problem to be solved and the feature representation of the mathematical word problem in the data set is: using the graph encoder GCN to capture the relationship between each word and adjacent words in the mathematical word problem and the relationship between each numerical value, and obtaining the feature representation of the mathematical word problem to be solved and the feature representation of the mathematical word problem in the data set; specifically: Semantic dependency feature aggregation: First, the mathematical word problem feature encoder is used to obtain the semantic embedding vector of the mathematical word problem to be solved as the initial feature vector of each node in the semantic dependency graph of the mathematical word problem to be solved. Then, the information of each node in the semantic dependency graph is aggregated through the graph encoder GCN to obtain the N-th layer of aggregated information matrix. Then, each node in the semantic dependency graph updates its own embedding vector from the domain node to obtain the semantic dependency feature vector after the N-th layer embedding update, that is, the semantic dependency feature vector of the mathematical word problem to be solved. For the math word problems in the dataset, firstly, the semantic embedding vector of the math word problems in the dataset is obtained through the math word problem feature encoder as the initial feature vector of the semantic dependency graph node of the math word problems in the dataset, and then the information aggregated from each node of the Nth layer from its own adjacent nodes and the semantic dependency feature vector after the Nth layer node embedding is updated are obtained; Numerical relationship aggregation: Use the graph encoder GCN to treat the numerical relationship graph of solving mathematical word problems separately and the greater than relationship graph and less than relationship diagram Perform feature aggregation to obtain a larger than relationship graph Aggregate information at level N and less than relationship diagram Aggregate information at level N , and then combine them through the aggregation mechanism and Get the combined feature vector , and finally After linear transformation and Sigmoid nonlinear activation, the numerical relationship feature vector of the mathematical word problem to be solved is obtained. , expressed as: ; ; ; ; ; In the formula, Indicates element-by-element multiplication; ReLU activation function; Sigmoid represents nonlinear activation function; Indicates that the mathematical word problem to be solved is greater than the relationship diagram and less than relationship diagram The number of iterations during feature aggregation; and Respectively represent the greater than relationship diagrams of the mathematical application problems to be solved and less than relationship diagram Information aggregated from neighboring nodes at level N; and Respectively represent the greater than relationship diagrams of the mathematical application problems to be solved and less than relationship diagram The corresponding degree matrix; and Respectively represent the greater than relationship diagrams of the mathematical application problems to be solved and less than relationship diagram The corresponding adjacency matrix; and Respectively represent the greater than relationship diagrams of the mathematical application problems to be solved and less than relationship diagram The corresponding identity matrix; represents the aggregation weight matrix obtained through the aggregation mechanism; and Represent the feature vectors of nodes in layer N and layer N-1 respectively; , , , , , , All are learnable weight matrices; Obtained by adopting The same calculation method is used to obtain the numerical relationship feature vector of the mathematical word problem in the data set. ; feature Fusion: The semantic dependency feature vector of the mathematical word problem to be solved and numerical relationship feature vector Fusion is performed to obtain the characteristic representation of the mathematical application problem to be solved ; The semantic dependency feature vector of the mathematical word problems in the data set and numerical relationship feature vector Fusion is performed to obtain the feature representation of the mathematical word problems in the data set .
5. A unified method for solving mathematical word problems integrating structural information according to claim 4, characterized in that: In step S4, the feature representation After combining its own corresponding knowledge points with feature representation Input the cosine similarity calculation module to perform similarity calculation and retrieve the data set with the mathematical word problem to be solved. The specific process of selecting math word problems with the same knowledge points as candidate math word problems is as follows: Assign different weight information to different levels of knowledge points in the math word problems in the data set, and obtain the weight matrix of the math word problems in the data set , represents the characteristics of mathematical word problems in the data set The weight matrix of the mathematical word problems in the corresponding data set Multiply them to get the mathematical word problem representation in the data set ; Among them, the levels of knowledge points in math word problems are divided into primary, secondary, and tertiary levels. When the math word problems in the data set and the math word problems to be solved have the same third-level knowledge points, the distance is 1; when the math word problems in the data set and the math word problems to be solved have the same second-level knowledge points, the distance is 2; when the math word problems in the data set and the math word problems to be solved have the same primary knowledge points, the distance is 4; when the math word problems in the data set and the math word problems to be solved do not have the same knowledge points, the distance is 0; Based on the representation of mathematical word problems in the data set , calculate the similarity score between the mathematical word problem to be solved and the mathematical word problems in the dataset through cosine similarity ; Will Input the mean square error loss function to calculate the loss of the similar title retriever ; Based on similarity score , retrieve the mathematical word problems to be solved in the data set Mathematical word problems with the same knowledge points are taken as candidate mathematical word problems.
6. A unified method for solving mathematical word problems integrating structural information according to claim 5, characterized in that: In step S5, the specific process of obtaining the semantic embedding vector of the candidate mathematical word problem and the global feature vector of the equation expression of the candidate mathematical word problem is as follows: Input all candidate math word problems into the math word problem feature encoder to obtain the semantic embedding vector set of candidate math word problems , express The first candidate math word problem The semantic embedding vectors of candidate mathematical word problems are input into the equation expression feature encoder to obtain the global feature vector set of the equation expressions of the candidate mathematical word problems. , express The first candidate math word problem The global eigenvectors of the candidate mathematical word problem equation expressions; set up The first candidate math word problem The equation expression corresponding to the candidate mathematical word problem is , express Middle symbol, get the The calculation process of the global eigenvector of the equation expression of the candidate mathematical word problem is expressed as: ; ; ; In the formula, and Represent the forward sequence time step and The hidden layer state at time steps; and Respectively represent the backward sequence time step and The hidden layer state at time steps; The expression of the equation Symbol embedding, Represents the forward sequence The hidden state of time steps; Represents the hidden state of the 0th time step of the backward sequence; Represents a bidirectional gated recurrent unit, Bi-GRU.
7. A unified method for solving mathematical word problems integrating structural information according to claim 6, characterized in that: In step S5, the semantic embedding vector of the application questions with similar purpose is obtained And similar purpose word problems equation expression global eigenvector The specific process is: The first The semantic embedding vectors of the candidate math word problems and the semantic embedding vectors of the math word problems to be solved They are input into the text feature extractor respectively, and the Semantic features of candidate mathematical word problems and semantic features of mathematical word problems to be solved ,in, The calculation process is expressed as: ; ; ; In the formula, ReLU activation function. , Respectively The weight matrix and bias term of the convolution kernel; Represents the maximum pooling operation; Indicates The pooling result of convolution kernels; Represents matrix concatenation; express Strategy; Represents the characteristic matrix obtained by randomly setting zeros with a certain probability; and Represent the weight matrix and bias term of the fully connected layer respectively; No. Semantic features of candidate mathematical word problems Adopt and Calculated in the same way; Will and After performing the vector inner product and normalizing, we can get the similarity probability between the mathematical word problem to be solved and the candidate mathematical word problem. , and then sort them according to the similarity probability , from the semantic embedding vector set of candidate mathematical word problems and the global eigenvector set of candidate mathematical word problem equation expressions Get semantic embedding vectors of word problems with similar purposes and similar purpose word problems equation expression global eigenvector .
8. A unified method for solving mathematical word problems integrating structural information according to claim 7, characterized in that: The specific process of obtaining the deep feature representation in step S6 is as follows: Through the cross-attention module, the mathematical word problems to be solved are The global eigenvector of Semantic embedding vectors of word problems with similar purposes Fusion to obtain deep feature representation , the calculation process is expressed as: ; ; In the formula, , , Represent query vector, key vector and value vector respectively; Softmax is a normalized exponential function; for and The size of the second dimension of , , Represents the query vector of the self-attention mechanism , key vector Sum value vector The projection parameter matrix of , ,in, is the learnable parameter matrix of the linear layer in the cross-attention mechanism; express The transpose of represents the cross attention mechanism; In step S6, the deep feature representation is combined with the global feature vector of the expression of the word problem equation of similar purpose After cascading, the gate control module is input to obtain the specific process of the initial node: The deep features are represented by the gating mechanism, i.e., the gating module. and Fusion, get the initial node , expressed as: ; ; ; In the formula, represents the candidate value of the initial hidden state; is the hyperbolic tangent activation function; is the gating signal; is the Sigmoid activation function; , They are all weight matrices of the gating modules; , are the bias items of the gating module; , express and The concatenated vector.
9. A unified method for solving mathematical word problems integrating structural information according to claim 8, characterized in that: The specific process of step S7 is: Will Input tree decoder, through top-down tree structure decoding and bottom-up subtree semantic transformation, using the semantic information of generated symbols to determine the generated symbols; specifically: Word embedding definition: Mathematical word problems to be solved Target vocabulary It consists of 4 parts: mathematical operators , unknown ,constant , as well as in the mathematical word problems to be solved Numbers in , for the target vocabulary Each token in Embed It is expressed as: ; In the formula, , , , They represent the mapping function for embedding mathematical operators, the mapping function for embedding unknown numbers, the mapping function for embedding constants, and the mapping function for embedding mathematical word problems to be solved. A function that embeds local information of numbers in the context of Node status update: In the process of generating symbols, the tree decoder is structurally adjusted, which is expressed as: ; In the formula, Indicates The state vector of each tree node; Indicates The node state vector after the tree node is updated; Indicates The symbol generated by each tree node; It is The embedding representation of the symbol generated by each tree node; Represents the semantic representation of the left subtree in the tree structure; , They represent the state update function of the left part of the subtree nodes in the tree structure and the state update function of the right part of the subtree nodes in the tree structure respectively; Negative log-likelihood loss: by calculating the equation expression of the mathematical word problem to be solved Middle The symbols in the positions of the given mathematical word problems to be solved The conditional probability under , and then the loss of the mathematical word problem analogy solver is obtained by minimizing the negative log-likelihood loss function It is expressed as; ; ; In the formula, is the equation expression of the mathematical word problem to be solved Total length; Indicates The tree node generates The symbol of the position The scoring function of Indicates The tree node generates The symbol of the position The scoring function of and Respectively represent The target vector of the tree node and the The context vector of each tree node.
10. A unified method for solving mathematical word problems integrating structural information according to claim 9, characterized in that: The specific process of constructing the dataset is as follows: 16,112 elementary school math word problems were collected from math test papers and learning websites. The collected math word problems included simple arithmetic problems and equation word problems. Preprocess the collected mathematical word problems: (1) Eliminate repeated math word problems; (2) Use the mathematics knowledge point dictionary to automatically annotate mathematics word problems, and use a semi-manual method to annotate the knowledge points for each mathematics word problem; the mathematics knowledge point dictionary is constructed based on the People's Education Press textbook; (3) Perform label consistency check on the results of knowledge point annotation, that is, perform similarity calculation on the results of the same knowledge point annotation, and select the results of knowledge point annotation with high similarity; Finally, the preprocessed math word problems were manually checked and corrected, and 15,000 math word problems were retained to form the data set.
Citation Information
Patent Citations
Mathematical question answering method and device
CN109961146A
Intelligent question solving method and system for arithmetic application questions
CN112860856A
Automatic answering method, automatic answering device, electronic equipment and storage device
CN115544051A
Mathematical application problem solving system and method based on BERT coding
CN116306940A
Method for improving automatic solving accuracy of mathematical application questions and automatic solving device for mathematical application questions
CN118014088A
