A multi-event extraction method and device, electronic equipment and storage medium

By using a neural network model to obtain event cue vectors and construct an entity connection graph, the problem of difficulty in simultaneously identifying and extracting multiple events in existing technologies is solved, thus improving the accuracy of event extraction.

CN116628178BActive Publication Date: 2026-06-19ZHONGKE DINGFU BEIJING TECH DEV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHONGKE DINGFU BEIJING TECH DEV
Filing Date
2023-05-25
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing event extraction methods based on trigger words struggle to simultaneously identify and extract multiple event information from text content, resulting in low accuracy.

Method used

The event cue vector is obtained using a neural network model, an entity connectivity graph is constructed, and multiple maximal cliques are parsed from it. By ensuring that the number of maximal cliques is the same as the number of events included in the text to be processed, multiple events can be identified and extracted simultaneously.

Benefits of technology

It improves the accuracy of extracting multiple events from text content and addresses situations where it is difficult to identify and extract multiple events simultaneously.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116628178B_ABST
    Figure CN116628178B_ABST
Patent Text Reader

Abstract

This application provides a method, apparatus, electronic device, and storage medium for extracting multiple events, aiming to improve the low accuracy of extracting multiple events from text content. The method includes: obtaining event cue vectors using a neural network model; obtaining the text to be processed and classifying events in the text based on the event cue vectors to obtain multiple event categories; extracting entity elements from each of the multiple event categories in the text to obtain all entity elements; constructing an entity connectivity graph based on the event cue vectors and all entity elements, and resolving multiple maximal cliques from the entity connectivity graph based on the event cue vectors, wherein the number of maximal cliques is the same as the number of events in the text to be processed, and the entity connectivity graph includes interconnected entity elements within the same event; and for each maximal clique, assigning element role labels to the entity elements within that maximal clique to obtain the role category of the entity elements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical fields of natural language processing, prompting learning, contrastive learning, and event extraction. More specifically, it relates to a multi-event extraction method, apparatus, electronic device, and storage medium. Background Technology

[0002] Currently, most methods for extracting event information from text content use trigger-word-based methods, such as "new product launch," "merger and acquisition," or "IPO." However, in practice, it has been found that trigger-word-based methods struggle to simultaneously identify and extract multiple events from text content; in other words, the accuracy of extracting multiple events from text using trigger-word-based methods is relatively low. Summary of the Invention

[0003] The purpose of this application is to provide a method, apparatus, electronic device, and storage medium for extracting multiple events, in order to improve the problem of low accuracy in extracting multiple events from text content.

[0004] This application provides a multi-event extraction method, comprising: obtaining event cue vectors using a neural network model, wherein the event cue vectors include multiple sets of token embedding vectors, each set of token embedding vectors representing an event category; obtaining text to be processed, and classifying the text according to the event cue vectors to obtain multiple event categories; extracting entity elements of each event category from the text to obtain all entity elements; constructing an entity connection graph based on the event cue vectors and all entity elements, and parsing multiple maximal cliques from the entity connection graph based on the event cue vectors, wherein the number of maximal cliques is the same as the number of events included in the text to be processed, and the entity connection graph includes interconnected entity elements in the same event; and for each maximal clique, assigning element role labels to the entity elements of that maximal clique to obtain the role category of the entity elements. In the implementation of the above scheme, an entity connectivity graph is constructed based on the event cue vectors obtained using a neural network model, and multiple maximal cliques are parsed from the entity connectivity graph. Since the number of maximal cliques is the same as the number of events included in the text to be processed, multiple events in the text content can be identified and extracted simultaneously, thereby improving the situation where it is difficult to identify and extract multiple events in the text content at the same time, and improving the accuracy of extracting multiple events from the text content.

[0005] Optionally, in this embodiment, constructing an entity connection graph based on the event prompt vector and all entity elements includes: for any two entity elements in the total entity elements, obtaining the entity element vectors corresponding to the two entity elements, and calculating a first similarity between the two entity element vectors; for each entity element in the total entity elements, obtaining the entity element vector corresponding to the entity element, and calculating a second similarity between the event prompt vector and the entity element vector; and constructing an entity connection graph using the event prompt vector and entity element vectors as nodes and the first and second similarities as edges. In the implementation of the above scheme, by constructing an entity connection graph using the event prompt vector and element vectors as nodes and the first and second similarities as edges, and parsing multiple maximal cliques from the entity connection graph, since the number of maximal cliques is the same as the number of events included in the text to be processed, multiple events in the text content can be identified and extracted simultaneously, thereby improving the situation where it is difficult to identify and extract multiple events in the text content simultaneously, and improving the accuracy of extracting multiple events from the text content.

[0006] Optionally, in this embodiment, resolving multiple maximal cliques from the entity connectivity graph based on event hint vectors includes: determining whether a complete subgraph in the entity connectivity graph satisfies preset conditions, the preset conditions including: all entity element vectors in the complete subgraph are paired, the complete subgraph includes an event hint vector, and the complete subgraph is not contained in any subgraph in the entity connectivity graph; if so, the complete subgraph is determined to be a maximal clique. In the implementation of the above scheme, by obtaining a complete subgraph including an event hint vector from the entity connectivity graph, and thus determining the complete subgraph as a maximal clique, since the event hint vector can not only represent event information but also entity element information in a specific event, the difficulty in simultaneously identifying and extracting multiple events from text content is improved, thereby increasing the accuracy of extracting multiple events from text content.

[0007] Optionally, in this embodiment, before using the neural network model to obtain the event cue vector, the method further includes: obtaining positive and negative samples; and training the neural network using the positive and negative samples to obtain the neural network model. In the implementation of the above scheme, by using positive and negative samples in the contrastive learning method to train the neural network, a more robust neural network model is obtained, thereby improving the accuracy of event extraction.

[0008] Optionally, in this embodiment, obtaining positive and negative samples includes: selecting sample texts of a first event from the training data text, and determining the entity element vectors corresponding to the sample texts of the first event as positive samples; selecting non-entity element vectors from the element vectors corresponding to the sample texts of the first event, and determining the non-entity element vectors as negative samples, wherein the non-entity element vectors include multiple randomly selected token embedding vectors. By training the model by determining the non-entity element vectors selected from the same event as negative samples, a more robust pre-trained language model is obtained, thereby improving the accuracy of event extraction.

[0009] Optionally, in this embodiment, obtaining positive and negative samples includes: selecting sample texts of a first event from the training data text and determining the entity element vectors corresponding to the sample texts of the first event as positive samples; selecting sample texts of a second event from the training data text and determining the entity element vectors corresponding to the sample texts of the second event as negative samples. In the implementation of the above scheme, by using entity element vectors corresponding to sample texts of different events as positive samples and entity element vectors of different events as negative samples to train the pre-trained neural network, a more robust pre-trained language model is obtained. Therefore, using a more robust pre-trained language model can improve the accuracy of event extraction.

[0010] Optionally, in this embodiment, obtaining positive and negative sample text includes: selecting sample text for a first event from the training data text, and determining the entity element vector corresponding to the sample text of the first event and the event cue vector of the first event as positive samples; selecting sample text for a second event from the training data text, and determining the event cue vector of the second event as negative samples. In the implementation of the above scheme, by using entity element vectors and event cue vectors of different events as positive sample text and event cue vectors of different events as negative sample text to train the pre-trained neural network, a more robust pre-trained language model is obtained. Therefore, using a more robust pre-trained language model can improve the accuracy of event extraction.

