Text relation extraction method and device, computer storage medium, and electronic device

Through multiple syntax parsers and word vector acquisition models, combining sliding window long short-term memory network and graph convolution model, the accuracy problem of text relationship extraction in the existing technology is solved, and more efficient text relationship triple extraction is achieved.

CN114492380BActive Publication Date: 2025-08-12HANGZHOU NETEASE CLOUD MUSIC TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210128348.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-11
Publication Date
2025-08-12
Estimated Expiration
2042-02-11

AI Technical Summary

Technical Problem

The existing graph-long short-term memory networks and graph convolutional neural networks have limitations in text relationship extraction. Graph-long short-term memory networks lack global information expression and graph structure display, while graph-convolutional neural networks rely on dependency syntax relationship graphs with low accuracy, resulting in low accuracy in relation extraction.

Method used

By inputting the pending text into multiple syntax parsers, obtaining multiple parsing results, and using word vectors to obtain the model generated word vector matrix, inputting it into a long and short-term memory network containing a sliding window, combining the graph convolution model and self-attention mechanism, extracting text relationship triplets.

Benefits of technology

It improves the accuracy and efficiency of text relationship extraction, enhances the fault tolerance of information, integrates context information and sentence structure information, and improves the parallelism and training efficiency of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114492380B_ABST
    Figure CN114492380B_ABST
Patent Text Reader

Abstract

The embodiments of the present disclosure relate to the field of computer technology, and more specifically, the embodiments of the present disclosure relate to a method and apparatus for extracting text relations, a computer storage medium, and an electronic device. The method comprises: obtaining a text to be processed, inputting the text to be processed into a plurality of syntactic parsers to obtain a plurality of parsing results; inputting the plurality of parsing results into a word vector acquisition model respectively to obtain a word vector matrix corresponding to each parsing result; inputting the word vector matrix corresponding to each parsing result into a long short-term memory network containing a sliding window to obtain an initial hidden layer corresponding to each parsing result; inputting the initial hidden layer corresponding to each parsing result into a graph convolution model to obtain a target convolution feature, pooling the target convolution feature to obtain a target pooling feature, and obtaining the text relationship triples included in the text to be processed through the target pooling feature. This method improves the accuracy and efficiency of text relationship extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of computer technology, and more specifically, to a text relationship extraction method and apparatus, a computer storage medium, and an electronic device. Background Art

[0002] This section is intended to provide a background or context to the embodiments of the disclosure that are recited in the claims, and no statement herein is admitted to be prior art by inclusion in this section.

[0003] Information extraction is a crucial task in natural language processing, particularly in today's information explosion. The purpose of information extraction lies in extracting useful information from massive amounts of unstructured text and structuring it into a format suitable for downstream processing. Information extraction can be categorized into entity extraction, relationship extraction, and event extraction. Relationship extraction involves extracting semantic relationships from text, typically between two or more entities. Current technologies can implement text relationship extraction using graph-based long short-term memory networks (GLSTMs) or graph convolutional neural networks (GCNNs). GLSTMs utilize a dependency syntactic tree to convert the entire text tree to a graph in the form of an adjacency matrix, and then use the GLSTM network to extract relationships. Graph convolutional neural networks (GCNNs) extract text relationships by directly converting sentence information from the text into a graph and feeding it into the GCNN's relationship extraction model. Summary of the Invention

[0004] However, in the current relationship extraction methods, on the one hand, the graph-based long short-term memory network can retain the original graph structure, but the graph-based long short-term memory network is a local sequence model that lacks the expression of global information, and the graph-based long short-term memory network cannot well display the graph structure information; on the other hand, the accuracy of the graph convolutional neural network depends on the dependency graph formed by the dependency syntactic relationship. Due to the diversity of data information, the accuracy of the obtained dependency syntactic tree is low, resulting in low prediction accuracy of the graph convolutional neural network.

[0005] To this end, there is a great need for an improved text relationship extraction method and device, computer storage medium and electronic device to provide a text relationship extraction method that can improve the accuracy of relationship extraction.

[0006] In this context, embodiments of the present disclosure are intended to provide a text relationship extraction method and apparatus, a computer storage medium, and an electronic device.

[0007] According to one aspect of the present disclosure, a text relationship extraction method is provided, comprising:

[0008] Obtaining a text to be processed, inputting the text to be processed into a plurality of syntactic parsers, and obtaining a plurality of parsing results corresponding to the plurality of syntactic parsers, wherein each parsing result includes at least one word segmentation;

[0009] Input the multiple parsing results into the word vector acquisition model respectively to obtain a word vector matrix corresponding to each parsing result;

[0010] Inputting the word vector matrix corresponding to each parsing result into a long short-term memory network including a sliding window to obtain an initial hidden layer corresponding to each parsing result;

[0011] The initial hidden layer corresponding to each parsing result is input into the graph convolution model to obtain a target convolution feature, the target convolution feature is pooled to obtain a target pooled feature, and the text relationship triples included in the text to be processed are obtained through the target pooled feature.

[0012] In an exemplary embodiment of the present disclosure, the text to be processed is input into a plurality of syntactic parsers to obtain a plurality of parsing results corresponding to the plurality of syntactic parsers, including:

[0013] Inputting the text to be processed into a plurality of syntactic parsers to obtain a plurality of syntactic parse trees corresponding to the syntactic parsers respectively;

[0014] A plurality of parsing results respectively corresponding to the plurality of syntactic parsers are obtained through the plurality of syntactic parsing trees.

[0015] In an exemplary embodiment of the present disclosure, the plurality of parsing results are respectively input into a word vector acquisition model to obtain a word vector matrix corresponding to each of the parsing results, including:

[0016] Obtaining the length of each parsing result, and adjusting the length of each parsing result to a preset length;

[0017] The word segments included in each parsing result after length adjustment are respectively input into the word vector acquisition model to obtain a word vector matrix corresponding to each parsing result.

[0018] In an exemplary embodiment of the present disclosure, the word vector matrix corresponding to each parsing result is input into a long short-term memory network including a sliding window to obtain an initial hidden layer corresponding to each parsing result, including:

[0019] Obtain all the participles included in each parsing result, as well as the context participles of each participle in all the participles;

[0020] Generate a context word vector for each word segment according to the word vector of each word segment in the word vector matrix and the word vectors of the above and below words segment of each word segment;

[0021] The word vector of each word segmentation and the context word vector of each word segmentation are respectively input into the long short-term memory network containing the sliding window to obtain an initial hidden layer corresponding to each parsing result.

[0022] In an exemplary embodiment of the present disclosure, the context-based long short-term memory network includes: a forget gate, an input gate, an output gate, a left gate and a right gate; wherein the left gate controls the word vector of the previous word of each word in all the word segmentations to flow into the current unit; the right gate controls the word vector of the following word segmentation of each word in all the word segmentations to flow into the current unit.

[0023] In an exemplary embodiment of the present disclosure, the graph convolution model includes a graph convolutional neural network and a self-attention mechanism; wherein the initial hidden layer corresponding to each parsing result is input into the graph convolution model to obtain the target convolution feature, including:

[0024] Obtaining a syntactic parse tree corresponding to each parsing result, converting the syntactic parse tree into an adjacency matrix, and inputting the adjacency matrix and the initial hidden layer corresponding to each parsing result into the graph convolutional neural network to obtain a target hidden layer corresponding to each parsing result;

[0025] Obtaining dependency relationships of the word segments included in each parsing result, and obtaining a relationship feature matrix of each parsing result based on the dependency relationships and the self-attention mechanism;

[0026] The adjacency matrix is replaced by the relationship feature matrix, and the relationship feature matrix and the target hidden layer corresponding to each parsing result are input into the graph convolutional neural network again to obtain the target convolution feature corresponding to each parsing result.

