Joint extraction method of relation triples and construction method of automatic question answering system

Through the combination of BERT encoder and relational attention module, the accuracy and complexity of relational triple extraction in the existing technology are solved, and efficient and accurate relational triple extraction and automatic question-and-answer system construction is realized, which is suitable for Large-scale corpus and multiple languages.

CN114691848BActive Publication Date: 2024-12-24CENT SOUTH UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210301448.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-24
Publication Date
2024-12-24
Estimated Expiration
2042-03-24

AI Technical Summary

Technical Problem

The existing pipeline-based relational triple extraction method has problems such as error propagation, ignoring the interdependence between entities and relationships, high complexity, and inadaptation to small languages. The traditional method requires a lot of manual work and poor generalization ability. Deep learning methods ignore the interactions of the extraction phase when dealing with complex overlapping relationships.

Method used

The context semantic information feature vector is generated by using the BERT encoder, combined with the cascade head-tail annotation decoder and the relational attention module, and the dependency between the subject and the relationship is extracted through the attention mechanism, and the end-to-end relational triple joint extraction is realized. And build an automatic question and answer system.

Benefits of technology

Improves the accuracy and reliability of relational triple extraction, simplifies the implementation process, is suitable for large-scale corpus and multiple languages, and improves generalization capabilities and extraction accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114691848B_ABST
    Figure CN114691848B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for joint extraction of relational triples, including obtaining a training data set and generating an input feature vector; inputting the input feature vector into an encoder to generate a contextual semantic information feature vector; decoding the contextual semantic information feature vector to obtain all possible subjects in the sentence and the corresponding subject feature vectors; inputting the contextual semantic information feature vector and the subject feature vector into a relational attention module to obtain the attention feature vectors of two branches and adding them, obtaining an activation vector through an activation function and performing multiplication processing to obtain a weighted attention feature vector; decoding the weighted attention feature vector and identifying the object of each relational dimension; performing relational matching between the subject and the object to obtain the final relational triple. The present invention also discloses a method for constructing an automatic question-answering system including the method for joint extraction of relational triples. The present invention can comprehensively extract relational triples, and has high reliability, good accuracy, and is simple and convenient to implement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of natural language processing, and in particular relates to a method for jointly extracting relation triples and a method for constructing an automatic question-answering system. Background Art

[0002] Integrating human knowledge is one of the key directions of artificial intelligence research. Inspired by human problem solving, intelligent systems can solve complex tasks by implementing knowledge representation and reasoning. Therefore, the importance of knowledge representation to artificial intelligence is self-evident. Among the many knowledge representation methods, knowledge graph has attracted great attention from academia and industry with its strong expression ability and modeling flexibility. At present, due to the rapid development of big data and deep learning, knowledge graph has become one of the core driving forces for the development of the Internet and artificial intelligence.

[0003] The key part of knowledge graphs is mostly relational facts formed by connecting two entities through semantic relations. Among them, facts are formally expressed as (subject, relation, object), that is, (subject, relation, object) or (s, r, o), which is called relation triples. Therefore, how to quickly and accurately extract relation triples is not only a key step in building large-scale knowledge graphs, but also an important task in information extraction (IE).

[0004] The pipeline-based relation triple extraction method not only has the problem of error propagation, but also ignores the relationship between the two subtasks, resulting in the inability to benefit from the interdependence of entities and relations, and also has the defect of high complexity. Therefore, in order to solve the problems of pipeline-based extraction methods, researchers have proposed end-to-end relation triple joint extraction methods in recent years. The relation triple joint extraction task is defined as detecting all entities from unstructured text and identifying the semantic relationships between them at the same time.

[0005] In recent years, the joint extraction methods of relation triples are mainly divided into two types: traditional methods and deep learning-based methods:

[0006] The joint extraction methods of relation triples based on traditional methods mainly include methods based on feature engineering and kernel functions. The feature engineering method mainly extracts feature vectors such as vocabulary, entity attributes, overlap, dependency syntax, and syntax trees, and trains classifiers to extract relation triples; while the kernel function method focuses on designing effective kernel functions to calculate the similarity between relation representations, and uses classifiers that support kernel functions for relation extraction. However, the joint extraction methods of relation triples based on traditional methods are mainly based on artificial construction and design of feature vectors and kernel functions; but it is precisely because a lot of manual work is required to achieve feature extraction and kernel function design, which makes it unsuitable for the extraction of relation triples from large-scale corpora; moreover, the extraction of features depends on natural language processing tools, and the extracted features are not accurate, which easily causes the problem of error propagation. At the same time, for small languages ​​with a lack of corpus, due to the lack of effective natural language processing tools, feature engineering-based methods cannot be used directly. Therefore, the traditional joint extraction method has poor extraction performance, requires a lot of manual work and domain expert knowledge, has poor generalization ability and scalability, and limits the development of practical applications.

[0007] The most common method based on deep learning is to input the word embedding vector of the text into the encoder to extract semantic information, obtain a feature vector with strong representation ability, and then decode the feature vector through the decoder to perform entity recognition and relationship classification, thereby realizing end-to-end joint extraction of relational triples. At present, with the improvement of the extraction accuracy of the joint extraction model, it is no longer limited to the simple relationship triple problem, but more concerned with the complex overlapping relationship triple problem, that is, different relationship triples in a sentence have the same subject and object, or even both are the same but have different relations; currently, the research methods for the overlapping triple problem mainly include tagging, seq-2-seq and table filling. However, this type of method ignores the interaction between the two extraction stages and the connection between the extracted subject and the relationship; in other words, the subject extracted in the first extraction stage is only related to a small number of relations. Summary of the invention

[0008] One of the purposes of the present invention is to provide a method for jointly extracting relation triples which has high reliability, good accuracy and is simple and convenient to implement.

[0009] A second object of the present invention is to provide a method for constructing an automatic question-answering system including the relation triple joint extraction method.

[0010] The method for jointly extracting relation triples provided by the present invention comprises the following steps:

[0011] S1. Obtain a training data set and generate an input feature vector based on the sentences in the training data set;

[0012] S2. Input the input feature vector obtained in step S1 into the encoder to generate a contextual semantic information feature vector;

[0013] S3. Decode the contextual semantic information feature vector obtained in step S2 to identify all possible subjects in the sentence and the corresponding subject feature vectors;

[0014] S4. Input the context semantic information feature vector obtained in step S2 and the subject feature vector obtained in step S3 into the relation attention module, thereby obtaining the attention feature vectors of the two branches;

[0015] S5. Add the attention feature vectors of the two branches obtained in step S4, then obtain the activation vector through the activation function, and perform multiplication to obtain the weighted attention feature vector;

[0016] S6. Decode the weighted attention feature vector obtained in step S5 again to identify the object of each relationship dimension;

[0017] S7. Perform relationship matching on the subject obtained in step S3 and the object obtained in step S6 to obtain the final relationship triplet.

[0018] The step S1 is to obtain a training data set and generate an input feature vector based on the sentences in the training data set. Specifically, the training data set is obtained and the sentences in the training data set are used to generate an input feature vector with a fixed length of 512 by a word embedding method; the input feature vector includes word embedding and position embedding.

[0019] Step S2 is to input the input feature vector obtained in step S1 into the encoder to generate a contextual semantic information feature vector. Specifically, the input feature vector obtained in step S1 is input into the BERT bidirectional encoder to extract the contextual semantic information feature vector.

[0020] The following formula is used as the encoding operation formula of the encoder:

[0021] h i =T(h i-1 )

[0022] Where h i is the context representation of the input sentence at layer i, and is the hidden state vector; T() is the operation function of the Transformer block; h0 is the output of the encoder, and h0 = W I , W I is the input feature vector obtained in step S1, and W I =W t +W p , W tis word embedding, W p Embed for position.

[0023] Step S3 of decoding the contextual semantic information feature vector obtained in step S2, thereby identifying all possible subjects in the sentence and the corresponding subject feature vectors, specifically includes the following steps:

[0024] A cascaded head and tail labeling decoder is used to decode the contextual semantic information feature vector, so as to identify all possible subjects in the sentence and the corresponding subject feature vectors; the decoder is a binary classification task after a dense layer, and obtains a subject head vector with a dimension of token length and a subject tail vector with a dimension of token length respectively; the position corresponding to the beginning of a subject in the subject head vector is classified as 1, and the remaining positions are classified as 0; the position corresponding to the end of a subject in the subject tail vector is classified as 1, and the remaining positions are classified as 0; the matching mechanism for identifying the subject is defined as combining the head of the subject with the closest tail; the subject feature vector includes the subject head vector and the subject tail vector.

[0025] Step S4, in which the contextual semantic information feature vector obtained in step S2 and the subject feature vector obtained in step S3 are input into the relational attention module, thereby obtaining the attention feature vectors of the two branches, specifically includes the following steps:

[0026] The context semantic information feature vector obtained in step S2 and the subject feature vector obtained in step S3 are input into the subject relationship attention module SRA; the subject relationship attention module SRA firstly converts the context semantic information feature vector F c and the subject feature vector F s The subject head vector and the subject tail vector in are connected at the channel level, and then averaged at the pixel level, and finally combined with the original contextual semantic information feature vector F c Pixel-level addition is performed to obtain fused features; the fused features are then passed through a Dense layer, and the global features and local features of two branches are extracted on the entire spatial features on the relationship channel to obtain two attention feature vectors on the relationship channel; the feature extraction operation of one branch includes a global maximum pooling operation, a reshape operation, and two one-dimensional convolution operations connected in series; the feature extraction operation of the other branch includes a global average pooling operation, a reshape operation, and two one-dimensional convolution operations connected in series; the activation functions of the Dense layer and the convolution layer are both Sigmoid functions.

[0027] Step S5 adds the attention feature vectors of the two branches obtained in step S4, then obtains the activation vector through the activation function, and performs multiplication to obtain the weighted attention feature vector. Specifically, the attention feature vectors of the two branches obtained in step S4 are added at the pixel level, then the activation vector is obtained through the Sigmoid activation function, and finally multiplied with the fusion feature to obtain the weighted attention feature vector.

[0028] Step S6 further decodes the weighted attention feature vector obtained in step S5 to identify the object of each relationship dimension, which specifically includes the following steps:

[0029] A decoder based on head and tail annotation is used to decode the weighted attention feature vector obtained in step S5 to identify the object of each relationship dimension; the decoder based on head and tail annotation is a binary classification task after a dense layer, and an object head vector with a dimension of token length and an object tail vector with a dimension of token length are obtained respectively; the position corresponding to the beginning of an object in the object head vector is classified as 1, and the remaining positions are classified as 0; the position corresponding to the end of an object in the object tail vector is classified as 1, and the remaining positions are classified as 0; the matching mechanism for identifying the object is defined as combining the head of the object with the closest tail; the object feature vector includes the object head vector and the object tail vector.

[0030] Step S7 performs relationship matching on the subject obtained in step S3 and the object obtained in step S6, thereby obtaining a final relationship triplet, which specifically includes the following steps:

[0031] The loss function uses binary cross entropy loss, and the following formula is used as the total loss function L:

[0032]

[0033] Where α and β are the set weight coefficients; To obtain the classification loss of the subject's head vector, To obtain the classification loss of the subject tail vector, To obtain the classification loss for the object head vector, is the classification loss when obtaining the object tail vector.

[0034] The present invention also discloses a method for constructing an automatic question-answering system including the relation triple joint extraction method, which specifically includes the following steps:

[0035] A. Obtain the text data to be extracted for relation triples;

[0036] B. Using the above-mentioned relation triple joint extraction method, extract the relation triples in the text data obtained in step A;

[0037] C. Construct the corresponding knowledge graph based on the relationship triples obtained in step B;

[0038] D. Based on the knowledge graph obtained in step C, a rule-based matching method is used to build an automatic question-answering system based on the obtained knowledge graph.

