An event extraction method, related device, equipment and storage medium
By converting natural language into nodes and edges, and generating semantic embedding vectors and graph embedding vectors, the problem of data set construction difficulty and data sparseness in traditional event extraction methods is solved, and the accuracy of event extraction and the learning ability of the model are improved.
Patent Information
- Application Number
- CN202110546916.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-19
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2041-05-19
AI Technical Summary
The traditional event extraction method relies on manual labeling of data sets and complex event architectures, which leads to high difficulty in building data sets, sparse data, and limited training, which in turn affects the effect of event extraction.
By converting sentence-level natural language into nodes and edges that are easy to identify, semantic embedding vectors and graph embedding vectors are generated, the event semantic definition architecture is expanded, and the accuracy of event semantic relationships is improved.
It improves the accuracy of event extraction, reduces the dependence on manually labeled data sets, simplifies the construction of event architecture, and enhances the model's learning ability of event semantic features and structural features.
Smart Images

Figure CN113761122B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of Internet technology, and in particular to an event extraction method, related devices, equipment and storage medium. Background Art
[0002] Event extraction is to extract events of interest to users from unstructured information and present them to users in a structured manner. Generally, it is done by first performing event detection on the information and then extracting event roles from the detected events.
[0003] The traditional event extraction method mainly adopts the supervised learning method, which generally requires manual labeling of the data set in advance to obtain the standard corpus, and pre-define the structure of the events in the data set, and then use the labeled corpus and the defined event structure to train the advanced neural network, and then use the trained advanced neural network to perform event extraction.
[0004] Although traditional event extraction methods do not depend on the content and format of the corpus, the construction of event extraction datasets is difficult and requires large-scale standard corpora. Otherwise, there will be a serious data sparsity problem, which will limit the training of advanced neural networks and result in poor event extraction results. Summary of the invention
[0005] An embodiment of the present application provides an event extraction method for expanding the event semantic definition architecture by converting sentence-level natural language into easily identifiable nodes and edges, and then converting the nodes and edges into semantic embedding vectors that can accurately reflect the semantic relationship between each node and graph embedding vectors of the semantic relationship between nodes connected by edges, so as to make the event semantic relationship have high accuracy, thereby ensuring the accuracy of obtaining the target event.
[0006] In view of this, the present application provides an event extraction method, comprising:
[0007] Obtaining a text to be processed, wherein the text to be processed includes N words, where N is an integer greater than 1;
[0008] generating an abstract semantic representation according to the text to be processed, wherein the abstract semantic representation includes nodes corresponding to words one by one, and edges for connecting the nodes;
[0009] Perform semantic encoding on the abstract semantic representation and the text to be processed to obtain a semantic embedding vector, wherein the semantic embedding vector is used to represent the semantic features between each word and event;
[0010] Performing graph encoding processing on the abstract semantic representation to obtain a graph embedding vector, wherein the graph embedding vector is used to represent the structural features between nodes connected by edges;
[0011] Concatenate the semantic embedding vector with the graph embedding vector to obtain a concatenated feature vector;
[0012] The concatenated feature vector is identified and the target event is output, wherein the target event includes trigger words and role words extracted from N words, the trigger words are used to indicate the events occurring in the text to be processed, and the role words are used to indicate the roles of various entities in the text to be processed in the events.
[0013] Another aspect of the present application provides an event extraction device, comprising:
[0014] An acquisition unit, used for acquiring a text to be processed, wherein the text to be processed includes N words, where N is an integer greater than 1;
[0015] A generating unit, used for generating an abstract semantic representation according to the text to be processed, wherein the abstract semantic representation includes nodes corresponding to words one by one, and edges for connecting the nodes;
[0016] A processing unit, used for performing semantic encoding processing on the abstract semantic representation and the text to be processed to obtain a semantic embedding vector, wherein the semantic embedding vector is used to represent the semantic features between each word and event;
[0017] The processing unit is further used to perform graph encoding processing on the abstract semantic representation to obtain a graph embedding vector, wherein the graph embedding vector is used to represent the structural features between nodes connected by edges;
[0018] The processing unit is further used to concatenate the semantic embedding vector with the graph embedding vector to obtain a concatenated feature vector;
[0019] The recognition unit is used to recognize the concatenated feature vector and output a target event, wherein the target event includes a trigger word and a role word extracted from N words, the trigger word is used to indicate an event occurring in the text to be processed, and the role word is used to indicate the role of each entity in the text to be processed in the event.
[0020] In a possible design, in an implementation of another aspect of the embodiment of the present application,
[0021] The processing unit is further used to perform node encoding processing on the text to be extracted to obtain a node encoding vector, and the node encoding vector is used to initialize the semantic features between each word and event;
[0022] The processing unit is also used to perform graph encoding processing on the node encoding vector and the abstract semantic representation through the graph coding model to obtain the graph embedding vector.
[0023] In a possible design, in an implementation of another aspect of the embodiment of the present application,
[0024] A determination unit, used to determine a trigger word maximum pooling feature vector and a role word maximum pooling feature vector corresponding to the semantic embedding vector according to a dynamic maximum pooling algorithm;
[0025] The processing unit is specifically used to concatenate the maximum pooled feature vector of the trigger word and the maximum pooled feature vector of the role word with the concatenated feature vector to obtain a feature vector to be identified;
[0026] The output unit is used to classify and identify the feature vector to be identified to obtain the target event.
[0027] In a possible design, in an implementation of another aspect of the embodiment of the present application,
[0028] The processing unit is specifically used to perform spectral clustering on the concatenated feature vectors to obtain a node clustering graph, wherein the node clustering graph includes clustering nodes and clustering edges connecting the clustering nodes;
[0029] The determination unit is further used to determine the edge weight value between cluster nodes according to the distance of the cluster edge;
[0030] The processing unit is specifically used to perform graph slicing processing on the node cluster graph to obtain K cluster subgraphs, where K is an integer greater than 1;
[0031] The output unit is also used to output the target event when the edge weight value of each cluster subgraph meets the preset weight value.
[0032] In a possible design, in an implementation of another aspect of the embodiment of the present application,
[0033] The processing unit is also used to encode the abstract semantic representation according to the sequence coding model to obtain a semantic embedding vector. The sequence coding model is used to perform temporal coding on the nodes connected by the edges.
[0034] In a possible design, in an implementation of another aspect of the embodiment of the present application,
[0035] The acquisition unit is further used to acquire the to-be-processed corpus from the database, where the to-be-processed corpus includes M sentences, where M is an integer greater than or equal to 1;
[0036] The generating unit is further used to generate an abstract semantic representation set from the corpus to be processed, wherein the abstract semantic representation set includes a node set corresponding to the sentences and an edge set formed by connecting the edges between the nodes.
[0037] In a possible design, in an implementation of another aspect of the embodiment of the present application,
[0038] The generation unit is further used to generate a contrastive learning training data set based on the abstract semantic representation set;
[0039] A training unit is used to pre-train the model based on the contrastive learning training dataset.
[0040] In a possible design, in an implementation of another aspect of the embodiment of the present application,
[0041] A construction unit, used to construct semantic positive examples based on edges, nodes, edge sets, and node sets, wherein the semantic positive examples are used to represent the semantic proximity between the trigger word and the role;
[0042] The construction unit is also used to perform node replacement operation on the semantic positive example to obtain the semantic negative example, wherein the semantic negative example indicates the semantic distance relationship between the trigger word and the role;
[0043] The building unit is also used to use semantic positive examples and semantic negative examples as semantic training data sets for comparative learning.
[0044] In a possible design, in an implementation of another aspect of the embodiment of the present application,
[0045] The training unit is specifically used to reversely train the basic sequence encoding model according to the contrastive learning semantic training data set and the loss function to obtain the sequence encoding model.
[0046] In a possible design, in an implementation of another aspect of the embodiment of the present application,
[0047] The construction unit is further used to perform two random graph samplings on each abstract semantic representation in the abstract semantic representation set to obtain 2M randomly sampled subgraphs, wherein the randomly sampled subgraphs include target nodes and subnodes, and each abstract semantic representation corresponds to two randomly sampled subgraphs;
[0048] The construction unit is also used to take 2M randomly sampled subgraphs as graph positive examples, which are used to represent the semantic closeness of the child nodes relative to the target node;
[0049] The construction unit is further used to randomly combine the randomly sampled subgraphs to obtain X randomly combined subgraphs, wherein each randomly combined subgraph contains two randomly sampled subgraphs, the two randomly sampled subgraphs in the randomly combined subgraph correspond to different abstract semantic representations, and X is an integer not equal to 2M;
[0050] The construction unit is also used to take X randomly combined subgraphs as negative examples, which are used to indicate the semantic distance between the subnodes and the target node;
[0051] The building unit is also used to use the positive examples and negative examples as comparative learning graph training data sets.
[0052] In a possible design, in an implementation of another aspect of the embodiment of the present application,
[0053] The determination unit is also used to take any node in the abstract semantic representation as a target node and take nodes other than the target node as child nodes;
[0054] The processing unit is further used to perform random walking from the target node to the child node to obtain a random node set, wherein the random node set includes the target node, the child node, and an edge formed by walking from the target node to the child node;
[0055] The processing unit is further used to depict a node subgraph based on the random node set;
[0056] The processing unit is also used to number the target nodes and sub-nodes in the node sub-graph to obtain a random sub-graph.
[0057] In a possible design, in an implementation of another aspect of the embodiment of the present application,
[0058] The training unit is specifically used to reversely train the basic graph coding model according to the comparative learning graph training data set and the loss function to obtain the graph coding model.
[0059] Another aspect of the present application provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer is enabled to execute the above-mentioned methods.
[0060] Another aspect of the present application provides a computer program product or a computer program, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. The processor of the network device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the network device executes the methods provided by the above aspects.
[0061] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0062] First, an abstract semantic representation is generated according to the text to be processed, and words are converted into nodes and edges that are easy to identify. Then, the abstract semantic representation and the text to be processed are semantically encoded to obtain a semantic embedding vector that can reflect the semantic features between each word and the event through the semantic features between each node, and a graph embedding vector that can accurately reflect the structural relationship between the nodes connected by the edges is obtained by graph encoding the abstract semantic representation. Then, event recognition is performed by concatenating the feature vector obtained by concatenating the semantic embedding vector and the graph embedding vector to obtain the target event. In the above manner, words are converted into nodes and edges that are easy to identify, and then nodes and edges are converted into semantic embedding vectors that can reflect the semantic features between each word and the event, and the structural features between nodes connected by the edges are converted into graph embedding vectors that can reflect the structural features between each word and the event, so as to expand the event semantic definition architecture, so that the learned semantic features and structural features between words and events have high accuracy, thereby improving the accuracy of obtaining target events. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 It is a schematic diagram of the architecture of data processing in the embodiment of the present application;
[0064] Figure 2 is a schematic diagram of an embodiment of the event extraction method in the embodiment of the present application;
[0065] Figure 3 is another schematic diagram of an embodiment of the event extraction method in the embodiment of the present application;
[0066] Figure 4 is another schematic diagram of an embodiment of the event extraction method in the embodiment of the present application;
[0067] Figure 5 is another schematic diagram of an embodiment of the event extraction method in the embodiment of the present application;
[0068] Figure 6 is another schematic diagram of an embodiment of the event extraction method in the embodiment of the present application;
[0069] Figure 7 is another schematic diagram of an embodiment of the event extraction method in the embodiment of the present application;
[0070] Figure 8 is another schematic diagram of an embodiment of the event extraction method in the embodiment of the present application;
[0071] Fig. 9 is another schematic diagram of an embodiment of the event extraction method in the embodiment of the present application;
[0072] Fig.10is another schematic diagram of an embodiment of the event extraction method in the embodiment of the present application;
[0073] Fig.11 is a schematic diagram of an abstract semantic representation of an event extraction method in an embodiment of the present application;
[0074] Fig.12 is a schematic diagram of a target event of the event extraction method in an embodiment of the present application;
[0075] Fig.13 This is a schematic diagram of an effect evaluation of the event extraction method in the embodiment of the present application;
[0076] Fig.14 It is another effect evaluation schematic diagram of the event extraction method in the embodiment of the present application;
[0077] Fig.15 is a schematic diagram of an embodiment of an event extraction device in an embodiment of the present application;
[0078] Fig.16 It is a schematic diagram of an embodiment of a computer device in an embodiment of the present application. DETAILED DESCRIPTION
[0079] An embodiment of the present application provides an event extraction method for expanding the event semantic definition architecture by converting words into easily identifiable nodes and edges, and then converting the nodes and edges into semantic embedding vectors that can accurately reflect the semantic relationship between each node and graph embedding vectors of the semantic relationship between nodes connected by edges, so as to make the event semantic relationship have high accuracy, thereby ensuring the accuracy of obtaining the target event.
[0080] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0081] It should be understood that the event extraction method provided in the present application can be applied to scenarios where information is acquired through natural language. As an example, event extraction is performed on news information to obtain key news information; as another example, a knowledge graph is constructed through event extraction; as another example, event information in a social network is acquired through event extraction; as another example, question and answer information of a question and answer system is acquired through event extraction, etc. In the above scenarios, in order to complete event extraction, traditional event extraction methods mainly obtain standard corpus by manually annotating data set labels in advance, and define the architecture of events in the data set in advance to train advanced neural networks, and then perform event extraction through the trained advanced neural networks. Not only is the construction of the event extraction data set difficult but also requires a large amount of standard corpus, which limits the training of advanced neural networks, resulting in poor event extraction effects.
[0082] In order to solve the above problems, this application proposes an event extraction method, which is applied to Figure 1 The data processing system shown is shown in Figure 1 , Figure 1 is a schematic diagram of the architecture of the data processing system in the embodiment of the present application, such as Figure 1 As shown, an abstract semantic representation is first generated according to the text to be processed, and words are converted into nodes and edges that are easy to identify. Then, the abstract semantic representation is semantically encoded to obtain a semantic embedding vector that can accurately reflect the semantic relationship between each node, and the abstract semantic representation is graph encoded to obtain a graph embedding vector that can accurately reflect the semantic relationship between nodes connected by edges. Then, event recognition is performed by concatenating the semantic embedding vector and the graph embedding vector to obtain a concatenated feature vector to obtain the target event. In the above manner, the event semantic definition architecture is expanded by converting words into nodes and edges that are easy to identify, and then converting nodes and edges into semantic embedding vectors that can accurately reflect the semantic relationship between each node and graph embedding vectors of the semantic relationship between nodes connected by edges, so that the event semantic relationship has a high accuracy, thereby ensuring the accuracy of obtaining the target event.
[0083] In order to solve the above problems, the present application proposes an event extraction method, which is generally executed by a server or a terminal device. Accordingly, the event extraction device is generally set in the server or the terminal device.
[0084] The event extraction method in this application is introduced below. Figure 2 In the embodiment of the present application, an event extraction method includes:
[0085] In step S101, a text to be processed is obtained, wherein the text to be processed includes N words, and N is an integer greater than 1.
[0086] In this embodiment, the text to be processed is a natural language instance, which is used to extract the events of interest to the information acquirer from the text to be processed through event extraction, and present them to the information acquirer in a structured manner. Specifically, it can be presented as a news information, an advertisement slogan, or a sentence excerpt from an article, etc., which is not specifically limited here. For example, a news information "Xiaoyangguang News reported a fire that occurred in the community today". Among them, this news contains multiple words, such as "today", "in the community" and "fire", which can be used to represent the events in this news information, and then the acquired events can help the news information acquirer quickly and accurately obtain key information in the news.
[0087] Among them, events are a form of information expression, which can be used to express the objective fact that specific people and objects interact with each other at a specific time and place. Generally speaking, they are at the sentence level, where events are composed of trigger words, event types and roles.
[0088] Among them, the trigger word is the core word indicating the occurrence of an event, which is mostly a verb or noun, or a phrase. For example, in the above news information "Xiaoyangguang News reported a fire that occurred in the community today", "fire" is a trigger word. Event type refers to the 8 event types and 33 subtypes defined in the data set (ACE2005). Among them, most event extractions use 33 event types. For example, in the above news information, the event type corresponding to the trigger word "fire" is "disaster". Roles include arguments and argument roles. Among them, arguments are participants in the event, mainly composed of entities, values, and time. For example, in the above news information, "today" and "in the community" can be understood as arguments; and values are non-entity participants in the event, such as jobs. Argument roles refer to the roles played by participants in the event. There are 35 types of roles defined in the data set (ACE2005), such as attackers, victims, etc., and for example, in the above news information, the role of "today" is "time" and the role of "in the community" is "place".
[0089] Specifically, when the information acquirer wants to quickly obtain an event of interest from a piece of information, the information can be used as text to be processed. By obtaining the text to be processed, the event can be extracted from the text to be processed to realize the event of interest to the information acquirer, and the event can be presented to the information acquirer in a structured manner to ensure the validity and completeness of the obtained event.
[0090] In step S102, an abstract semantic representation is generated according to the text to be processed, wherein the abstract semantic representation includes nodes corresponding to words one by one, and edges for connecting the nodes.
[0091] In this embodiment, after obtaining the text to be processed, an abstract semantic representation can be generated based on the text to be processed, thereby converting the unannotated text to be processed into a semantic abstract representation that can clearly reflect the semantic relationship between each word in the text. On the one hand, it can be understood as automatic annotation of the unannotated text to be processed, without the need for manual annotation, which can reduce training costs, ensure sufficient training data, and to a certain extent ensure model training accuracy, thereby ensuring the accuracy of event acquisition; on the other hand, since the relationship between edges and nodes in the abstract semantic representation structure is similar to the relationship between trigger words and roles in an event, this embodiment can generate an abstract semantic representation for the text to be processed, so that the semantic features between each word and the event can be represented by extracting edges and nodes in the abstract semantic representation, and then the trigger words and role words in the event corresponding to the text to be processed can be accurately obtained through the semantic features between each word and the event, thereby improving the accuracy of event acquisition.
[0092] Further, since the text to be processed is a natural language instance, and the semantic processing of natural language sentences is mainly through natural language processing (NLP), wherein NLP is an important direction in the field of computer science and artificial intelligence. It studies various theories and methods that can realize effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language used by people in daily life, so it is closely related to the study of linguistics. Natural language processing technology generally includes technologies such as text processing, semantic understanding, machine translation, robot question answering, knowledge graph, etc. Therefore, this embodiment can generate an abstract semantic representation according to the text to be processed to obtain the semantic features between each word and event in the text to be processed, which can be obtained by an abstract semantic representation parser (Abstract Meaning Representation, AMR), or other natural language processing technologies such as abstract semantic representation parsers (CAMR) or abstract semantic representation predictors (JAMR), which are not specifically limited here.
[0093] The abstract semantic representation is achieved by converting natural language sentences into nodes and edges connecting the nodes, where each node is a word or phrase in the natural language sentence, and different edges represent the relationship between different nodes. For example, a natural language instance s can be parsed into a graph g consisting of a node set and an edge set by the abstract semantic representation parser. s =(V s ,E s ), where V s is a set of nodes, E s is an edge set, u and v represent nodes, and r represents the edge type. The edge relationship types include special relationship types and general relationship types. Special relationship types include real-time subject (argument role, ARG0), object subject (argument role, ARG1), time (time) and location (location). These three edge relationship types are similar to the relationship between trigger words and roles in events, so they are used to extract semantic features between words and events; general relationship types include motivation (instance).
[0094] For example, in the news information scenario, the text to be processed is "Xiaoyangguang News reported a fire that occurred in the community today". The text to be processed is parsed by the abstract semantic representation parser to obtain the following: Fig.12 The figure shows an abstract semantic representation graph structure (AMR structure), which connects "report" with "Little Sunshine Information" through the edge "ARG0", connects "report" with "fire" through the edge "ARG1", connects "fire" with "today" through the edge "time", and connects "fire" with "within the community" through the edge "ARG1". It can clearly and intuitively reflect the semantic relationship between the nodes, and thus can reflect the semantic characteristics between each word and event through the semantic relationship between the nodes.
[0095] Specifically, after obtaining the text to be processed, the abstract semantic parser can be used to parse the text to be processed into a semantic abstract representation that can clearly and intuitively reflect the semantic relationship between nodes, so that the semantic features between each word and event can be represented by extracting the semantic relationship between the edges and nodes in the abstract semantic representation, and then the semantic features between each word and event can be used to accurately obtain the trigger words and role words of the events corresponding to the text to be processed, thereby improving the accuracy of obtaining events.
[0096] In step S103, semantic encoding is performed on the abstract semantic representation and the text to be processed to obtain a semantic embedding vector, wherein the semantic embedding vector is used to represent the semantic relationship feature between each node.
[0097] In this embodiment, since the relationship represented by the three edges ARG, time, and location in the abstract semantic representation is similar to the relationship between the trigger word and the role in the event, and the semantic relationship between each node is reflected through these three special semantic relationships, the semantic features between each word and the event can be reflected through the three special semantic relationships between the nodes. Therefore, in order to accurately extract the node pairs connected by these three edges from the abstract semantic representation, and then convert the extracted node pairs into semantic features between words and events, thereby realizing the acquisition of trigger words and role words in the event through the semantic features between words and events, so as to improve the accuracy of event acquisition, this embodiment performs semantic encoding processing on the abstract semantic representation and the file to be processed, specifically, through a sequence coding model, the semantic relationship between each node in the abstract semantic representation is converted into a semantic embedding vector that can reflect the semantic features between words and events.
[0098] For example, the obtained text to be processed is a natural language instance s = {w1, w2, ..., w n}, where w i is the i-th word. After the text to be processed passes through the sequence encoding model, a semantic representation matrix of s will be obtained, that is, the semantic embedding vector.
[0099] Specifically, after obtaining the abstract semantic representation, in order to accurately convert the relationship between nodes and edges in the abstract semantic representation into semantic features between words and events, the acquired abstract semantic representation and the text to be processed can be passed through a sequence encoding model, so that the semantic relationship between each node in the abstract semantic representation is converted into a semantic embedding vector that can reflect the semantic features between words and events, so that the semantic embedding vector can be further analyzed later, so as to accurately obtain the trigger words and role words in the event corresponding to the text to be processed through the semantic embedding vector that can reflect the semantic features between words and events, thereby improving the accuracy of obtaining events.
[0100] In step S104, graph encoding processing is performed on the abstract semantic representation to obtain a graph embedding vector, wherein the graph embedding vector is used to represent the semantic relationship features between nodes connected by edges.
[0101] In this embodiment, since the structure of the abstract semantic representation is a Fig.11The graph structure shown, therefore, in order to be able to further extract the structural features between any nodes connected by edges in the graph structure, to obtain the structural features between any nodes connected by edges to reflect the graph embedding vector of the structural features between words and events, and then accurately obtain the trigger words and role words in the event corresponding to the text to be processed through the graph embedding vector that can reflect the structural features between words and events, thereby improving the accuracy of obtaining events, this embodiment performs graph encoding processing on the abstract semantic representation, specifically, through a graph encoding model, to convert the structural features between each node in the abstract semantic representation into a graph embedding vector that can reflect the structural features between words and events.
[0102] For example, the obtained text to be processed is a natural language instance s={w1,w2,...,w n}, the abstract semantic representation obtained after the text to be processed is analyzed is g s =(V s ,E s ), where V s is a set of nodes, E s ={(u,v,r)} is an edge set, u,v represent nodes, r represents the type of edge, and passing this abstract semantic representation through the graph encoder will result in g s The representation vector of , that is, the graph embedding vector.
[0103] Specifically, after obtaining the abstract semantic representation, in order to be able to more randomly and sufficiently obtain the structural features that can be used to represent the relationship between each word and event through the structural features of the nodes and edges in the graph structure of the abstract semantic representation, and then accurately obtain the trigger words and role words in the event corresponding to the text to be processed through the graph embedding vector that can reflect the structural features between the words and the event, the abstract semantic representation obtained can be passed through a graph coding model to obtain a graph embedding vector that can represent the structural features between the nodes connected by edges to reflect the structural features between each word and the event, so that the graph embedding vector can be further analyzed later, so as to accurately obtain the trigger words and role words in the event corresponding to the text to be processed through the graph embedding vector that can reflect the structural features between the words and the event, thereby improving the accuracy of obtaining events.
[0104] In step S105, the semantic embedding vector is concatenated with the graph embedding vector to obtain a concatenated feature vector;
[0105] In this embodiment, after obtaining the semantic embedding vector and the graph embedding vector, the semantic embedding vector and the graph embedding vector can be spliced to enrich the extension of the semantic definition architecture of the event, so that the spliced feature vector can be subsequently recognized, so that more refined classification of trigger words and role words can be achieved through the learned semantic features and structural features between words and events, thereby improving the accuracy of event extraction.
[0106] For example, a semantic embedding vector h and a graph embedding vector g are obtained, and the semantic embedding vector and the graph embedding vector are concatenated to obtain a concatenated feature vector f = (h, g).
[0107] Specifically, after obtaining the semantic embedding vector and the graph embedding vector, in order to enable more precise classification of trigger words and role words through the learned semantic features and structural features between words and events, thereby improving the accuracy of event extraction, the semantic embedding vector and the graph embedding vector can be spliced to obtain a spliced feature vector after feature expansion.
[0108] In step S106, the concatenated feature vector is identified and a target event is output, wherein the target event includes trigger words and role words extracted from N words, the trigger words are used to indicate an event occurring in the text to be processed, and the role words are used to indicate the role of each entity in the text to be processed in the event.
[0109] In this embodiment, after obtaining the spliced feature vector, in order to accurately convert the semantic features and structural features between the words and events in the obtained spliced feature vector into different categories such as trigger words and event types, or the probabilities of role words, to achieve event extraction, this embodiment inputs the spliced feature vector that can be used to reflect the semantic features and structural features between words and events into the event classifier for identification. Through the learned semantic features and structural features between words and events, more detailed classification of trigger words and role words can be achieved to output the information of interest to the information acquirer, that is, the target event, thereby improving the accuracy of event extraction.
[0110] For example, Fig.11 As shown, a text to be processed "Xiaoyangguang News reported a fire that occurred in the community today" is converted into a concatenated feature vector and then feature recognition is performed to obtain the trigger word "fire" and the corresponding event type (event type) is "disaster", and the argument role (argument role) "today" in the event is "time (time-within)", and the argument role (argument role) "within the community" is "place (place)".
[0111] Specifically, after obtaining the concatenated feature vector, this embodiment inputs the concatenated feature vector obtained by concatenating a semantic embedding vector that can be used to reflect the semantic features between words and events and a graph embedding vector that is used to reflect the structural features between words and events into an event classifier for recognition. This can improve the accuracy of event extraction by achieving more detailed classification of trigger words and role words in events through the learned semantic features and structural features between words and events.
[0112] In an embodiment of the present application, an event extraction method is provided. Through the above-mentioned method, the words are converted into nodes and edges that are easy to identify, and then the nodes and edges are converted into semantic embedding vectors that can accurately reflect the semantic features between each word and the event, and the structural features between the nodes connected by the edges are converted into graph embedding vectors that can reflect the structural features between each word and the event. In this way, the expansion of the event semantic definition architecture is achieved, so that the learned semantic features and structural features between words and events have higher accuracy, thereby improving the accuracy of acquiring target events.
[0113] Optionally, in the above Figure 2 Based on the corresponding embodiment, in another optional embodiment of the event extraction method provided in the embodiment of the present application, as Figure 3 As shown, the method also includes:
[0114] In step S301, the text to be extracted is node-coded to obtain a node coding vector, which is used to initialize the semantic features between each word and event;
[0115] In step S302, the node coding vector and the abstract semantic representation are subjected to graph coding processing through a graph coding model to obtain a graph embedding vector.
[0116] In this embodiment, after obtaining the text to be processed, the text to be processed can be converted into a node encoding vector that is initialized to reflect the semantic features between each word and the event, and then the node encoding vector that can reflect the semantic features between each word and the event and the abstract semantic representation that can reflect the structural relationship between the nodes can be converted into the structural features between each node by using a graph coding model. Then, a graph embedding vector that can reflect the structural features between each word and the event through the structural features between each node is obtained, so that more important structural features in event extraction can be captured through the graph embedding vector in the future, thereby improving the accuracy of event extraction.
[0117] Among them, the graph coding model can specifically adopt a graph isomorphism model (GIN) or a graph neural network, etc., and no specific restrictions are made here.
[0118] For example, a text to be processed is obtained as s={w1,w2,...,w n}, the abstract semantic representation obtained after the text to be processed is analyzed is g s =(V s ,E s ), that is, for s={w1,w2,...,w n} The Roberta model (RoBERTa) can be used for node encoding to obtain the node encoding vector {h} = {h1,h2,...,h n}=RoBERTa(w1,w2,...,w n ), then, the node encoding vector {h} is combined with the abstract semantic representation g s Through the graph isomorphism model (GIN), we get the graph embedding vector g = GIN (g s ,{h}).
[0119] Specifically, after obtaining the text to be processed and the abstract semantic representation corresponding to the text to be processed, the nodes of the text to be extracted can be encoded, and the node encoding vector obtained by the processing that can reflect the semantic features between each word and the event and the abstract semantic representation that can reflect the structural relationship between the nodes can be converted into a graph embedding vector that can reflect the structural features between each word and the event through the structural features between the nodes connected by edges through a graph encoding model. This achieves the accurate capture of the structural features between each node in each graph structure based on the characteristics of the graph structure of the abstract semantic representation, and then reflects the structural features between each word and the event through the structural features between each node. Then, the semantic relationship between the trigger words and the roles in the event can be more accurately learned through the graph embedding vector that can reflect the structural features between each word and the event, thereby improving the accuracy of event extraction.
[0120] Optionally, in the above Figure 2 Based on the corresponding embodiment, in another optional embodiment of the event extraction method provided in the embodiment of the present application, as Figure 4 As shown, the concatenated feature vector is identified, and the output target events include:
[0121] In step S401, a trigger word maximum pooling feature vector and a role word maximum pooling feature vector corresponding to the semantic embedding vector are determined according to a dynamic maximum pooling algorithm;
[0122] In step S402, the maximum pooled feature vector of the trigger word and the maximum pooled feature vector of the role word are concatenated with the concatenated feature vector to obtain a feature vector to be identified;
[0123] In step S403, the feature vector to be identified is classified and identified to obtain the target event.
[0124] In this embodiment, the dynamic maximum pooling method is an event classifier under supervised learning. Since the trigger word in the event directly triggers the occurrence of the event and is an important feature that determines the event category, the maximum pooling feature method can be used to solve the event judgment problem. It includes two main steps: candidate event type classification and candidate event role classification, which are used to determine the maximum pooling feature vector of the trigger word and the maximum pooling feature vector of the role word. Specifically, the trigger word maximum pooling feature vector and the role word maximum pooling feature vector corresponding to the semantic embedding vector are first determined according to the dynamic maximum pooling algorithm, that is, the semantic embedding vector is divided into a candidate trigger word embedding vector and a candidate role word embedding vector, and then the candidate trigger word embedding vector and the candidate role word embedding vector are respectively subjected to maximum pooling processing to obtain the trigger word maximum pooling feature vector and the role word maximum pooling feature vector.
[0125] Among them, for the semantic embedding vectors h1,h2,...,h t ,...,h n The maximum pooling process can be understood as classifying the candidate event types of the semantic embedding vector to obtain the dynamic maximum pooling aggregation feature, that is, the maximum pooling feature vector of the trigger word is expressed as:
[0126] [x i,t ] i =max{[h1] i ,...,[h t ] i}
[0127] [x t+i,n ] i =max{[h t+1 ] i ,...,[h n ] i}
[0128]
[0129] Among them, h t is the embedding vector of the candidate trigger word, x i,t is the representation vector of the first sequence, i.e., the sequence before the trigger word t, x t+1,n is the representation vector of the second sequence, i.e., the sequence after the trigger word t, [x n ] i represents the i-th dimension of vector x, [h n ] i is the i-th dimension of the semantic embedding vector.
[0130] Among them, for the semantic embedding vectors h1,h2,...,h t ,...,ha ,...,h n The maximum pooling process can be understood as classifying candidate event roles on the semantic embedding vector to obtain dynamic maximum pooling aggregation features, that is, the maximum pooling feature vector of the role word is expressed as:
[0131] [x i,t ] i =max{[h1] i ,...,[h t ] i}
[0132] [x t+i,a ] i =max{[h t+1 ] i ,...,[h a ] i}
[0133]
[0134]
[0135] Among them, h t is the embedding vector of the candidate trigger word, h a is the embedding vector of the candidate role, x i,t is the representation vector of the first sequence, i.e., the sequence before the trigger word t, x t+1,a is the representation vector of the second sequence, that is, the sequence after the trigger word t and before the role a, x a+1,n is the representation vector of the third sequence, i.e. the sequence after character a, [x n ] i represents the i-th dimension of vector x, [h n ] i is the i-th dimension of the semantic embedding vector.
[0136] Furthermore, the semantic relationship features between the trigger word and the role are expanded by concatenating the maximum pooling feature vector of the trigger word and the maximum pooling feature vector of the role word with the concatenated feature vector to obtain the feature vector to be identified, that is, the obtained dynamic maximum pooling aggregation feature x and the vector g = GIN (g s ,{h}) to obtain the concatenated feature vector to be identified f=(x,g).
[0137] Furthermore, a classifier (Softmax) is used to classify the feature vector to be identified:
[0138] Pred = Softmax(MLP(f))
[0139] Among them, f is the feature vector to be identified.
[0140] Furthermore, the classifier Softmax is optimized by using the cross entropy loss function:
[0141] Loss=CrossEntropy(Pred,Gold)
[0142] Among them, Gold is the true label.
[0143] Specifically, after obtaining the concatenated feature vector, the concatenated feature vector used to reflect the semantic features and structural features between words and events can be used to achieve more detailed classification of trigger words and role words in events, thereby improving the accuracy of event extraction. This embodiment divides the semantic embedding vector into a candidate trigger word embedding vector and a candidate role word embedding vector, and then performs maximum pooling processing on the candidate trigger word embedding vector and the candidate role word embedding vector respectively to obtain a trigger word maximum pooling feature vector and a role word maximum pooling feature vector, and then uses a classifier to classify and identify the feature vector to be identified by concatenating the trigger word maximum pooling feature vector and the role word maximum pooling feature vector with the concatenated feature vector, so as to achieve more detailed classification of trigger words and role words in events through the acquired trigger word maximum pooling feature vector, role word maximum pooling feature vector and the concatenated feature vector that can be used to reflect the semantic features and structural features between words and events, thereby improving the accuracy of event extraction.
[0144] Optionally, in the above Figure 2 Based on the corresponding embodiment, in another optional embodiment of the event extraction method provided in the embodiment of the present application, as Figure 5 As shown, the concatenated feature vector is identified, and the output target events include:
[0145] In step S501, spectral clustering is performed on the concatenated feature vectors to obtain a node cluster graph, wherein the node cluster graph includes cluster nodes and cluster edges connecting the cluster nodes;
[0146] In step S502, the edge weight values between cluster nodes are determined according to the distance of the cluster edges;
[0147] In step S503, the node cluster graph is cut to obtain K cluster subgraphs, where K is an integer greater than 1;
[0148] In step S504, when the edge weight value of each cluster subgraph meets the preset weight value, the target event is output.
[0149] In this embodiment, according to the obtained spliced feature vector, in order to accurately convert the spliced feature vector into trigger words and event types, as well as arguments and argument roles, this embodiment can use a joint clustering method to identify the obtained spliced feature vector, wherein the joint clustering method is an event classifier under unsupervised learning; the joint clustering method is an iterative clustering method based on spectral clustering, specifically, firstly performing a first spectral clustering on the spliced feature vector to obtain a node clustering graph including cluster nodes and cluster edges connecting the cluster nodes; then, determining the edge weight value between the cluster nodes according to the distance of the cluster edges, it can be understood that the distance of the cluster edges refers to the distance between two clusters. The distance between nodes, wherein the edge weight value between two cluster nodes that are farther away, i.e., the two cluster nodes, is lower, and the edge weight value between two cluster nodes that are closer, i.e., the two cluster nodes, is higher. Then, the node cluster graph is cut according to the edge weight value, so that the sum of edge weights between different subgraphs after cutting is as low as possible, and the sum of edge weights within the subgraph is as high as possible, that is, when the distance between subgraphs is as far as possible and the subgraphs are as similar as possible, the edge weight value of each cluster subgraph meets the preset weight value, wherein the preset weight value is set according to the actual application requirements, and no specific restriction is made here, and the clustering results of the trigger word cluster and the clustering results of the role cluster, i.e., the target event, are output.
[0150] Further, the present embodiment may adopt a joint clustering method to identify the acquired concatenated feature vectors, or may perform a first spectral clustering on the concatenated feature vectors to obtain a node clustering diagram including cluster nodes and clustering edges connecting the cluster nodes as the first clustering result, and then, by calculating the overall similarity of the node clustering diagram, when the overall similarity of the same type of results is too low and the similarity of the demerits of different types is high, the similarity matrix may be adjusted for the result of the first spectral clustering, and spectral clustering may be performed again until the similarity meets the requirement or reaches the iteration upper limit, and the clustering results of the trigger word cluster and the clustering results of the role cluster are output, that is, the target event, which can be understood as calculating the distance between each cluster node and the sample by randomly confirming the node clustering diagram, and then, according to the shortest distance between each cluster node and the sample, it is explained that the two are of the same category, and the sample is assigned to the clustering cluster closest to it, that is, it can be understood as assigning the event type in the data set to a clustering cluster until convergence, and finally outputting the cluster center point of the clustering cluster and the size of the clustering cluster.
[0151] Optionally, in the above Figure 2 On the basis of the corresponding embodiment, in another optional embodiment of the event extraction method provided in the embodiment of the present application, semantic encoding processing is performed on the abstract semantic representation to obtain a semantic embedding vector including:
[0152] The abstract semantic representation is encoded according to the sequence coding model to obtain a semantic embedding vector. The sequence coding model is used to perform temporal encoding on the nodes connected by edges.
[0153] In this embodiment, after obtaining the text to be processed and the abstract semantic representation corresponding to the text to be processed, in order to accurately extract the semantic features between each node contained in the text to be processed and the abstract semantic representation, that is, to accurately convert the semantic features between each node into the semantic features between words and events, this embodiment uses a sequence encoding model to temporally encode the nodes connected by edges on the text to be processed and the abstract semantic representation, such as the bidirectional masked pre-trained language model (BERT), the Roberta model (RoBERTa) or the permutation pre-trained language model (XLNET), etc., without limitation, to accurately obtain a semantic embedding vector that has temporal characteristics and can represent the semantic features between words and events, so that the semantic embedding vector can be further identified later to accurately identify the event corresponding to the text to be processed through the semantic features between words and events, thereby improving the accuracy of obtaining events.
[0154] For example, for a text to be processed, s={w1,w2,...,w n}, and the abstract semantic representation obtained after the text to be processed is parsed is g s =(V s ,E s ), and then s={w1,w2,...,w n} and g s =(V s ,E s ) uses the Roberta model (RoBERTa) for semantic encoding, that is, encoding the word sequence into a representation vector sequence. Specifically, a multi-layer bidirectional transform encoder is used in the Roberta model (RoBERTa) to obtain the semantic representation matrix {h1,h2,...,h n}=RoBERTa(w1,w2,...,w n ), i.e., the semantic embedding vector, where each w i Represents a word, h i That's w i The corresponding hidden vector.
[0155] Specifically, after obtaining the text to be processed and the abstract semantic representation of the text to be processed, the multi-layer bidirectional transform encoder in the Roberta model (RoBERTa) in the sequence coding model can be used to obtain the semantic representation matrix of the hidden vector, that is, a semantic embedding vector that has temporal characteristics and can represent the semantic features between words and events.
[0156] Optionally, in the above Figure 2 Based on the corresponding embodiment, in another optional embodiment of the event extraction method provided in the embodiment of the present application, as Figure 6 As shown, the method also includes:
[0157] In step S601, a corpus to be processed is obtained from a database, where the corpus to be processed includes M sentences, where M is an integer greater than or equal to 1;
[0158] In step S602, an abstract semantic representation set is generated from the corpus to be processed, and the abstract semantic representation set includes a node set corresponding to the sentences and an edge set formed by connecting the edges between the nodes.
[0159] In this embodiment, in order to enable the model to better learn the semantic features and structural features between words and events, the model can be pre-trained to further improve the learning ability of the model. This embodiment is achieved by pre-processing the corpus to be processed before pre-training the model, so that the corpus to be processed can be converted into data of the same format, and the unlabeled data can be converted into the semantic relationship and structural relationship between nodes and edges to achieve automatic data labeling without manual labeling. This can not only reduce the training cost, but also ensure that the amount of training data is sufficient, thereby improving the model learning ability to a certain extent, and avoiding the situation where the sequence coding model or the graph coding model is restricted in learning the semantic relationship between the trigger word and the role due to the high cost of manual labeling data set, thereby reducing the model learning ability. This embodiment first obtains the corpus to be processed in the database, that is, a batch of unlabeled natural language instances, and performs abstract semantic representation on the corpus to be processed. The specific processing method is the same as the abstract semantic representation of the text to be processed, which is not repeated here, so as to obtain a set of abstract semantic representations that can reflect the semantic relationship between words, that is, the abstract semantic representation set, to expand the model training sample, improve the model learning ability, and thus improve the accuracy of event extraction.
[0160] For example, Fig.11As shown in FIG, generating an abstract semantic representation set from the corpus to be processed is to parse the unlabeled data, such as the sentences in the corpus to be processed, into a graph structure of abstract semantic representations one by one. The nodes of this graph structure represent the corresponding concepts, and the edges represent the semantic relationship between different concepts. Among them, a concept is basically a word. For entity phrases, this graph structure connects the words in the phrase with the subject (name) edge and the operation (operation) edge. Such edges can be merged together, that is, the entity phrase becomes a node. It can be understood that since the three edges ARG, time, and location in the abstract semantic representation structure represent the relationship with the event The relationship between the trigger words and roles is similar. The semantic relationship between each node can be reflected through these three special semantic relationships, and then the semantic features between each word and event can be reflected through the three special semantic relationships between nodes. Therefore, this embodiment can generate an abstract semantic representation set for the corpus to be processed, so that it can be converted into semantic features between words and events by extracting the node pairs connected by these three edges in each abstract semantic representation structure in the abstract semantic representation set, and then the semantic features between the trigger words and roles in the event can be more accurately reflected through the semantic features between words and events, so as to improve the learning ability of the model and thereby improve the accuracy of event acquisition.
[0161] The graph structure of the abstract semantic representation can be understood as a single-rooted directed acyclic tree; Fig.11 The purpose of the illustrated "report-01" is to ensure the integrity of the sentence's semantics; "directed" is to ensure semantic transfer; and "acyclic" is to prevent semantic transfer from falling into an infinite loop.
[0162] Specifically, before pre-training the model, in order to avoid the situation where the model's learning ability is reduced due to the high cost of manually annotated data sets, which limits the semantic relationship between the model's learning trigger words and roles, this embodiment performs abstract semantic representation on the unannotated corpus to be processed, and obtains a set of abstract semantic representations that can reflect the semantic features between words and events through the semantic relationship between nodes, so as to expand the training data set, improve the model's learning ability, and thus improve the accuracy of part extraction.
[0163] Optionally, in the above Figure 2 Based on the corresponding embodiment, in another optional embodiment of the event extraction method provided in the embodiment of the present application, as Figure 7 As shown, the method also includes:
[0164] In step S701, a contrastive learning training data set is generated according to the abstract semantic representation set;
[0165] In step S702, the basic model is pre-trained according to the comparative learning training data set to obtain a training model.
[0166] In this embodiment, the contrastive learning training data set is to construct corresponding positive examples and negative examples based on the contrastive learning method by acquiring the abstract semantic representation set, wherein the positive example is used to approximately represent the close relationship, and the negative example is used to approximately represent the distant relationship. The contrastive learning training data set includes a contrastive learning semantic training data set and a contrastive learning graph training data set, etc., and may also include other data sets constructed based on the contrastive learning method, which is not specifically limited here.
[0167] Specifically, after obtaining the abstract semantic representation set, in order to enable the basic model to better learn the semantic features and structural features between words and events, the basic model can be pre-trained to further improve the learning ability of the model. The basic model can be a pre-built graph isomorphism model (GIN), graph neural network, bidirectional mask pre-trained language model (BERT), Roberta model (RoBERTa) or permutation pre-trained language model (XLNET), etc., which are not specifically limited. When pre-training the model, this embodiment first constructs corresponding positive examples and negative examples based on the acquired abstract semantic representation set based on the contrastive learning method, and uses the constructed positive examples and negative examples as contrastive learning training data sets, so that the basic model can be pre-trained by contrastive learning training data sets to improve the learning ability of the basic model, obtain a trained training model, and thus improve the accuracy of event extraction.
[0168] Optionally, in the above Figure 2 Based on the corresponding embodiment, in another optional embodiment of the event extraction method provided in the embodiment of the present application, as Figure 8 As shown, the method also includes:
[0169] In step S801, a semantic positive example is constructed according to the edges, nodes, edge sets and node sets, wherein the semantic positive example is used to represent the semantic close relationship between the trigger word and the role;
[0170] In step S802, a node replacement operation is performed on the semantic positive example to obtain a semantic negative example, wherein the semantic negative example is used to represent the semantic distance relationship between the trigger word and the role;
[0171] In step S803, the semantic positive examples and the semantic negative examples are used as a semantic training data set for comparative learning.
[0172] In this embodiment, since the relationship represented by the three edges ARG, time, and location in the abstract semantic representation is similar to the relationship between the trigger word and the role in the event, and the semantic relationship between each node is reflected by these three special semantic relationships, the semantic features between each word and the event can be reflected by the three special semantic relationships between the nodes. Therefore, in order to accurately extract the node pairs connected by the three edges from the abstract semantic representation, and then convert the extracted node pairs into semantic features between the word and the event, the trigger word and the role word in the event can be acquired through the semantic features between the word and the event, thereby improving the accuracy of acquiring the event, specifically, after acquiring the abstract semantic representation set, the edge, node, edge set, and node set can be recorded as P based on the contrastive learning method. s ={(u,v)(u,v,r)∈E s ,r∈R p},R p ={ARG, time, location}, and put P s As a positive example that can approximately express the semantic close relationship between the trigger word and the role, it is also called a semantic positive example.
[0173] Furthermore, in order to more accurately learn the semantic features between each word and event, so that the semantic relationship between the trigger word and the role in the event can be reflected by the learned semantic features between the word and the event, this embodiment replaces the trigger word or role of the node pair to construct a negative example that can be used to approximate the semantic distance relationship between the trigger word and the role pair, that is, a semantic negative example. It can be understood that, assuming (t, a) ∈ P s , where t is the trigger word and a is the node pair of the role, then t can be replaced by in, satisfy r∈R p , after replacement, we can get a negative example Similarly, by replacing the role, you can replace a negative example in, satisfy r∈R p , therefore, by replacing the trigger words, we can construct m t negative examples, and by replacing the roles, we can construct m a The set of these negative examples is the negative examples that can approximately represent the semantic distance relationship between the trigger word and the role, that is, semantic positive and negative examples.
[0174] Specifically, after obtaining the set of abstract semantic representations, a semantic positive example that can approximately represent the semantically close relationship between the trigger word and the role is constructed by edges, nodes, edge sets, and node sets, and a negative example that can approximately represent the semantically distant relationship between the trigger word and the role is obtained by performing a node replacement operation on the semantic positive example. Then, the semantic positive example and the semantic negative example are used as a contrastive learning semantic training data set, so that the contrastive learning semantic training data set can be used to train the model in the future, so that the model can learn more semantic relationships between the trigger words and the roles through the contrastive learning semantic training data set, thereby improving the learning ability of the model, enhancing the accuracy of the model prediction, and thus improving the accuracy of event acquisition.
[0175] Optionally, in the above Figure 2 On the basis of the corresponding embodiment, in another optional embodiment of the event extraction method provided in the embodiment of the present application, the method further includes:
[0176] The basic sequence encoding model is reversely trained according to the contrastive learning semantic training dataset and the loss function to obtain the sequence encoding model.
[0177] In this embodiment, after obtaining the contrastive learning semantic training data set, in order to enable the model to better learn the semantic features between words and events, the model can be pre-trained according to the contrastive learning semantic training data set, and the trained basic coding model can be reversely trained according to the following loss function and in combination with the semantic representation matrix to obtain the optimized sequence coding model, thereby improving the learning ability of the sequence coding model for the semantic features between words and events, thereby improving the accuracy of event extraction:
[0178]
[0179] Where W is a learnable matrix that defines a similarity measure between representation vectors, h t is the representation vector of the trigger word t, that is, the hidden vector of the trigger word, h a is the representation vector of character a, that is, the hidden vector of the character, is the i-th replacement trigger word The representation vector is the hidden vector that replaces the trigger word, and log is the logarithmic function with e as the base, and exp is the exponential function with e as the base.
[0180] Furthermore, by adding up all the loss functions, we get the final loss function:
[0181]
[0182] Among them, t represents the trigger word, a represents the role, B represents the corpus to be processed, and P sIt is a semantic positive example.
[0183] Specifically, after obtaining the contrastive learning semantic training data set, the model can be pre-trained according to the contrastive learning semantic training data set, which can avoid repeated learning of the corpus during the training process and reduce the learning cost. Then, the basic sequence model can be reversely trained by combining the superimposed semantic representation matrix with the loss function. The basic sequence model can be iteratively optimized continuously until convergence to obtain an optimized sequence coding model, which can improve the sequence coding model's ability to learn the semantic features between words and events, thereby improving the accuracy of event extraction.
[0184] It should be noted that if Fig.13 As shown, it can be understood that the evaluation result of the sequence encoding model obtained after pre-training based on the contrastive learning method is obtained by evaluating. It can be understood that in supervised learning, such as Fig.13 As shown in (a), various models perform event extraction on the ACE2005 dataset, including the performance of event detection (ED) and event argument extraction (EAE), as well as Fig.13 As shown in (b), the performance of event detection (ED) on the data set (MAVEN), where the model CLEVE is represented as the sequence encoding model obtained by reverse training the basic encoding model according to the loss function and the semantic representation matrix in this embodiment, that is, the model is obtained after adding pre-training based on contrastive learning. Taking the F1 indicator as the evaluation basis, it can be found that after adding pre-training based on contrastive learning, the model performance has been significantly improved, where P represents precision, R represents recall, and the F1 score is the harmonic mean of P and R, ED represents event detection, and EAE represents event argument extraction.
[0185] Furthermore, if Fig.14 As shown, it can be understood that in unsupervised learning, Fig.14 As shown in (a), various models perform event extraction on the (ACE2005) dataset, including the performance of event detection (ED) and event role extraction (EAE), as well as Fig.14As shown in (b), the performance of event detection (ED) on the data set (MAVEN), where the model (CLEVE) is represented as the sequence encoding model obtained by reverse training the basic encoding model according to the loss function and the semantic representation matrix in this embodiment, that is, the model obtained after adding pre-training based on contrastive learning. Based on the data (B-Cubed) indicator as the evaluation basis, it can be found that after adding pre-training based on contrastive learning, the model performance has been significantly improved.
[0186] Optionally, in the above Figure 2 Based on the corresponding embodiment, in another optional embodiment of the event extraction method provided in the embodiment of the present application, as Fig. 9 As shown, the method also includes:
[0187] In step S901, random graph sampling is performed twice on each abstract semantic representation in the abstract semantic representation set to obtain 2M randomly sampled subgraphs, wherein the randomly sampled subgraphs include target nodes and child nodes, and each abstract semantic representation corresponds to two randomly sampled subgraphs;
[0188] In step S902, 2M randomly sampled subgraphs are used as graph positive examples, which are used to represent the semantic closeness of the child node with respect to the target node;
[0189] In step S903, the randomly sampled subgraphs are randomly combined to obtain X randomly combined subgraphs, wherein each randomly combined subgraph contains two randomly sampled subgraphs, the two randomly sampled subgraphs in the randomly combined subgraph correspond to different abstract semantic representations, and X is an integer not equal to 2M;
[0190] In step S904, X randomly combined subgraphs are used as graph negative examples, where the graph negative examples are used to indicate the semantic distance relationship between the subnodes and the target node;
[0191] In step S905, the positive examples and negative examples are used as graph training data sets for comparative learning.
[0192] In this embodiment, after obtaining the sampled representation set, each abstract semantic representation graph structure can be regarded as an original graph. Then, in order for the subsequent model to better learn the structural relationship between nodes during the pre-training process, this embodiment reduces the subsequent model's acquisition of simple solutions during the pre-training process by enhancing the randomness of the structural relationship in the graph structure, thereby improving the model's learning ability and thus improving the accuracy of event extraction. Specifically, each original graph can be randomly sampled twice, which can be understood as dividing each original graph into two randomly sampled subgraphs, wherein the randomly sampled subgraph is a graph formed by randomly walking from any node to other nodes until all the nodes are walked, wherein the route walked can be regarded as the edge connecting the nodes.
[0193] Furthermore, in order to further improve the learning ability of the model learning structural features, this embodiment uses a contrastive learning graph training data set constructed based on a contrastive learning method to pre-train the model. First, each abstract semantic representation in the abstract semantic representation set is subjected to two random graph samplings. Specifically, for an abstract semantic representation, any node of the abstract semantic representation is selected as the target node, and other nodes except the selected target node are used as child nodes of the abstract semantic representation. Then, the selected target child node is subjected to random graph sampling to obtain a randomly sampled subgraph. Similarly, M abstract semantic representations are subjected to two random graph samplings respectively to obtain 2M randomly sampled subgraphs, where M is an integer greater than or equal to 1, and these 2M randomly sampled subgraphs are used as graph positive examples. These graph positive examples can be used to approximately represent the semantic proximity of the child node relative to the target node. For example, the i-th abstract semantic representation g in the abstract semantic representation set i Perform two random samplings respectively, and we can get g i The corresponding two randomly sampled subgraphs are shown in a 2i-1 and a 2i , where i is an integer less than or equal to 2M, and the randomly sampled subgraph a 2i-1 and a 2i As a pair of graph positive examples, the graph positive example is used to approximate the semantic closeness relationship between the child node and the target node. Then, the 2M randomly sampled subgraphs are randomly combined in pairs (such as permutation combination or cross combination, etc.), and the two randomly sampled subgraphs combined together correspond to different abstract semantic representations. For example, assuming that the randomly sampled subgraph a j The corresponding abstract semantics is represented by g j , randomly select a k The corresponding abstract semantics is represented by g k , when randomly sampling subgraph a j and randomly sampled subgraph a kCombined together, a random combination subgraph is obtained, where j or k is an integer not equal to i. Similarly, 2M randomly sampled subgraphs can be combined to obtain X random combination subgraphs. For example, 2M randomly sampled subgraphs are permuted and combined to obtain random combination subgraphs, where y is an integer less than or equal to M. Further, the obtained X random combination subgraphs are used as negative examples. These negative examples can be used to approximate the semantic distance relationship between the subnodes and the target node. For example, the randomly sampled subgraph a j and randomly sampled subgraph a k Combined together, a randomly combined subgraph can be obtained as a pair of graph negative examples, which are used to approximately represent the semantic distance relationship between the sub-node and the target node. Then, graph positive examples and graph negative examples can be constructed based on the contrastive learning method to enhance the randomness of the model learning structural relationship, so as to reduce the acquisition of simple solutions in the subsequent pre-training of the model through the contrastive learning graph training data set, improve the model's ability to learn structural features in the graph structure, and thus improve the accuracy of event extraction.
[0194] Specifically, after obtaining the sampled representation set, based on the contrastive learning method, firstly, each abstract semantic representation in the abstract semantic representation set is subjected to random graph sampling twice to obtain two randomly sampled subgraphs corresponding to each abstract semantic representation, and these randomly sampled subgraphs are used as positive examples. Then, the randomly sampled subgraphs corresponding to two different abstract semantic representations are randomly combined to obtain randomly combined subgraphs, wherein the two randomly sampled subgraphs contained in each randomly combined subgraph do not correspond to the same abstract semantic representation. Then, these randomly combined subgraphs are used as negative examples, and the positive and negative examples are used as contrastive learning graph training data sets, so that in the subsequent pre-training of the model through the contrastive learning graph training data set, the acquisition rate of simple solutions can be reduced, and the model's ability to learn structural features in the graph structure can be improved, thereby improving the accuracy of event extraction.
[0195] Optionally, in the above Figure 2 Based on the corresponding embodiment, in another optional embodiment of the event extraction method provided in the embodiment of the present application, as Fig.10 As shown, the method also includes:
[0196] In step S1001, any node in the abstract semantic representation is used as a target node, and nodes other than the target node are used as child nodes;
[0197] In step S1002, a random walk is performed from the target node to the child node to obtain a random node set, wherein the random node set includes the target node, the child node, and an edge formed from the target node to the child node;
[0198] In step S1003, a node subgraph is drawn according to the random node set;
[0199] In step S1004, the target nodes and sub-nodes in the node sub-graph are numbered to obtain a randomly sampled sub-graph.
[0200] In this embodiment, graph sampling includes three steps: random walking with restart behavior, subgraph inference, and anonymization. The random walking with restart behavior is to take any node in the abstract semantic representation as the target node, and the target node must meet the condition of in-degree 0, and take nodes other than the target node as subnodes. Then, the original graph can be regarded as an undirected graph and start walking with equal probability. For example, walking from A to B, C, and D has a probability of one-third of walking. Then, it can return to the starting point and start walking again with a preset fixed probability. The preset fixed probability is usually set to 0.8, and can also be set in the range of 0.0 to 1.0, without specific restrictions here, so that the random walking exploration range is wider and the sampled subgraphs are more random. Then, when all the subnodes adjacent to the target node, that is, the starting point, have been walked, the walking is terminated to obtain a random node set including the target node, subnodes, and edges formed from the target node to the subnodes.
[0201] Furthermore, subgraph inference is performed based on the obtained random node set to obtain a graph covering the target node, child nodes, and edges from the target node to the child nodes in the random node set, namely, a node subgraph.
[0202] Furthermore, anonymization is to renumber the obtained node subgraphs to obtain randomly sampled subgraphs, which can be used to prevent the search for simple solutions during pre-training and improve the model's ability to learn structural features in graph structures, thereby improving the accuracy of event extraction.
[0203] Optionally, in the above Figure 2 On the basis of the corresponding embodiment, in another optional embodiment of the event extraction method provided in the embodiment of the present application, the method further includes:
[0204] The basic graph encoding model is reversely trained according to the comparative learning graph training dataset and the loss function to obtain the graph encoding model.
[0205] Specifically, after obtaining the contrastive learning graph training data set, in order to enable the model to better learn the structural features between words and events, the model can be pre-trained according to the contrastive learning graph training data set, and the basic graph encoding model can be reversely trained using the following loss function to obtain the optimized graph encoding model, thereby improving the learning ability of the sequence encoding model for the structural features between words and events, thereby improving the accuracy of event extraction:
[0206]
[0207] Among them, m is the number of input abstract semantic representation graphs, and a 2i represents the randomly sampled subgraph a corresponding to the i-th abstract semantic representation graph randomly selected from m abstract semantic representation graphs 2i-1 and a 2i The representation vector obtained by the graph encoder is similar to a j Random sampling of sample a j The representation vector obtained by the graph encoder is 1 j≠2i-1 is an indicator function, which is 1 when j≠2i-1 and 0 otherwise.
[0208] The event extraction device in this application is described in detail below. Fig.15 , Fig.15 This is a schematic diagram of an embodiment of an event extraction device in an embodiment of the present application. The event extraction device 20 includes:
[0209] An acquisition unit 201 is used to acquire a text to be processed, wherein the text to be processed includes N words, where N is an integer greater than 1;
[0210] A generating unit 202, configured to generate an abstract semantic representation according to the text to be processed, wherein the abstract semantic representation includes nodes corresponding to words one by one, and edges for connecting the nodes;
[0211] The processing unit 203 is used to perform semantic encoding processing on the abstract semantic representation and the text to be processed to obtain a semantic embedding vector, wherein the semantic embedding vector is used to represent the semantic features between each word and the event;
[0212] The processing unit 203 is further used to perform graph encoding processing on the abstract semantic representation to obtain a graph embedding vector, wherein the graph embedding vector is used to represent the structural features between nodes connected by edges;
[0213] The processing unit 203 is further used to concatenate the semantic embedding vector with the graph embedding vector to obtain a concatenated feature vector;
[0214] The processing unit 203 is used to identify the concatenated feature vector and output the target event, wherein the target event includes a trigger word and a role word extracted from N words, the trigger word is used to indicate the event that occurs in the text to be processed, and the role word is used to indicate the role of each entity in the text to be processed in the event.
[0215] In an embodiment of the present application, an event extraction device is provided. Through the above method, it is realized by converting words into nodes and edges that are easy to identify, and then converting the nodes and edges into semantic embedding vectors that can reflect the semantic features between each word and the event, and converting the structural features between the nodes connected by the edges into graph embedding vectors that can reflect the structural features between each word and the event, so as to expand the event semantic definition architecture, so that the learned semantic features and structural features between words and events have higher accuracy, thereby improving the accuracy of acquiring target events.
[0216] Optionally, in the above Fig.15 On the basis of the corresponding embodiment, in another embodiment of the event extraction device provided by the embodiment of the present application,
[0217] The processing unit 203 is further used to perform node coding processing on the text to be extracted to obtain a node coding vector, and the node coding vector is used to initialize the semantic features between each word and event;
[0218] The processing unit 203 is further used to perform graph coding processing on the node coding vector and the abstract semantic representation through a graph coding model to obtain a graph embedding vector.
[0219] In this embodiment, the processing unit 203 can perform node encoding processing on the acquired text to be processed to obtain a node encoding vector that can be easily recognized by the graph coding model and initializes the semantic features between each word and the event. Then, the processing unit 203 can perform graph encoding processing on the node encoding vector and the abstract semantic representation through the graph coding model to convert the structural features between each node into a graph embedding vector that can reflect the structural features between each word and the event, so that more important structural features in event extraction can be captured through the graph embedding vector in the future, thereby improving the accuracy of event extraction.
[0220] Optionally, in the above Fig.15 On the basis of the corresponding embodiment, in another embodiment of the event extraction device provided by the embodiment of the present application,
[0221] A determination unit 204 is used to determine a trigger word maximum pooling feature vector and a role word maximum pooling feature vector corresponding to the semantic embedding vector according to a dynamic maximum pooling algorithm;
[0222] The processing unit 203 is specifically used to concatenate the maximum pooling feature vector of the trigger word and the maximum pooling feature vector of the role word with the concatenated feature vector to obtain a feature vector to be identified;
[0223] The output unit 205 is used to classify and identify the feature vector to be identified to obtain the target event.
[0224] In this embodiment, the determination unit 204 can perform dynamic maximum pooling processing on the acquired semantic embedding vector to achieve event type classification and event role classification of the semantic embedding vector, and obtain the maximum pooling feature vector of the trigger word and the maximum pooling feature vector of the role word. Then, the processing unit 203 concatenates the maximum pooling feature vector of the trigger word and the maximum pooling feature vector of the role word with the concatenated feature vector to obtain the feature vector to be identified. Furthermore, an event classifier is used in the output unit 205 to classify and identify the feature vector to be identified, so as to achieve more detailed classification of the trigger words and role words in the event, thereby improving the accuracy of event extraction.
[0225] Optionally, in the above Fig.15 On the basis of the corresponding embodiment, in another embodiment of the event extraction device provided by the embodiment of the present application,
[0226] The processing unit 203 is specifically used to perform spectral clustering on the concatenated feature vectors to obtain a node clustering graph, wherein the node clustering graph includes cluster nodes and cluster edges connecting the cluster nodes;
[0227] The determination unit 204 is further used to determine the edge weight value between the cluster nodes according to the distance of the cluster edge;
[0228] The processing unit 203 is specifically used to perform graph cutting processing on the node cluster graph to obtain K cluster subgraphs, where K is an integer greater than 1;
[0229] The output unit 205 is further configured to output the target event when the edge weight value of each cluster subgraph meets a preset weight value.
[0230] In this embodiment, the processing unit 203 performs spectral clustering on the acquired concatenated feature vectors, and performs graph cutting processing on the node cluster graph obtained by the spectral clustering to obtain K cluster subgraphs, and then the edge weight values between the cluster nodes are determined by the determination subunit 205, and then the edge weight value of each cluster subgraph is detected by the output unit 205. When it is detected that the edge weight value of the cluster subgraph meets the preset weight value, it can be understood that the cluster subgraph belongs to the cluster cluster corresponding to the preset weight value, wherein the preset weight value has a corresponding relationship with the cluster cluster, and the clustering results of the trigger word cluster and the clustering results of the role cluster are output by the output unit 205, so as to achieve more refined classification of the trigger words and role words in the event, thereby improving the accuracy of event extraction.
[0231] Optionally, in the above Fig.15 On the basis of the corresponding embodiment, in another embodiment of the event extraction device provided by the embodiment of the present application,
[0232] The processing unit 203 is further used to encode the abstract semantic representation according to the sequence coding model to obtain a semantic embedding vector. The sequence coding model is used to perform temporal coding on the nodes connected by the edges.
[0233] In this embodiment, the processing unit 203 adopts the multi-layer bidirectional transform encoder in the Roberta model (RoBERTa) of the sequence coding model to obtain the semantic representation matrix of the hidden vector, that is, the semantic embedding vector that has temporal characteristics and can represent the semantic features between words and events, so that the more important semantic features in event extraction can be captured through the semantic embedding vector later, thereby improving the accuracy of event extraction.
[0234] Optionally, in the above Fig.15 On the basis of the corresponding embodiment, in another embodiment of the event extraction device provided by the embodiment of the present application,
[0235] The acquisition unit 201 is further used to acquire the to-be-processed corpus from the database, where the to-be-processed corpus includes M sentences, where M is an integer greater than or equal to 1;
[0236] The generating unit 202 is further used to generate an abstract semantic representation set from the corpus to be processed, where the abstract semantic representation set includes a node set corresponding to the sentences and an edge set formed by connecting the edges between the nodes.
[0237] In this embodiment, a batch of unprocessed corpora in the database are obtained by the acquisition unit 201. In order to enable the model to better learn the semantic features and structural features between words and events, the corpora to be processed can be preprocessed by the generation unit 202 before pre-training the model. Specifically, the corpus to be processed can be abstractly semantically represented to obtain an abstract semantic representation set, so as to subsequently construct training samples for model training, improve the learning ability of the model, and thus improve the accuracy of event extraction.
[0238] Optionally, in the above Fig.15 On the basis of the corresponding embodiment, in another embodiment of the event extraction device provided by the embodiment of the present application,
[0239] The generating unit 202 is further configured to generate a contrastive learning training data set according to the abstract semantic representation set.
[0240] The training unit 206 is used to pre-train the basic model according to the contrastive learning training data set to obtain a training model.
[0241] In this embodiment, the contrastive learning method is used on the acquired abstract semantic representation set by the generation unit 202 to construct a contrastive learning training data set, wherein the contrastive learning training data set includes positive examples that can be used to approximately represent close relationships, and negative examples that are used to approximately represent distant relationships. Then, in order to enable the basic model to better learn the semantic features and structural features between words and events, the contrastive learning training data set is used to pre-train the basic model through the training unit 206 to improve the learning ability of the basic model, thereby obtaining a trained training model, thereby improving the accuracy of event extraction.
[0242] Optionally, in the above Fig.15 On the basis of the corresponding embodiment, in another embodiment of the event extraction device provided by the embodiment of the present application,
[0243] A construction unit 207, configured to construct a semantic positive example based on the edge, the node, the edge set, and the node set, wherein the semantic positive example is used to represent the semantic close relationship between the trigger word and the role;
[0244] The construction unit 207 is further used to perform a node replacement operation on the semantic positive example to obtain a semantic negative example, wherein the semantic negative example is used to represent the semantic distance relationship between the trigger word and the role;
[0245] The construction unit 207 is further configured to use the semantic positive examples and the semantic negative examples as semantic training data sets for comparative learning.
[0246] In this embodiment, a contrastive learning method is adopted by the construction unit 207 to construct semantic positive examples and semantic negative examples, and the semantic positive examples and semantic negative examples are used as a contrastive learning semantic training data set, so that the contrastive learning semantic training data set can be used to train the model later, so that the model can learn more semantic relationships between trigger words and roles through the contrastive learning semantic training data set, thereby improving the learning ability of the model, enhancing the accuracy of the model prediction, and thus improving the accuracy of event acquisition.
[0247] Optionally, in the above Fig.15 On the basis of the corresponding embodiment, in another embodiment of the event extraction device provided by the embodiment of the present application,
[0248] The training unit 206 is specifically used to perform reverse training on the basic sequence coding model according to the contrastive learning semantic training data set and the loss function to obtain the sequence coding model.
[0249] In this embodiment, the basic sequence coding model is coded by the training unit 206 using the acquired contrastive learning semantic training data set, and then the trained basic sequence coding model is reversely trained using the loss function in the training unit 206 and in combination with the acquired semantic representation matrix to obtain an optimized sequence coding model, thereby improving the learning ability of the sequence coding model for the semantic features between words and events, thereby improving the accuracy of event extraction.
[0250] Optionally, in the above Fig.15 On the basis of the corresponding embodiment, in another embodiment of the event extraction device provided by the embodiment of the present application,
[0251] The construction unit 207 is further used to perform two random graph samplings on each abstract semantic representation in the abstract semantic representation set to obtain 2M randomly sampled subgraphs, wherein the randomly sampled subgraphs include the target node and the child nodes, and each abstract semantic representation corresponds to two randomly sampled subgraphs;
[0252] The construction unit 207 is further used to use 2M randomly sampled subgraphs as graph positive examples, where the graph positive examples are used to represent the semantic closeness relationship between the sub-nodes and the target node;
[0253] The construction unit 207 is further used to randomly combine the randomly sampled subgraphs to obtain X randomly combined subgraphs, wherein each randomly combined subgraph includes two randomly sampled subgraphs, and the two randomly sampled subgraphs in the randomly combined subgraph correspond to different abstract semantic representations, and X is an integer not equal to 2M;
[0254] The construction unit 207 is further used to use the X randomly combined subgraphs as negative examples, where the negative examples are used to indicate the semantic distance relationship between the subnodes and the target node;
[0255] The construction unit 207 is further used to use the positive examples and the negative examples as graph training data sets for comparative learning.
[0256] In this embodiment, the construction unit 207 constructs positive examples and negative examples of images through a comparative learning method, and uses the positive examples and negative examples of images as a comparative learning graph training data set, so that the comparative learning graph training data set can be used to train the basic model later, so that the basic model can learn more structural relationships between trigger words and roles through the comparative learning graph training data set, thereby improving the learning ability of the basic model, enhancing the accuracy of the basic model's prediction, and thus improving the accuracy of acquiring events.
[0257] Optionally, in the above Fig.15 On the basis of the corresponding embodiment, in another embodiment of the event extraction device provided by the embodiment of the present application,
[0258] The determination unit 204 is further configured to use any node in the abstract semantic representation as a target node, and use nodes other than the target node as child nodes;
[0259] The processing unit 203 is further used to perform a random walk from the target node to the child node to obtain a random node set, where the random node set includes the target node, the child node, and an edge formed from the target node to the child node;
[0260] The processing unit 203 is further used to draw a node subgraph according to the random node set;
[0261] The processing unit 203 is further used to number the target nodes and sub-nodes in the node sub-graph to obtain a randomly sampled sub-graph.
[0262] In this embodiment, the target node for random walking in the abstract semantic representation and the child node corresponding to the target node are first determined by the determination unit 204, and then the acquired target node and child node are subjected to random walking with restart behavior, subgraph inference and anonymization processing in turn by the processing unit 203 to obtain a randomly sampled subgraph, which can be used to prevent the search for simple solutions when pre-training the basic model with a comparison graph training data set, and improve the ability of the basic model to learn structural features in the graph structure, thereby improving the accuracy of event extraction.
[0263] Optionally, in the above Fig.15 On the basis of the corresponding embodiment, in another embodiment of the event extraction device provided by the embodiment of the present application,
[0264] The training unit 206 is specifically used to perform reverse training on the basic graph coding model according to the comparative learning graph training data set and the loss function to obtain the graph coding model.
[0265] In this embodiment, the basic graph coding model is coded using the acquired contrastive learning semantic training data set through the training unit 206, and then the trained basic graph coding model is reversely trained through the loss function in the training unit 206 to obtain an optimized graph coding model, thereby improving the graph coding model's ability to learn the structural features between words and events, thereby improving the accuracy of event extraction.
[0266] Another aspect of the present application provides a schematic diagram of a computer device, such as Fig.16For the sake of convenience, only the parts related to the embodiments of the present invention are shown. For specific technical details not disclosed, please refer to the method part of the embodiments of the present invention. The processing device applied to data recovery can be any terminal device including a mobile phone, a tablet computer, a personal digital assistant (PDA), a point of sales (POS), a car computer, etc., and the processing device applied to data recovery is a mobile phone as an example:
[0267] Fig.16 FIG. 1 is a block diagram of a partial structure of a mobile phone related to a processing device for data recovery provided by an embodiment of the present invention. Fig.16 The mobile phone includes: a radio frequency (RF) circuit 310, a memory 320, an input unit 330, a display unit 340, a sensor 350, an audio circuit 360, a wireless fidelity (WiFi) module 370, a processor 380, and a power supply 390. Those skilled in the art will understand that Fig.16 The mobile phone structure shown in the figure does not constitute a limitation on the mobile phone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0268] Combine the following Fig.16 A detailed introduction to the various components of the mobile phone:
[0269] The RF circuit 310 can be used for receiving and sending signals during the process of sending and receiving information or making calls. In particular, after receiving the downlink information of the base station, it is sent to the processor 380 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit 310 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, LNA), a duplexer, etc. In addition, the RF circuit 310 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to the Global System of Mobile communication (Global System of Mobile communication, GSM), General Packet Radio Service (General Packet Radio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access, CDMA), Wideband Code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE), email, Short Messaging Service (SMS), etc.
[0270] The memory 320 can be used to store software programs and modules. The processor 380 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 320. The memory 320 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 320 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0271] The input unit 330 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the mobile phone. Specifically, the input unit 330 may include a touch panel 331 and other input devices 332. The touch panel 331, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 331 or near the touch panel 331 using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 331 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 380, and can receive and execute commands sent by the processor 380. In addition, the touch panel 331 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 331, the input unit 330 may also include other input devices 332. Specifically, other input devices 332 may include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, etc.
[0272] The display unit 340 can be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 340 may include a display panel 341. Optionally, the display panel 341 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch panel 331 may cover the display panel 341. When the touch panel 331 detects a touch operation on or near it, it is transmitted to the processor 380 to determine the type of touch event. Subsequently, the processor 380 provides a corresponding visual output on the display panel 341 according to the type of touch event. Although in Fig.16 In the embodiment, the touch panel 331 and the display panel 341 are used as two independent components to realize the input and output functions of the mobile phone, but in some embodiments, the touch panel 331 and the display panel 341 can be integrated to realize the input and output functions of the mobile phone.
[0273] The mobile phone may also include at least one sensor 350, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 341 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 341 and / or the backlight when the mobile phone is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.
[0274] The audio circuit 360, the speaker 361, and the microphone 362 can provide an audio interface between the user and the mobile phone. The audio circuit 360 can transmit the received audio data to the speaker 361 after converting the electrical signal, which is converted into a sound signal for output; on the other hand, the microphone 362 converts the collected sound signal into an electrical signal, which is received by the audio circuit 360 and converted into audio data, and then the audio data is output to the processor 380 for processing, and then sent to another mobile phone through the RF circuit 310, or the audio data is output to the memory 320 for further processing.
[0275] WiFi is a short-range wireless transmission technology. The mobile phone can help users send and receive emails, browse web pages and access streaming media through the WiFi module 370. It provides users with wireless broadband Internet access. Fig.16 A WiFi module 370 is shown, but it is understandable that it is not an essential component of the mobile phone and can be omitted as needed without changing the essence of the invention.
[0276] The processor 380 is the control center of the mobile phone. It uses various interfaces and lines to connect various parts of the entire mobile phone. It executes various functions of the mobile phone and processes data by running or executing software programs and / or modules stored in the memory 320, and calling data stored in the memory 320. Optionally, the processor 380 may include one or more processing units; optionally, the processor 380 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 380.
[0277] The mobile phone also includes a power supply 390 (such as a battery) for supplying power to various components. Optionally, the power supply can be logically connected to the processor 380 through a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system.
[0278] Although not shown, the mobile phone may also include a camera module, a Bluetooth module, etc., which will not be described in detail here.
[0279] In the embodiment of the present invention, the processor 380 included in the terminal device is used to execute the following Figures 2 to 10 The steps in the corresponding embodiments.
[0280] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0281] Another aspect of the present application provides a computer-readable storage medium, wherein instructions are stored in the computer-readable storage medium, and when the instructions are executed on a computer, the computer executes the following Figures 2 to 10 The illustrated embodiments describe steps in a method.
[0282] Another aspect of the present application provides a computer program product comprising instructions, which when executed on a computer or a processor, causes the computer or the processor to execute the following Figures 2 to 10 The illustrated embodiments describe steps in a method.
[0283] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0284] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0285] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0286] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0287] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.
Claims
1. An event extraction method, characterized in that: include: Obtaining a text to be processed, wherein the text to be processed includes N words, where N is an integer greater than 1; Generating an abstract semantic representation according to the text to be processed, wherein the abstract semantic representation includes nodes corresponding to the words one by one, and edges for connecting the nodes; Performing semantic encoding processing on the abstract semantic representation and the text to be processed to obtain a semantic embedding vector, wherein the semantic embedding vector is used to represent the semantic features between each of the words and the event; Performing graph encoding processing on the abstract semantic representation to obtain a graph embedding vector, wherein the graph embedding vector is used to represent structural features between the nodes connected by the edges; Concatenating the semantic embedding vector with the graph embedding vector to obtain a concatenated feature vector; The concatenated feature vector is identified and a target event is output, wherein the target event includes a trigger word and a role word extracted from the N words, the trigger word is used to indicate the event occurring in the text to be processed, and the role word is used to indicate the role of each entity in the text to be processed in the event.
2. The method according to claim 1, characterized in that Before performing graph encoding processing on the abstract semantic representation to obtain a graph embedding vector, the method further includes: Performing node coding processing on the text to be processed to obtain a node coding vector, wherein the node coding vector is used to initialize the semantic features between each of the words and the event; The performing graph encoding processing on the abstract semantic representation to obtain a graph embedding vector comprises: The node encoding vector and the abstract semantic representation are subjected to graph encoding processing through a graph coding model to obtain the graph embedding vector.
3. The method according to claim 1, characterized in that The performing event recognition on the concatenated feature vector and outputting the target event comprises: Determine the trigger word maximum pooling feature vector and the role word maximum pooling feature vector corresponding to the semantic embedding vector according to a dynamic maximum pooling algorithm; The maximum pooled feature vector of the trigger word and the maximum pooled feature vector of the role word are concatenated with the concatenated feature vector to obtain a feature vector to be identified; The feature vector to be identified is classified and identified to obtain the target event.
4. The method according to claim 1, characterized in that: The performing event recognition on the concatenated feature vector and outputting the target event further comprises: Performing spectral clustering on the concatenated feature vectors to obtain a node cluster graph, wherein the node cluster graph includes cluster nodes and cluster edges connecting the cluster nodes; Determining edge weight values between the cluster nodes according to the distance of the cluster edges; Performing graph cutting processing on the node cluster graph to obtain K cluster subgraphs, where K is an integer greater than 1; When the edge weight value of each of the cluster subgraphs meets the preset weight value, the target event is output.
5. The method according to claim 1, characterized in that The performing semantic encoding processing on the abstract semantic representation to obtain a semantic embedding vector comprises: The abstract semantic representation is encoded according to a sequence coding model to obtain the semantic embedding vector, and the sequence coding model is used to perform temporal coding on the nodes connected by the edges.
6. The method according to claim 1, characterized in that Before generating an abstract semantic representation according to the text to be processed, the method further includes: Obtaining a corpus to be processed from a database, wherein the corpus to be processed includes M sentences, where M is an integer greater than or equal to 1; The corpus to be processed is used to generate an abstract semantic representation set, wherein the abstract semantic representation set includes a node set corresponding to the sentences and an edge set formed by connecting the edges between the nodes.
7. The method according to claim 6, characterized in that After generating a set of abstract semantic representations from the corpus to be processed, the method further comprises: generating a contrastive learning training data set according to the abstract semantic representation set; The basic model is pre-trained according to the comparative learning training data set to obtain a training model.
8. The method according to claim 7, characterized in that The contrastive learning training data set includes a contrastive learning semantic training data set, and generating the contrastive learning training data set according to the abstract semantic representation set includes: constructing the semantic positive example according to the edge, the node, the edge set and the node set, wherein the semantic positive example is used to represent the semantic close relationship between the trigger word and the role; Performing a node replacement operation on the semantic positive example to obtain a semantic negative example, wherein the semantic negative example is used to represent a semantic distance relationship between the trigger word and the role; The semantic positive examples and the semantic negative examples are used as semantic training data sets for comparative learning.
9. The method according to claim 8, characterized in that The training model includes a sequence coding model, and the pre-training of the basic model according to the contrastive learning training data set to obtain the training model includes: The basic sequence encoding model is reversely trained according to the contrastive learning semantic training data set and the loss function to obtain the sequence encoding model.
10. The method according to claim 7, characterized in that The contrastive learning training data set also includes a contrastive learning graph training data set, and generating the contrastive learning training data set according to the abstract semantic representation set includes: Performing two random graph samplings on each of the abstract semantic representations in the abstract semantic representation set to obtain 2M randomly sampled subgraphs, wherein the randomly sampled subgraphs include target nodes and child nodes, and each of the abstract semantic representations corresponds to two randomly sampled subgraphs; Using 2M randomly sampled subgraphs as graph positive examples, wherein the graph positive examples are used to represent the semantic closeness relationship between the child node and the target node; The randomly sampled subgraphs are randomly combined to obtain X randomly combined subgraphs, wherein each of the randomly combined subgraphs includes two randomly sampled subgraphs, the two randomly sampled subgraphs in the randomly combined subgraphs correspond to different abstract semantic representations, and X is an integer not equal to 2M; Taking X randomly combined subgraphs as graph negative examples, wherein the graph negative examples are used to represent the semantic distance relationship between the subnodes and the target node; The positive examples of the images and the negative examples of the images are used as a comparative learning image training data set.
11. The method according to claim 10, characterized in that The random graph sampling includes: Taking any node in the abstract semantic representation as the target node, and taking nodes other than the target node as the child nodes; Perform a random walk from the target node to the child node to obtain a random node set, wherein the random node set includes the target node, the child node, and an edge formed from the target node to the child node; Describing a node subgraph according to the random node set; The target node and the child nodes in the node subgraph are numbered to obtain the randomly sampled subgraph.
12. The method according to claim 10, characterized in that The training model includes a graph coding model, and the pre-training of the basic model according to the comparative learning training data set to obtain the training model includes: The basic graph coding model is reversely trained according to the comparative learning graph training data set and the loss function to obtain the graph coding model.
13. An event extraction device, characterized in that: include: An acquisition unit, configured to acquire a text to be processed, wherein the text to be processed includes N words, and N is an integer greater than 1; A generating unit, configured to generate an abstract semantic representation according to the text to be processed, wherein the abstract semantic representation includes nodes corresponding to the words one by one, and edges for connecting the nodes; A processing unit, configured to perform semantic encoding processing on the abstract semantics and the text representation to be processed to obtain a semantic embedding vector, wherein the semantic embedding vector is used to represent the semantic features between each of the words and the event; The processing unit is further used to perform graph encoding processing on the abstract semantic representation to obtain a graph embedding vector, wherein the graph embedding vector is used to represent the structural features between the nodes connected by the edges; The processing unit is further used to concatenate the semantic embedding vector with the graph embedding vector to obtain a concatenated feature vector; An identification unit is used to identify the concatenated feature vector and output a target event, wherein the target event includes a trigger word and a role word extracted from the N words, the trigger word is used to indicate an event occurring in the text to be processed, and the role word is used to indicate the role of each entity in the text to be processed in the event.
14. A computer device, characterized in that: include: memories, transceivers, processors, and bus systems; Wherein, the memory is used to store programs; The processor is used to implement the method according to any one of claims 1 to 12 when executing the program in the memory; The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.
15. A computer-readable storage medium comprising instructions, which, when executed on a computer, causes the computer to perform the method according to any one of claims 1 to 12.
16. A computer program product comprising instructions, characterized in that When the method is executed on a computer or a processor, the computer or the processor is caused to execute the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Text event extraction method and device based on grammar dependency information
CN111581954A
Event extraction method and system fusing dependency information and pre-trained language model
CN111897908A