[0027] In an exemplary embodiment of the present disclosure, the dependency relationship of the word segments included in each parsing result is obtained, and a relationship feature matrix of each parsing result is obtained based on the dependency relationship and the self-attention mechanism, including:

[0028] Generate a relational attention matrix according to the dependency relationship of the word segments included in each parsing result and the self-attention mechanism;

[0029] Performing matrix multiplication on the relational attention matrix and the target hidden layer corresponding to each parsing result to obtain a multiplication result;

[0030] The multiplication result and the target hidden layer corresponding to each parsing result are element-summed to obtain a relational feature matrix of each parsing result.

[0031] In an exemplary embodiment of the present disclosure, the adjacency matrix is replaced by the relationship feature matrix, and the relationship feature matrix and the target hidden layer corresponding to each parsing result are input into the graph convolutional neural network again to obtain the target convolution feature corresponding to each parsing result, including:

[0032] Replacing the adjacency matrix with the relationship feature matrix, and obtaining a target hidden layer of the parsing result corresponding to the relationship feature matrix;

[0033] Inputting the relationship feature matrix corresponding to each parsing result and the target hidden layer into the graph convolutional neural network again to obtain an enhanced feature matrix corresponding to each parsing result;

[0034] Feature fusion is performed on the multiple enhanced feature matrices corresponding to the multiple parsing results to obtain the target convolution feature.

[0035] In an exemplary embodiment of the present disclosure, the target convolution feature is pooled to obtain a target pooled feature, and the text relation triples included in the to-be-processed text are obtained through the target pooled feature, including:

[0036] Obtaining entity location information included in the text to be processed, and performing pooling based on the entity location information to obtain entity feature information;

[0037] Pooling the target convolutional features to obtain feature pooling information, and concatenating the entity feature information with the feature pooling information to obtain the target pooling features corresponding to the text to be processed;

[0038] Inputting the target pooling feature corresponding to the text to be processed into a feedforward neural network to obtain a target feature corresponding to the text to be processed, and inputting the target feature into a classifier to obtain a relationship probability distribution of the segmentations included in the text to be processed;

[0039] The text relationship triples included in the text to be processed are obtained through the relationship probability distribution of the word segments.

[0040] According to one aspect of the present disclosure, a text relationship extraction device is provided, comprising:

[0041] A syntactic parsing module, configured to obtain a text to be processed, input the text to be processed into a plurality of syntactic parsers, and obtain a plurality of parsing results corresponding to the plurality of syntactic parsers, wherein each parsing result includes at least one word segmentation;

[0042] A word vector matrix acquisition module, configured to input the plurality of parsing results into a word vector acquisition model respectively to obtain a word vector matrix corresponding to each of the parsing results;

[0043] A hidden layer acquisition module, configured to input the word vector matrix corresponding to each parsing result into a long short-term memory network including a sliding window to obtain an initial hidden layer corresponding to each parsing result;

[0044] The text relationship extraction module is used to input the initial hidden layer corresponding to each parsing result into the graph convolution model to obtain target convolution features, pool the target convolution features to obtain target pooling features, and obtain the text relationship triples included in the text to be processed through the target pooling features.

[0045] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned text relationship extraction method is implemented.

[0046] According to one aspect of the present disclosure, there is provided an electronic device, including:

[0047] processor; and

[0048] a memory for storing executable instructions of the processor;

[0049] The processor is configured to execute any one of the above-mentioned text relationship extraction methods by executing the executable instructions.

[0050] According to the text relationship extraction method implemented in the present disclosure, on the one hand, a text to be processed, such as a sentence, is obtained, and the text to be processed is input into multiple syntactic parsers to obtain multiple parsing results. Subsequent calculations are performed based on the multiple parsing results, and rich dependency syntactic information is utilized to prevent the singleness and limitations of the construction of a single dependency syntactic tree. The problem of low accuracy of relationship extraction caused by relationship extraction based on a single dependency syntactic tree in the prior art is solved, the fault tolerance of information is enhanced, and the accuracy of relationship extraction is improved. On the other hand, after obtaining multiple parsing results, for each parsing result, the parsing result is respectively input into the word vector acquisition model to obtain the word vector of each word included in each parsing result. The word vector matrix corresponding to each parsing result is input into a long short-term memory network containing a sliding window to obtain an initial hidden layer corresponding to each parsing result. The context information of each word segmentation in the parsing result can be input into the network through the long short-term memory network containing a sliding window, which can better integrate the left and right context information and the sentence structure information to show better performance. On the other hand, the obtained initial hidden layer is input into the graph convolution model to obtain the target convolution feature, and the text relationship triple of the text to be processed is obtained through the target convolution feature. The graph convolution model improves the utilization of graph structure information, improves the parallelism of the model and the training efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings, in which several embodiments of the present disclosure are shown by way of example and not limitation, wherein:

[0052] Figure 1 The following schematically shows a flow chart of a text relationship extraction method according to an embodiment of the present disclosure;

[0053] Figure 2 A flowchart of a method for inputting a text to be processed into multiple syntactic parsers to obtain multiple parsing results according to an embodiment of the present disclosure is schematically shown;

[0054] Figure 3 A flowchart schematically illustrates a method for inputting multiple parsing results into a word vector acquisition model to obtain a word vector matrix corresponding to each parsing result according to an embodiment of the present disclosure;

[0055] Figure 4 Schematically shows a schematic diagram of a long short-term memory network including a sliding window according to an embodiment of the present disclosure;

[0056] Figure 5A flowchart schematically illustrates a method for inputting a word vector matrix of a word segment included in each parsing result into a long short-term memory network including a sliding window to obtain an initial hidden layer of the parsing result according to an embodiment of the present disclosure;

[0057] Figure 6 A flowchart schematically illustrates a method for inputting an initial hidden layer corresponding to each parsing result into a graph convolution model to obtain target convolution features according to an embodiment of the present disclosure;

[0058] Figure 7 A flowchart schematically illustrates a method for obtaining a relational feature matrix of each parsing result based on the dependency relationship of the word segments included in each parsing result and a self-attention mechanism according to an embodiment of the present disclosure;

[0059] Figure 8 A flowchart schematically illustrates a method for inputting a slice relationship feature matrix and a target hidden layer into a graph convolutional neural network to obtain target convolution features corresponding to each parsing result according to an embodiment of the present disclosure;

[0060] Figure 9 A flowchart of a method for obtaining text relation triples included in a to-be-processed text by using target pooling features according to an embodiment of the present disclosure is schematically shown;

[0061] Figure 10 Schematically shows a block diagram of a text relationship extraction device according to an embodiment of the present disclosure;

[0062] Figure 11 A schematic diagram of a computer storage medium according to an embodiment of the present disclosure is shown;

[0063] Figure 12 A block diagram of an electronic device according to a disclosed embodiment is schematically shown.

[0064] In the drawings, the same or corresponding reference numerals denote the same or corresponding parts. DETAILED DESCRIPTION

[0065] The principles and spirit of the present disclosure will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided solely to enable those skilled in the art to better understand and implement the present disclosure, and are not intended to limit the scope of the present disclosure in any way. Rather, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.

[0066] Those skilled in the art will appreciate that the embodiments of the present disclosure may be implemented as a system, apparatus, device, method, or computer program product. Therefore, the present disclosure may be implemented in the following forms: entirely in hardware, entirely in software (including firmware, resident software, microcode, etc.), or in a combination of hardware and software.

[0067] According to an embodiment of the present disclosure, a text relationship extraction method, a text relationship extraction device, a computer storage medium, and an electronic device are provided.

[0068] In this document, any number of elements in the drawings is for illustration and not for limitation, and any naming is for distinction only and does not have any limiting meaning.

[0069] The principles and spirit of the present disclosure are described in detail below with reference to several representative embodiments of the present disclosure. SUMMARY OF THE INVENTION

