A Method for Extracting Junior High School Mathematics Knowledge Point Relationships Based on Knowledge Graphs

By introducing knowledge graphs and local entity semantic fusion modules in relation extraction, combining equalization relationship fusion devices and bidirectional long and short-term memory networks, the shortcomings of existing methods in the expression of semantic information of entity and relationship types are solved, and the accuracy and effect of relationship extraction are significantly improved.

CN118709773BActive Publication Date: 2025-06-10JIANGXI NORMAL UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411217878.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-02
Publication Date
2025-06-10
Estimated Expiration
2044-09-02

AI Technical Summary

Technical Problem

When fusion of entity information, existing relationship extraction methods only rely on the semantic information of the sentence, ignoring the information of the entity itself, resulting in limited entity expression; at the same time, semantic information of relationship types is often ignored, making it difficult to capture long-distance dependencies.

Method used

Using a knowledge graph-based method, the eigenvectors of head and tail entities are trained through relational triplets, combined with local entity semantic fusion modules and equalization relationship fusion devices, enhance the feature representation of entities and relationships, and capture bidirectional semantic dependencies through bidirectional long and short-term memory networks.

Benefits of technology

It effectively enhances the ability to express entities and relationships, improves the accuracy and reliability of relationship extraction, and performs excellently in capturing long-distance dependencies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118709773B_ABST
    Figure CN118709773B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for extracting junior high school mathematics knowledge point relationships based on a knowledge graph, which includes the following steps: constructing a data set for preprocessing to obtain sentence text data, inputting the sentence text data into a pre-trained language module for processing to obtain text semantic feature encoding vectors, inputting the data set into a pre-trained language module based on knowledge representation learning to obtain entity feature encoding vectors and a set of relationship type feature encoding vectors, inputting the text semantic feature encoding vectors, entity feature encoding vectors and the set of relationship type feature encoding vectors into a local entity semantic fusion module to obtain relationship-semantic feature encoding vectors, and inputting the relationship-semantic feature encoding vectors into a classifier module for prediction. By fully fusing the set of relationship type feature encoding vectors, sentence text data and entity feature encoding vectors, this method improves the accuracy of the relationship extraction effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of artificial intelligence algorithms, and specifically to a method for extracting junior high school mathematics knowledge point relationships based on a knowledge graph. Background Art

[0002] As a basic information extraction task, relation extraction is widely used in downstream tasks. The purpose is to identify the relationship between a given pair of entities in the text and classify it into a predefined relationship category, such as dependency relationship, synonym relationship, equivalence relationship, etc.

[0003] Recently, researchers have achieved excellent performance based on deep learning methods, which rely on a large amount of labeled training data. However, a large amount of annotation data requires a lot of time and is labor-intensive. In addition, in some specific fields, specific domain knowledge is required, which is quite expensive. Therefore, in recent years, relation extraction under limited resources has attracted extensive attention from scholars.

[0004] Currently, researchers have proposed many methods to solve the relation extraction problem. The mainstream of the research is based on the semantic features of sentences. For example, in the segmented convolutional neural network model, the encoded vector of the sentence is fed into the convolutional neural network to extract the semantic features of the context. The local semantic features within the sliding window are aggregated through convolutional operations, and then the sentence is divided into three segments according to the positions of the entities for pooling operations. Finally, all the semantic information is integrated. On this basis, some researchers have proposed to rely on a multi-reference graph between sentences for relation extraction. The establishment of the reference graph depends on its named entity recognition tags and semantic similarity to capture the joint relationships in the data. Different from this method that uses feature information, the fine-tuning method is to make some modifications to the original model according to the input of the downstream specific task so that its final output is what is required in the current task. With the continuous development of large models, some researchers have also used gold-standard induced reasoning to provide more evidence information to align the input entities and tags.

[0005] Despite the great progress in this field, the current methods still face two huge challenges. First, as the most important information source for relation extraction, entities only rely on the semantic information of sentences for fusion when fusing entity information, ignoring the information that entities themselves can provide, which limits the expression of entities. Second, as the specific basis for relation classification, the semantic information contained in relation types is often ignored.

[0006] To solve this problem, instead of simply using the pre-trained language module BERT to encode the semantics, entities, and relationship types of sentences, we utilize the relationships that the head and tail entities have on the hyperplane during the training of relation triples, along with the relation feature vectors and entity feature vectors. The feature vectors obtained by this method can represent the entity structured semantic information in the knowledge base, providing the model with more relational feature information. During the entity enhancement stage, a local attention mechanism is used with the entity and the sentence to obtain enhanced entity feature vectors, which not only better represent the semantics of the sentence but also enrich the representation of entities in the knowledge base on the original basis. During the relation fusion process, due to the excessive number and long semantic relationships of relation types, it is difficult for the model to capture long-distance dependencies. Therefore, we designed an equilibrium relation fusion module, which cascades the relation types on both sides of the sentence containing the entity, enabling it to better encode the relation types and capture the bidirectional semantic dependencies during the forward and backward processes. Summary of the Invention

[0007] Aiming at the deficiencies of the prior art, the present invention provides a method for extracting junior high school mathematics knowledge point relationships based on a knowledge graph, aiming to solve the problem that entities, as the most important information source for relation extraction, rely only on the semantic information of sentences for fusion when fusing entity information, ignoring the information that entities themselves can provide and restricting the expression of entities.

[0008] To achieve the above object, the present invention provides the following technical solutions: A method for extracting junior high school mathematics knowledge point relationships based on a knowledge graph, comprising the following steps:

[0009] Step S1: Construct a data set, which includes several sentence text data, and annotate the sentence text data in the data set;