[0011] Optionally, in this embodiment, training the neural network using positive and negative sample text includes: training the neural network using the K-centre algorithm with both positive and negative sample text. In the implementation of the above scheme, by combining the K-centre algorithm, cue learning, and contrastive learning to train the neural network, a more robust neural network model is obtained. Therefore, using a more robust neural network model can improve the accuracy of event extraction.

[0012] This application embodiment also provides a multi-event extraction device, including: a cue vector prediction module, used to obtain event cue vectors using a neural network model; an event category acquisition module, used to obtain the text to be processed and classify the text according to the event cue vectors to obtain multiple event categories; an entity element acquisition module, used to extract entity elements of each event category from the text to be processed to obtain all entity elements; a maximal clique parsing module, used to construct an entity connectivity graph based on the event cue vectors and all entity elements, and parse multiple maximal cliques from the entity connectivity graph based on the event cue vectors, wherein the number of maximal cliques is the same as the number of events included in the text to be processed, and the entity connectivity graph includes interconnected entity elements in the same event; and a role category acquisition module, used to assign role labels to the entity elements of each maximal clique to obtain the role category of the entity elements.

[0013] Optionally, in this embodiment, the maximal clique resolution module includes: a first similarity calculation submodule, used to obtain the entity element vectors corresponding to any two entity elements among all entity elements, and calculate the first similarity between the two entity element vectors; a second similarity calculation submodule, used to obtain the entity element vector corresponding to each entity element among all entity elements, and calculate the second similarity between the event prompt vector and the entity element vector; and an entity connection graph construction submodule, used to construct an entity connection graph with the event prompt vector and entity element vector as nodes and the first similarity and second similarity as edges.

[0014] Optionally, in this embodiment, the maximal clique resolution module includes: a preset condition judgment submodule, used to determine whether a complete subgraph in the entity connection graph satisfies a preset condition, the preset condition including: all entity element vectors in the complete subgraph are connected in pairs, and the complete subgraph includes an event prompt vector, and the complete subgraph is not contained in any subgraph in the entity connection graph; and a maximal clique determination submodule, used to determine the complete subgraph as a maximal clique if the complete subgraph in the entity connection graph satisfies the preset condition.

[0015] Optionally, in this embodiment of the application, the multi-event extraction device further includes: a sample text acquisition module for acquiring positive and negative samples; and a language model training module for training the neural network using the positive and negative samples to obtain a neural network model.

[0016] Optionally, in this embodiment of the application, the sample text acquisition module includes: a first positive sample determination submodule, used to filter out sample text of a first event from training data text, and determine the entity element vector corresponding to the sample text of the first event as a positive sample; and a first negative sample determination submodule, used to select non-entity element vectors from the element vectors corresponding to the sample text of the first event, and determine the non-entity element vectors as negative samples, wherein the non-entity element vectors include multiple randomly selected token embedding vectors.

[0017] Optionally, in this embodiment of the application, the sample text acquisition module includes: a second positive sample determination submodule, used to filter out sample text of a first event from the training data text, and determine the entity element vector corresponding to the sample text of the first event as a positive sample; and a second negative sample determination submodule, used to filter out sample text of a second event from the training data text, and determine the entity element vector corresponding to the sample text of the second event as a negative sample.

[0018] Optionally, in this embodiment of the application, the sample text acquisition module includes: a third positive sample determination submodule, used to filter out sample text of the first event from the training data text, and determine the entity element vector corresponding to the sample text of the first event and the event prompt vector of the first event as positive samples; and a third negative sample determination submodule, used to filter out sample text of the second event from the training data text, and determine the event prompt vector of the second event as negative samples.

[0019] Optionally, in an embodiment of this application, the language model training module includes: training the neural network using positive and negative samples through the K-centre algorithm.

[0020] Optionally, in the embodiments of this application, the neural network model includes: BERT model, Roberta model, UniLM model, XLNET model, RNN model, CNN model, or a model based on the Transformer structure.

[0021] This application also provides an electronic device, including a processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the machine-readable instructions, when executed by the processor, perform the method described above.

[0022] This application also provides a computer-readable storage medium storing a computer program that is executed by a processor to perform the methods described above.

[0023] Other features and advantages of embodiments of this application will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing embodiments of this application. Attached Figure Description

[0024] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0025] Figure 1 The illustration shows a schematic diagram of the event extraction process of the text to be processed provided in an embodiment of this application;

[0026] Figure 2 The flowchart shown is a schematic diagram of the multi-event extraction method provided in an embodiment of this application;

[0027] Figure 3 The diagram shown is a schematic representation of the entity connection diagram of the pledge event provided in the embodiments of this application;

[0028] Figure 4 The illustration shows a flowchart of a language model training process using contrastive learning, provided in an embodiment of this application.

[0029] Figure 5 The diagram shown is a structural schematic of the multi-event extraction device provided in an embodiment of this application;

[0030] Figure 6 The diagram shows a structural schematic of an electronic device provided in an embodiment of this application. Detailed Implementation

[0031] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in the embodiments of this application are for illustrative and descriptive purposes only and are not intended to limit the protection scope of the embodiments of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in the embodiments of this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of the embodiments of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.

[0032] Furthermore, the described embodiments are merely a part of the embodiments of this application, and not all of them. The components of the embodiments of this application described and illustrated herein can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed embodiments of this application, but merely to illustrate selected embodiments of this application.

[0033] It is understood that the terms "first" and "second" in the embodiments of this application are used to distinguish similar objects. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and that "first" and "second" do not necessarily imply that they are different. In the description of the embodiments of this application, the term "and / or" is merely a description of the association relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship. The term "multiple" refers to two or more (including two), and similarly, "multiple groups" refers to two or more groups (including two groups).

[0034] Before introducing the multi-event extraction method provided in the embodiments of this application, let's first introduce some concepts involved in the embodiments of this application:

[0035] Prompt learning, also known as prompt-based learning, is a learning paradigm in the field of NLP that uses pre-trained language models to perform prediction tasks. This paradigm mainly includes pre-training, prompting, and prediction. It can replace the traditional fine-tuning-based learning paradigm, which can include pre-training and fine-tuning.

[0036] The concept of a clique can be understood as a complete graph, that is, a complete subgraph of the original graph. If a clique is not contained within any other clique, that is, it is not a proper subset of any other clique, then the clique is called a maximal clique of the original graph. A maximal clique is a clique that cannot be contained within any larger clique; in other words, there is no vertex in the clique that has an edge between it and any vertex in the clique.

[0037] It should be noted that the multi-event extraction method provided in this application embodiment can be executed by an electronic device. Here, an electronic device refers to a device terminal or server with the function of executing computer programs. Device terminals include, for example, smartphones, personal computers, tablets, personal digital assistants, or mobile internet devices. A server refers to a device that provides computing services through a network. Servers include, for example, x86 servers and non-x86 servers. Non-x86 servers include, for example, mainframes, minicomputers, and UNIX servers.