[0071] The present inventors have discovered that text relationship extraction through graph-based long short-term memory networks mainly constructs the input graph into an independent state, with the nodes in the graph being sub-states. The long short-term memory network is used to iteratively train the states on the graph, allowing each word in the text to be processed to exchange information through dependency relationships, and each word node receives information from a larger range of nodes. The long short-term memory network can retain the original graph structure and avoid information loss. However, the graph-based long short-term memory network is a sequence-based model that lacks the expression of global information and cannot display graph structure information well. When text relationship extraction is performed through graph convolutional neural networks, compared with graph-based long short-term memory networks, graph convolutional neural networks can learn larger graph topology information, and at the same time can introduce an attention mechanism to enhance the dependency between nodes, and can filter out redundant noise and retain more relevant information. However, the accuracy of the graph convolutional neural network is highly dependent on the dependency graph formed by the dependency syntactic relationship. Due to the diversity of data information, the accuracy of the obtained dependency syntactic tree is low, resulting in low prediction accuracy of the graph convolutional neural network.

[0072] In view of the above content, the basic idea of the present disclosure is: according to the text relationship extraction method and text relationship extraction device of the embodiment of the present disclosure, first, the text to be processed is input into multiple syntactic parsers to obtain multiple parsing results. After obtaining multiple parsing results, each parsing result is input into the word vector acquisition model to obtain the word vector of the word segmentation included in each parsing result and the word vector matrix corresponding to the parsing result. The word vector matrix corresponding to the parsing result is input into a long short-term memory network containing a sliding window to obtain an initial hidden layer corresponding to each parsing result. Finally, the initial hidden layer is input into the graph convolution model to obtain the target convolution feature of the text to be processed, the target convolution feature of the text to be processed is pooled to obtain the target pooling feature, and the text relationship triples included in the text to be processed are obtained through the target pooling feature.

[0073] After introducing the basic principles of the present disclosure, various non-limiting embodiments of the present disclosure are described in detail below.

[0074] Exemplary Methods

[0075] The following combination Figure 1 The text relationship extraction method according to an exemplary embodiment of the present disclosure is described below.

[0076] refer to Figure 1 , the text relationship extraction method may include the following steps:

[0077] S1. Obtain a text to be processed, input the text to be processed into multiple syntactic parsers, and obtain multiple parsing results corresponding to the multiple syntactic parsers, wherein each parsing result includes at least one word segmentation;

[0078] S2. Input the multiple parsing results into the word vector acquisition model respectively to obtain a word vector matrix corresponding to each parsing result;

[0079] S3. Inputting the word vector matrix corresponding to each parsing result into a long short-term memory network including a sliding window to obtain an initial hidden layer corresponding to each parsing result;

[0080] S4. Input the initial hidden layer corresponding to each parsing result into the graph convolution model to obtain target convolution features, pool the target convolution features to obtain target pooling features, and obtain the text relationship triples included in the text to be processed through the target pooling features.

[0081] In the text relationship extraction method of the embodiment of the present invention, on the one hand, a text to be processed, such as a sentence, is obtained, and the text to be processed is input into multiple syntactic parsers to obtain multiple parsing results. Subsequent calculations are performed based on the multiple parsing results, and rich dependency syntactic information is utilized to prevent the singleness and limitations of the construction of a single dependency syntactic tree, thereby solving the problem of low accuracy of relationship extraction caused by relationship extraction based on a single dependency syntactic tree in the prior art, enhancing the fault tolerance of information and improving the accuracy of relationship extraction; on the other hand, after obtaining multiple parsing results, for each parsing result, the parsing result is respectively input into the word vector acquisition model to obtain the word vector of each word included in each parsing result. The word vector matrix corresponding to each parsing result is input into a long short-term memory network containing a sliding window to obtain an initial hidden layer corresponding to each parsing result. The context information of each word segmentation in the parsing result can be input into the network through the long short-term memory network containing a sliding window, which can better integrate the left and right context information and the sentence structure information to show better performance. On the other hand, the obtained initial hidden layer is input into the graph convolution model to obtain the target convolution feature, and the text relationship triple of the text to be processed is obtained through the target convolution feature. The graph convolution model improves the utilization of graph structure information, improves the parallelism of the model and the training efficiency.

[0082] In step S1, a text to be processed is obtained, and the text to be processed is input into a plurality of syntactic parsers to obtain a plurality of parsing results corresponding to the plurality of syntactic parsers, wherein each parsing result includes at least one word segmentation.

[0083] In an exemplary embodiment of the present disclosure, the text to be processed is obtained by preprocessing the initial text. The source of the initial text can be on-site data or off-site data. Among them, on-site data is mainly tables with simple data relationships; off-site data is mainly data crawled from websites, with complex and diverse text forms, and it is difficult to extract text relationships. In this exemplary embodiment, the source of the initial text is off-site data. After obtaining the initial text, the preprocessing of the initial text may include: obtaining the initial text, segmenting the initial text, removing paragraphs with inconsistent formats in the initial text, and ensuring the uniform format of the sentences in the initial text; after segmenting the initial text, processing missing values in the initial text, determining the range of missing values in the initial text, calculating the missing ratio of each field, determining the method for processing missing values based on the missing ratio, and removing unnecessary fields, as well as cleaning the initial text for logical errors, deduplicating the initial text, and removing unreasonable values in the initial text; finally, performing correlation verification on the initial text, associating the unstructured data in the initial text with the structured data in the site, obtaining the text to be processed, and ensuring the accuracy of the data.

[0084] In an exemplary embodiment of the present disclosure, after obtaining the text to be processed, referring to Figure 2 As shown, the text to be processed is input into multiple syntactic parsers to obtain multiple parsing results corresponding to the multiple syntactic parsers respectively, which may include step S21 and step S22:

[0085] Step S21. Inputting the text to be processed into multiple syntactic parsers to obtain multiple syntactic parse trees corresponding to the syntactic parsers respectively;

[0086] Step S22: Obtain multiple parsing results corresponding to the multiple syntactic parsers respectively through the multiple syntactic parsing trees.

[0087] In the following, step S21 and step S22 will be explained and illustrated. Specifically, first, after obtaining the text to be processed, such as a sentence, the text to be processed is input into multiple syntactic parsers, and multiple syntactic parsing trees are obtained through multiple syntactic parsers; wherein, the syntactic parsing tree represents the grammatical structure of the sentence as a tree structure that is easier to understand, and the words in the sentence are segmented by analyzing the part of speech, grammatical structure, and syntactic structure of the sentence, divided into nodes, and the dependency relationship between the nodes is established; then, multiple parsing results are obtained through multiple syntactic parsing trees. Among them, the number of syntactic parsers can be 2 or 3, and the number of syntactic parsers is not specifically limited in this example embodiment. The multiple parsers are different parsers, and can be a transfer-based dependency parser, DDParser (Baidu Dependency Parser), StanfordParser (an open-source parser developed by the Stanford University Natural Language Processing Group), or LTP (Language Technology Platform). In this example embodiment, the type of parser is not specifically limited. In this example embodiment, the text to be processed is parsed by multiple parsers, which improves the accuracy of dependency syntactic tree construction and the accuracy of relationship extraction.

[0088] In step S2, the multiple parsing results are respectively input into the word vector acquisition model to obtain a word vector matrix corresponding to each parsing result.

[0089] In the exemplary embodiment of the present disclosure, the word vector acquisition model can be Skip-gram (a model of Word2vec), BERT (Bidirectional Encoder Representation from Transformers, a bidirectional encoder of Transformer), or GloVe (Global Vectors for for word representation, a word representation tool based on global word frequency statistics). In this exemplary embodiment, the word vector acquisition model is not specifically limited. Figure 3 As shown, in this embodiment, the multiple parsing results are respectively input into the word vector acquisition model to obtain the word vector matrix corresponding to each parsing result, which may include steps S31 and S32:

[0090] Step S31. Obtain the length of each parsing result, and adjust the length of each parsing result to a preset length;

[0091] Step S32. Input the word segments included in each parsing result after adjusting the length into the word vector acquisition model respectively to obtain the word vector matrix corresponding to each parsing result.

[0092] In the following, step S31 and step S32 will be explained and illustrated. Specifically, after obtaining multiple parsing results through multiple syntactic parsers, there may be inconsistent numbers of word segments included in each parsing result of the same sentence. Therefore, first, the length of the parsing result input into the word vector acquisition model is adjusted, and the length of each parsing result is adjusted to a preset length, wherein the length of the parsing result in this embodiment is the number of word segments included in a sentence after being parsed by the syntactic parser. The preset length can be adjusted based on experience. In this example embodiment, the preset length is not specifically limited; adjusting the length of the parsing result may include: when the length of the parsing result is greater than the preset length, cutting off the word segments after the preset length in the parsing result; when the length of the parsing result is less than the preset length, padding the parsing result with zeros; after obtaining multiple parsing results of the same length, for each parsing result, the word segments included in the parsing result are respectively input into the word vector acquisition model to obtain the word vector of each word segment in the parsing result, and according to the word vectors of all word segments included in each parsing result, a word vector matrix corresponding to each parsing result is obtained.

[0093] For example, when the word vector acquisition model is Skip-gram, the Skip-gram model is a type of Word2Vec (a language model in natural language processing). The Skip-gram model uses a word as input to predict the context of the word. Its optimization goal is:

[0094]

[0095] Among them, w j is the central word, w is any participle in the parsing result; p(w∨w j )for

[0096]

[0097] In order to reduce the amount of parameter training and improve the quality of word vectors, the Skip-gram model uses negative sampling technology, that is, sampling high-frequency words to reduce the number of training samples. This method only updates a part of the model parameters, reducing the amount of model calculation and improving the model calculation efficiency.

[0098] In step S3, the word vector matrix corresponding to each parsing result is input into a long short-term memory network containing a sliding window to obtain an initial hidden layer corresponding to each parsing result.

[0099] In an exemplary embodiment of the present disclosure, the long short-term memory network including the sliding window is a long short-term memory network whose input data includes context data; Figure 4 As shown, the input data of the long short-term memory network containing a sliding window is the word vector of each word segmentation and the context word vector of each word segmentation; it includes an input gate, an output gate, a forget gate, a left gate and a right gate; among which, the input gate selectively records new information into the state of the cell; the output gate outputs the output value of the hidden state, and the forget gate selectively forgets certain information in the cell state; the left gate is used to control the word vector of the previous word segmentation of each word segmentation to flow into the current unit; the right gate is used to control the word vector of the following word segmentation of each word segmentation to flow into the current unit.

[0100] In the exemplary embodiment of the present disclosure, referring to Figure 5 As shown, the word vector matrix corresponding to each parsing result is input into a long short-term memory network containing a sliding window to obtain an initial hidden layer corresponding to each parsing result, which may include steps S51 to S53:

[0101] Step S51: Obtain all the segmented words included in each parsing result, as well as the context segmented words of each segmented word in all the segmented words;

[0102] Step S52. Generate a context word vector for each word segmentation based on the word vector of each word segmentation in the word vector matrix and the word vectors of the preceding and following words of each word segmentation;

[0103] Step S53. Input the word vector of each word segmentation and the context word vector of each word segmentation into the long short-term memory network containing the sliding window to obtain an initial hidden layer corresponding to each parsing result.

[0104] The following will further explain and illustrate steps S51 to S53. Specifically, each word segmentation and the context segmentation of each word segmentation included in each parsing result are obtained; then, the context word vector ε of each word segmentation is generated based on the word vector matrix of the parsing result and the word vector of the context segmentation of each word segmentation. j =[x j-1 ,x j ,x j+1 ], where ε j The context word vector for each word segmentation; x j is the word vector of any word included in the word vector matrix of the parsing result; x j-1 The word vector of the previous word of any word included in the word vector matrix of the parsing result; x j+1 The word vector of the following word of any word included in the word vector matrix of the parsing result; after generating the context word vector of each word, the word vector of each word included in the word vector matrix of each parsing result and the context word vector of each word are used as input and input into the long short-term memory network containing the sliding window to obtain the initial hidden layer corresponding to each parsing result.

[0105] For the initial state without information exchange, the state of each word segmentation can directly obtain the sliding window information features. During the information exchange process, the hidden state of each word segmentation is synchronized with the hidden state of the context word segmentation:

[0106]

[0107]

[0108] in, is the input hidden layer of any word segmentation at the current moment; is the input hidden layer of any word segmentation at the previous moment; are the input hidden layers of the previous segmentation and the following segmentation of any segmentation at the previous moment; is the output hidden layer of any word segmentation at the current moment; is the output hidden layer of any word segmentation at the previous moment; are the output hidden layers of the previous segmentation and the following segmentation of any segmentation at the previous moment; Figure 4 Schematic diagram of a long short-term memory network with a sliding window, shown in the left door Control the cell state of the previous word of any word to flow into the current unit; in the right gate Control the cell state of the following word of any word at the previous moment to flow into the current unit. The initial hidden layer corresponding to each parsing result is obtained through the long short-term memory network containing the sliding window

[0109]

[0110] o t For the cell state from the current cell To hidden state The output gate;

[0111]

[0112] is the in-degree word vector of any word segmentation, Among them, E input (j) is the set of in-degree word vectors of any participle, that is, the set of in-edges of any participle; is the word vector of any word segmentation; is the out-degree word vector of any word segmentation, Among them, E output (j) is the set of out-degree word vectors of any word, that is, the set of outgoing edges of any word; is the word vector of any word segmentation; is the input hidden layer of the current unit of any word segmentation at the previous moment, is the output hidden layer of any word segmentation at the previous moment, ε j is the context word vector of any word segmentation, W o 、U o 、V o Both are weight indicators, b o is the deviation vector.

[0113]

[0114] For the left door, is the cell state of the previous participle of any participle at the previous moment, For the Gate of Forgetfulness, is the cell state of any participle at the previous moment, For the right door, is the cell state of the following participle of any participle at the previous moment, is the output of the Sigmoid layer in the input gate, is the output of the tanh layer in the input gate.

[0115]

[0116]

[0117]

[0118]

[0119]

[0120] W l 、U l 、V l , W f 、U f 、V f , W r 、U r 、V r , W i 、U i 、V i , W u 、U u 、V u Both are weight indicators, b l 、b f 、b r 、b i 、b u is the deviation vector.

[0121] Normally, in order to obtain the contextual information of the text, the model often introduces a long short-term memory network, which is a special structure of RNN (Recurrent Neural Network). The advantage of the long short-term memory network is that it solves the problem of gradient disappearance and explosion in the case of long sentence dependencies, but the parallelism of the long short-term memory network is not high, and it is a sequence model, so there may be information missing problems; in this example implementation, the sliding window idea is introduced. Compared with the gate-level idea of the original long short-term memory network, the long short-term memory network containing the sliding window has added a left gate and a right gate to control the information from any word segmentation context, and uses the sequence characteristics to update the current unit. Compared with the traditional long short-term memory network, this solution can better integrate the context information and the sentence structure information, and show better performance.

[0122] In step S4, the initial hidden layer corresponding to each parsing result is input into the graph convolution model to obtain the target convolution feature, the target convolution feature is pooled to obtain the target pooling feature, and the text relationship triples included in the text to be processed are obtained through the target pooling feature.