[0010] Step S2: Construct an extraction model, which includes a pre-trained language module BERT, a pre-trained language module based on knowledge representation learning, a local entity semantic fusion module, an equilibrium relation fusion module, and a classifier module;

[0011] Step S3: Input the sentence text data into the pre-trained language module BERT for processing to obtain a text semantic feature encoding vector; use the data set as the input of the pre-trained language module based on knowledge representation learning to obtain an entity feature encoding vector and a set of relation type feature encoding vectors;

[0012] Step S4: Input the text semantic feature encoding vector and the entity feature encoding vector in Step S3 into the local entity semantic fusion module for fusion to obtain an enhanced head entity feature vector and an enhanced entity semantic vector respectively;

[0013] Step S5: Input the text semantic feature encoding vector and the set of relationship type feature encoding vectors in Step S3, and the enhanced head entity feature vector and the enhanced entity semantic vector in Step S4 into the balanced relationship fusion module to obtain the relationship-semantic feature encoding vector;

[0014] Step S6: Input the relationship-semantic feature encoding vector in Step S5 into the classifier module for prediction.

[0015] Furthermore, in Step S1, the sentence text data in the dataset is annotated, and the specific process is as follows:

[0016] Construct a middle school mathematics knowledge point dataset, which includes an entity set and a relationship type set;

[0017] Among them, the middle school mathematics knowledge point dataset includes several sentence text data X, and the sentence text data X contains: a head entity, a tail entity, and the relationship between the two entities;

[0018] The sentence text data X is expressed as:

[0019] (1);

[0020] In the formula, X represents the sentence text data; represents the (i + 1)-th character in the sentence text data X; represents the i-th character in the sentence text data X, represents the (i + n)-th character in the sentence text data X; represents the (i + n + k)-th character in the sentence text data X; represents the (i + n + m)-th character in the sentence text data X. and respectively represent the start flag and end flag of the head entity; and respectively represent the spans of the head entity and the tail entity; and respectively represent the start flag and end flag of the tail entity.

[0021] Furthermore, in Step S3, the text semantic feature encoding vector is obtained, and the specific process is as follows:

[0022] Input the sentence text data X into the pre-trained language module BERT to obtain the text semantic feature encoding vector:

[0023] (2);

[0024] In the formula, represents the 1st character in the sentence text data X ; Indicates the th character in the sentence text data X ; Indicates the text semantic feature encoding vector.

[0025] Furthermore, the entity feature encoding vector and the set of relation type feature encoding vectors obtained in step S3 are as follows:

[0026] The entity set E = {e 1 , e 2 , …, e n, t 1 , t 2 , …, t n} and the relation type set L = {l 1 , l 2, …, l n} in the middle school mathematics knowledge point dataset are represented in the form of relation triples S = {(e, l, t)}. S, E, and L are used as the inputs of the pre-training language module for knowledge representation learning to obtain the entity feature encoding vector and the set of relation type feature encoding vectors, denoted as:

[0027] = MATH - ENITITY(S, E, L) (3);

[0028] r = { }= MATH - RELATION(S, E, L) (4);

[0029] In the formula, e represents the head entity; l represents the relation type; t represents the tail entity; represents the head entity feature encoding vector; represents the tail entity feature encoding vector; e 1 represents the first head entity in the entity set; e 2 represents the second head entity in the entity set; e n represents the nth head entity in the entity set; t 1 represents the first tail entity in the entity set; t 2 represents the second tail entity in the entity set; t n represents the nth tail entity in the entity set; l 1 represents the first relation type in the relation type set; l 2 represents the second relation type in the relation type set; l n represents the nth relation type in the relation type set; MATH - ENITITY represents the process of the entity feature encoding vector in the pre-training language module for knowledge representation learning; Indicates the A relational type feature encoding vector; Indicates the th relational type feature encoding vector in the set of relational type feature encoding vectors; Indicates the th relational type feature encoding vector; MATH-RELATION represents the process of the set of relational type feature encoding vectors in the pre-trained language module of knowledge representation learning.

[0030] Furthermore, in step S4, the head entity feature vector is enhanced, and the specific process is as follows:

[0031] Step S41, input the head entity feature encoding vector and the text semantic feature encoding vector H into the local entity semantic fusion module for fusion;

[0032] Step S42, in the local entity semantic fusion module, use the head entity feature encoding vector as the query vector, the text semantic feature encoding vector H as the key vector and value vector, and process the dot product result of the head entity feature encoding vector and the text semantic feature encoding vector H through an activation function to generate a head entity intermediate feature encoding vector S 1 ;

[0033] Step S43, use the activation function again to normalize each element in the head entity intermediate feature encoding vector S 1 , calculate the head entity attention weight 1 of each element in the head entity intermediate feature encoding vector S , multiply the calculated head entity attention weight by the key vector, perform weighted summation on the key vector, and obtain the enhanced head entity feature vector H E , expressed as:

[0034] S 1 = sigmoid( )(5);

[0035] (6);

[0036] H E = × H i (7);

[0037] In the formula, represents the exponential function; sigmoid represents the activation function; represents the i-th element of the intermediate feature encoding vector; H i represents the i-th text semantic feature encoding vector.

[0038] Furthermore, in step S4, enhancing the entity semantic vector, the specific process is as follows:

[0039] Step S44, input the tail entity feature encoding vector and the enhanced head entity feature vector H E into the local entity semantic fusion module for fusion;

[0040] Step S45, use the tail entity feature encoding vector as the query vector, the enhanced head entity feature vector H E as the key vector and value vector, and process the dot product result of the tail entity feature encoding vector and the enhanced head entity feature vector H E through an activation function to generate an intermediate tail entity feature encoding vector S 2 ;

