Knowledge graph-based junior high school mathematics knowledge point relation extraction method

By combining the knowledge graph and the local entity semantic fusion module in the relationship extraction, the problem in the existing technology that entity information fusion relies on insufficient semantic information and the relationship type semantics is difficult to capture is solved, and a more accurate and reliable relationship extraction effect is achieved.

CN118709773AActive Publication Date: 2024-09-27JIANGXI NORMAL UNIV

Patent Information

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

AI Technical Summary

Technical Problem

Existing relationship extraction methods only rely on the semantic information of sentences when merging entity information, ignoring the information of the entities themselves, limiting the expression of entities, and the semantic information of relationship types is difficult to capture long-distance dependencies.

Method used

Using a knowledge graph-based method, the pre-trained language module BERT, the local entity semantic fusion module and the balanced relationship fusion module combine entity features and relationship type features to enhance entity expression and capture bidirectional semantic dependencies.

Benefits of technology

It improves the accuracy and reliability of relationship extraction, makes full use of entity and relationship type information, and enhances the relationship extraction effect, especially in the application of middle school mathematics knowledge point data sets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118709773A
    Figure CN118709773A
Patent Text Reader

Abstract

The invention discloses a junior high school mathematics knowledge point relation extraction method based on a knowledge graph, which comprises the following steps of: constructing a data set for preprocessing to obtain sentence text data, inputting the sentence text data into a pre-training language module for processing to obtain a text semantic feature coding vector, and extracting the text semantic feature coding vector; inputting the data set into a pre-training language module based on knowledge representation learning to obtain an entity feature coding vector and relation type feature coding vector set, and inputting the text semantic feature coding vector and the entity feature coding vector and relation type feature coding vector set into a local entity semantic fusion module; and obtaining a relation-semantic feature coding vector, and inputting the relation-semantic feature coding vector into a classifier module for prediction. According to the method, the relation type feature coding vector set, the sentence text data and the entity feature coding vectors are fully fused, so that the accuracy of the relation extraction effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] As a basic information extraction task, relation extraction is widely used in downstream tasks. Its purpose is to identify the relationship between a given pair of entities in the text and classify them into pre-defined relationship categories, such as dependency relations, synonymous relations, equivalence relations, 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 annotated data is time-consuming and 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 widespread attention from scholars.

[0004] At present, researchers have proposed many methods to solve the problem of relationship extraction. The mainstream of the research is based on the semantic features of sentences, such as the segmented convolutional neural network model, which extracts the semantic features of the context by feeding the encoding vector of the sentence into the convolutional neural network, aggregates the local semantic features in the sliding window through convolution operations, and then divides the sentence into three segments according to the location of the entity for pooling operations, and finally integrates all the semantic information. On this basis, some researchers have proposed to rely on multiple reference graphs between sentences to extract relationships. The establishment of the reference graph relies on its named entity recognition label and semantic similarity to capture the joint relationship in the data. Different from this method based on fine-tuning that uses feature information, it makes some modifications to the original model based on the input of the downstream specific task so that its final output is what is needed in the current task. With the continuous development of large models, some researchers have used gold standard induced reasoning to provide more evidence information to align the input entities and labels.

[0005] Although great progress has been made in this field, current methods still face two major challenges. First, entities are the most important source of information for relation extraction. When fusing entity information, they only rely on the semantic information of the sentence, ignoring the information that the entity itself can provide, which limits the expression of the entity. Second, as the specific basis for relation classification, the semantic information contained in the relation type is often ignored.

[0006] In order to solve this problem, we do not simply use the pre-trained language module BERT to encode the semantics of sentences, entities, and types of relations, but use the relation triples to train the relationship between the head entity and the tail entity on the hyperplane, the relation feature vector and the entity feature vector. The feature vector obtained by this method can express the structured semantic information of the entity in the knowledge base, and bring more relation feature information representation to the model. In the stage of enhancing entities, the local attention mechanism is used for entities and sentences to obtain enhanced entity feature vectors, which not only better expresses the semantics of sentences, but also enriches the expression of entities in the knowledge base on the original basis. In the process of fusing relations, too many relation types and too long semantic relations make it difficult for the model to capture longer-distance dependencies, so we designed a balanced relation aggregator to cascade relation types on both sides of the sentence containing entities, so that it can better encode relation types and capture bidirectional semantic dependencies in the forward and backward process. Summary of the invention