[0123] In the exemplary embodiment of the present disclosure, the graph convolution model includes a graph convolutional neural network (GCN) and a self-attention mechanism. The graph in the graph convolutional neural network refers to a relationship topology diagram established by vertices and edges, and the features of the adjacent nodes of each vertex are aggregated in the form of convolution. The self-attention mechanism is a type of attention mechanism, and its core is to calculate the weight of the current node to the current node, fully considering the semantic and grammatical connections between different words in the sentence. Figure 6 As shown, the initial hidden layer corresponding to each parsing result is input into the graph convolution model to obtain the target convolution feature, which may include steps S61 to S63:

[0124] Step S61. Obtain a syntactic parse tree corresponding to each parsing result, convert the syntactic parse tree into an adjacency matrix, and input the adjacency matrix and the initial hidden layer corresponding to each parsing result into the graph convolutional neural network to obtain a target hidden layer corresponding to each parsing result;

[0125] Step S62: Obtain the dependency relationship of the word segments included in each parsing result, and obtain the relationship feature matrix of each parsing result based on the dependency relationship and the self-attention mechanism;

[0126] Step S63. Use the relationship feature matrix to replace the adjacency matrix, and input the relationship feature matrix and the target hidden layer corresponding to each analysis result into the graph convolutional neural network again to obtain the target convolution feature corresponding to each analysis result.

[0127] Below, steps S61 to S63 will be further explained and illustrated. Specifically, for the graph convolutional neural network, hidden layer expression and adjacency matrix are required as input. Therefore, first, the syntactic parse tree corresponding to each parsing result is obtained, the syntactic parse tree is converted into an adjacency matrix, the converted adjacency matrix and the initial hidden layer corresponding to the parsing result are used as the input of the graph convolutional neural network, and are input into the graph convolutional neural network to obtain the target hidden layer corresponding to each parsing result; when a parsing result contains n word segmentations, the syntactic parse tree corresponding to the parsing result can be converted into an n*n adjacency matrix A. n*n , when there is an edge between participle a and participle b, A ab=1, when there is no edge between any two words, the value is 0. Target hidden layer It can be expressed as:

[0128]

[0129] in, is a nonlinear function, which may be a ReLU (Linear Rectification Function). In this exemplary embodiment, the nonlinear function is not specifically limited. (m) is a linear transformation, b (m) is the bias term. In the expression of the target hidden layer, we can get that during the graph convolution process, each word collects and summarizes information from its neighboring words; the initial state The corresponding input is the initial hidden layer of each parsing result.

[0130] Then, since the weights of the edges in the initial adjacency matrix are consistent, the efficiency of the model learning edges is low. Therefore, the self-attention mechanism can be used to help the edges in the topological graph adaptively obtain weight information, that is, obtain the dependency relationship of the segmented words included in the parsing result, and according to the dependency relationship between the segmented words, the self-attention mechanism is used to obtain the relationship feature matrix of each parsing result; finally, the adjacency matrix is replaced by the relationship feature matrix, and the relationship feature matrix and the target hidden layer are input into the graph convolutional neural network again as input to obtain the target convolution feature of each parsing result.

[0131] For further reference, Figure 7 As shown, obtaining the dependency relationship of the word segments included in each parsing result, and obtaining the relationship feature matrix of each parsing result based on the dependency relationship and the self-attention mechanism may include steps S71 to S73:

[0132] Step S71. Generate a relational attention matrix based on the dependency relationship of the word segments included in each parsing result and the self-attention mechanism;

[0133] Step S72: performing matrix multiplication on the relational attention matrix and the target hidden layer corresponding to each parsing result to obtain a multiplication result;

[0134] Step S73: performing element-wise summation on the multiplication result and the target hidden layer corresponding to each parsing result to obtain a relational feature matrix for each parsing result.

[0135] Below, steps S71 to S73 will be further explained and illustrated. Specifically, first, a relational attention matrix is generated based on the dependency relationship of the word segments included in the parsing result. The relationship between different word segments is learned by the self-attention mechanism. Specifically, the relational attention matrix is calculated through the softmax layer; then, matrix multiplication is performed on the relational attention matrix and the target hidden layer of each parsing result to obtain the multiplication result; finally, the elements are summed between the multiplication result and the target hidden layer to obtain the relational feature matrix of each parsing result. The relationship between different word segments a and b can be expressed by P ab or P ba To express, the relationship between different participles can be obtained by the dot product of the word vectors of different participles;

[0136]

[0137] Among them, P a is the position of word a in the relation attention matrix, P b is the position of word b in the relational attention matrix, and the relational feature matrix of each parsing result can be expressed as Among them, α starts learning from 0, C j The target hidden layer for any parsing result. The relational feature matrix of each parsing result contains the dependency information between all the word segments included in the parsing result. This can capture richer semantic information from the processed text and enable the model to learn the strength of the association between word segments, improving the model's ability to discriminate between word segments.

[0138] In further reference Figure 8 As shown, the adjacency matrix is replaced by the relationship feature matrix, and the relationship feature matrix and the target hidden layer corresponding to each parsing result are input into the graph convolutional neural network again to obtain the target convolution feature corresponding to each parsing result. The process may include steps S81 to S83:

[0139] Step S81: replacing the adjacency matrix with the relationship feature matrix, and obtaining a target hidden layer of the parsing result corresponding to the relationship feature matrix;

[0140] Step S82: Inputting the relationship feature matrix corresponding to each parsing result and the target hidden layer into the graph convolutional neural network again to obtain an enhanced feature matrix corresponding to each parsing result;

[0141] Step S83: Perform feature fusion on the multiple enhanced feature matrices corresponding to the multiple parsing results to obtain the target convolution feature.

[0142] The following will further explain and illustrate steps S81 to S83. Specifically, after obtaining the relationship feature matrix corresponding to each parsing result, the relationship feature matrix can be used to replace the previous adjacency matrix, and the relationship feature matrix corresponding to the parsing result and the target hidden layer can be used as input to the graph convolutional neural network again to obtain the enhanced feature matrix corresponding to each parsing result. Finally, the enhanced feature matrices corresponding to each parsing result are fused to obtain the target convolution features of the text to be processed. The Hadamard product can be used to fuse the enhanced feature matrices of each parsing result. When there are n parsing results for the text to be processed, the matrix dot product is performed on the enhanced feature matrices corresponding to each parsing result to obtain the target convolution features of the text to be processed. The target convolution features of the text to be processed can be expressed as:

[0143] After obtaining the target convolution feature of the text to be processed, the target convolution feature can be pooled to obtain the text relationship triples included in the text to be processed. Figure 9 As shown, the target convolution feature is pooled to obtain a target pooling feature, and the text relation triples included in the to-be-processed text are obtained through the target pooling feature, which may include steps S91 to S94:

[0144] Step S91: obtaining entity location information included in the text to be processed, and performing pooling on the entity location information to obtain entity feature information;

[0145] Step S92: pooling the target convolutional features to obtain feature pooling information, concatenating the entity feature information with the feature pooling information to obtain the target pooling features corresponding to the text to be processed;

[0146] Step S93: Inputting the target pooling features corresponding to the text to be processed into a feedforward neural network to obtain target features corresponding to the text to be processed, and inputting the target features into a classifier to obtain a relationship probability distribution of the segmentations included in the text to be processed;

[0147] Step S94: Obtain the text relationship triples included in the text to be processed through the relationship probability distribution of the word segmentation.