[0041] Step S46, once again use the activation function to normalize each element in the intermediate tail entity feature encoding vector S 2 , calculate the attention weight of the tail entity for each element in the intermediate tail entity feature encoding vector S 2 , and multiply the calculated attention weight of the tail entity by the key vector, and perform weighted summation on the key vector to obtain the enhanced entity semantic vector H e , which is expressed as:

[0042] S 2 = sigmoid( ) (8);

[0043] (9);

[0044] H e = × H E (10);

[0045] In the formula, represents the i-th intermediate tail entity feature encoding vector.

[0046] Furthermore, in step S5, obtaining the relation-semantic feature encoding vector, the specific process is as follows:

[0047] Step S51, splice the text semantic feature encoding vector , the enhanced head entity feature vector H E and the enhanced entity semantic vector H e to obtain a composite semantic entity vector h ee , which is expressed as:

[0048] h ee = f(H; H E ; H e )(11);

[0049] In the formula, f represents the vector splicing operation;

[0050] Step S52: Decompose the set r of relationship type feature encoding vectors into two parts; the first part is r F 1-i = {r F 1 , r F 2 ,..., r F i} and the second part is r Y i-n = {r Y i , r Y i+1 ,..., r Y n};

[0051] Among them, r F 1-i represents the set of the first to the i-th relationship type feature encoding vectors in the first part; r F 1 represents the first relationship type feature encoding vector in the set of relationship type feature encoding vectors in the first part; r F 2 represents the second relationship type feature encoding vector in the set of relationship type feature encoding vectors in the first part; r F i represents the i-th relationship type feature encoding vector in the set of relationship type feature encoding vectors in the first part; r Y i-n represents the set of the i-th to the n-th relationship type feature encoding vectors in the second part; r Y i represents the i-th relationship type feature encoding vector in the set of relationship type feature encoding vectors in the second part; r Y i+1 represents the (i + 1)-th relationship type feature encoding vector in the set of relationship type feature encoding vectors in the second part; r Y n represents the n-th relationship type feature encoding vector in the set of relationship type feature encoding vectors in the second part;

[0052] Step S53: The set r of the first to the i-th relationship type feature encoding vectors in the first part F 1-i , the composite semantic entity vector hee and the set of relationship type feature encoding vectors r of the i-th to the n-th in the second part Y i-n Perform a concatenation operation, denoted as;

[0053] H reer =concat(r F 1-i ; h ee ; r Y i-n )={J 1 , J 2 ,..., J m} (12);

[0054] In the formula, H reer represents the composite semantic feature vector after the concatenation operation; concat represents the concatenation operation; J 1 represents the first element in the concatenated sequence; J 2 represents the second element in the concatenated sequence; J m represents the m-th element in the concatenated sequence;

[0055] Step S54, input the composite semantic feature vector H reer after the concatenation operation into a bidirectional long short-term memory network. Among them, the equilibrium relationship fusion module includes a bidirectional long short-term memory network. The bidirectional long short-term memory network is divided into a forward output and a backward output. The hidden states H f reer and H b reer at the last time step T of the forward long short-term memory network and the backward long short-term memory network are concatenated, denoted as:

[0056] H er =[H f reer ; H b reer (13);

[0057] In the formula, H er represents the relationship-semantic feature encoding vector; H f reer represents the hidden state of the forward output bidirectional long short-term memory network at time T; H b reer represents the hidden state of the backward output bidirectional long short-term memory network at time T.

[0058] Furthermore, the forward output in step S54 is denoted as:

[0059] (14);

[0060] (15);

[0061] (16);

[0062] (17);

[0063] = + (18);

[0064] = (19);

[0065] H f reer = (20);

[0066] In the formula, represents the value of the forward process input gate; represents the input weight matrix of the forward input gate; represents the feature vector encoding of the input at forward time t; represents the recurrent weight matrix of the forward input gate; represents the forward time -1 output of the hidden layer state; represents the bias term of the forward input gate; represents the value of the forward forget gate output; represents the input weight matrix of the forward forget gate; represents the recurrent weight matrix of the forward forget gate; represents the bias term of the forward forget gate; represents the value of the forward output gate; represents the input weight matrix of the forward output gate; represents the recurrent weight matrix of the forward output gate; represents the bias term of the forward output gate; represents the forward candidate hidden state; represents the activation function; represents the weight matrix for forward controlling the influence of the current input on the candidate cell state; represents the recurrent weight matrix for forward controlling the influence of the previous hidden state on the candidate cell; represents the bias term of the forward candidate cell state; represents the forward cell state at time t; represents the forward cell state at time t - 1; represents the forward hidden state at time t; represents the value of the output gate at the last forward time step T; represents the cell state at the last forward time step T.

[0067] Furthermore, the backward output in step S54 is expressed as:

[0068] (21);

[0069] (22);

[0070] (23);

[0071] (24);

[0072] = + (25);

[0073] = (26);

[0074] H b reer = (27);

[0075] In the formula, represents the value of the input gate in the backward process; represents the backward time encoding of the input feature vector; represents the output of the hidden layer state at the backward time +1; represents the bias term of the backward input gate; represents the value of the output of the backward forget gate; represents the bias term of the backward forget gate; represents the value of the backward output gate; represents the bias term of the backward output gate; represents the backward candidate hidden state; represents the bias term of the backward candidate hidden state; represents the cell state at the backward process time step t; represents the backward cell state at time +1; represents the value of the backward input gate; represents the backward hidden state at time; represents the value of the output gate at the last backward time step T; represents the cell state at the last backward time step T.

[0076] Further, in step S6, the relationship-semantic feature encoding vector in step S5 is input into the classifier module for prediction. The specific process is as follows:

[0077] Input the relationship-semantic feature encoding vector H er into a multi-layer perceptron to obtain the output of the multi-layer perceptron. The classifier module includes a multi-layer perceptron. The output of the multi-layer perceptron is normalized through an activation function to generate a probability distribution, realizing the prediction of the relationship type in the sentence text data. When predicting the relationship type, a cross-entropy loss function is used for training, expressed as;

[0078] (28);

[0079] h' = MLP(H er ) (29);

[0080] y' = softmax(wh' + b) (30);