[0007] In view of the shortcomings of the prior art, the present invention provides a method for extracting relationships between junior high school mathematics knowledge points based on knowledge graphs, which aims to solve the problem that entities are the most important information source for relationship extraction, but when fusing entity information, they only rely on the semantic information of sentences to perform fusion, ignoring the information that the entity itself can provide, thereby limiting the expression of the entity.

[0008] To achieve the above object, the present invention provides the following technical solution: a method for extracting relationships of junior high school mathematics knowledge points based on knowledge graph, comprising the following steps: 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; 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, 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; 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, and obtain an enhanced head entity feature vector and an enhanced entity semantic vector respectively; 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; Step S6: Input the relation-semantic feature encoding vector in step S5 into the classifier module for prediction.

[0009] Furthermore, in step S1, the sentence text data in the data set is annotated, and 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 They respectively represent the start and end marks of the tail entity.

[0010] Further, 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 module BERT to obtain the text semantic feature encoding vector: (2); In the formula, Represents the first character in the sentence text data X ; Represents the first Characters ; Represents the text semantic feature encoding vector.

[0011] Further, in step S3, the entity feature coding vector and the relationship type feature coding vector set are obtained, and the specific process is as follows: The entity set E={e1,e2,…,e n, t1,t2,…,tn} 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 collection in the pre-trained language module of knowledge representation learning.

[0012] Further, 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 local entity semantic fusion module for fusion; Step S42: In the 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.

[0013] Further, 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 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.

[0014] Further, 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; rY 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.

[0015] Further, 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.