[0148] Below, steps S91 to S94 will be further explained and illustrated. Specifically, first, the location information of the entities included in the text to be processed is obtained, and the location information of the entities obtained is pooled to obtain the entity feature information of the entities included in the text to be processed; wherein, the location information of the entities included in the text to be processed is obtained in advance. Since this solution aims to extract the relationship between entities, the entities included in the text can be determined in advance, such as meaningful word segments in a sentence. The location information can be used to identify the entity information in the text to be processed. The location information can be determined by manual annotation or other existing entity extraction tools; the entity feature information can be obtained by H entity_i To express, Then, the target convolution features of the sentence to be processed are pooled to obtain the feature pooling information H sentence =f(H (2) ), cascade the feature pooling information and the entity feature information to obtain the target pooling features of the text to be processed, and input the obtained target pooling features into the Feed Forward Neural Networks (FFNN) to obtain the target features H of the text to be processed final , H final =FFNN(Concat[H entity_i ;H sentence ]); Finally, the target features of the text to be processed are input into the Softmax classifier to obtain the relationship probability distribution p=Softmax(H final ), and the highest result in the probability distribution is taken as the classification result R = argmax (p), and the relation triples included in the text to be processed are obtained according to the classification result.

[0149] In addition, before using the above-mentioned model to extract text relationships, the constructed model is also trained. The constructed model includes: multiple syntactic parsers, word vector acquisition models, long short-term memory networks containing sliding windows, and graph convolution models. When training the constructed model, first, the acquired initial text is preprocessed to obtain the text to be processed. The preprocessing includes: text sentence segmentation, removal of paragraphs with inconsistent formats, missing value processing, and relevance verification. Then, the text to be processed is input into the constructed model for training, and the constructed model is evaluated. When evaluating the model, it can be evaluated by accuracy, recall rate, and F1 value. In this example embodiment, the evaluation method is not specifically limited. Among them, the accuracy rate, also called the precision rate, mainly checks how many true positive samples are in the samples predicted to be positive. There are two sources of samples predicted to be positive. One is the positive class is predicted as the positive class (TP), and the other is the negative class is predicted as the positive class (FP). The accuracy rate J can be expressed as The recall rate, also known as the recall rate, mainly checks how many positive examples in the sample are correctly predicted. There may be two situations: one is that the original positive class is predicted as the positive class (TP), and the other is that the original positive class is predicted as the negative class (FN). The recall rate M can be expressed as The F1 value is the harmonic mean of precision and recall, which can be expressed as Finally, the constructed model is optimized until convergence is achieved, resulting in an optimal model. The SGD optimizer or the Adam optimizer can be used for model optimization; the optimizer is not specifically limited in this exemplary embodiment. After the optimal model is obtained, it can be tested on a test set.

[0150] In summary, the method provided by the present disclosure can be applied to extract relations from unstructured text. When performing relation extraction, first, the text to be processed is input into multiple syntactic parsers to obtain multiple parsing results; then, the multiple parsing results are respectively input into the word vector acquisition model to obtain the word vector matrix of each parsing result, and the context word vector is generated according to the word vector of each word segment in each parsing result and the word vector of the context word segment of the word segment. The word vector of each word segment and the context word vector of each word segment are respectively input into the long short-term memory network containing a sliding window to obtain the initial hidden layer of each parsing result; then, the syntactic parse tree corresponding to each parsing result is converted into an adjacency matrix, and the adjacency matrix and the initial hidden layer are input into the graph convolutional neural network to obtain the target hidden layer of each parsing result; at the same time, the dependency relationship of the word segment included in each parsing result is input into the self-attention network to obtain the target hidden layer of each parsing result. The relation feature matrix of the analysis result is obtained, the adjacency matrix is replaced by the relation feature matrix, and the relation feature matrix and the target hidden layer are used as input and respectively input into the graph convolutional neural network to obtain an enhanced feature matrix of each analysis result, and multiple enhanced feature matrices are fused to obtain the target convolution features of the text to be processed; finally, the target convolution features are pooled to obtain feature pooling information, and the entity information included in the preset text to be processed is obtained, the entity information is pooled to obtain entity feature information, the feature pooling information and the entity feature information are cascaded and input into the feedforward neural network to obtain the target features of the text to be processed, and the target features are input into the classifier to obtain the relational probability distribution of the segmentations included in the text to be processed, and the text relation triples included in the text to be processed are obtained through the relational probability distribution. On the one hand, through multiple syntactic parsers, the singleness and limitations of a single dependency syntactic tree are broken, the fault tolerance of information is enhanced, and the accuracy of prediction is improved; on the other hand, through a long short-term memory network containing a sliding window, the context information of each word in the parsing result can be input into the network, which improves the efficiency of text relationship extraction; on the other hand, the two-step graph convolutional neural network improves the utilization process of graph structure information, improves the parallelism of the model and the training efficiency.

[0151] Exemplary devices

[0152] After introducing the text relationship extraction method of the exemplary embodiment of the present disclosure, Figure 10 A text relationship extraction device according to an exemplary embodiment of the present disclosure is described.

[0153] refer to Figure 10As shown, the text relationship extraction device 10 of the exemplary embodiment of the present disclosure may include: a syntactic parsing module 1001, a word vector matrix acquisition module 1002, a hidden layer acquisition module 1003 and a text relationship extraction module 1004; wherein:

[0154] The syntax parsing module 1001 is used to obtain a text to be processed, input the text to be processed into multiple syntax parsers, and obtain multiple parsing results corresponding to the multiple syntax parsers, wherein each parsing result includes at least one word segmentation;

[0155] A word vector matrix acquisition module 1002 is configured to input the plurality of parsing results into a word vector acquisition model to obtain a word vector matrix corresponding to each of the parsing results;

[0156] A hidden layer acquisition module 1003 is configured to input the word vector matrix corresponding to each parsing result into a long short-term memory network including a sliding window to obtain an initial hidden layer corresponding to each parsing result;

[0157] The text relationship extraction module 1004 is used to input the initial hidden layer corresponding to each parsing result into the graph convolution model to obtain target convolution features, pool the target convolution features to obtain target pooling features, and obtain the text relationship triples included in the text to be processed through the target pooling features.

[0158] According to an exemplary embodiment of the present disclosure, the syntax parsing module includes:

[0159] A syntactic parse tree acquisition module, configured to input the text to be processed into a plurality of syntactic parsers to obtain a plurality of syntactic parse trees corresponding to the syntactic parsers respectively;

[0160] The parsing result acquisition module is used to obtain multiple parsing results corresponding to the multiple syntactic parsers respectively through the multiple syntactic parsing trees.

[0161] According to an exemplary embodiment of the present disclosure, the word vector matrix acquisition module includes:

[0162] A parsing result length adjustment module, configured to obtain the length of each parsing result and adjust the length of each parsing result to a preset length;

[0163] The matrix acquisition module is used to input the word segmentations included in each parsing result after length adjustment into the word vector acquisition model to obtain a word vector matrix corresponding to each parsing result.

[0164] According to an exemplary embodiment of the present disclosure, the hidden layer acquisition module includes:

[0165] A word segmentation determination module is used to obtain all the word segments included in each parsing result, as well as the context segmentations of each word in all the word segments;

[0166] A context vector matrix generation module is used to generate a context word vector for each word segment based on the word vector of each word segment in the word vector matrix and the word vectors of the above and below words segment of each word segment;

[0167] The initial hidden layer acquisition module is used to input the word vector of each word segmentation and the context word vector of each word segmentation into the long short-term memory network containing the sliding window to obtain the initial hidden layer corresponding to each parsing result.

[0168] According to an exemplary embodiment of the present disclosure, the long short-term memory network containing a sliding window includes: a forget gate, an input gate, an output gate, a left gate and a right gate; wherein the left gate controls the word vector of the previous word of each word in all the word segmentations to flow into the current unit; the right gate controls the word vector of the following word segmentation of each word in all the word segmentations to flow into the current unit.

[0169] According to an exemplary embodiment of the present disclosure, the graph convolution model includes a graph convolutional neural network and a self-attention mechanism; the text relationship extraction module includes:

[0170] a target hidden layer acquisition module, configured to acquire a syntactic parse tree corresponding to each parsing result, convert the syntactic parse tree into an adjacency matrix, and input the adjacency matrix and the initial hidden layer corresponding to each parsing result into the graph convolutional neural network to obtain a target hidden layer corresponding to each parsing result;