[0038] Please see Figure 1 The illustration shows a schematic diagram of the event extraction process for the text to be processed provided in this application embodiment. The following describes the application scenarios applicable to this multi-event extraction method. These application scenarios include, but are not limited to, the use of this event extraction method to extract events from special scene texts where trigger words are not readily identifiable or are difficult to identify. These special scene texts include, but are not limited to, police report texts, speech-recognized meeting texts, and human-computer dialogue texts. Here, speech-recognized meeting texts or human-computer dialogue texts are used as examples. Specifically, the content of the meeting text or human-computer dialogue text could be: "On October 16, 2016, HG Company signed a contract. The contract stipulated that HG Company pledged 80,000 shares to WL Company." The event category after classifying the text to be processed is "Pledge". The corresponding entity elements of the event category include: HG Company, WL Company, 80,000 shares, and "October 16, 2016". Among them, the element role of HG Company is Pledger, the element role of WL Company is Pledgee, the element role of 80,000 shares is Shares, and the element role of "October 16, 2016" is the start date.

[0039] Of course, in practical applications, this event extraction method can also be used to perform event extraction tasks such as event detection, entity extraction, combination extraction, and entity recording on the text to be processed. Event detection refers to identifying all possible event types in the text using various classification labels. Entity extraction, also known as argument extraction or entity element extraction, refers to extracting entity elements that detect events from the text and encoding these entity elements into dense vectors. Combination extraction refers to extracting the combination between entity elements and events, i.e., the combination indicates that the entity element belongs to a specific event. Entity recording, also known as argument labeling or argument role labling, refers to combining the event type with the combination between entity elements and events to determine the role category of the entity element in the event, and generating the final entity record or entity record table based on the role category of the entity element in the event.

[0040] During the research, two scenarios were identified regarding multiple events within the text to be processed: First, the text contains multiple events of the same event category, such as multiple merger and acquisition (M&A) events in a company's annual report. For example, A first acquires B, and then C acquires A. In this M&A event, A is both the acquirer and the acquired party, making it difficult to distinguish A's role within the M&A event. Second, the text contains multiple events of different event categories (e.g., new product launches and M&A events in news reports). For example, A first launches a new product and then acquires B. In this case, A is both the product launcher and the acquirer, making it difficult to distinguish A's role in both the product launch and M&A events. Trigger-based event extraction methods struggle to identify and extract multiple events of the same event category because the trigger words for the same event type are identical. Therefore, trigger-based event extraction methods cannot distinguish between "multiple events of the same event category."

[0041] Please see Figure 2The illustrated flowchart shows a multi-event extraction method provided in this application embodiment. The main idea of ​​this method is to obtain event cue vectors that represent not only event information but also entity element information within a specific event. Multiple maximal cliques are then parsed from the entity connectivity graph constructed using these event cue vectors and all entity elements extracted from the text to be processed. The number of maximal cliques is the same as the number of events included in the text to be processed. Therefore, multiple events in the text content can be identified and extracted simultaneously, thus achieving the function of simultaneously identifying and extracting multiple events from the text content. Implementation methods of the above-described multi-event extraction method may include:

[0042] Step S110: Use a neural network model to obtain event cue vectors. The event cue vectors include multiple sets of token embedding vectors, and each set of token embedding vectors represents an event category.

[0043] The neural network model in this application embodiment can be a pre-trained language model such as BERT model, RoBERTa model, UniLM model, XLNET model, GloVe model, GPT model, BART model, ELMo model, and SentenceBERT model. Of course, it can also be an RNN model, CNN model, or a pre-trained language model based on the Transformer structure.

[0044] It is understood that there are many ways to implement step S110, including but not limited to: using hard prompts and soft prompts to predict the event prompt vector. Here, hard prompts refer to using a manually designed or constructed prompt template to obtain the event prompt vector, while soft prompts refer to concatenating a learnable embedding vector before the text representation vector to obtain the event prompt vector. Therefore, the implementation of step S110 will be described in detail below.

[0045] Step S120: Obtain the text to be processed, and classify the text according to the event prompt vector to obtain multiple event categories.

[0046] The text to be processed refers to text containing multiple text statements. Each text statement corresponds to one or more event categories. Therefore, each text to be processed includes text statements for multiple event categories. When each text statement corresponds to multiple event categories, the task can be understood as a multi-event classification task, i.e., a multi-label classification task.

[0047] Event type, also known as event category, refers to the result of classifying the text to be processed into events. For example, the text to be processed may include event types such as merger and acquisition events, shareholder reduction and pledge events.

[0048] Understandably, event cue vectors represent event information. That is, an event cue vector consists of multiple sets of token embedding vectors, each representing an event category (event information includes the event category). Specifically, if the similarity between one set of token embedding vectors in the event cue vectors and the aforementioned "staking" event category representation vectors (which can be understood as a set of token embedding vectors for a specific event category) is greater than the similarity between other event category representation vectors, then event classification can be performed based on this similarity. Therefore, the event cue vectors can be used to classify the text being processed, thereby obtaining the event category. This event category is the result of the aforementioned event classification, which is a subtask of event detection.

[0049] Step S130: Extract entity elements of each event category from the text to be processed based on the event prompt vector to obtain all entity elements.

[0050] Understandably, since event hint vectors can represent not only event information but also entity element information within specific events, for example, given the similarity between the event hint vector and the event category representation vector for "pledge," it can be inferred that the event hint vector is also similar to the representation vector for "pledgee," and similarly to the representation vector for "pledgee." The aforementioned entity elements include, for example, "pledgee" or "pledgee." Therefore, entity elements corresponding to event categories can be extracted from the text to be processed based on the event hint vectors.

[0051] Step S140: Construct an entity connection graph based on the event hint vector and all entity elements, and parse multiple maximal cliques from the entity connection graph based on the event hint vector. The number of maximal cliques is the same as the number of events included in the text to be processed. The entity connection graph includes entity elements that are connected to each other in the same event.

[0052] It is understood that there are many ways to implement step S140 above. Therefore, the implementation of step S140 above will be described in detail below.

[0053] Step S150: For each of the multiple maximal cliques, assign element roles to the entity elements of that maximal clique to obtain the role category of the entity elements.

[0054] For example, the implementation of step S150 above involves using a feed-forward neural network (FFN) in a pre-trained language neural network to label the entity elements of the maximal clique with their roles, thereby obtaining the role category of the entity elements.

[0055] In the above implementation process, an entity connectivity graph is constructed based on the event cue vectors obtained using a neural network model, and multiple maximal cliques are parsed from the entity connectivity graph. Since the number of maximal cliques is the same as the number of events included in the text to be processed, multiple events in the text content can be identified and extracted simultaneously, thereby improving the situation where it is difficult to identify and extract multiple events in the text content at the same time, and improving the accuracy of extracting multiple events from the text content.

[0056] As a first optional implementation of step S110 above, when using a neural network model to obtain the event prompt vector, a hard prompt method can be used to obtain the event prompt vector. Here, the hard prompt method refers to using a manually designed or constructed prompt template to obtain the event prompt vector. For example, this implementation method is as follows:

[0057] Step S111: Obtain the pre-constructed category label description statement, category label explanation definition statement, element role name, and event keywords.

[0058] Step S112: Input the category label description statement, category label explanation definition statement, element role name and event keywords into the neural network model to obtain the sentence representation vector output by the neural network model.

[0059] The neural network model in this application embodiment can be a pre-trained language model such as BERT model, RoBERTa model, UniLM model, XLNET model, GloVe model, GPT model, BART model, ELMo model, and SentenceBERT model. Of course, it can also be an RNN model, CNN model, or a pre-trained language model based on the Transformer structure.