[0039] The method for jointly extracting relation triplets and the method for constructing an automatic question-answering system provided by the present invention use a BERT encoder to encode unstructured text to obtain contextual semantic feature information, then decode the contextual semantic features to extract the subject, and finally fuse the contextual semantic features and the extracted subject features, and use a subject-relationship attention mechanism to autonomously learn the dependency between the subject and relationship dimensions, so as to more accurately extract the object of a specific relationship, and obtain the final result through matching; the method of the present invention can comprehensively extract relation triplets, and has high reliability, good accuracy, and is simple and convenient to implement. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 The figure is a schematic diagram of the process flow of the extraction method of the present invention.

[0041] Figure 2 Schematic diagram of the head and tail labeling strategy of the extraction method of the present invention.

[0042] Figure 3 Schematic diagram of the calculation process of the weighted attention feature vector of the present invention.

[0043] Figure 4 A schematic diagram of a method flow of the automatic question-answering system construction method of the present invention. DETAILED DESCRIPTION

[0044] like Figure 1 The figure shows a schematic diagram of the method flow of the extraction method of the present invention: the method for joint extraction of relational triples provided by the present invention comprises the following steps:

[0045] S1. Obtain a training data set, and generate an input feature vector based on the sentences in the training data set; specifically, obtain a training data set, and generate an input feature vector with a fixed length of 512 by using a word embedding method for the sentences in the training data set; the input feature vector includes a word embedding and a position embedding;

[0046] S2. Input the input feature vector obtained in step S1 into the encoder to generate a contextual semantic information feature vector; specifically, input the input feature vector obtained in step S1 into the BERT bidirectional encoder to extract the contextual semantic information feature vector;

[0047] In specific implementation, the following formula is used as the encoding operation formula of the encoder:

[0048] h i =T(h i-1 )

[0049] Where h i is the context representation of the input sentence at layer i, and is the hidden state vector; T() is the operation function of the Transformer block; h0 is the output of the encoder, and h0 = W I , W I is the input feature vector obtained in step S1, and W I =W t +W p , W t is the word embedding obtained by the WordPiece method, which can reach a compromise between the effectiveness of words and the flexibility of characters; W p is the position embedding, which is obtained by first initializing the absolute position encoding and then putting it into a pre-trained model; the position embedding enables the encoder to distinguish the different positions of words by adding the position information of the word to the input vector; otherwise, no matter how chaotic the sentence structure is, the encoder will provide similar results; i ranges from 1 to n, where n is the number of Transformer blocks;

[0050] S3. Decoding the contextual semantic information feature vector obtained in step S2, thereby identifying all possible subjects in the sentence and the corresponding subject feature vectors; specifically comprising the following steps:

[0051] A cascaded head-tail labeling decoder is used to decode the context semantic information feature vector, so as to identify all possible subjects in the sentence and the corresponding subject feature vector; the decoder is a binary classification task after a dense layer, and obtains a subject head vector with a dimension of token length and a subject tail vector with a dimension of token length respectively; the position corresponding to the beginning of a subject in the subject head vector is classified as 1, and the remaining positions are classified as 0; the position corresponding to the end of a subject in the subject tail vector is classified as 1, and the remaining positions are classified as 0; the matching mechanism for identifying the subject is defined as combining the head of the subject with the closest tail; the subject feature vector includes the subject head vector and the subject tail vector;

[0052] The corresponding annotation strategy is as follows Figure 2 As shown; Figure 2 (a) Annotation examples extracted for the subject; Figure 2 (b) Annotation examples extracted for the relational dimension objects;

[0053] S4. Input the context semantic information feature vector obtained in step S2 and the subject feature vector obtained in step S3 into the relational attention module, thereby obtaining the attention feature vectors of the two branches; specifically comprising the following steps:

[0054] The context semantic information feature vector obtained in step S2 and the subject feature vector obtained in step S3 are input into the subject relationship attention module SRA; the subject relationship attention module SRA firstly converts the context semantic information feature vector F c and the subject feature vector F s The subject head vector and the subject tail vector in the channel level are connected respectively, and then the pixel level average operation is performed, and finally the context semantic information feature vector F is added. c Add pixel-level features to obtain fused features; then pass the fused features through the Dense layer, extract the global features and local features of two branches on the entire spatial features of the relationship channel, and obtain two attention feature vectors on the relationship channel; the feature extraction operation of one branch includes the global maximum pooling operation, reshape operation and two one-dimensional convolution operations in series; the feature extraction operation of the other branch includes the global average pooling operation, reshape operation and two one-dimensional convolution operations in series; the activation functions of the Dense layer and the convolution layer are both Sigmoid functions;

[0055] S5. Add the attention feature vectors of the two branches obtained in step S4, then obtain the activation vector through the activation function, and perform multiplication to obtain the weighted attention feature vector; specifically, add the attention feature vectors of the two branches obtained in step S4 at the pixel level, then obtain the activation vector through the Sigmoid activation function, and finally multiply it with the fusion feature to obtain the weighted attention feature vector;

[0056] The above process can be formally expressed as:

[0057]

[0058] F=F I *S(Con1D(R(GVP(D o )))+Con1D(R(GMP(D o ))))

[0059] Where F I is the fusion feature; F c is the contextual semantic information feature vector; is the subject feature vector F s The subject head vector in ; is the subject feature vector F sThe tail-body-head vector in the figure; C() is the connection operation function; Avg() is the pixel-level average operation function; D o is the output of the Dense layer; GMP() is the global maximum pooling operation function; GVP() is the global average pooling operation function; R() is the reshape operation function; Con1D() is two one-dimensional convolution operation functions; S() is the Sigmoid activation function; F is the weighted attention feature vector; the specific process is as follows Figure 3 As shown;

[0060] S6. Decode the weighted attention feature vector obtained in step S5 again to identify the object of each relationship dimension; specifically, the steps include:

[0061] The weighted attention feature vector obtained in step S5 is decoded by a decoder based on head and tail annotation to identify the object of each relationship dimension; the decoder based on head and tail annotation is a binary classification task after a dense layer, and an object head vector with a dimension of token length and an object tail vector with a dimension of token length are obtained respectively; the position corresponding to the beginning of an object in the object head vector is classified as 1, and the remaining positions are classified as 0; the position corresponding to the end of an object in the object tail vector is classified as 1, and the remaining positions are classified as 0; the matching mechanism for identifying the object is defined as combining the head of the object with the closest tail; the object feature vector includes the object head vector and the object tail vector;

[0062] S7. Perform relationship matching on the subject obtained in step S3 and the object obtained in step S6, so as to obtain the final relationship triplet; specifically, the steps include:

[0063] The loss function uses binary cross entropy loss, and the following formula is used as the total loss function L:

[0064]

[0065] Where α and β are the set weight coefficients; To obtain the classification loss of the subject's head vector, To obtain the classification loss of the subject tail vector, To obtain the classification loss for the object head vector, is the classification loss when obtaining the object tail vector.

[0066] Finally, the classic evaluation indicators precision (Prec.), regression (Rec.) and F1-score are used to measure the relationship triple extraction results; the calculation formula is:

[0067]

[0068]

[0069]

[0070] Where N precdict N is the total number of relation triplets predicted by the model; correct The total number of relation triplets predicted correctly by the model; N gold is the number of ground truth triplets in the training dataset;

[0071] The effect of the method of the present invention is further described below in conjunction with an embodiment:

[0072] For comparison, 5,000 and 703 sample data were collected from two public datasets, NYT and WebNLG, respectively. Each sample was a sentence of unstructured text data, and multiple relation triplets were manually calibrated as the corresponding Ground Truth.

[0073] The method of the present invention is compared with several existing methods, with extraction accuracy, recall rate and F1 score as evaluation criteria. The specific experimental data are shown in Table 1 and Table 2:

[0074] Table 1 Schematic diagram of comparative experimental results on NTY dataset