[0171] A relationship feature matrix acquisition module is used to obtain the dependency relationship of the word segments included in each parsing result, and obtain the relationship feature matrix of each parsing result based on the dependency relationship and the self-attention mechanism;

[0172] A target convolution feature acquisition module is used to replace the adjacency matrix with the relationship feature matrix, and input the relationship feature matrix and the target hidden layer corresponding to each parsing result into the graph convolutional neural network again to obtain the target convolution feature corresponding to each parsing result.

[0173] According to an exemplary embodiment of the present disclosure, the relationship feature matrix acquisition module includes:

[0174] A relation attention matrix generation module, configured to generate a relation attention matrix based on the dependency relationship of the word segments included in each parsing result and the self-attention mechanism;

[0175] A multiplication result acquisition module, configured to perform matrix multiplication on the relational attention matrix and the target hidden layer corresponding to each parsing result to obtain a multiplication result;

[0176] The feature matrix acquisition module is used to sum the elements of the multiplication result and the target hidden layer corresponding to each parsing result to obtain the relationship feature matrix of each parsing result.

[0177] According to an exemplary embodiment of the present disclosure, the target convolution feature acquisition module includes:

[0178] a target hidden layer acquisition module, configured to replace the adjacency matrix with the relationship feature matrix and acquire a target hidden layer of the parsing result corresponding to the relationship feature matrix;

[0179] An enhanced feature matrix acquisition module is used to input the relationship feature matrix corresponding to each parsing result and the target hidden layer into the graph convolutional neural network again to obtain an enhanced feature matrix corresponding to each parsing result;

[0180] The convolution feature acquisition module is used to perform feature fusion on the multiple enhanced feature matrices corresponding to the multiple parsing results to obtain the target convolution feature.

[0181] According to an exemplary embodiment of the present disclosure, the text relationship extraction module includes:

[0182] An entity feature information acquisition module is used to acquire entity location information included in the text to be processed, and obtain entity feature information by pooling the entity location information;

[0183] A target pooling feature acquisition module is used to pool the target convolution features to obtain feature pooling information, and concatenate the entity feature information with the feature pooling information to obtain the target pooling features corresponding to the text to be processed;

[0184] A relationship probability distribution determination module is used to input the target pooling feature corresponding to the text to be processed into a feedforward neural network to obtain a target feature corresponding to the text to be processed, and input the target feature into a classifier to obtain a relationship probability distribution of the word segmentations included in the text to be processed;

[0185] The triple acquisition module is used to obtain the text relationship triples included in the text to be processed through the relationship probability distribution of the word segmentation.

[0186] Since the functional modules of the video device in the embodiment of the present disclosure are the same as those in the above-mentioned video retrieval method disclosed in the embodiment, they will not be described in detail here.

[0187] Exemplary Storage Media

[0188] After introducing the text relationship extraction method and apparatus according to the exemplary embodiment of the present disclosure, Figure 11 Computer storage media according to exemplary embodiments of the present disclosure are described.

[0189] refer to Figure 11 As shown, a program product 1100 for implementing the above method according to an embodiment of the present disclosure is described. The program product 1100 may be a portable compact disc read-only memory (CD-ROM) and include program code, and may be run on a device such as a personal computer. However, the program product of the present disclosure is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0190] The program product may be implemented in any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0191] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0192] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0193] Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, and the like, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0194] Exemplary electronic devices

[0195] After introducing the storage medium of the exemplary embodiment of the present disclosure, next, reference is made to Figure 11 An electronic device according to an exemplary embodiment of the present disclosure will be described.

[0196] Figure 12 The electronic device 1200 shown is merely an example and should not limit the functions and scope of use of the embodiments of the present disclosure.

[0197] like Figure 12 As shown, electronic device 1200 is implemented as a general-purpose computing device. Components of electronic device 1200 may include, but are not limited to, the aforementioned at least one processing unit 1210, the aforementioned at least one storage unit 1220, a bus 1230 connecting various system components (including storage unit 1220 and processing unit 1210), and a display unit 1240.

[0198] The storage unit stores program codes, which can be executed by the processing unit 1210, so that the processing unit 1210 performs the steps described in the "Exemplary Method" section of the present disclosure according to various exemplary embodiments. For example, the processing unit 1210 can perform the following steps: Figure 1 Steps S1 to S4 shown in FIG.

[0199] The storage unit 1220 may include a volatile storage unit, such as a random access memory unit (RAM) 12201 and / or a cache memory unit 12202 , and may further include a read-only memory unit (ROM) 12203 .

[0200] The storage unit 1220 may also include a program / utility 12204 having a set (at least one) of program modules 12205, such program modules 12205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0201] The bus 1230 may include a data bus, an address bus, and a control bus.

[0202] The electronic device 1200 can also communicate with one or more external devices 1300 (e.g., a keyboard, a pointing device, a Bluetooth device, etc.), and such communication can be performed via an input / output (I / O) interface 1250. The electronic device 1200 also includes a display unit 1240, which is connected to the input / output (I / O) interface 1250 for display. In addition, the electronic device 1100 can also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via a network adapter 1260. As shown, the network adapter 1260 communicates with other modules of the electronic device 1200 via a bus 1230. It should be understood that although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device 1200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0203] It should be noted that while the detailed description above mentions several modules or submodules of the audio playback device and audio sharing device, this division is merely exemplary and not mandatory. In practice, depending on the embodiments of the present disclosure, the features and functions of two or more units / modules described above may be embodied in a single unit / module. Conversely, the features and functions of a single unit / module described above may be further divided and embodied by multiple units / modules.

[0204] Furthermore, although the operations of the disclosed method are described in a particular order in the accompanying drawings, this does not require or imply that the operations must be performed in this particular order, or that all illustrated operations must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.

[0205] Although the spirit and principles of the present disclosure have been described with reference to several specific embodiments, it should be understood that the present disclosure is not limited to the specific embodiments disclosed, and the division into various aspects does not mean that the features in these aspects cannot be combined to benefit. Such division is only for the convenience of expression. The present disclosure is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the appended claims.

Claims

1. A text relationship extraction method, characterized in that: include: Obtaining a text to be processed, inputting the text to be processed into a plurality of syntactic parsers, and obtaining a plurality of parsing results corresponding to the plurality of syntactic parsers, wherein each parsing result includes at least one word segmentation; Input the multiple parsing results into the word vector acquisition model respectively to obtain a word vector matrix corresponding to each parsing result; Inputting the word vector matrix corresponding to each parsing result into a long short-term memory network including a sliding window to obtain an initial hidden layer corresponding to each parsing result; Obtain a syntactic parse tree corresponding to each parsing result, convert the syntactic parse tree into an adjacency matrix, and input the adjacency matrix and the initial hidden layer corresponding to each parsing result into the graph convolutional neural network of the graph convolutional model to obtain a target hidden layer corresponding to each parsing result; generate a relational attention matrix based on the dependency relationship of the word segments included in each parsing result and the self-attention mechanism of the graph convolutional model; perform matrix multiplication on the relational attention matrix and the target hidden layer corresponding to each parsing result to obtain a multiplication result; perform element-wise summation on the multiplication result and the target hidden layer corresponding to each parsing result to obtain to the relation feature matrix of each parsing result; replacing the adjacency matrix with the relation feature matrix, and obtaining the target hidden layer of the parsing result corresponding to the relation feature matrix; inputting the relation feature matrix corresponding to each parsing result and the target hidden layer into the graph convolutional neural network again to obtain the enhanced feature matrix corresponding to each parsing result; performing feature fusion on the multiple enhanced feature matrices corresponding to the multiple parsing results to obtain target convolution features, pooling the target convolution features to obtain target pooling features, and obtaining the text relation triples included in the text to be processed through the target pooling features.