[0060] Step S113: Determine the event cue vector based on the multiple token embedding vectors in the sentence representation vector.

[0061] There are many ways to implement step S113 above, including but not limited to the following:

[0062] In the first implementation, after obtaining multiple token embedding vectors from the sentence representation vector output by the neural network model, the category token embedding vector (i.e., the embedding vector corresponding to the [CLS] tag) selected from the multiple token embedding vectors is determined as the event prompt vector. This includes: parsing the category tag description statement, category tag explanation and definition statement, element role name, and event keywords from the prompt template; then concatenating the "[CLS]" tag, category tag description statement, category tag explanation and definition statement, element role name, event keywords, and "[SEP]" tag to obtain a concatenated string; and then inputting the concatenated string into the neural network model to obtain the sentence representation vector output by the neural network model. Since this sentence representation vector includes multiple token embedding vectors, the category token embedding vector corresponding to the event category token (i.e., the vector corresponding to the "[CLS]" token) can be selected from the multiple token embedding vectors in the sentence representation vector, and the category token embedding vector is determined as the event prompt vector. The prompt template mentioned above may include: category tag description statement, category tag explanation and definition statement, element role name, and / or event keywords.

[0063] The second implementation method obtains the event cue vector through max-pooling, including: performing max-pooling on multiple token embedding vectors in the sentence representation vector to obtain the event cue vector. Specifically, for example, max-pooling can be performed on multiple token embedding vectors in the sentence representation vector to obtain the maximum token embedding vector, and this maximum token embedding vector can be determined as the event cue vector.

[0064] The third implementation method obtains the event cue vector through mean-pooling, including: performing mean-pooling on multiple token embedding vectors in the sentence representation vector to obtain the event cue vector. Specifically, for example, mean-pooling can be performed on multiple token embedding vectors in the sentence representation vector to calculate the mean token embedding vector, and then the mean token embedding vector can be determined as the event cue vector.

[0065] The fourth implementation method obtains the event cue vector through min-pooling, including: performing min-pooling on multiple token embedding vectors in the sentence representation vector to obtain the event cue vector. Specifically, for example, min-pooling can be performed on multiple token embedding vectors in the sentence representation vector to obtain the minimum token embedding vector, and this minimum token embedding vector can be determined as the event cue vector.

[0066] As a second optional implementation of step S110 above, when using a neural network model to obtain the event cue vector, a soft prompt method can be used to obtain the event cue vector. Here, the soft prompt method refers to obtaining the event cue vector through an embedding vector, which can be updated during training. This update process during training can be understood as "learning." The above implementation may include:

[0067] Step S114: Obtain the event matrix. The event matrix is ​​a matrix structure constructed based on the total number of event categories and multiple token embedding vectors for each event category, and is obtained by learning the matrix structure using a neural network model.

[0068] It is understandable that each set of token embedding vectors can represent an event category. Each set of token embedding vectors includes multiple token embedding vectors, and each token embedding vector is a vector composed of multiple tokens, such as a token embedding vector composed of K tokens.

[0069] The implementation of step S114 above is as follows: Based on the index number of the event type, assuming each event category has K tokens, an event matrix can be constructed based on the total number of index numbers and the K tokens. For example, the first event matrix contains the first K tokens, the second event matrix contains tokens from K+1 to 2K, and so on. Then, a neural network model is used to train and learn this event matrix to obtain the event matrix. Therefore, this event matrix is ​​a matrix structure constructed based on the total number of event categories and the multiple token embedding vectors of each event category, and obtained by learning the matrix structure using a neural network model.

[0070] Step S115: For each event category, determine the event cue vector based on multiple token embedding vectors in the event matrix.

[0071] It is understood that the event matrix described above may include multiple token embedding vectors.

[0072] There are many ways to implement step S115 above, including but not limited to the following:

[0073] In the first implementation, the maximum token embedding vector is determined as the event cue vector. Specifically, for example, max-pooling is performed on multiple token embedding vectors in the event matrix to obtain the maximum token embedding vector, and the maximum token embedding vector is determined as the event cue vector.

[0074] In the second implementation, the mean token embedding vector is determined as the event prompt vector. For example, mean-pooling is performed on multiple token embedding vectors in the event matrix to obtain the mean token embedding vector, and the mean token embedding vector is determined as the event prompt vector.

[0075] The third implementation method is to determine the minimum token embedding vector as the event prompt vector. For example, multiple token embedding vectors in the event matrix are subjected to min-pooling to obtain the minimum token embedding vector, and the minimum token embedding vector is determined as the event prompt vector.

[0076] As an optional implementation of step S120 above, when classifying events in the text to be processed based on the event cue vector, the event category can be determined based on the similarity value between the text representation vector and the event cue vector. This implementation may include:

[0077] Step S121: Obtain the text representation vector of the text to be processed, and the event categories of multiple token embedding vectors in the event prompt vector.

[0078] An example implementation of step S121 above is as follows: A manually designed or constructed prompt template and the text to be processed are input into a neural network model. Then, the text representation vector output by the neural network model is obtained. Since the prompt template is manually designed or constructed, the event category corresponding to the event prompt vector is already known when the prompt template is designed or constructed. At this time, the event category of multiple token embedding vectors in the event prompt vector can be directly obtained. In specific practice, one prompt template corresponds to one event category. Multiple prompt templates can be manually designed or constructed, and these multiple prompt templates can represent multiple event categories. Alternatively, the text to be processed is input into a neural network model, and the text representation vector output by the neural network model is obtained. The category embedding vector of the [cls] tag is obtained from the text representation vector output by the neural network model, and the event category of the event prompt vector is determined based on the category embedding vector.

[0079] Step S122: For each set of token embedding vectors in the multiple sets of token embedding vectors, determine whether the similarity value between the text representation vector and the set of token embedding vectors is greater than a preset threshold.

[0080] For example, in implementing step S122 above: for each set of token embedding vectors in the multiple sets of token embedding vectors, assuming the text representation vector is represented as a and the event prompt vector is represented as b, then the formula can be used. This function calculates the similarity value between the text representation vector and a set of token embedding vectors in the event prompt vector, and determines whether the similarity value between the text representation vector and the set of token embedding vectors in the event prompt vector is greater than a preset threshold. Here, 'a' is the text representation vector, 'b' is a set of token embedding vectors in the event prompt vector, and 'cos_similarity(a,b)' represents the similarity value between the text representation vector and the set of token embedding vectors in the event prompt vector.

[0081] Step S123: If the similarity value between the text representation vector and a set of token embedding vectors in the event prompt vector is greater than a preset threshold, then the event category of the text to be processed is determined as the event category of the set of token embedding vectors.

[0082] The implementation of steps S122 to S123 above is as follows: An executable program compiled or interpreted using a preset programming language is used to determine whether the similarity value between the text representation vector and a set of token embedding vectors in the event prompt vector is greater than a preset threshold. If the similarity value between the text representation vector and a set of token embedding vectors in the event prompt vector is greater than the preset threshold, the executable program is used to determine the event category of the text to be processed as the event category of that set of token embedding vectors. The programming languages ​​that can be used include, for example, C, C++, Java, BASIC, JavaScript, LISP, Shell, Perl, Ruby, Python, and PHP, etc.