[0016] Further, the backward output in step S54 is expressed as: (twenty one); (twenty two); (twenty three); (twenty four); = + (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.

[0017] Further, 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 erInput 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.

[0018] Compared with the existing technology, the present invention has the following beneficial effects: (1) The present invention can fully consider the association between the head entity and the tail entity, and 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.

[0019] (2) This method proposes a local entity semantic fusion module, which not only takes into account the importance of the head entity in the sentence text data, but also takes into account that the sentence text data provides important support and assistance for the judgment of the relationship type between the head entity and the tail entity.

[0020] (3) This method enhances the intrinsic connection between entities and relations and improves the accuracy of relation extraction by fully integrating the relation type feature coding vector set with sentence text data, head entity feature coding vector and tail entity feature coding vector.

[0021] (4) The present invention can effectively extract the relationship information between the data sets of middle school mathematics knowledge points, and provide powerful technical support to help students and teachers understand the relationships such as dependencies and attributes between knowledge points while understanding the knowledge points, so as to fully grasp and understand the knowledge points. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 It is a flow chart of the present invention.

[0023] Figure 2 This is a flow chart of the local entity semantic fusion module of the present invention. DETAILED DESCRIPTION

[0024] The present invention is further described in detail below with reference to implementation cases and accompanying drawings.

[0025] like Figure 1 As shown, a method for extracting relationships between junior high school mathematics knowledge points based on knowledge graphs includes the following steps: 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; 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, 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; 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, and obtain an enhanced head entity feature vector and an enhanced entity semantic vector respectively; 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; Step S6: Input the relation-semantic feature encoding vector in step S5 into the classifier module for prediction.

[0026] Among them, in step S1, the sentence text data in the data set is annotated, and the specific process is as follows: We collected relevant texts containing middle school mathematics knowledge points from Baidu Encyclopedia, People's Education Press textbooks, etc. through crawler technology to construct a middle school mathematics knowledge point dataset, which contains 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 They respectively represent the start and end marks of the tail entity.

[0027] Among them, the text semantic feature encoding vector is obtained in step S3, and the specific process is: Input the sentence text data X into the pre-trained language module BERT to obtain the text semantic feature encoding vector: (2); In the formula, Represents the first character in the sentence text data X ; Represents the first Characters ; Represents the text semantic feature encoding vector.

[0028] Among them, in step S3, the entity feature coding vector and the relationship type feature coding vector set are obtained, and the specific process is: 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 nrepresents 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 collection in the pre-trained language module of knowledge representation learning.

[0029] The specific process of enhancing the head entity feature vector in step S4 is as follows: Step S41: Encode the head entity feature vector And the text semantic feature encoding vector H is input into the local entity semantic fusion module for fusion; Step S42: In the 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.

[0030] The specific process of enhancing the entity semantic vector in step S4 is as follows: Step S44: Encode the tail entity feature vector and the enhanced head entity feature vector H E Input into the 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.

[0031] 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.

[0032] 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.

[0033] The backward output in step S54 is expressed as: (twenty one); (twenty two); (twenty three); (twenty four); = + (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.

[0034] 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: 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.

[0035] The junior high school mathematics knowledge point relationship extraction system based on knowledge graph includes: Annotation module: used to construct a data set, which includes a number of sentence text data, and annotate the sentence text data in the data set; Construction module: used to build the extraction model, which includes the pre-trained language module BERT, the pre-trained language module based on knowledge representation learning, the local entity semantic fusion module, the balanced relationship fusion module and the classifier module; Training module: used to input sentence text data into the pre-trained language module BERT for processing to obtain text semantic feature encoding vectors; use the data set as the input of the pre-trained language module based on knowledge representation learning to obtain entity feature encoding vectors and relationship type feature encoding vector sets; 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, and obtain the enhanced head entity feature vector and the enhanced entity semantic vector respectively; Feature fusion module: used to input the text semantic feature encoding vector and the relationship type feature encoding vector set, the enhanced head entity feature vector and the enhanced entity semantic vector into the balanced relationship fusion module to obtain the relationship-semantic feature encoding vector; Prediction module: used to input the relation-semantic feature encoding vector into the classifier module for prediction.

[0036] 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 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; 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, 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; 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, and obtain an enhanced head entity feature vector and an enhanced entity semantic vector respectively; 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; 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 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 They respectively represent the start and end marks of the tail entity.

3. According to claim 2, a method for extracting relationships between junior high school mathematics knowledge points based on knowledge graphs is characterized by: 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 module BERT to obtain the text semantic feature encoding vector: (2); In the formula, Represents the first character in the sentence text data X ; Represents the first Characters ; Represents the text semantic feature encoding vector.

4. According to claim 3, a method for extracting relationships between junior high school mathematics knowledge points based on knowledge graphs is characterized by: 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 collection in the pre-trained language module of knowledge representation learning.

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 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 local entity semantic fusion module for fusion; Step S42: In the 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.

6. According to claim 5, a method for extracting relationships between junior high school mathematics knowledge points based on knowledge graphs is characterized by: 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 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.

7. The method for extracting relationships between junior high school mathematics knowledge points based on knowledge graph according to claim 6 is characterized in that: 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 and 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.

8. The method for extracting relationships between junior high school mathematics knowledge points based on knowledge graph according to claim 7 is characterized in that: 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.

9. The method for extracting relationships between junior high school mathematics knowledge points based on knowledge graph according to claim 8 is characterized in that: 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 hidden layer state output; 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.

10. The method for extracting relationships between junior high school mathematics knowledge points based on knowledge graph according to claim 9, characterized in that: 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

  • Geographic information knowledge point extraction method and device, storage medium and computer equipment

    CN111488468A

  • Model fusion triad representation learning system and method based on deep learning

    CN111581395A

  • Accurate subsidy system based on student portraits under big data

    CN112241446A

  • Text implicit sentiment analysis method combined with external knowledge

    CN113435211A

  • BERT and knowledge embedding-based processing technology relation extraction method

    CN115455195A

Cited By

  • Long text relation determination method and device based on external knowledge base and electronic equipment

    CN119312807A

  • Language model construction method and device based on data enhancement, equipment and medium

    CN119760144A