2. The text relationship extraction method according to claim 1, characterized in that: Inputting the text to be processed into a plurality of syntactic parsers to obtain a plurality of parsing results corresponding to the plurality of syntactic parsers, including: Inputting the text to be processed into a plurality of syntactic parsers to obtain a plurality of syntactic parse trees corresponding to the syntactic parsers respectively; A plurality of parsing results respectively corresponding to the plurality of syntactic parsers are obtained through the plurality of syntactic parsing trees.

3. The text relationship extraction method according to claim 1, characterized in that: Input the multiple parsing results into the word vector acquisition model respectively to obtain the word vector matrix corresponding to each parsing result, including: Obtaining the length of each parsing result, and adjusting the length of each parsing result to a preset length; The word segments included in each parsing result after length adjustment are respectively input into the word vector acquisition model to obtain a word vector matrix corresponding to each parsing result.

4. The text relationship extraction method according to claim 1, characterized in that: Input the word vector matrix corresponding to each parsing result into a long short-term memory network containing a sliding window to obtain an initial hidden layer corresponding to each parsing result, including: Obtain all the participles included in each parsing result, as well as the context participles of each participle in all the participles; Generate a context word vector for each word segmentation based on the word vector of each word segmentation in the word vector matrix and the word vectors of the above and below words segmentation of each word segmentation; The word vector of each word segmentation and the context word vector of each word segmentation are respectively input into the long short-term memory network containing the sliding window to obtain an initial hidden layer corresponding to each parsing result.

5. The text relationship extraction method according to claim 4, characterized in that: The long short-term memory network containing a sliding window includes: a forget gate, an input gate, an output gate, a left gate and a right gate; wherein the left gate controls the word vector of the previous word of each word in all the word segmentations to flow into the current unit; the right gate controls the word vector of the following word segmentation of each word in all the word segmentations to flow into the current unit.

6. The text relationship extraction method according to claim 1, characterized in that: Pooling the target convolutional features to obtain target pooling features, and obtaining text relation triples included in the to-be-processed text through the target pooling features, including: Obtaining entity position information of the word segments included in the text to be processed, and performing pooling based on the entity position information to obtain entity feature information; Pooling the target convolutional features to obtain feature pooling information, and concatenating the entity feature information with the feature pooling information to obtain the target pooling features corresponding to the text to be processed; Inputting the target pooling feature corresponding to the text to be processed into a feedforward neural network to obtain a target feature corresponding to the text to be processed, and inputting the target feature into a classifier to obtain a relationship probability distribution of the segmentations included in the text to be processed; The text relationship triples included in the text to be processed are obtained through the relationship probability distribution of the word segments.

7. A text relationship extraction device, characterized in that: include: A syntactic parsing module, configured to obtain a text to be processed, input the text to be processed into a plurality of syntactic parsers, and obtain a plurality of parsing results corresponding to the plurality of syntactic parsers, wherein each parsing result includes at least one word segmentation; A word vector matrix acquisition module, configured to input the plurality of parsing results into a word vector acquisition model respectively to obtain a word vector matrix corresponding to each of the parsing results; A hidden layer acquisition module, configured to input the word vector matrix corresponding to each parsing result into a long short-term memory network including a sliding window to obtain an initial hidden layer corresponding to each parsing result; The text relationship extraction module is used to input the initial hidden layer corresponding to each parsing result into the graph convolution model to obtain the target convolution feature, pool the target convolution feature to obtain the target pooling feature, and obtain the text relationship triples included in the text to be processed through the target pooling feature; the graph convolution model includes a graph convolutional neural network and a self-attention mechanism; the text relationship extraction module includes: a target hidden layer acquisition module, used to obtain the syntactic parse tree corresponding to each parsing result, convert the syntactic parse tree into an adjacency matrix, and input the adjacency matrix and the initial hidden layer corresponding to each parsing result into the graph convolutional neural network to obtain the target hidden layer corresponding to each parsing result; the relationship feature matrix acquisition module includes: a relationship attention matrix generation module, used to generate a relationship attention matrix according to the dependency relationship of the word segmentations included in each parsing result and the self-attention mechanism. matrix; a multiplication result acquisition module, used to perform matrix multiplication on the relationship attention matrix and the target hidden layer corresponding to each parsing result to obtain a multiplication result; a feature matrix acquisition module, used to perform element-wise summation on the multiplication result and the target hidden layer corresponding to each parsing result to obtain a relationship feature matrix for each parsing result; a target convolution feature acquisition module, including: a target hidden layer acquisition module, used to replace the adjacency matrix with the relationship feature matrix, and obtain the target hidden layer of the parsing result corresponding to the relationship feature matrix; an enhanced feature matrix acquisition module, used to input the relationship feature matrix corresponding to each parsing result and the target hidden layer into the graph convolutional neural network again to obtain an enhanced feature matrix corresponding to each parsing result; a convolution feature acquisition module, used to perform feature fusion on the multiple enhanced feature matrices corresponding to the multiple parsing results to obtain the target convolution feature.

8. The text relationship extraction device according to claim 7, characterized in that: The syntactic parsing module includes: A syntactic parse tree acquisition module, configured to input the text to be processed into a plurality of syntactic parsers to obtain a plurality of syntactic parse trees corresponding to the syntactic parsers respectively; The parsing result acquisition module is used to obtain multiple parsing results corresponding to the multiple syntactic parsers respectively through the multiple syntactic parsing trees.

9. The text relationship extraction device according to claim 7, characterized in that: The word vector matrix acquisition module includes: A parsing result length adjustment module, configured to obtain the length of each parsing result and adjust the length of each parsing result to a preset length; The matrix acquisition module is used to input the word segmentations included in each parsing result after length adjustment into the word vector acquisition model to obtain a word vector matrix corresponding to each parsing result.

10. The text relationship extraction device according to claim 7, characterized in that: The hidden layer acquisition module includes: A word segmentation determination module is used to obtain all the word segments included in each parsing result, as well as the context segmentations of each word in all the word segments; A context vector matrix generation module is used to generate a context word vector for each word segment based on the word vector of each word segment in the word vector matrix and the word vectors of the above and below words segment of each word segment; The initial hidden layer acquisition module is used to input the word vector of each word segmentation and the context word vector of each word segmentation into the long short-term memory network containing the sliding window to obtain the initial hidden layer corresponding to each parsing result.

11. The text relationship extraction device according to claim 10, characterized in that: The long short-term memory network containing a sliding window includes: a forget gate, an input gate, an output gate, a left gate and a right gate; wherein the left gate controls the word vector of the previous word of each word in all the word segmentations to flow into the current unit; the right gate controls the word vector of the following word segmentation of each word in all the word segmentations to flow into the current unit.

12. The text relationship extraction device according to claim 7, characterized in that: The text relationship extraction module includes: An entity feature information acquisition module is used to acquire entity location information included in the text to be processed, and obtain entity feature information by pooling the entity location information; A target pooling feature acquisition module is used to pool the target convolution features to obtain feature pooling information, and concatenate the entity feature information with the feature pooling information to obtain the target pooling features corresponding to the text to be processed; A relationship probability distribution determination module is used to input the target pooling feature corresponding to the text to be processed into a feedforward neural network to obtain a target feature corresponding to the text to be processed, and input the target feature into a classifier to obtain a relationship probability distribution of the word segmentations included in the text to be processed; The triple acquisition module is used to obtain the text relationship triples included in the text to be processed through the relationship probability distribution of the word segmentation.

13. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the text relationship extraction method according to any one of claims 1 to 6 is implemented.

14. An electronic device, characterized in that: include: processor; as well as a memory for storing executable instructions of the processor; The processor is configured to execute the text relationship extraction method according to any one of claims 1 to 6 by executing the executable instructions.

Citation Information

Patent Citations

  • Emotion analysis method and device, electronic equipment and storage medium

    CN112966074A