[0083] As an optional implementation of step S130 above, when extracting all entity elements from the text to be processed (i.e., entity extraction or element extraction), a BiLSTM model + CRF layer can be used, or an LSTM model + CRF layer can be used for entity extraction. This implementation may include:

[0084] The first implementation method uses a BiLSTM model with a CRF layer for entity extraction. For example, the BiLSTM model is used to vectorize the text to be processed to obtain a text representation vector, and a Conditional Random Forest (CRF) layer is used to perform named entity recognition on the text to be processed to obtain all entity elements.

[0085] The second implementation uses an LSTM model with a CRF layer for entity extraction. For example, an LSTM model is used to vectorize the text to be processed, obtaining a text representation vector. Then, a Conditional Random Field (CRF) layer is used to perform named entity recognition on the text to obtain all entity elements. Assuming the specific content of the text to be processed is "On October 16, 2016, HG Company signed a contract. The contract stipulated that HG Company pledged 80,000 shares to WL Company," then all entity elements extracted from the text could include: HG Company, WL Company, 80,000 shares, and "October 16, 2016."

[0086] As an optional implementation of step S140 above, when constructing the entity connection graph based on the event hint vector and all entity elements, the entity connection graph can be constructed using the event hint vector and element vector as nodes. This implementation may include:

[0087] Step S141: For any two entity elements among all entity elements, obtain the entity element vectors corresponding to the two entity elements, and calculate the first similarity between the two entity element vectors.

[0088] Step S142: For each entity element in all entity elements, obtain the entity element vector corresponding to that entity element, and calculate the second similarity between the event prompt vector and the entity element vector.

[0089] Step S143: Construct an entity connection graph using the event prompt vector and entity element vector as nodes and the first similarity and second similarity as edges.

[0090] Please see Figure 3 The diagram shown is a schematic representation of the entity connection graph of the pledge event provided in this application embodiment. The implementation of steps S141 to S143 is as follows: For any two entity elements among all entity elements, obtain the entity element vectors corresponding to the two entity elements, and calculate the first similarity between the entity element vectors corresponding to the two entity elements using an executable program compiled or interpreted in a preset programming language. For each entity element among all entity elements, obtain the entity element vector corresponding to the entity element, and calculate the second similarity between the event prompt vector and the entity element vector corresponding to the entity element using an executable program compiled or interpreted in a preset programming language. An entity connection graph is constructed using the event prompt vector and entity element vector as nodes, and the first similarity and second similarity as edges.

[0091] As an optional implementation of step S140 above, when resolving multiple maximal cliques from the entity connectivity graph based on the event cue vector, the nodes of the maximal cliques can be determined based on the similarity between the event cue vector and the element vector. This implementation may include:

[0092] Step S144: Determine whether the complete subgraph in the entity connection graph meets the preset conditions. The preset conditions include: all entity element vectors in the complete subgraph are connected in pairs, the complete subgraph includes an event prompt vector, and the complete subgraph is not contained in any subgraph in the entity connection graph.

[0093] Step S145: If a complete subgraph in the entity connection graph satisfies a preset condition, then the complete subgraph is determined to be a maximal clique.

[0094] The implementation of steps S144 to S145 above is as follows: An executable program compiled or interpreted using a preset programming language is used to determine whether a complete subgraph in the entity connection graph satisfies preset conditions. These preset conditions include: all entity element vectors in the complete subgraph are pairwise connected, the complete subgraph includes an event notification vector, and the complete subgraph is not contained within any subgraph in the entity connection graph. The programming languages ​​that can be used include, for example, C, C++, Java, BASIC, JavaScript, LISP, Shell, Perl, Ruby, Python, and PHP. If the complete subgraph in the entity connection graph satisfies the preset conditions, the electronic device uses the executable program to determine the complete subgraph as a maximal clique.

[0095] Please see Figure 4 The illustrated embodiment of this application provides a flowchart of training a language model using contrastive learning. As a first optional implementation of training the pre-trained language model in the aforementioned multi-event extraction method, before using the neural network model to obtain event cue vectors, the neural network model can also be trained using contrastive learning (i.e., using contrastive learning training with positive and negative samples). This implementation may include:

[0096] Step S210: Obtain positive and negative samples.

[0097] It is understood that there are many ways to implement step S210 above. Therefore, the implementation of step S210 above will be described in detail below.

[0098] Step S220: Train the neural network using positive and negative samples to obtain a neural network model.

[0099] Since there are many ways to implement step S220, the implementation of step S220 will be described in detail below.

[0100] As a first optional implementation of step S210 above, when acquiring positive and negative samples, the selected non-entity element vector can be used as the negative sample text. This implementation may include:

[0101] Step S211: Select the sample text of the first event from the training data text, and determine the entity element vector corresponding to the sample text of the first event as a positive sample.

[0102] Step S212: Select non-entity element vectors from the element vectors corresponding to the first event class sample text, and determine the non-entity element vectors as negative samples. The non-entity element vectors include multiple randomly selected token embedding vectors.

[0103] It is understandable that the above-mentioned non-entity element vector refers to the word vector that is not an entity element. This non-entity element vector can include multiple randomly selected token embedding vectors (vectors corresponding to tokens). For example, in the sentence "The contract stipulates that HG Company pledges 80,000 shares to WL Company", the word "stipulates" is not an entity element word. The non-entity element vector corresponding to "stipulates" can be determined as the above-mentioned negative sample.

[0104] As a second optional implementation of step S210 above, when obtaining positive and negative samples, entity element vectors corresponding to sample texts of the same category can be used as positive samples, and entity element vectors corresponding to sample texts of different categories can be used as negative sample texts. This implementation may include:

[0105] Step S213: Select sample texts of the first event from the training data texts, and determine the entity element vectors corresponding to the sample texts of the first event as positive samples.

[0106] For example, in the sample text “The contract stipulates that HG Company pledges 80,000 shares to WL Company”, “HG Company” and “WL Company” are entity elements. The entity element vectors corresponding to “HG Company” and “WL Company” can be determined as the positive samples mentioned above.

[0107] Step S214: Select sample texts of the second event from the training data texts, and determine the entity element vectors corresponding to the sample texts of the second event as negative sample texts.

[0108] It is understandable that the first event and the second event mentioned above can be of the same type or different types of events; that is, the categories of the first event and the second event can be the same or different.

[0109] The implementation principle and implementation method of step S214 are similar to those of steps S212 and S213. Therefore, the implementation principle and implementation method will not be described here. If there is anything unclear, please refer to the description of steps S212 and S213.

[0110] As a third optional implementation of step S210 above, when obtaining positive sample text and negative sample text, event cue vectors of the same category can be used as positive sample text, and event cue vectors of different categories can be used as negative sample text. This implementation may include:

[0111] Step S215: Select the sample text of the first event from the training data text, and determine the entity element vector corresponding to the sample text of the first event and the event prompt vector of the first event as positive sample text.

[0112] Step S216: Select sample texts of the second event from the training data texts, and determine the event prompt vector of the second event as a negative sample.

[0113] It is understandable that the first event and the second event mentioned above can be of the same type or different types of events; that is, the categories of the first event and the second event can be the same or different.

[0114] The implementation principles and methods of steps S215 to S216 are similar to those of steps S213 to S214. Therefore, their implementation principles and methods will not be described again here. If there are any unclear points, please refer to the description of steps S213 to S214. The only difference is that steps S213 to S214 use sample text as positive or negative sample text, while steps S215 to S216 use event prompt vector positive or negative sample text.