[0075] Comparison Method Accuracy (%) Recall rate (%) F1 score (%) Novel Tagging 62.4 31.7 42.0 CopyR-Mul 61.0 56.6 58.7 <![CDATA[GraphRel 2p ]]> 63.9 60.0 61.9 CopyMTL-Mul 75.7 68.7 72.0 CopyRRL 77.9 67.2 72.1 CasRel 89.7 89.5 89.6 Method of the present invention 92.3 91.5 91.9

[0076] Table 2 Schematic diagram of comparative experimental results on WebNLG dataset

[0077] Comparison Method Accuracy (%) Recall rate (%) F1 score (%) Novel Tagging 52.5 19.3 28.3 CopyR-Mul 37.7 36.4 37.1 GraphRel2p 44.7 41.1 42.9 CopyMTL-Mul 58.0 54.9 56.4 CopyRRL 63.3 59.9 61.6 CasRel 93.4 90.1 91.8 Method of the present invention 93.9 92.0 93.0

[0078] It can be seen from Table 1 and Table 2 that, under the same other conditions, the method of the present invention can improve the extraction accuracy of relation triples in terms of accuracy, recall rate and F1 score.

[0079] like Figure 4 The figure shows a method flow chart of the method for constructing an automatic question answering system of the present invention: the method for constructing an automatic question answering system including the relation triple joint extraction method provided by the present invention specifically comprises the following steps:

[0080] A. Obtain the text data to be used for relation triple extraction;

[0081] B. Using the above-mentioned relation triple joint extraction method, extract the relation triples in the text data obtained in step A;

[0082] C. Construct the corresponding knowledge graph based on the relationship triples obtained in step B;

[0083] D. Based on the knowledge graph obtained in step C, a rule-based matching method is used to build an automatic question-answering system based on the obtained knowledge graph.

[0084] The automatic question-and-answer system construction method provided by the present invention can be used in existing automatic question-and-answer occasions, such as the automatic consultation system of online shopping platforms (such as consultation on delivery time, consultation on refund policy, etc.), the automatic consultation system of bank outlets (operator business halls, etc.) (such as consultation on business processes, automatic number collection, etc.).

Claims

1. A method for joint extraction of relation triples, applied to an automatic question answering system, comprises the following steps: S1. Obtain a training data set, and generate an input feature vector based on the sentences in the training data set; specifically, obtain a training data set, and generate an input feature vector with a fixed length of 512 by using a word embedding method for the sentences in the training data set; the input feature vector includes a word embedding and a position embedding; S2. Input the input feature vector obtained in step S1 into the encoder to generate a contextual semantic information feature vector; specifically, input the input feature vector obtained in step S1 into the BERT bidirectional encoder to extract the contextual semantic information feature vector; In specific implementation, the following formula is used as the encoding operation formula of the encoder: h i =T(h i-1 ) Where h i is the context representation of the input sentence at layer i, and is the hidden state vector; T() is the operation function of the Transformer block; h0 is the output of the encoder, and h0 = W I , W I is the input feature vector obtained in step S1, and W I =W t +W p , W t is word embedding, W p for position embedding; S3. Decode the contextual semantic information feature vector obtained in step S2 to identify all possible subjects in the sentence and the corresponding subject feature vectors; S4. Input the context semantic information feature vector obtained in step S2 and the subject feature vector obtained in step S3 into the relation attention module, thereby obtaining the attention feature vectors of the two branches; S5. Add the attention feature vectors of the two branches obtained in step S4, then obtain the activation vector through the activation function, and perform multiplication to obtain the weighted attention feature vector; S6. Decode the weighted attention feature vector obtained in step S5 again to identify the object of each relationship dimension; S7. Perform relationship matching on the subject obtained in step S3 and the object obtained in step S6 to obtain the final relationship triplet.