[0081] In the formula, represents the total cross-entropy loss function; represents the true category; represents the loss value of each sample in the cross-entropy loss function; y' represents the predicted relationship category; w and b represent the weight matrix and bias, h' represents the representation of the sentence text data obtained through the multi-layer perceptron; MLP represents the multi-layer perceptron; softmax represents the activation function.

[0082] Compared with the existing technologies, the present invention has the following beneficial effects: (1) The present invention can fully consider the relevance between the head entity and the tail entity, as well as between the head entity, the relationship type, and the tail entity. The full utilization of the head entity, the tail entity, and the relationship type makes the extraction result more accurate and reliable.

[0083] (2) The present method proposes a local entity semantic fusion module, which not only considers the importance of the head entity in the sentence text data, but also considers that the sentence text data provides important support and help for judging the relationship type between the head entity and the tail entity.

[0084] (3) By fully fusing the relationship type feature encoding vector set with the sentence text data, the head entity feature encoding vector, and the tail entity feature encoding vector, the present method enhances the internal connection between the entity and the relationship, and improves the accuracy of the relationship extraction effect.

[0085] (4) The present invention can effectively extract the relationship information between the middle school mathematics knowledge point datasets, providing strong technical support to help students and teachers understand the dependencies, attributes, and other relationships between knowledge points while understanding the knowledge points, and comprehensively master and understand the knowledge points. BRIEF DESCRIPTION OF THE DRAWINGS

[0086] Figure 1 It is a flowchart of the present invention.

[0087] Figure 2 It is a flowchart of the local entity semantic fusion module of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0088] The present invention will be further described in detail below in conjunction with the embodiments and the drawings.

[0089] As Figure 1 shown, a junior high school mathematics knowledge point relationship extraction method based on a knowledge graph includes the following steps:

[0090] Step S1: Construct a dataset, which includes several sentence text data, and annotate the sentence text data in the dataset;

[0091] Step S2: Construct an extraction model, which includes a pre-trained language module BERT, a pre-trained language module based on knowledge representation learning, a local entity semantic fusion module, an equilibrium relationship fusion module, and a classifier module;

[0092] Step S3: Input the sentence text data into the pre-trained language module BERT for processing to obtain a text semantic feature encoding vector; use the dataset as the input of the pre-trained language module based on knowledge representation learning to obtain an entity feature encoding vector and a set of relationship type feature encoding vectors;

[0093] Step S4: Input the text semantic feature encoding vector and the entity feature encoding vector in Step S3 into the local entity semantic fusion module for fusion to obtain an enhanced head entity feature vector and an enhanced entity semantic vector respectively;

[0094] Step S5: Input the text semantic feature encoding vector and the set of relationship type feature encoding vectors in Step S3, and the enhanced head entity feature vector and the enhanced entity semantic vector in Step S4 into the equilibrium relationship fusion module to obtain a relationship-semantic feature encoding vector;

[0095] Step S6: Input the relationship-semantic feature encoding vector in Step S5 into the classifier module for prediction.

[0096] Among them, in Step S1, when annotating the sentence text data in the dataset, the specific process is as follows:

[0097] The relevant texts containing knowledge points of middle school mathematics from sources such as Baidu Encyclopedia and People's Education Edition textbooks were collected through web crawler technology to construct a knowledge point dataset for middle school mathematics. The knowledge point dataset for middle school mathematics includes an entity set and a relationship type set;

[0098] Among them, the knowledge point dataset for middle school mathematics includes several sentence text data X, and the sentence text data X contains: head entity, tail entity, and the relationship between the two entities;

[0099] The sentence text data X is expressed as:

[0100] (1);

[0101] In the formula, X represents the sentence text data; represents the (i + 1)-th character in the sentence text data X; represents the i-th character in the sentence text data X, represents the (i + n)-th character in the sentence text data X; represents the (i + n + k)-th character in the sentence text data X; represents the (i + n + m)-th character in the sentence text data X. and respectively represent the start flag and end flag of the head entity; and respectively represent the spans of the head entity and the tail entity; and respectively represent the start flag and end flag of the tail entity.

[0102] Among them, in step S3, the text semantic feature encoding vector is obtained, and the specific process is as follows:

[0103] The sentence text data X is input into the pre-trained language module BERT to obtain the text semantic feature encoding vector:

[0104] (2);

[0105] In the formula, represents the 1st character in the sentence text data X ; represents the -th character in the sentence text data X ; represents the text semantic feature encoding vector.

[0106] Among them, in step S3, the entity feature encoding vector and the relationship type feature encoding vector set are obtained, and the specific process is as follows:

[0107] The entity set E = {e in the knowledge point dataset for middle school mathematics1 , e 2 , …, e n, t 1 , t 2 , …, t n}, and the set of relation types \(L = \{l 1 , l 2, …, l n \}\) are represented in the form of relation triples \(S=\{(e, l, t)\}\). Taking \(S\), \(E\), and \(L\) as the input of the pre-training language module for knowledge representation learning, the entity feature encoding vector and the set of relation type feature encoding vectors are obtained, denoted as:

[0108] =\(MATH - ENITITY(S, E, L)\) (3);

[0109] \(r = { \}=MATH - RELATION(S, E, L)\) (4);

[0110] In the formula, \(e\) represents the head entity; \(l\) represents the relation type; \(t\) represents the tail entity; represents the head entity feature encoding vector; represents the tail entity feature encoding vector; \(e 1 represents the first head entity in the entity set; \(e 2 represents the second head entity in the entity set; \(e n represents the \(n\)th head entity in the entity set; \(t 1 represents the first tail entity in the entity set; \(t 2 represents the second tail entity in the entity set; \(t n represents the \(n\)th tail entity in the entity set; \(l 1 represents the first relation type in the relation type set; \(l 2 represents the second relation type in the relation type set; \(l n represents the \(n\)th relation type in the relation type set; \(MATH - ENITITY\) represents the process of the entity feature encoding vector in the pre-training language module for knowledge representation learning; represents the th relation type feature encoding vector in the set of relation type feature encoding vectors; represents the th relation type feature encoding vector in the set of relation type feature encoding vectors; represents the th relation type feature encoding vector in the set of relation type feature encoding vectors; \(MATH - RELATION\) represents the process of the set of relation type feature encoding vectors in the pre-training language module for knowledge representation learning.

[0111] Among them, in step S4, enhancing the head entity feature vector, the specific process is as follows:

[0112] Step S41, input the head entity feature encoding vector and the text semantic feature encoding vector H into the local entity semantic fusion module for fusion;

[0113] Step S42, in the local entity semantic fusion module, use the head entity feature encoding vector as the query vector, the text semantic feature encoding vector H as the key vector and value vector, and process the dot product result of the head entity feature encoding vector and the text semantic feature encoding vector H through the activation function to generate a head entity intermediate feature encoding vector S 1 ;

[0114] Step S43, use the activation function again to normalize each element in the head entity intermediate feature encoding vector S 1 to calculate the head entity attention weight of each element in the head entity intermediate feature encoding vector S 1 , multiply the calculated head entity attention weight by the key vector, perform weighted summation on the key vector, and obtain the enhanced head entity feature vector H , expressed as: E S

[0115] = sigmoid( 1 ) (5); ) (5);

[0116] (6);

[0117] H E = ×H i (7);

[0118] In the formula, represents the exponential function; sigmoid represents the activation function; represents the i-th element of the intermediate feature encoding vector; H i represents the i-th text semantic feature encoding vector.

[0119] Among them, in step S4, enhancing the entity semantic vector, the specific process is as follows:

[0120] Step S44, input the tail entity feature encoding vector and the enhanced head entity feature vector H E into the local entity semantic fusion module for fusion;

[0121] Step S45, the tail entity feature encoding vector As a query vector, enhance the head entity feature vector H E As key vectors and value vectors, process the dot product result of the tail entity feature encoding vector and the enhanced head entity feature vector H E through an activation function to generate an intermediate feature encoding vector S of the tail entity 2 ;

[0122] Step S46, once again use the activation function to normalize each element in the intermediate feature encoding vector S of the tail entity 2 and calculate the attention weights of the tail entity for each element in the intermediate feature encoding vector S of the tail entity 2 ; multiply the obtained attention weights of the tail entity by the key vectors, perform weighted summation on the key vectors, and obtain the enhanced entity semantic vector H , expressed as: e ;

[0123] S 2 = sigmoid( )(8);

[0124] (9);

[0125] H e = × H E (10);

[0126] In the formula, represents the i-th intermediate feature encoding vector of the tail entity.

[0127] Among them, the relationship-semantic feature encoding vector obtained in step S5 is specifically as follows:

[0128] Step S51, splice the text semantic feature encoding vector , the enhanced head entity feature vector H E and the enhanced entity semantic vector H e to obtain a composite semantic entity vector h ee , expressed as:

[0129] h ee = f(H; H E ; H e )(11);

[0130] In the formula, f represents the vector splicing operation;

[0131] Step S52, decompose the set r of relationship type feature encoding vectors into two parts; the first part is r F 1-i = {rF 1 , r F 2 ,..., r F i}, and the second part is r Y i-n = {r Y i , r Y i+1 ,..., r Y n};

[0132] Among them, r F 1-i represents the set of the first to the i-th relationship type feature coding vectors of the first part; r F 1 represents the first relationship type feature coding vector in the set of relationship type feature coding vectors of the first part; r F 2 represents the second relationship type feature coding vector in the set of relationship type feature coding vectors of the first part; r F i represents the i-th relationship type feature coding vector in the set of relationship type feature coding vectors of the first part; r Y i-n represents the set of the i-th to the n-th relationship type feature coding vectors of the second part; r Y i represents the i-th relationship type feature coding vector in the set of relationship type feature coding vectors of the second part; r Y i+1 represents the (i + 1)-th relationship type feature coding vector in the set of relationship type feature coding vectors of the second part; r Y n represents the n-th relationship type feature coding vector in the set of relationship type feature coding vectors of the second part;

[0133] Step S53, cascade the set of the first to the i-th relationship type feature coding vectors r F 1-i , the composite semantic entity vector h ee , and the set of the i-th to the n-th relationship type feature coding vectors r Y i-n , which is expressed as;

[0134] H reer = concat(r F 1-i ; h ee ; r Y i-n ) = {J1 , J 2 ,..., J m} (12);

[0135] Wherein, H reer represents the composite semantic feature vector after the concatenation operation; concat represents the concatenation operation; J 1 represents the first element in the concatenated sequence; J 2 represents the second element in the concatenated sequence; J m represents the m-th element in the concatenated sequence;

[0136] Step S54, input the composite semantic feature vector H reer after the concatenation operation into a bidirectional long short-term memory network. Among them, the equilibrium relationship fusion module includes a bidirectional long short-term memory network. The bidirectional long short-term memory network is divided into a forward output and a backward output. The hidden states H f reer and H b reer at the last time step T of the forward long short-term memory network and the backward long short-term memory network are concatenated, expressed as:

[0137] H er =[H f reer ; H b reer (13);

[0138] Wherein, H er represents the relationship-semantic feature encoding vector; H f reer represents the hidden state of the forward output bidirectional long short-term memory network at time step T; H b reer represents the hidden state of the backward output bidirectional long short-term memory network at time step T.

[0139] Among them, the forward output in step S54 is expressed as:

[0140] (14);

[0141] (15);

[0142] (16);

[0143] (17);

[0144] = + (18);

[0145] = (19);

[0146] H f reer = (20);

[0147] In the formula, represents the value of the forward process input gate; represents the input weight matrix of the forward input gate; represents the feature vector encoding of the input at the forward time t; represents the recurrent weight matrix of the forward input gate; represents the forward time -1 output of the hidden layer state; represents the bias term of the forward input gate; represents the value of the forward forget gate output; represents the input weight matrix of the forward forget gate; represents the recurrent weight matrix of the forward forget gate; represents the bias term of the forward forget gate; represents the value of the forward output gate; represents the input weight matrix of the forward output gate; represents the recurrent weight matrix of the forward output gate; represents the bias term of the forward output gate; represents the forward candidate hidden state; represents the activation function; represents the weight matrix for the forward control of the influence of the current input on the candidate cell state; represents the recurrent weight matrix for the forward control of the influence of the previous hidden state on the candidate cell; represents the bias term of the forward candidate cell state; represents the forward cell state at time t; represents the forward cell state at time t-1; represents the forward hidden state at time t; represents the value of the output gate at the forward last time step T; represents the forward cell state at the last time step T.

[0148] Among them, the backward output in step S54 is expressed as:

[0149] (21);

[0150] (22);

[0151] (23);

[0152] (24);

[0153] = + (25);

[0154] = (26);

[0155] H b reer = (27);

[0156] Wherein, represents the value of the backward process input gate; represents the backward time the input feature vector encoding; represents the backward time the output of the hidden layer state at +1; represents the bias term of the backward input gate; represents the value of the backward forget gate output; represents the bias term of the backward forget gate; represents the value of the backward output gate; represents the bias term of the backward output gate; represents the backward candidate hidden state; represents the bias term of the backward candidate hidden state; represents the cell state at the backward process time t; represents the backward the cell state at +1; represents the value of the backward input gate; represents the backward the hidden state at the time; represents the value of the output gate at the backward last time step T; represents the cell state at the backward last time step T.

[0157] Among them, in step S6, the relationship-semantic feature encoding vector in step S5 is input into the classifier module for prediction. The specific process is as follows:

[0158] The relationship-semantic feature encoding vector H erInput into the multi-layer perceptron to obtain the output of the multi-layer perceptron. The classifier module includes a multi-layer perceptron. The output of the multi-layer perceptron is normalized through an activation function to generate a probability distribution, realizing the prediction of the relationship type in the sentence text data. When predicting the relationship type, the cross-entropy loss function is used for training, expressed as;

[0159] (28);

[0160] h' = MLP(H er )(29);

[0161] y' = softmax(wh' + b)(30);

[0162] In the formula, represents the total cross-entropy loss function; represents the true category; represents the loss value of each sample in the cross-entropy loss function; y' represents the predicted relationship category; w and b represent the weight matrix and bias, h' represents the representation of the sentence text data obtained through the multi-layer perceptron; MLP represents the multi-layer perceptron; softmax represents the activation function.

[0163] The junior high school mathematics knowledge point relationship extraction system based on the knowledge graph includes:

[0164] Annotation module: used to construct a data set, the data set includes several sentence text data, and annotate the sentence text data in the data set;

[0165] Construction module: used to construct an extraction model, the extraction model includes a pre-trained language module BERT, a pre-trained language module based on knowledge representation learning, a local entity semantic fusion module, an equilibrium relationship fusion module and a classifier module;

[0166] Training module: used to input the sentence text data into the pre-trained language module BERT for processing to obtain the text semantic feature encoding vector; use the data set as the input of the pre-trained language module based on knowledge representation learning to obtain the entity feature encoding vector and the relationship type feature encoding vector set;

[0167] Fusion module: used to input the text semantic feature encoding vector and the entity feature encoding vector into the local entity semantic fusion module for fusion to obtain the enhanced head entity feature vector and the enhanced entity semantic vector respectively;

[0168] Feature fusion module: used to input the text semantic feature encoding vector, the relationship type feature encoding vector set, the enhanced head entity feature vector and the enhanced entity semantic vector into the equilibrium relationship fusion module to obtain the relationship-semantic feature encoding vector;

[0169] Prediction module: used to input the relationship-semantic feature encoding vector into the classifier module for prediction.

[0170] Although the embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for extracting relationships between junior high school mathematics knowledge points based on knowledge graph, characterized in that: The steps include: Step S1: construct a data set, the data set includes a number of sentence text data, and annotate the sentence text data in the data set; In step S1, the sentence text data in the data set is annotated. The specific process is as follows: Construct a data set of middle school mathematics knowledge points, which includes entity sets and relationship type sets; Among them, the middle school mathematics knowledge point dataset includes a number of sentence text data X, and the sentence text data X contains: a head entity, a tail entity, and the relationship between two entities; The sentence text data X is represented as: (1); In the formula, X represents sentence text data; Represents the i+1th character in the sentence text data X; represents the i-th character in the sentence text data X, Represents the i+nth character in the sentence text data X; represents the i+n+kth character in the sentence text data X; Represents the i+n+mth character in the sentence text data X; and Respectively represent the start and end marks of the header entity; and Represent the span of the head entity and the tail entity respectively; and Respectively represent the start and end marks of the tail entity; Step S2: constructing an extraction model, the extraction model includes a pre-trained language module BERT, a pre-trained language module based on knowledge representation learning, a pre-local entity semantic fusion module, a balanced relationship fusion module and a classifier module; Step S3: Input the sentence text data into the pre-trained language module BERT for processing to obtain a text semantic feature encoding vector; use the data set as the input of the pre-trained language module based on knowledge representation learning to obtain an entity feature encoding vector and a relationship type feature encoding vector set; In step S3, the entity feature coding vector and the relationship type feature coding vector set are obtained. The specific process is as follows: The entity set E={e1,e2,…,e n, t1,t2,…,t n } and the set of relation types L = {l1,l 2, …,l n } is expressed in the form of a relation triple S = {(e, l, t)}, and S, E, and L are used as the input of the pre-trained language module based on knowledge representation learning to obtain the entity feature encoding vector and the relationship type feature encoding vector set, which are expressed as: =MATH-ENITITY(S,E,L)(3); r={ }=MATH-RELATION(S,E,L)(4); In the formula, e represents the head entity; l represents the relationship type; t represents the tail entity; Represents the head entity feature encoding vector; represents the tail entity feature encoding vector; e1 represents the first head entity in the entity set; e2 represents the second head entity in the entity set; e n represents the nth head entity in the entity set; t1 represents the first tail entity in the entity set; t2 represents the second tail entity in the entity set; t n represents the nth tail entity in the entity set; l1 represents the first relationship type in the relationship type set; l2 represents the second relationship type in the relationship type set; l n Represents the nth relation type in the relation type set; MATH-ENITITY represents the process of entity feature encoding vector in the pre-trained language module of knowledge representation learning; Indicates the first in the set of feature encoding vectors of relationship type relation type feature encoding vector; Indicates the first in the set of feature encoding vectors of relationship type relation type feature encoding vector; Indicates the first in the set of feature encoding vectors of relationship type relation type feature encoding vectors; MATH-RELATION represents the process of relation type feature encoding vector set in the pre-trained language module of knowledge representation learning; Step S4: input the text semantic feature encoding vector and the entity feature encoding vector in step S3 into the pre-local entity semantic fusion module for fusion, and obtain an enhanced head entity feature vector and an enhanced entity semantic vector respectively; In step S4, the head entity feature vector is enhanced, and the specific process is as follows: Step S41: Encode the head entity feature vector And the text semantic feature encoding vector H is input into the pre-local entity semantic fusion module for fusion; Step S42: In the pre-local entity semantic fusion module, the head entity feature encoding vector As the query vector, the text semantic feature encoding vector H is used as the key vector and value vector, and the head entity feature encoding vector is activated by the activation function. The dot product result of the text semantic feature encoding vector H is processed to generate a head entity intermediate feature encoding vector S1; Step S43, the activation function is used again to normalize each element in the head entity intermediate feature encoding vector S1, and the head entity attention weight of each element in the head entity intermediate feature encoding vector S1 is calculated. , according to the calculated head entity attention weight Multiply it with the key vector and perform weighted summation on the key vector to obtain the enhanced head entity feature vector H E , expressed as: S1=sigmoid( )(5); (6); H E = ×H i (7); In the formula, represents the exponential function; sigmoid represents the activation function; represents the i-th element of the intermediate feature encoding vector; H i Represents the i-th text semantic feature encoding vector; In step S4, the entity semantic vector is enhanced, and the specific process is as follows: Step S44: Encode the tail entity feature vector and the enhanced head entity feature vector H E Input into the pre-local entity semantic fusion module for fusion; Step S45: Encode the tail entity feature vector As the query vector, the enhanced head entity feature vector H E As the key vector and value vector, the tail entity feature encoding vector is encoded by the activation function and the enhanced head entity feature vector H E The dot product result is processed to generate a tail entity intermediate feature encoding vector S2; Step S46, again use the activation function to normalize each element in the tail entity intermediate feature encoding vector S2, and calculate the tail entity attention weight of each element in the tail entity intermediate feature encoding vector S2 , according to the calculated tail entity attention weight Multiply it with the key vector and perform weighted summation on the key vector to obtain the enhanced entity semantic vector H e , expressed as: S2=sigmoid( )(8); (9); H e = ×H E (10); In the formula, Represents the intermediate feature encoding vector of the i-th tail entity; Step S5: input the text semantic feature coding vector and the relationship type feature coding vector set in step S3 and the enhanced head entity feature vector and the enhanced entity semantic vector in step S4 into the balanced relationship fusion module to obtain the relationship-semantic feature coding vector; In step S5, the relationship-semantic feature encoding vector is obtained, and the specific process is as follows: Step S51: Encode the text semantic feature vector , Enhanced head entity feature vector H E and the enhanced entity semantic vector H e Concatenate to get the composite semantic entity vector h ee , expressed as: h ee =f(H;H E ;H e )(11); In the formula, f represents the vector concatenation operation; Step S52, decompose the relationship type feature coding vector set r into two parts; the first part is r F 1-i ={r F 1,r F 2,...,r F i } and the second part is r Y i-n ={r Y i ,r Y i+1 ,...,r Y n }; Among them, r F 1-i Represents the set of feature encoding vectors of the first to the i-th relationship type in the first part; r F 1 represents the first relation type feature coding vector in the first part of the relation type feature coding vector set; r F 2 represents the second relation type feature coding vector in the first part of the relation type feature coding vector set; r F i represents the i-th relation type feature coding vector in the first part of the relation type feature coding vector set; r Y i-n Represents the set of feature encoding vectors of the relationship types from the ith to the nth in the second part; r Y i represents the i-th relation type feature coding vector in the second part of the relation type feature coding vector set; r Y i+1 represents the i+1th relation type feature coding vector in the second part of the relation type feature coding vector set; r Y n represents the nth relation type feature coding vector in the second part of the relation type feature coding vector set; Step S53: The first part of the first to the i-th relationship type feature coding vector set r F 1-i , composite semantic entity vector h ee And the second part is the set of feature encoding vectors r from the i-th to the n-th relationship type Y i-n Perform cascade operation, expressed as; H reer =concat(r F 1-i ;h ee ;r Y i-n )={J1, J2,..., J m }(12); In the formula, H reer represents the composite semantic feature vector after the cascade operation; concat represents the cascade operation; J1 represents the first element in the cascaded sequence; J2 represents the second element in the cascaded sequence; J m Represents the mth element in the concatenated sequence; Step S54: The composite semantic feature vector H after the cascade operation is reer Input into the bidirectional long short-term memory network, where the equilibrium relationship fusion module includes a bidirectional long short-term memory network, which is divided into a forward output and a backward output. The hidden state H of the last time step T of the forward long short-term memory network and the backward long short-term memory network f reer and H b reer The concatenation is expressed as: H er =[H f reer ;H b reer ](13); In the formula, H er Represents the relationship-semantic feature encoding vector; H f reer H represents the hidden state of the forward output bidirectional long short-term memory network at time T; b reer Represents the hidden state of the backward output bidirectional long short-term memory network at time T; Step S6: Input the relation-semantic feature encoding vector in step S5 into the classifier module for prediction.

2. According to claim 1, a method for extracting relationships between junior high school mathematics knowledge points based on knowledge graph, characterized in that: In step S3, the text semantic feature encoding vector is obtained, and the specific process is as follows: Input the sentence text data X into the pre-trained language model BERT to obtain the text semantic feature encoding vector: (2); In the formula, Represents the first character in the text semantic feature encoding vector ; Represents the first Characters ; Represents the text semantic feature encoding vector.

3. According to claim 2, a method for extracting relationships between junior high school mathematics knowledge points based on knowledge graphs is characterized by: The forward output in step S54 is expressed as: (14); (15); (16); (17); = + (18); = (19); H f reer = (20) In the formula, Represents the value of the input gate of the forward process; Represents the input weight matrix of the forward input gate; The feature vector encoding representing the input at forward time t; represents the recursive weight matrix of the forward input gate; Represents the forward moment The output of the hidden layer state is -1; represents the bias term of the forward input gate; Represents the value output by the forward forget gate; Represents the input weight matrix of the forward forget gate; represents the recursive weight matrix of the forward forget gate; Represents the bias term of the forward forget gate; Represents the value of the forward output gate; represents the input weight matrix of the forward output gate; represents the recursive weight matrix of the forward output gate; represents the bias term of the forward output gate; represents the hidden state of the forward candidate; represents the activation function; The weight matrix representing the forward control of the influence of the current input on the candidate cell state; Represents the recursive weight matrix that forward controls the impact of the previous hidden state on the candidate cells; A bias term representing the forward candidate cell state; represents the cell state at time t; represents the cell state at time t-1 forward; represents the hidden state at the forward time t; Represents the value of the output gate at the last forward time step T; Represents the cell state at the last forward time step T.

4. According to claim 3, a method for extracting relationships between junior high school mathematics knowledge points based on knowledge graphs is characterized by: The backward output in step S54 is expressed as: (21); (22); (23); (24); = + (25); = (26); H b reer = (27); In the formula, Represents the value of the input gate of the backward process; Represents backward time The input feature vector encoding; Represents backward time +1 is the output of the hidden layer state; Represents the bias term of the backward input gate; Represents the value output by the backward forget gate; Represents the bias term of the backward forget gate; Represents the value of the backward output gate; Represents the bias term of the backward output gate; Represents the hidden state of the backward candidate; A bias term representing the backward candidate hidden state; represents the cell state at time t in the backward process; Reverse +1 cell status at time; Represents the value of the backward input gate; Reverse The hidden state of the moment; Represents the value of the output gate at the last backward time step T; Represents the cell state at the last backward time step T.

5. According to claim 4, a method for extracting relationships between junior high school mathematics knowledge points based on knowledge graphs is characterized by: In step S6, the relation-semantic feature encoding vector in step S5 is input into the classifier module for prediction. The specific process is as follows: The relation-semantic feature encoding vector H er Input to the multi-layer perceptron to obtain the output of the multi-layer perceptron. The classifier module includes the multi-layer perceptron. The output of the multi-layer perceptron is normalized by the activation function to generate a probability distribution to predict the relationship type in the sentence text data. When predicting the relationship type, the cross entropy loss function is used for training, which is expressed as; (28); h'=MLP(H er )(29); y'=softmax(wh'+b)(30); In the formula, represents the total cross entropy loss function; represents the real category; represents the loss value of each sample in the cross entropy loss function; y' represents the predicted relationship category; w and b represent the weight matrix and bias, h' represents the representation of sentence text data obtained by the multi-layer perceptron; MLP represents the multi-layer perceptron; softmax represents the activation function.

Citation Information

Patent Citations

  • Text implicit sentiment analysis method combined with external knowledge

    CN113435211A