[0115] As a fourth optional implementation of step S210 above, combining two or more of the first, second and third optional implementations above, the negative sample can be either a vector of randomly replaced entity words of the same event, or a vector of entity elements and / or a vector of non-entity elements corresponding to sample texts of different events, or a vector of event prompts corresponding to sample texts of different events.

[0116] As an optional implementation of step S220 above, when training the neural network using positive and negative samples, the K-centre algorithm (also known as the K-centre algorithm) and contrastive learning can be used for training. This implementation may include:

[0117] Step S221: Train the neural network using positive and negative samples using the K-centre algorithm to obtain the neural network model.

[0118] For example, the implementation of step S221 described above can be achieved using the following formula: The K-centre algorithm described above can be implemented using the following formula.

[0119] This means that the loss value of the neural network can be calculated using this formula; where loss represents the loss value of the neural network calculated using positive and negative samples, N represents the total number of positive and negative samples, K represents the total number of entity element vectors corresponding to the same event (e.g., the first event), and K+1 represents the entity element vectors corresponding to the same event (e.g., the first event) and the event cue vectors for that same event. This represents the m-th positive sample selected in the i-th iteration. Let m represent the nth positive sample selected in the i-th iteration (m≠n), and τ represent the temperature hyperparameter. This represents the negative sample selected in the i-th iteration (there are many possible negative samples, such as the first, second, third, or fourth optional implementation of step S210 above). It is understood that when selecting a negative sample, it can be randomly selected from the first, second, third, or fourth optional implementation, or the first, second, third, or fourth implementation of step S210 can be executed sequentially.

[0120] Then, the network weight parameters of the neural network are updated based on the loss value until the accuracy of the neural network no longer increases or the number of iterations (epochs) exceeds a preset threshold. The trained neural network model is then obtained. This preset threshold can be set according to specific circumstances, such as 100 or 1000. In the above implementation, the neural network is trained by combining the K-centre algorithm, cue learning, and contrastive learning, resulting in a more robust neural network model. Using this more robust neural network model can improve the accuracy of event extraction.

[0121] Of course, in the specific implementation process, the neural network can be trained based on more loss values. The following describes the process of training the neural network model using four types of labels (including event category labels, entity element labels, event entity relationship labels, and entity role labels).

[0122] As a second optional implementation of the multi-event extraction method for training a pre-trained language model, before using the pre-trained language model to predict event cue vectors from the text to be processed, the pre-trained language model can also be trained using four types of labels (including event category labels, entity element labels, event entity relationship labels, and entity role labels). This implementation may include:

[0123] Step S230: Obtain sample text and sample tags. The sample tags include: event category tags, entity element tags, event entity relationship tags, and entity role tags of the sample text. The event category tags are the set of event categories included in the sample text. The entity element tags are the set of entity elements extracted from the sample sentences of the sample text. The event entity relationship tags are the set of correspondences between entity elements and events. The entity role tags are the role categories of entity elements in events.

[0124] The event category label is the set of event categories included in the sample text. For example, if the sample text states, "HG Company signed a contract stipulating that HG Company pledged 80,000 shares to WL Company," then the event category set for this sample text would be "pledge." Similarly, if the sample text states, "HG Company pledged 80,000 shares to WL Company, and shareholders reduced their holdings in HG Company," then the event category set for this sample text would include both "pledge" and "reduction of holdings."

[0125] Entity element tags are the set of entity elements included in the sample text. For example, if the specific content of the sample text is "HG Company signed a contract stipulating that HG Company pledged 80,000 shares to WL Company", then the entity element tags of the sample text include: HG Company, WL Company, and 80,000 shares.

[0126] Event entity relationship tags are a set of correspondences between entity elements and events. Suppose the specific content of the sample text is "HG Company pledged 80,000 shares to WL Company, and the shareholders reduced their holdings of HG Company's shares", then the entity role tag of the entity element "WL Company" is "pledgee", and the event entity relationship tag of the entity element "WL Company" is "WL Company" which belongs to the pledge event.

[0127] Entity role label is the role category of an entity element in an event. For example, if the specific content of the sample text is "HG Company pledged 80,000 shares to WL Company, and the shareholders reduced their holdings of HG Company's shares", then the entity role label of the entity element "WL Company" is "pledgee".

[0128] Step S240: Using sample text as training data, and the event category label, entity element label, event entity relationship label, and entity role label of the sample text as training labels, train the neural network to obtain a neural network model.

[0129] As an optional implementation of step S240 above, when training the neural network, the neural network model can be trained simultaneously based on four loss values. This implementation may include:

[0130] Step S241: Use a neural network model to obtain the event cue vector, pool all token embedding vectors in the sample text to obtain the sample representation vector, and calculate the text similarity between the event cue vector and the sample representation vector. Determine the first loss value based on the event category label and the text similarity.

[0131] It is understood that the specific implementation of using a neural network model to obtain event prompt vectors is similar to the implementation of step S110 above, so it will not be repeated here.

[0132] The implementation of step S241 above is as follows: Assuming there are multiple event category labels, the following calculation is performed for each event category label: First, the sample text is input into the neural network model, and then the neural network model outputs the complete token embedding vector of the sample text. Further, the complete token embedding vector of the sample text is pooled (e.g., max pooling, mean pooling, or min pooling, etc.) to obtain the sample representation vector. Then, the formula is used... Calculate the text similarity between the event cue vector and the sample representation vector, where a is the sample representation vector, b is the event cue vector, and cos_similarity(a,b) represents the text similarity between the event cue vector and the sample representation vector.