2. The method for joint extraction of relation triples according to claim 1, characterized in that Step S3 of decoding the context semantic information feature vector obtained in step S2, thereby identifying all possible subjects in the sentence and the corresponding subject feature vectors, specifically includes the following steps: A cascaded head and tail labeling decoder is used to decode the contextual semantic information feature vector, so as to identify all possible subjects in the sentence and the corresponding subject feature vectors; the decoder is a binary classification task after a dense layer, and obtains a subject head vector with a dimension of token length and a subject tail vector with a dimension of token length respectively; the position corresponding to the beginning of a subject in the subject head vector is classified as 1, and the remaining positions are classified as 0; the position corresponding to the end of a subject in the subject tail vector is classified as 1, and the remaining positions are classified as 0; the matching mechanism for identifying the subject is defined as combining the head of the subject with the closest tail; the subject feature vector includes the subject head vector and the subject tail vector.

3. The method for joint extraction of relation triples according to claim 2, characterized in that Step S4, in which the contextual semantic information feature vector obtained in step S2 and the subject feature vector obtained in step S3 are input into the relational attention module, thereby obtaining the attention feature vectors of the two branches, specifically includes the following steps: The context semantic information feature vector obtained in step S2 and the subject feature vector obtained in step S3 are input into the subject relationship attention module SRA; the subject relationship attention module SRA firstly converts the context semantic information feature vector F c and the subject feature vector F s The subject head vector and the subject tail vector in are connected at the channel level, and then averaged at the pixel level, and finally combined with the original contextual semantic information feature vector F c Pixel-level addition is performed to obtain fused features; the fused features are then passed through a Dense layer, and the global features and local features of two branches are extracted on the entire spatial features on the relationship channel to obtain two attention feature vectors on the relationship channel; the feature extraction operation of one branch includes a global maximum pooling operation, a reshape operation, and two one-dimensional convolution operations connected in series; the feature extraction operation of the other branch includes a global average pooling operation, a reshape operation, and two one-dimensional convolution operations connected in series; the activation functions of the Dense layer and the convolution layer are both Sigmoid functions.

4. The method for joint extraction of relation triples according to claim 3 is characterized in that Step S5 adds the attention feature vectors of the two branches obtained in step S4, then obtains the activation vector through the activation function, and performs multiplication to obtain the weighted attention feature vector. Specifically, the attention feature vectors of the two branches obtained in step S4 are added at the pixel level, then the activation vector is obtained through the Sigmoid activation function, and finally multiplied with the fusion feature to obtain the weighted attention feature vector.

5. The method for joint extraction of relation triples according to claim 4 is characterized in that Step S6 further decodes the weighted attention feature vector obtained in step S5 to identify the object of each relationship dimension, which specifically includes the following steps: The weighted attention feature vector obtained in step S5 is decoded by a decoder based on head and tail annotation to identify the object of each relationship dimension; the decoder based on head and tail annotation is a binary classification task after a dense layer, and an object head vector with a dimension of token length and an object tail vector with a dimension of token length are obtained respectively; the position corresponding to the beginning of an object in the object head vector is classified as 1, and the remaining positions are classified as 0; the position corresponding to the end of an object in the object tail vector is classified as 1, and the remaining positions are classified as 0; the matching mechanism for identifying the object is defined as combining the head of the object with the closest tail; The object feature vector includes the object head vector and the object tail vector.

6. The method for joint extraction of relation triples according to claim 5, characterized in that Step S7 performs relationship matching on the subject obtained in step S3 and the object obtained in step S6, thereby obtaining a final relationship triplet, which specifically includes the following steps: The loss function uses binary cross entropy loss, and the following formula is used as the total loss function L: Where α and β are the set weight coefficients; To obtain the classification loss of the subject's head vector, To obtain the classification loss of the subject tail vector, To obtain the classification loss for the object head vector, is the classification loss when obtaining the object tail vector.

7. A method for constructing an automatic question answering system including the method for jointly extracting relation triples according to any one of claims 1 to 6, comprising the following steps: A. Obtain the text data to be used for relation triple extraction; B. Using the above-mentioned relation triple joint extraction method, extract the relation triples in the text data obtained in step A; C. Construct the corresponding knowledge graph based on the relationship triples obtained in step B; D. Based on the knowledge graph obtained in step C, a rule-based matching method is used to build an automatic question-answering system based on the obtained knowledge graph.