Geological knowledge graph construction method and device, storage medium and equipment
The processing of geological text and relational labels through neural network classifiers and sparse marking rules solves the problem of triple overlap in geological knowledge graph construction, improves construction efficiency and information diversity, and reduces information redundancy.
Patent Information
- Application Number
- CN202411700303.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2024-12-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
There are problems of low efficiency and large information redundancy when building knowledge graphs in the geological field, especially triple overlapping problems, such as single entity overlap, entity pair overlapping and head and tail entity overlapping, resulting in low efficiency in knowledge graph construction and information redundancy. big.
Using neural network classifiers and preset marking rules, the sentences and relationship labels in geological text are encoded into embedded vectors, and the blank three-dimensional matrix is constructed for marking, and the best geological triples are filtered out using the filter classifier, and the best geological triples are selected and the Its input knowledge graph to build a database, and reduces search space and information redundancy through relation-specific marking schemes and sparse marking rules.
It improves the information diversity and construction efficiency of the knowledge graph, reduces time overhead, effectively solves the problem of triplet overlap, reduces information redundancy, and ensures the simplicity and effectiveness of decoding triplets.
Smart Images

Figure CN119180329A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method, device, storage medium and equipment for constructing a geological knowledge graph, and belongs to the technical field of knowledge graph construction. Background Art
[0002] With the development of the Internet, people can easily obtain a large amount of text information, but this information is often lengthy and complex, and requires a lot of time and effort to understand. Therefore, information extraction technology came into being, which can automatically extract key information from a large amount of text, among which entity relationship extraction is the top priority, and it is the key technology for building knowledge graphs.
[0003] Constructing a geological knowledge graph is of great significance for geological research and application. The geological knowledge graph can integrate geological knowledge scattered in different documents, databases and expert experience to form a systematic and structured knowledge base, which is conducive to knowledge sharing and transmission. Through the knowledge graph, complex knowledge reasoning and association analysis can be carried out to discover hidden geological laws and new knowledge points, and promote the research and innovation of geological science. The geological knowledge graph can assist in practical applications such as geological exploration, mineral resource assessment, and disaster prediction, and improve the scientificity and accuracy of decision-making. The geological knowledge graph can not only be used in geology, but also can be combined with fields such as environmental science and engineering to form an interdisciplinary knowledge system and promote the development of related fields.
[0004] Triples are the basic building blocks of knowledge graphs, usually composed of entities, relations, and entities in the form of (head entity, relation, tail entity). Triple extraction plays a key role in the construction of knowledge graphs. By extracting triples, complex geological knowledge can be represented in a simple structured form, which is convenient for storage, retrieval, and analysis. Triple extraction technology can quickly extract valuable information from massive geological literature and data, greatly improving the efficiency of knowledge graph construction. Triple extraction not only identifies entities, but also reveals the relationships between entities, which is crucial for understanding the causal relationships and interactions behind geological phenomena. Through continuous triple extraction, the geological knowledge graph can be continuously updated and expanded to maintain the timeliness and accuracy of the knowledge base. Triple extraction helps to deeply understand the professional terms and concepts in the geological field, improve the semantic level of the knowledge graph, and support more advanced knowledge applications and reasoning.
[0005] However, the current joint entity relationship extraction in the geological field faces a large number of complex triple overlap problems, including SingleEntityOverlap (SEO), EntityPairOverlap (EPO), HeadTTailOverlap (HTO), in addition to cascade errors and information redundancy, resulting in low efficiency and large amount of information redundancy in constructing geological knowledge graphs. Summary of the invention
[0006] The purpose of the present invention is to provide a method, device, storage medium and equipment for constructing a geological knowledge map, so as to solve the problems of low efficiency and large amount of information redundancy in constructing geological knowledge maps in the prior art.
[0007] To achieve the above objectives, the present invention is implemented by adopting the following technical solutions:
[0008] In a first aspect, the present invention provides a method for constructing a geological knowledge graph, comprising:
[0009] Get geological text containing geological information and multiple predefined relationship tags;
[0010] Encoding the sentences in the geological text into sentence embedding vectors, encoding the relationship tags into corresponding relationship tag embedding vectors, and embedding the relationship tag embedding vectors into the sentence embedding vectors to obtain text embedding vectors;
[0011] The text embedding vector and the relationship label are input into a neural network classifier, and the following operations are performed in the neural network classifier: a blank three-dimensional matrix is constructed according to the text embedding vector and the relationship label, and each item in the blank three-dimensional matrix is labeled according to a preset labeling rule to obtain a three-dimensional labeled matrix and output it;
[0012] Using a preset screening classifier to screen out a three-dimensional labeling matrix containing the best geological triplet from all three-dimensional labeling matrices;
[0013] The optimal geological triples are extracted and input into the knowledge graph construction database to construct a geological knowledge graph.
[0014] Furthermore, the encoding is performed through a trained BERT model.
[0015] Furthermore, embedding the relationship tag embedding vector into the sentence embedding vector to obtain the text embedding vector is performed by the following method:
[0016] The similarity weight between the relation label embedding vector and the sentence embedding vector is calculated by formula (1):
[0017] (1);
[0018] in, is the similarity weight between the i-th relation label embedding vector and the sentence embedding vector, softmax represents the normalization operation, is the sentence embedding vector, is the relation label embedding vector corresponding to the i-th relation label, and h is the dimension of the relation label embedding vector and the sentence embedding vector;
[0019] The relation tag embedding vector is embedded into the sentence embedding vector by formula (2):
[0020] (2);
[0021] in, is the text embedding vector embedded with the relation tag embedding vector, and T represents transposition.
[0022] Furthermore, constructing a blank three-dimensional matrix according to the text embedding vector and the relationship label includes:
[0023] Constructing a blank three-dimensional matrix of the number of relationship tags multiplied by the number of sentences, wherein the length and width of the blank three-dimensional matrix are the number of word units in the sentence, and the height of the blank three-dimensional matrix is the number of relationship tags. Each blank three-dimensional matrix corresponds to a combination of a sentence and each relationship tag, and each blank three-dimensional matrix is composed of a plurality of blank two-dimensional matrices. The number of blank two-dimensional matrices in the blank three-dimensional matrix is the same as the number of relationship tags. Each blank two-dimensional matrix corresponds to a combination of a sentence and a relationship tag, and each item in the blank two-dimensional matrix corresponds to each word unit in the sentence in terms of rows and columns.
[0024] The step of marking each item in the blank three-dimensional matrix by a preset marking rule to obtain a three-dimensional marking matrix includes:
[0025] Assign labels to each item in the blank three-dimensional matrix to obtain a three-dimensional labeling matrix containing geological triples;
[0026] The labels include HB-TB, HB-TE and HE-TE;
[0027] Among them, HB-TB means: this item in the three-dimensional labeling matrix is the starting position of the head entity and the tail entity;
[0028] HB-TE means: the entry in the three-dimensional tag matrix corresponds to the start position of the head entity in the row and the end position of the tail entity in the column;
[0029] HE-TE means: This item in the three-dimensional tag matrix is the end position of the head entity and the tail entity.
[0030] Furthermore, assigning labels to each item in the blank three-dimensional matrix includes:
[0031] The score vector of each item in the blank three-dimensional matrix is calculated by formula (3):
[0032] (3);
[0033] in, is the entry in the blank three-dimensional matrix The corresponding score vector, Represents the relationship label in the blank three-dimensional matrix The entry in the i-th row and j-th column of the blank two-dimensional matrix, k is a natural number from 1 to K, where K is the number of predefined relationship labels. is the i-th token in the sentence, is the jth token in the sentence, is the kth relation label, T represents transposition, R represents the set of all relations, is the ReLU activation function, represents the drop out strategy function used to prevent overfitting, M is the pre-trained weight matrix, b is the bias matrix, is the head entity embedding vector in the text embedding vector, is the tail entity embedding vector in the text embedding vector, is a join operation;
[0034] Input the score vector of each item into formula (4) to obtain the probability corresponding to the label of each item in the blank three-dimensional matrix:
[0035] (4);
[0036] in, Represents the predicted item The corresponding label, Representation word and The sentence that belongs to Indicates that the limiting condition is a sentence Mid-term The corresponding label is The probability of
[0037] Assign the label with the highest calculated probability to each item in the blank three-dimensional matrix.
[0038] Furthermore, the method of using a preset screening classifier to screen out a three-dimensional labeling matrix containing the best geological triplet from all three-dimensional labeling matrices includes:
[0039] The relationship labels in the three-dimensional label matrix are transformed into The following word pairs and word pairs pre-labeled with true labels Compare and select the word pair with the smallest objective function value As a relationship tag The best word-gram pairs under , thereby screening out the three-dimensional label matrix containing the best geological triples:
[0040] (5);
[0041] in, is the objective function value of the screening classifier, Representing word pairs The corresponding pre-annotated true label results, Indicates that given an input sentence , word pair and relationship tags Under the condition of The corresponding predicted probability is Equal log probability, is the i-th token in the sentence, is the jth token in the sentence, is the kth relation tag, L is the sentence is the number of tokens in , and K is the number of predefined relation tags.
[0042] In a second aspect, the present invention provides a geological knowledge graph construction device, comprising:
[0043] The information acquisition module is configured to: acquire geological text containing geological information and a plurality of predefined relationship tags;
[0044] The encoding module is configured to: encode the sentences in the geological text into sentence embedding vectors, encode the relationship tags into corresponding relationship tag embedding vectors, and embed the relationship tag embedding vectors into the sentence embedding vectors to obtain text embedding vectors;
[0045] The labeling module is configured to: input the text embedding vector and the relationship label into a neural network classifier, and perform the following operations in the neural network classifier: construct a blank three-dimensional matrix according to the text embedding vector and the relationship label, label each item in the blank three-dimensional matrix according to a preset labeling rule to obtain a three-dimensional labeling matrix and output it;
[0046] The screening module is configured to: screen out the three-dimensional labeling matrix containing the best geological triplet from all three-dimensional labeling matrices using a preset screening classifier;
[0047] The graph construction module is configured to extract the optimal geological triples and input them into the knowledge graph construction database to construct a geological knowledge graph.
[0048] In a third aspect, the present invention provides a computer-readable storage medium having a computer program / instruction stored thereon. When the computer program / instruction is executed by a processor, the steps of the method for constructing a geological knowledge graph described in any one of the first aspects are implemented.
[0049] In a fourth aspect, the present invention provides a computer device, comprising:
[0050] Memory, for storing computer programs / instructions;
[0051] A processor is used to execute the computer program / instructions to implement the steps of the geological knowledge map construction method described in any one of the first aspects.
[0052] Compared with the prior art, the beneficial effects achieved by the present invention are:
[0053] The present invention provides a geological knowledge graph construction method, device, storage medium and equipment. By embedding a relationship tag embedding vector into a sentence embedding vector, the rich semantic information in the relationship tag is integrated into the representation vector of the sentence, the sentence is enhanced, the information basis validity of the knowledge graph is improved, richer semantic information is included, and the information diversity of the knowledge graph is improved; through a relationship-specific labeling scheme, the triple overlap problem is effectively solved, and the efficiency is improved to a certain extent, and the time overhead is reduced; the originally huge time overhead is greatly reduced through the design of the classifier; the relationship-specific labeling rules and triple classifiers can be designed in a single module to avoid cascading errors and less information redundancy;
[0054] More specifically, compared with the traditional "BIE" (start, inside, end) tagging, the "I" tag is discarded in the tagging rule, and the "HI" and "TI" tags are not used in this tagging rule. Therefore, the obtained three-dimensional tag matrix is sparse, which provides several advantages: first, during the classification process, the use of three special tags instead of nine can effectively reduce the potential search space; second, the sparsity ensures the availability of sufficient negative samples during training; third, the sparsity ensures the simplicity and efficiency of the decoding triplet process.
[0055] More specifically, from the score function, it can be seen that the present invention achieves parallel scoring with only two layers of fully connected networks, and reduces the actual processing steps to , effectively reducing the time overhead; in addition, the scoring function conforms to the idea of HOLE and can capture the association and mutual exclusion between relations. In general, it effectively solves the problem of a large number of overlapping triples in geological texts and ensures the simplicity and effectiveness of decoding triple elements. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 It is a flow chart of a method for constructing a geological knowledge graph corresponding to Embodiment 1 of the present invention;
[0057] Figure 2 It is a flow chart of a method for constructing a geological knowledge graph corresponding to Embodiment 2 of the present invention;
[0058] Figure 3 is a schematic diagram of the attention mechanism provided by Embodiment 2 of the present invention;
[0059] Figure 4 This is a schematic diagram of markings under the birthplace relationship tag provided in Embodiment 2 of the present invention;
[0060] Figure 5 Embodiment 2 of the present invention provides Schematic diagram of the markings under the relationship label;
[0061] Figure 6 Embodiment 2 of the present invention provides Diagram of the markings under the Relationships tab. DETAILED DESCRIPTION
[0062] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and are not intended to limit the protection scope of the present invention.
[0063] Example 1.
[0064] like Figure 1 As shown, the present invention provides a method for constructing a geological knowledge graph, comprising:
[0065] Get geological text containing geological information and multiple predefined relationship tags;
[0066] Encode the sentences in the geological text into sentence embedding vectors, encode the relationship tags into corresponding relationship tag embedding vectors, and embed the relationship tag embedding vectors into the sentence embedding vectors to obtain the text embedding vectors;
[0067] The text embedding vector and the relationship label are input into the neural network classifier, and the following operations are performed in the neural network classifier: a blank three-dimensional matrix is constructed according to the text embedding vector and the relationship label, and each item in the blank three-dimensional matrix is labeled according to a preset labeling rule to obtain a three-dimensional labeled matrix;
[0068] Using a preset screening classifier to screen out a three-dimensional labeling matrix containing the best geological triplet from all three-dimensional labeling matrices;
[0069] The best geological triples are extracted and input into the knowledge graph construction database to construct a geological knowledge graph.
[0070] The present invention embeds the relationship label embedding vector into the sentence embedding vector, so as to integrate the rich semantic information in the relationship label into the representation vector of the sentence, enhance the sentence, improve the information basis effectiveness of the knowledge graph, include richer semantic information, and improve the information diversity of the knowledge graph; through the relationship-specific labeling scheme, the triple overlap problem is effectively solved, and the efficiency is improved to a certain extent and the time overhead is reduced; through the design of the classifier, the originally huge time overhead is greatly reduced; the relationship-specific labeling rules and triple classifiers can be designed in a single module to avoid cascading errors and less information redundancy.
[0071] Example 2.
[0072] like Figure 2 As shown, the present invention provides a method for constructing a geological knowledge graph, comprising:
[0073] Step 1: Use the pre-trained BERT model to encode the sentences and pre-defined relationship labels in the manually annotated (head entity, relationship, tail entity) geological text into embedding vector form to obtain sentence embedding vectors and relationship label embedding vectors; Figure 3 As shown in the figure, the attention mechanism is used to integrate the semantic information contained in the relationship label embedding vector into the sentence embedding vector, that is, the similarity weight of the relationship label for each word (lemma) in the sentence is calculated to integrate the relationship label embedding vector into the sentence embedding vector with different weights, and finally the text embedding vector enhanced by integrating the relationship label information is obtained.
[0074] BERT, the full name of which is Bidirectional Encoder Representations from Transformers, is a bidirectional encoder model.
[0075] Step 2: Based on step 1, the text embedding vector and relationship label are input into the neural network classifier. Through a relationship-specific labeling rule (labeling scheme), the text embedding vector of each sentence in the geological text and the different head entities and tail entities corresponding to the geological triples composed of different relationship labels are labeled. Each labeling result is stored in a three-dimensional labeling matrix to obtain multiple three-dimensional labeling matrices containing the geological triplet information of the sentence under different relationship labels. The efficiency of the labeling scheme is improved through design.
[0076] Step 3: Design an objective function to transform the relationship labels in the three-dimensional label matrix obtained in step 2 The following word pairs Token pairs with manually annotated true labels Compare and get the relationship label The best word pair under , thus obtaining the best geological triplet.
[0077] Step 4: Input the obtained optimal geological triples into the Neo4j database through specific Cypher statements to construct a geological knowledge graph.
[0078] Specific measures taken in step 1 include:
[0079] The attention mechanism based on deep learning (DL) is used to calculate the similarity weight of each predefined relationship tag for each word in the geological text sentence. The relationship tag information is integrated into the sentence embedding vector according to the weight to obtain the enhanced text embedding vector.
[0080] The present invention first uses a formula to define the task of triple extraction. Given a sentence , with L tokens and a set of predefined relations , is the i-th relation label, and K is the total number of relation labels. The purpose of joint entity and relation extraction is to identify All possible triplets in , where N is the number of triplets, and The i-th head entity and the i-th tail entity are composed of several consecutive word units. is the i-th relation label, that is, the entity is ,in yes arrive The splicing, is the pth word, is the qth word.
[0081] Figure 3 The framework for obtaining an attention-enhanced text embedding vector is presented. In the encoding layer, instead of only encoding the sentence using the pre-trained model BERT, BERT is used to encode the sentence and the relationship tag at the same time. In addition, the present invention uses an attention mechanism to traverse all relationship tags and calculate the similarity weight of each relationship tag for each word in the sentence, so as to integrate the relationship tag embedding vector into the sentence embedding vector with different weights, thereby obtaining an enhanced text embedding vector. Given a relationship tag type , express The i-th relation tag in , BERT is used to encode it and the sentence into a vector representation and :
[0082] ;
[0083] ;
[0084] in, is the sentence embedding vector, is the relation label embedding vector corresponding to the i-th relation label, , is a vector space, and is the dimension of BERT.
[0085] Next, the present invention uses the attention mechanism to calculate and The similarity weight between them is shown in the following formula:
[0086] ;
[0087] = ;
[0088] in, Indicates The similarity score matrix between each relationship and each word (lemma) in the current sentence, is the similarity weight between the i-th relation label embedding vector and the sentence embedding vector (a matrix), which describes the The importance of each relationship to the sentence, softmax represents the normalization operation, is the sentence embedding vector, is the relation label embedding vector corresponding to the i-th relation label, and h is the dimension of the relation label embedding vector and the sentence embedding vector.
[0089] Then, Used with Perform dot product operation to obtain weighted sum vector. The present invention adopts weighted average method here, through which the present invention transposes and compare it with Multiply them to get the weighted sum vector. Finally, add the weighted sum vector to the original text representation to get the enhanced text embedding vector:
[0090] ;
[0091] ;
[0092] The superscript T represents the matrix transpose. This is for The weighted sum vector obtained by the relationship, and is the enhanced text embedding vector obtained by adding the weighted sum vector to the original sentence embedding vector.
[0093] Through the above calculations, a richer geological text embedding vector is obtained, which contains the semantic information of the relationship tags.
[0094] Regarding the relationship-specific labeling scheme (labeling rule) for labeling the corresponding head entity and tail entity in the sentence using a three-dimensional matrix for each relationship tag, a corresponding three-dimensional labeling matrix is constructed for each sentence based on the obtained enhanced text embedding vector.
[0095] There are many labeling schemes, such as sequence labeling, where each entity is labeled with only one relation type. However, this may lead to significant overhead when the dataset contains many relation types. The method proposed in this paper is more lightweight and has better scalability.
[0096] The specific measures taken in step 2 include:
[0097] In this invention, for a sentence, we design a neural network classifier, which is Combinations (geological triplets) are assigned labels where , ; is the i-th token in the sentence, is the jth token in the sentence, is the kth relationship label, and the present invention uses a three-dimensional label matrix to store the tagging results, where L represents the length of the geological text sequence (the number of tokens in a sentence) and K represents the number of predefined relationship tags.
[0098] The present invention uses the "BIE" (B start, I inside, E end) tag to indicate the position information of each word in the entity, "H" and "T" represent Head (head entity) and Tail (tail entity), respectively. For example, "HB" represents the starting position of the head entity paired with the tail entity under a specific relationship r, and "TE" represents the ending position of the tail entity paired with the head entity under a specific relationship r. In a sentence containing a triple (Zhang San, birthplace, Beijing), the word can be found in the relation-specific submatrix. Find three special tags, such as Figure 4 As shown. Relationship tags and The labeled instances corresponding to the relation labels are as follows: Figure 5 He Ru Figure 6 as shown
[0099] Four types of tags are used in the tagging rule and can be determined by detecting entity boundary tags:
[0100] The first is HB-TB: This tag represents the start position of the head entity and the start position of the tail entity paired in the three-dimensional tagging matrix. For example, the combination (Zhang, place of birth, North) is tagged as "HB-TB" because there is a "place of birth" relationship between the two entities "Zhang San" and "Beijing".
[0101] The second is HB-TE: This tag indicates that in the three-dimensional tagging matrix, this item is the start position of the head entity in the row and the end position of the tail entity in the column. For example, "Zhang" is the starting position of "Zhang San" and "Jing" is the ending position of "Beijing", so the combination (Zhang, place of birth, Jing) is given the tag "HB-TE".
[0102] The third is HE-TE: Similar to "HB-TB", this tag means that these two positions represent the end positions of the paired head entity and tail entity in the three-dimensional tagging matrix. For example, the combination (San, place of birth, Jing) is given the tag "HE-TE".
[0103] The fourth is "-": Except for the above three tags, all are tagged as "-".
[0104] When a single token represents the entity itself, it is tagged as both the start and end positions. It should be noted that different from the traditional "BIE" (beginning, inside, end) tagging in the past, the "I" tag is discarded in the tagging scheme of the present invention, and the "HI" and "TI" tags are not used in this tagging scheme. Therefore, the obtained three-dimensional tagging matrix is sparse and provides several advantages: First, during the classification process, using three special tags instead of nine can effectively reduce the potential search space; second, the sparsity ensures the availability of sufficient negative samples during training; third, the sparsity guarantees the simplicity and efficiency of the process of decoding triples.
[0105] The three-dimensional tagging matrix marks the boundaries of paired head and tail entities and the relationships between them. Therefore, decoding triples becomes simpler. Specifically, for each relationship, the span of the head entity ranges from "HB-TE" to "HE-TE", while the span of the tail entity ranges from "HB-TB" to "HB-TE". The two paired entities share the same "HB-TE" tag.
[0106] For the sentences in the input geological text, the enhanced text embedding vector obtained by using attention in step 1 is Expressed as Here, Indicates in the sentence Words are embedded in text vectors Next, for the matrix of effective labeling, the present invention lists all possible and design a classifier to assign high confidence labels. However, using the input The simple classification neural network has two disadvantages. First, the simple classifier cannot fully explore the interactions between geological entities and relationships, and fails to model the inherent structural information of geological triples. Second, As input, the model needs to perform at least This requires multiple computations to classify all combinations, which results in an unacceptable time overhead.
[0107] In order to solve these problems, the idea of HOLE was inspired and the scoring function was defined as follows:
[0108] ;
[0109] Among them, h is the head entity embedding vector, t is the tail entity embedding vector, and r represents the current corresponding relationship label embedding vector. represents a cyclic dependency, which captures the potential dependency between two geological entities. The operator is redefined as a nonlinear concatenation projection:
[0110] ;
[0111] in, , is a trainable weight matrix, is the trainable bias matrix, Represents the dimension of the entity pair embedding vector. Symbol is a connection operation, is the ReLU activation function, and T represents transpose. The new definition brings the following benefits. First, the score function can be directly connected to the output of the sentence encoding layer. Second, it can be obtained by using the matrix Adaptively learn the mapping function from entity features to entity pair representations. Third, the connection between two entities is not commutative, i.e. , which is essential for modeling asymmetric relationships.
[0112] Next, the present invention uses all relations to represent Calculate word pairs simultaneously and The significance of is a vector space, K is the number of predefined relationship labels, and 4 is the number of classification labels. Therefore, the final score function of the method of the present invention is defined as:
[0113] ;
[0114] in, It is a geological triplet The score vector of the corresponding three-dimensional labeling matrix, k is a natural number from 1 to K, K is the number of predefined relationship labels, is the i-th token in the sentence, is the jth token in the sentence, is the kth relation label, T represents transposition, R represents the set of all relations, is the ReLU activation function, represents the drop out strategy function used to prevent overfitting, M is the pre-trained weight matrix, b is the bias matrix, is the head entity embedding vector in the text embedding vector, is the tail entity embedding vector in the text embedding vector, It is a connection operation.
[0115] Therefore, the present invention uses only two layers of fully connected networks (matrix can also be viewed as a trainable weight) to achieve parallel scoring and reduce the actual processing steps to , effectively reducing the time overhead. In addition, the score function conforms to the idea of HoLE (Holographic Embeddings, a model based on semantic similarity) and can capture the association and mutual exclusion between relations.
[0116] Finally, the present invention will The score vector is input into the softmax function to predict the label corresponding to the word pair under the corresponding relationship:
[0117] (4);
[0118] in, Represents the predicted geological triple The corresponding label, Representation word and The sentence that belongs to Indicates that the limiting condition is a sentence China Geological Triad The corresponding label is probability.
[0119] The above relation-specific tagging rules naturally handle complex situations involving a large number of overlapping patterns in geological text. Specifically, in the case of entity pair overlap (EPO), i.e., the same entity pair corresponds to multiple different relations, the entity pairs receive tags in different sub-matrices based on their relations (the tagging results under different relations are stored in different 3D tag matrices). For example, in Figure 5 and Figure 6 In (Zhang San, Relationship tags, three) and (three, The relationship label, Zhang San) constitutes two EPO triples, so the two entity pairs are marked in and In the case of single entity overlap (SEO), i.e., one entity is common to different triples, if two triples share the same relation, the entity pair is labeled ; otherwise, they are labeled in different sub-matrices based on their corresponding relation labels. In the most complex head-tail overlap (HTO) pattern, that is, in a triple, the head entity and the tail entity have overlapping parts, such as Figure 5 and Figure 6 The triples in (Zhang San, Relationship tags, three) and (three, The relation label, Zhang San), is also formed in the same way when a single token represents the entity itself, it is labeled with the start and end positions. The labeling method ensures that two entity pairs are labeled in different sub-matrices according to their relationship, thus effectively handling the HTO pattern.
[0120] Overall, the relation-specific notation applied here effectively resolves the problem of large amounts of overlapping triples in geological texts and ensures simplicity and effectiveness in decoding triple elements.
[0121] The objective function in step 3 is:
[0122] ;
[0123] in, is the objective function value of the screening classifier, Represents geological triples The corresponding pre-annotated true label results, Indicates that given an input sentence , word pair and relationship tags Under the conditions, The corresponding predicted probability is Equal log probability, is the i-th token in the sentence, is the jth token in the sentence, is the kth relation tag, L is the sentence is the number of tokens in , and K is the number of predefined relation tags.
[0124] The geological triplet corresponding to the minimum objective function value is taken as the optimal geological triplet.
[0125] The method for extracting geological triples is as follows: the final labeling results are matched into corresponding head entities and tail entities through rules, and finally combined into geological triples. The rules are as follows: for each relationship, the span of the head entity is from "HB-TE" to "HE-TE", and the span of the tail entity is from "HB-TB" to "HB-TE", and the two paired entities share the same "HB-TE' label.
[0126] In order to avoid cascading errors and reduce information redundancy, the above-mentioned marking rules and the final process of extracting ternaries can be designed in the same module. In view of the shortcomings of cascading errors and information redundancy that are easily generated between multi-module models, a single-module strategy is used in the decoding process, and two tasks share one module, which can better avoid the occurrence of cascading errors and reduce information redundancy.
[0127] Example 3.
[0128] The present invention provides a geological knowledge graph construction device, comprising:
[0129] The information acquisition module is configured to: acquire geological text containing geological information and a plurality of predefined relationship tags;
[0130] The encoding module is configured to: encode the sentences in the geological text into sentence embedding vectors, encode the relationship tags into corresponding relationship tag embedding vectors, and embed the relationship tag embedding vectors into the sentence embedding vectors to obtain text embedding vectors;
[0131] The labeling module is configured to: input the text embedding vector and the relationship label into a neural network classifier, label the geological triples obtained by combining each text embedding vector and each relationship label according to a preset labeling rule, and store the labeling results in a three-dimensional labeling matrix, wherein the labeling results include the geological triples of the sentences under the relationship labels;
[0132] The screening module is configured to: screen out the three-dimensional labeling matrix containing the best geological triplet from all three-dimensional labeling matrices using a preset classifier;
[0133] The graph construction module is configured to extract the optimal geological triples and input them into the knowledge graph construction database to construct a geological knowledge graph.
[0134] Example 4.
[0135] The present invention provides a computer-readable storage medium having a computer program / instruction stored thereon. When the computer program / instruction is executed by a processor, the steps of the method for constructing a geological knowledge graph provided in Example 1 are implemented:
[0136] Get geological text containing geological information and multiple predefined relationship tags;
[0137] Encode the sentences in the geological text into sentence embedding vectors, encode the relationship tags into corresponding relationship tag embedding vectors, and embed the relationship tag embedding vectors into the sentence embedding vectors to obtain the text embedding vectors;
[0138] Input the text embedding vector and the relationship label into the neural network classifier, label the geological triples obtained by combining each text embedding vector and each relationship label according to the preset labeling rules, and store the labeling results in a three-dimensional labeling matrix, wherein the labeling results include the geological triples of the sentences under the relationship labels;
[0139] Using a preset classifier, a three-dimensional labeling matrix containing the best geological triplet is selected from all three-dimensional labeling matrices;
[0140] The best geological triples are extracted and input into the knowledge graph construction database to construct a geological knowledge graph.
[0141] Example 5.
[0142] The present invention also provides a computer device, comprising:
[0143] Memory, for storing computer programs / instructions;
[0144] A processor is used to execute the computer program / instructions to implement the steps of the geological knowledge map construction method provided in Example 1:
[0145] Get geological text containing geological information and multiple predefined relationship tags;
[0146] Encode the sentences in the geological text into sentence embedding vectors, encode the relationship tags into corresponding relationship tag embedding vectors, and embed the relationship tag embedding vectors into the sentence embedding vectors to obtain the text embedding vectors;
[0147] Input the text embedding vector and the relationship label into the neural network classifier, label the geological triples obtained by combining each text embedding vector and each relationship label according to the preset labeling rules, and store the labeling results in a three-dimensional labeling matrix, wherein the labeling results include the geological triples of the sentences under the relationship labels;
[0148] Using a preset classifier, a three-dimensional labeling matrix containing the best geological triplet is selected from all three-dimensional labeling matrices;
[0149] The best geological triples are extracted and input into the knowledge graph construction database to construct a geological knowledge graph.
[0150] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0151] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0152] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0153] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0154] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for constructing a geological knowledge graph, characterized in that: include: Get geological text containing geological information and multiple predefined relationship tags; Encoding the sentences in the geological text into sentence embedding vectors, encoding the relationship tags into corresponding relationship tag embedding vectors, and embedding the relationship tag embedding vectors into the sentence embedding vectors to obtain text embedding vectors; The text embedding vector and the relationship label are input into a neural network classifier, and the following operations are performed in the neural network classifier: a blank three-dimensional matrix is constructed according to the text embedding vector and the relationship label, and each item in the blank three-dimensional matrix is labeled according to a preset labeling rule to obtain a three-dimensional labeled matrix and output it; Using a preset screening classifier to screen out a three-dimensional labeling matrix containing the best geological triplet from all three-dimensional labeling matrices; The optimal geological triples are extracted and input into the knowledge graph construction database to construct a geological knowledge graph.
2. The method for constructing a geological knowledge map according to claim 1, characterized in that: The encoding is performed through a trained BERT model.
3. The method for constructing a geological knowledge map according to claim 1, characterized in that: The embedding of the relation tag embedding vector into the sentence embedding vector to obtain the text embedding vector is performed by the following method: The similarity weight between the relation label embedding vector and the sentence embedding vector is calculated by formula (1): (1); in, is the similarity weight between the i-th relation label embedding vector and the sentence embedding vector, softmax represents the normalization operation, is the sentence embedding vector, is the relation label embedding vector corresponding to the i-th relation label, and h is the dimension of the relation label embedding vector and the sentence embedding vector; The relation tag embedding vector is embedded into the sentence embedding vector by formula (2): (2); in, is the text embedding vector embedded with the relation tag embedding vector, and T represents transposition.
4. The method for constructing a geological knowledge map according to claim 1, characterized in that: The step of constructing a blank three-dimensional matrix according to the text embedding vector and the relationship label includes: Constructing a blank three-dimensional matrix of the number of relationship tags multiplied by the number of sentences, wherein the length and width of the blank three-dimensional matrix are the number of word units in the sentence, and the height of the blank three-dimensional matrix is the number of relationship tags. Each blank three-dimensional matrix corresponds to a combination of a sentence and each relationship tag, and each blank three-dimensional matrix is composed of a plurality of blank two-dimensional matrices. The number of blank two-dimensional matrices in the blank three-dimensional matrix is the same as the number of relationship tags. Each blank two-dimensional matrix corresponds to a combination of a sentence and a relationship tag, and each item in the blank two-dimensional matrix corresponds to each word unit in the sentence in terms of rows and columns. The step of marking each item in the blank three-dimensional matrix by a preset marking rule to obtain a three-dimensional marking matrix includes: Assign labels to each item in the blank three-dimensional matrix to obtain a three-dimensional labeling matrix containing geological triples; The labels include HB-TB, HB-TE and HE-TE; Among them, HB-TB means: this item in the three-dimensional labeling matrix is the starting position of the head entity and the tail entity; HB-TE means: the entry in the three-dimensional tag matrix corresponds to the start position of the head entity in the row and the end position of the tail entity in the column; HE-TE means: This item in the three-dimensional tag matrix is the end position of the head entity and the tail entity.
5. The method for constructing a geological knowledge map according to claim 4, characterized in that: The step of assigning labels to each item in the blank three-dimensional matrix includes: The score vector of each item in the blank three-dimensional matrix is calculated by formula (3): (3); in, is the entry in the blank three-dimensional matrix The corresponding score vector, Represents the relationship label in the blank three-dimensional matrix The entry in the i-th row and j-th column of the blank two-dimensional matrix, k is a natural number from 1 to K, where K is the number of predefined relationship labels. is the i-th token in the sentence, is the jth token in the sentence, is the kth relation label, T represents transposition, R represents the set of all relations, is the ReLU activation function, represents the drop out strategy function used to prevent overfitting, M is the pre-trained weight matrix, b is the bias matrix, is the head entity embedding vector in the text embedding vector, is the tail entity embedding vector in the text embedding vector, is a join operation; Input the score vector of each item into formula (4) to obtain the probability corresponding to the label of each item in the blank three-dimensional matrix: (4); in, Represents the predicted item The corresponding label, Representation word and The sentence that belongs to Indicates that the limiting condition is a sentence Mid-term The corresponding label is The probability of Assign the label with the highest calculated probability to each item in the blank three-dimensional matrix.
6. The method for constructing a geological knowledge map according to claim 1, characterized in that: The method of using a preset screening classifier to screen out a three-dimensional label matrix containing the best geological triplet from all three-dimensional label matrices includes: The relationship labels in the three-dimensional label matrix are transformed into The following word pairs and word pairs pre-labeled with true labels Compare and select the word pair with the smallest objective function value As a relationship tag The best word-gram pairs under , thereby screening out the three-dimensional label matrix containing the best geological triples: (5); in, is the objective function value of the screening classifier, Representing word pairs The corresponding pre-annotated true label results, Indicates that given an input sentence , word pair and relationship tags Under the condition of The corresponding predicted probability is Equal log probability, is the i-th token in the sentence, is the jth token in the sentence, is the kth relation tag, L is the sentence is the number of tokens in , and K is the number of predefined relation tags.
7. A geological knowledge graph construction device, characterized in that: include: The information acquisition module is configured to: acquire geological text containing geological information and a plurality of predefined relationship tags; The encoding module is configured to: encode the sentences in the geological text into sentence embedding vectors, encode the relationship tags into corresponding relationship tag embedding vectors, and embed the relationship tag embedding vectors into the sentence embedding vectors to obtain text embedding vectors; The labeling module is configured to: input the text embedding vector and the relationship label into a neural network classifier, and perform the following operations in the neural network classifier: construct a blank three-dimensional matrix according to the text embedding vector and the relationship label, label each item in the blank three-dimensional matrix according to a preset labeling rule to obtain a three-dimensional labeling matrix and output it; The screening module is configured to: screen out the three-dimensional labeling matrix containing the best geological triplet from all three-dimensional labeling matrices using a preset screening classifier; The graph construction module is configured to extract the optimal geological triples and input them into the knowledge graph construction database to construct a geological knowledge graph.
8. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method for constructing a geological knowledge map described in any one of claims 1 to 6 are implemented.
9. A computer device, characterized in that: include: Memory, for storing computer programs / instructions; A processor, used to execute the computer program / instructions to implement the steps of the geological knowledge map construction method described in any one of claims 1 to 6.
Citation Information
Patent Citations
Disaster emergency knowledge graph construction method for aid decision-making
CN117252255A
Mine disaster tracing method based on knowledge graph
WO2024221780A1