[0133] After obtaining the text similarity between the event cue vector and the sample representation vector, loss1 = -y can also be used. b ×log(sigmoid(cos_similarity(a,b))+(1-y bThe loss function `log(1-sigmoid(cos_similarity(a,b)))` is used to calculate the similarity between the event category label and the text, obtaining the first loss value. Here, `loss1` represents the first loss value calculated by the loss function, and `yb` indicates whether the sample event category is the same as the event category label (0 indicates different, 1 indicates the same). It can be understood that in the process of calculating the first loss value using the `loss1` loss function, if the sample event category is the same as the event category label, the model can adjust the event cue vector to increase the similarity `cos_similarity(a,b)` between the event cue vector and the text representation vector. Similarly, if the sample event category is different from the event category label, the model can adjust the event cue vector to decrease the similarity `cos_similarity(a,b)` between the event cue vector and the text representation vector, thus enabling the model to assign multiple event category labels to the text being processed (i.e., multi-label text classification).

[0134] Step S242: Use a neural network model to extract sample entity elements from each sample sentence of the sample text, and calculate the second loss value between the sample entity elements of the sample sentence and the entity element labels of the sample sentence.

[0135] An example implementation of step S242 above is as follows: The second loss value mentioned above refers to the loss value between the sample entity element and the entity element label. Entity elements include, for example, G Company, WL Company, 80,000 shares, and "October 16, 2016" in the text to be processed. A Conditional Random Field (CRF) can be used to obtain the entity element labels of the sample text, and a neural network can be used to extract sample entity elements from each sample sentence of the sample text. Then, the formula... The second loss value between the sample entity elements and the entity element labels of the sample statement is calculated. Here, loss2 represents the second loss value between the sample entity elements and the entity element labels of the sample statement, p(x) represents the entity element labels of the sample statement, and q(x) represents the sample entity elements extracted from the sample statement by the neural network.

[0136] Step S243: Pool the entity element tokens in the sample text to obtain entity representation vectors, calculate the vector similarity between the event prompt vector and the entity representation vector corresponding to the sample text, and calculate the vector similarity based on the event entity relationship label to obtain the third loss value.

[0137] An example implementation of step S243 above is as follows: After pooling the entity element tokens in the sample text to obtain the entity representation vector, the output layer of the neural network can be set as two different fully connected layers. These two different fully connected layers can include: a first fully connected layer and a second fully connected layer; wherein, the first fully connected layer is used to use the formula... The entity representation vector obtained after pooling the tokens of the sample entity element is calculated, and the second fully connected layer is used to apply the formula. Calculate the event prompt vector corresponding to the prompt template, where, e represents the entity representation vector computed by the first fully connected layer of the neural network. j This represents the entity representation vector after the entity element token pooling. b e e represents the weights and bias parameters corresponding to the entity representation vectors, respectively. i This represents the event prompt vector corresponding to the prompt template. This represents the event cue vector output after the cue template is input into the second fully connected layer of the neural network. b s These represent the weights and bias parameters corresponding to the event notification vector, respectively.

[0138] Then, you can also use formulas. Calculate the semantic distance similarity matrix between the entity representation vector and the event prompt vector corresponding to the prompt template; where, This represents the event cue vector output by the neural network model after the cue template is input into the second fully connected layer for computation. d represents the entity representation vector computed by the first fully connected layer of the neural network. h This represents the embedding dimension of the entity representation vector, or the embedding dimension of the event cues vector. Since the embedding dimension of the entity representation vector and the embedding dimension of the event cues vector are the same, therefore, d h It can represent the dimension of both entity representation vectors and event prompt vectors. This represents the semantic distance similarity matrix between the entity representation vector and the event prompt vector.

[0139] Finally, use the formula Calculate the third loss value between any two sample entity elements within the same event; where loss3 represents the third loss value between any two sample entity elements within the same event. This represents the semantic distance similarity matrix between the entity representation vector and the event cue vector. This indicates whether the event category corresponding to the sample entity element of the sample statement is the same as the event category label of the sample statement in the event entity relationship label (0 indicates that they are different, and 1 indicates that they are the same).

[0140] Step S244: Use a neural network to extract the sample role category of the sample entity element, and calculate the fourth loss value between the sample role category and the entity role label of the sample text.

[0141] An example implementation of step S244 above is as follows: A feedforward neural network (FFN) is used to extract the sample role category of the sample entity element. The prediction process of this sample role category can be expressed by the formula: Where, ε k This represents the sample entity element, FFN represents the processing procedure of the feedforward neural network, and sigmoid represents the calculation process of the sigmoid function (also called the logistic function). This indicates the sample role category of the sample entity element.

[0142] After obtaining the sample role category of the sample entity element, the formula can be used. To calculate the fourth loss value between the sample role category and the entity role label of the sample text; where loss4 represents the fourth loss value between the sample role category and the entity role label of the sample text. This indicates the sample role category of the sample entity element. This indicates whether the sample role category is the same as the role category corresponding to the entity role label in the sample text (0 indicates that they are different, and 1 indicates that they are the same).

[0143] Step S245: Train the neural network based on the first loss value, the second loss value, the third loss value and / or the fourth loss value to obtain the neural network model.

[0144] For example, the implementation of step S245 above can be as follows: It is understood that the formula Loss = a × loss1 + b × loss2 + c × loss3 + d × loss4 can also be used to calculate the first loss value, the second loss value, the third loss value and / or the fourth loss value to obtain the total loss value; where loss1 represents the first loss value calculated by the loss function between the sample event category and the event category label of the sample text, loss2 represents the second loss value between the sample entity element of the sample statement and the entity element label of the sample statement, loss3 represents the third loss value between any two sample entity elements in the same event, loss4 represents the fourth loss value between the sample role category and the entity role label of the sample text, and a, b, c and d are adjustable hyperparameters.

[0145] After obtaining the total loss value, the network weight parameters of the neural network are updated based on this total loss value until the accuracy of the neural network no longer increases or the number of iterations (epochs) exceeds a preset threshold. The trained neural network model is then obtained. The preset threshold can be set according to specific circumstances, such as 100 or 1000.

[0146] As an optional implementation of the above event extraction method, the neural network model may include: BERT model, Roberta model, UniLM model, XLNET model, RNN model, CNN model or a model based on Transformer structure.

[0147] Please see Figure 5 The diagram shown is a structural schematic of a multi-event extraction device provided in an embodiment of this application; this application provides a multi-event extraction device 300, including:

[0148] The cue vector prediction module 310 is used to obtain event cue vectors using a neural network model. The event cue vectors include multiple sets of token embedding vectors, each set of token embedding vectors representing an event category.

[0149] The event category acquisition module 320 is used to acquire the text to be processed and classify the text according to the event prompt vector to obtain multiple event categories.

[0150] The entity element acquisition module 330 is used to extract the entity elements of each event category from the text to be processed, and obtain all entity elements.

[0151] The maximal clique parsing module 340 is used to construct an entity connectivity graph based on the event hint vector and all entity elements, and to parse multiple maximal cliques from the entity connectivity graph based on the event hint vector. The number of maximal cliques is the same as the number of events included in the text to be processed. The entity connectivity graph includes entity elements that are connected to each other in the same event.

[0152] The Role Category Acquisition Module 350 is used to assign role labels to the entity elements of each of the multiple maximal clusters, thereby obtaining the role category of the entity elements.

[0153] Optionally, in this embodiment of the application, the maximal clique resolution module includes:

[0154] The first similarity calculation submodule is used to obtain the entity element vectors corresponding to any two entity elements from all entity elements, and calculate the first similarity between the two entity element vectors.

[0155] The second similarity calculation submodule is used to obtain the entity element vector corresponding to each entity element in all entity elements, and calculate the second similarity between the event prompt vector and the entity element vector.

[0156] The entity connection graph construction submodule is used to construct an entity connection graph using event prompt vectors and entity element vectors as nodes and first similarity and second similarity as edges.

[0157] Optionally, in this embodiment of the application, the maximal clique resolution module includes:

[0158] The preset condition judgment submodule is used to determine whether a complete subgraph in the entity connection graph meets preset conditions. The preset conditions include: all entity element vectors in the complete subgraph are connected in pairs, the complete subgraph includes an event prompt vector, and the complete subgraph is not contained in any subgraph in the entity connection graph.

[0159] The maximal clique determination submodule is used to determine a complete subgraph as a maximal clique if it meets preset conditions.

[0160] Optionally, in embodiments of this application, the multi-event extraction device further includes:

[0161] The sample text acquisition module is used to acquire positive and negative samples.

[0162] The language model training module is used to train the neural network using positive and negative samples to obtain the neural network model.

[0163] Optionally, in this embodiment of the application, the sample text acquisition module includes:

[0164] The first positive sample determination submodule is used to filter out the sample text of the first event from the training data text and determine the entity element vector corresponding to the sample text of the first event as a positive sample.

[0165] The first negative sample determination submodule is used to select non-entity element vectors from the element vectors corresponding to the sample text of the first event, and determine the non-entity element vectors as negative samples. The non-entity element vectors include multiple randomly selected token embedding vectors.

[0166] Optionally, in this embodiment of the application, the sample text acquisition module includes:

[0167] The second positive sample determination submodule is used to filter out the sample text of the first event from the training data text and determine the entity element vector corresponding to the sample text of the first event as a positive sample.

[0168] The second negative sample determination submodule is used to filter out sample texts of the second event from the training data texts and determine the entity element vectors corresponding to the sample texts of the second event as negative samples.

[0169] Optionally, in this embodiment of the application, the sample text acquisition module includes:

[0170] The third positive sample determination submodule is used to filter out the sample text of the first event from the training data text, and determine the entity element vector corresponding to the sample text of the first event and the event prompt vector of the first event as positive samples.

[0171] The third negative sample determination submodule is used to filter out sample text of the second event from the training data text and determine the event prompt vector of the second event as a negative sample.

[0172] Optionally, in this embodiment of the application, the language model training module includes:

[0173] The K-centre algorithm is used to train a pre-trained neural network using positive and negative samples.

[0174] Optionally, in the embodiments of this application, the neural network model includes: BERT model, Roberta model, UniLM model, XLNET model, RNN model, CNN model, or a model based on the Transformer structure.

[0175] It should be understood that this device corresponds to the above-described multi-event extraction method embodiment and is capable of performing the various steps involved in the above method embodiment. The specific functions of this device can be found in the description above, and detailed descriptions are omitted here to avoid repetition. The device includes at least one software functional module that can be stored in memory or embedded in the device's operating system (OS) in the form of software or firmware.

[0176] Please see Figure 6 The diagram shows a structural schematic of an electronic device provided in an embodiment of this application. An electronic device 400 provided in this application includes a processor 410 and a memory 420. The memory 420 stores machine-readable instructions executable by the processor 410. When the machine-readable instructions are executed by the processor 410, the method described above is performed.

[0177] This application embodiment also provides a computer-readable storage medium 430, on which a computer program is stored, and the computer program is executed by a processor 410 to perform the above method.

[0178] The computer-readable storage medium 430 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0179] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For apparatus embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

[0180] It should be understood that the disclosed apparatus and methods can also be implemented in other ways, as provided in the embodiments of this application. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in the flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending primarily on the functions involved.

[0181] Furthermore, the functional modules of each embodiment in this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part. In addition, in the description of this specification, the reference to terms such as "one embodiment," "some embodiments," "example," "specific example," "some examples," etc., means that the specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. Furthermore, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification and the features of different embodiments or examples.

[0182] The above description is only an optional implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the embodiments of this application should be covered within the protection scope of the embodiments of this application.

Claims

1. A multi-event extraction method, characterized in that, include: The event cue vector is obtained using a neural network model. The event cue vector includes multiple sets of token embedding vectors, and each set of token embedding vectors represents an event category. Obtain the text to be processed, and classify the text into multiple event categories based on the event prompt vector; Extract the entity elements of each of the multiple event categories from the text to be processed to obtain all entity elements; An entity connection graph is constructed based on the event hint vector and all entity elements. Multiple maximal cliques are parsed from the entity connection graph based on the event hint vector. The number of maximal cliques is the same as the number of events included in the text to be processed. The entity connection graph includes entity elements that are connected to each other in the same event. For each of the plurality of maximal cliques, the entity elements of that maximal clique are assigned element role labels to obtain the role category of the entity elements; The process includes, before obtaining the event cue vector using the neural network model, acquiring positive and negative samples; and training the neural network using the positive and negative samples to obtain the neural network model. The step of obtaining positive and negative samples includes: filtering sample text of a first event from training data text, and determining the entity element vector corresponding to the sample text of the first event as the positive sample; selecting non-entity element vectors from the element vectors corresponding to the sample text of the first event, and determining the non-entity element vectors as the negative sample, wherein the non-entity element vectors include multiple randomly selected token embedding vectors.

2. The method according to claim 1, characterized in that, The step of constructing an entity connection graph based on the event prompt vector and all entity elements includes: For any two entity elements among all the entity elements, obtain the entity element vectors corresponding to the two entity elements, and calculate the first similarity between the two entity element vectors. For each entity element among all the entity elements, obtain the entity element vector corresponding to that entity element, and calculate the second similarity between the event prompt vector and the entity element vector; Using the event prompt vector and the entity element vector as nodes, and the first similarity and the second similarity as edges, the entity connection graph is constructed.

3. The method according to claim 2, characterized in that, The process of resolving multiple maximal cliques from the entity connectivity graph based on the event cue vector includes: Determine whether the complete subgraph in the entity connection graph meets the preset conditions. The preset conditions include: all entity element vectors in the complete subgraph are connected in pairs, the complete subgraph includes one of the event prompt vectors, and the complete subgraph is not contained in any subgraph of the entity connection graph. If so, then the complete subgraph is identified as the maximal clique.

4. The method according to claim 1, characterized in that, The acquisition of positive and negative samples includes: The sample text of the first event is selected from the training data text, and the entity element vector corresponding to the sample text of the first event is determined as the positive sample; The sample text of the second event is selected from the training data text, and the entity element vector corresponding to the sample text of the second event is determined as the negative sample.

5. The method according to claim 1, characterized in that, The acquisition of positive and negative samples includes: The sample text of the first event is selected from the training data text, and the entity element vector corresponding to the sample text of the first event and the event prompt vector of the first event are determined as the positive sample; The sample text of the second event is selected from the training data text, and the event prompt vector of the second event is determined as the negative sample.

6. The method according to claim 1, characterized in that, The step of training the neural network using the positive and negative samples includes: The neural network is trained using the positive and negative samples through the K-centre algorithm.

7. A multi-event extraction device, characterized in that, include: The cue vector prediction module is used to obtain event cue vectors using a neural network model. The event cue vectors include multiple sets of token embedding vectors, each set of token embedding vectors representing an event category. The event category acquisition module is used to acquire the text to be processed and classify the text according to the event prompt vector to obtain multiple event categories; The entity element acquisition module is used to extract the entity element of each of the multiple event categories from the text to be processed, and obtain all entity elements; The maximal clique parsing module is used to construct an entity connectivity graph based on the event hint vector and all entity elements, and to parse multiple maximal cliques from the entity connectivity graph based on the event hint vector. The number of maximal cliques is the same as the number of events included in the text to be processed. The entity connectivity graph includes entity elements that are connected to each other in the same event. The role category acquisition module is used to mark the role of the entity elements of each of the multiple maximal clusters and obtain the role category of the entity elements. The process includes, before obtaining the event cue vector using the neural network model, acquiring positive and negative samples; and training the neural network using the positive and negative samples to obtain the neural network model. The step of obtaining positive and negative samples includes: filtering sample text of a first event from training data text, and determining the entity element vector corresponding to the sample text of the first event as the positive sample; selecting non-entity element vectors from the element vectors corresponding to the sample text of the first event, and determining the non-entity element vectors as the negative sample, wherein the non-entity element vectors include multiple randomly selected token embedding vectors.

8. An electronic device, characterized in that, include: A processor and a memory, the memory storing machine-readable instructions executable by the processor, which, when executed by the processor, perform the method as described in any one of claims 1 to 6.