Event detection method and apparatus, and electronic device

By introducing multi-level event labels into the event detection model, the problems of insufficient data and class imbalance in existing technologies are solved, thereby improving the accuracy of event detection.

CN115408514BActive Publication Date: 2026-07-07BEIJING SANKUAI ONLINE TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING SANKUAI ONLINE TECH CO LTD
Filing Date
2021-05-11
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

Existing event detection models suffer from poor detection performance due to insufficient datasets and class imbalance.

Method used

By acquiring text sequences with fine-grained event labels, setting multi-level coarse-grained event labels according to preset event hierarchy relationships, and training an event detection model, including an encoder, a probability mapping module, and a classifier module, multi-level event detection is performed.

Benefits of technology

It improves the accuracy of event detection by introducing multi-level event labels, providing additional supervision signals and enhancing the model's output accuracy when detecting fine-grained events.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115408514B_ABST
    Figure CN115408514B_ABST
Patent Text Reader

Abstract

The application discloses an event detection method, belongs to the computer technical field, and is used for improving event detection accuracy. The method comprises the following steps: acquiring a plurality of text sequences provided with fine-grained event labels; according to the fine-grained event label provided for each text sequence, setting at least one level of coarse-grained event label of each text sequence according to a preset event hierarchical relationship; training an event detection model based on the plurality of text sequences and the multi-level event label set for each text sequence, wherein the multi-level event label comprises a fine-grained event label and at least one level of coarse-grained event label; and detecting event information included in a target text sequence through the event detection model obtained through training. The event detection method disclosed in the embodiment of the application effectively improves the accuracy of event detection in the text by combining coarse-grained label information to assist fine-grained event label training model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to an event detection method, apparatus, electronic device, and computer-readable storage medium. Background Technology

[0002] Event extraction is an important and challenging task in the field of information extraction, with wide applications in automatic summarization, automatic question answering, information retrieval, and knowledge graph construction. It aims to extract structured event information from unstructured text, including event categories, participants, and attributes. In event extraction, event detection is the first subtask to be completed. The event detection subtask is used to detect which events are contained in the unstructured text and their categories. For example, in the sentence "The wounded soldier eventually died," "wounded" and "died" trigger the "wounded" and "died" events, respectively.

[0003] Existing technologies primarily employ word-level detection models to classify whether each word in a text triggers an event and the type of event. These word-level detection models include, for example, DMCNN, JRNN, dBRNN, BERT, DMBERT, and NPN. For each word, the model constructs a semantic representation based on its context, then classifies it into an event category. If the classification result is a specific event category, the word triggers an event of that category; otherwise, it does not trigger any event. Most of these detection models utilize supervised learning, requiring extensive word and event annotation before training. However, due to the large number of event types and the prevalence of insufficient and imbalanced event extraction datasets, training data is often missing or imbalanced, impacting the event detection performance of existing models.

[0004] It is evident that existing event detection methods still require improvement. Summary of the Invention

[0005] This application provides an event detection method that helps improve the accuracy of event detection results.

[0006] In a first aspect, embodiments of this application provide an event detection method, including:

[0007] Retrieve a sequence of texts with fine-grained event labels;

[0008] Based on the fine-grained event labels set for each text sequence, and in accordance with a preset event hierarchy, at least one level of coarse-grained event labels are set for each text sequence.

[0009] An event detection model is trained based on the aforementioned text sequences and the multi-level event labels set for each text sequence, wherein the multi-level event labels include: fine-grained event labels and at least one level of coarse-grained event labels.

[0010] The event detection model, obtained through training, detects event information included in the target text sequence.

[0011] Secondly, embodiments of this application provide an event detection device, including:

[0012] The training sample acquisition module is used to acquire several text sequences with fine-grained event labels.

[0013] A multi-level event label setting module is used to set at least one level of coarse-grained event labels for each text sequence according to the fine-grained event labels set for each text sequence and according to a preset event hierarchy relationship.

[0014] The model training module is used to train an event detection model based on the plurality of text sequences and multi-level event labels set for each of the text sequences, wherein the multi-level event labels include: fine-grained event labels and at least one level of coarse-grained event labels.

[0015] The event detection module is used to detect event information included in the target text sequence using the trained event detection model.

[0016] Thirdly, embodiments of this application also disclose an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the event detection method described in embodiments of this application.

[0017] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the steps of the event detection method disclosed in embodiments of this application.

[0018] The event detection method disclosed in this application involves acquiring several text sequences with fine-grained event labels; setting at least one level of coarse-grained event labels for each text sequence according to a preset event hierarchy based on the fine-grained event labels set for each text sequence; training an event detection model based on the several text sequences and the multi-level event labels set for each text sequence, wherein the multi-level event labels include: fine-grained event labels and at least one level of coarse-grained event labels; and detecting event information included in the target text sequence through the trained event detection model, which helps to improve the accuracy of event detection.

[0019] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0020] 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. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0021] Figure 1 This is a flowchart of the event detection method according to Embodiment 1 of this application;

[0022] Figure 2 This is a schematic diagram of a multi-level tagging of a text sequence according to Embodiment 1 of this application;

[0023] Figure 3 This is a schematic diagram of the event detection model of Embodiment 1 of this application;

[0024] Figure 4 This is a schematic diagram of the event detection device structure according to Embodiment 2 of this application;

[0025] Figure 5 A block diagram schematically illustrates an electronic device for performing the method according to this application; and

[0026] Figure 6 A storage unit for holding or carrying program code implementing the method according to this application is illustrated schematically. Detailed Implementation

[0027] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0028] Example 1

[0029] An event detection method disclosed in the embodiments of this application, such as Figure 1 As shown, the method includes steps 110 to 140.

[0030] Step 110: Obtain several text sequences with fine-grained event labels.

[0031] In the prior art, when training an event detection model, it is first necessary to construct several training samples. The sample data of the training samples is a text sequence, and the sample labels are fine-grained event labels. The fine-grained event labels are used to indicate the true value of each word in the text sequence of the corresponding sample data matching each preset fine-grained event.

[0032] The preset fine-grained events are defined according to event detection requirements. In some embodiments of this application, the fine-grained events can be the 33 events defined in the annotation guidance information of the ACE 2005 annotation specification. For example, the fine-grained event categories include: birth, divorce, marriage, injury, death, transportation, money transfer, establishment of a company, etc.

[0033] Step 120: Based on the fine-grained event labels set for each text sequence, and according to the preset event hierarchy, set at least one level of coarse-grained event labels for each text sequence.

[0034] In some embodiments of this application, the at least one level of coarse-grained event tags may include one level of coarse-grained event tags, or two or more levels of coarse-grained event tags.

[0035] In some embodiments of this application, multiple levels of events can be defined, and correspondingly, words in the text sequence can be assigned event tags to events at different levels. For example, in some embodiments of this application, corresponding to the annotation guidelines in the ACE 2005 annotation specification, a three-level event relationship can be set: the lowest level event is a fine-grained event, the middle level events are events corresponding to the parent category of the fine-grained event, and the highest level event corresponds to the root category event of the fine-grained event. Different levels of events correspond to different event category granularities. The event granularity corresponding to the event hierarchy from bottom to top is from fine to coarse. For example, the granularity of the middle level event is greater than that of the fine-grained event but less than that of the highest level event. In the embodiments of this application, the lowest level event is called a "fine-grained event," and the next lower level and above events are called coarse-grained events. From the event hierarchy, it can be seen that the next level of coarse-grained event is a subcategory of the previous level of coarse-grained event, and the fine-grained event is a subcategory contained in the lowest level of coarse-grained event. Each type of coarse-grained event may further include one or more fine-grained events.

[0036] Accordingly, in some embodiments of this application, a three-layer event label is defined, wherein the top coarse-grained event label is used to indicate the top coarse-grained event matched by each word in the text sequence, the bottom coarse-grained event label is used to indicate the bottom coarse-grained event matched by each word in the text sequence, and the fine-grained event label (i.e., the sub-category event label of the bottom coarse-grained event) is used to indicate the fine-coarse-grained event matched by each word in the text sequence.

[0037] For example, corresponding to the annotation guidelines in the ACE 2005 annotation specification, the lowest-level coarse-grained event categories in this embodiment include the following eight event categories: life, movement, affairs, business, conflict, communication, personal professional events, and legal matters; the fine-grained event categories include 33 event categories such as: birth, divorce, marriage, injury, death, transportation, money transfer, and business establishment. These 33 fine-grained event categories belong to the aforementioned eight coarse-grained event categories. For example, the fine-grained event categories such as "birth," "divorce," "marriage," "injury," and "death" belong to the coarse-grained event category "life." The aforementioned eight coarse-grained events are event categories.

[0038] In some embodiments of this application, after obtaining several text sequences with fine-grained event labels, the coarse-grained events matching each word in the text sequence can be determined according to the hierarchical relationship of the event categories described above. Furthermore, coarse-grained event labels for each level of the text sequence are determined based on the coarse-grained events matching each word in the text sequence, thus obtaining multi-level event labels for each text sequence. The coarse-grained event labels at each level are used to indicate the true value of each word matching a preset coarse-grained event at each level in the text sequence of the corresponding sample data.

[0039] In some embodiments of this application, the multi-level event labels of a text sequence can be represented as (Label1, Label2, Label3), where Label1 represents the top-level event label of the text sequence, Label2 represents the middle-level event label of the text sequence, and Label3 represents the bottom-level event label of the text sequence. The event labels at each level of the text sequence constitute a label sequence, and each event label in the label sequence is used to indicate the event category at that level matched by a word at a specified position in the corresponding text sequence. For example, the multi-level event labels of the text sequence "a bird died when a snake bit it" are as follows: Figure 2 As shown.

[0040] Figure 2In this context, B-Event is the top-level coarse-grained event identifier, B-Life and B-Conflict are two types of event identifiers for the bottom-level coarse-grained events, and B-Die and B-Attack are two types of fine-grained event identifiers.

[0041] Step 130: Train an event detection model based on the several text sequences and the multi-level event labels set for each text sequence.

[0042] The multi-level event tags include: fine-grained event tags and at least one level of coarse-grained event tags.

[0043] In some embodiments of this application, such as Figure 3 As shown, the event detection model includes: an encoder module 310, a probability mapping module 320, and a classifier module 330. The encoder module 310 encodes and maps the input text sequence to determine the probability distribution of the fine-grained event label space corresponding to the text sequence. The probability mapping module 320 maps the probability distribution of the fine-grained event label space corresponding to the text sequence output by the encoder module 310 to obtain the probability distribution of the coarse-grained event label space at each level corresponding to the text sequence.

[0044] The training of the event detection model based on the plurality of text sequences and the multi-level event labels set for each text sequence includes: encoding each text sequence separately using the encoder module to determine the probability of each word in each text sequence matching a preset fine-grained event; mapping the probability of each word in each text sequence matching a preset fine-grained event using the probability mapping module to determine the probability of each word in each text sequence matching a preset coarse-grained event at each level; and classifying the probability of each word in each text sequence matching a preset fine-grained event using the classifier module. The probabilities of pre-set coarse-grained events at each level are matched and classified for mapping to determine the estimated value of each level of events matched by each word in each text sequence; wherein, each level of events includes: the pre-set fine-grained events and the pre-set coarse-grained events at each level; based on the estimated value of each level of events matched by each word in each text sequence and the true value of each level of events matched by each word in the text sequence as indicated by the multi-level event labels set in the text sequence, the loss value of the event detection model is determined; with the goal of minimizing the loss value, the event detection model is iteratively optimized until the training termination condition is met.

[0045] First, the encoder module 310 encodes each text sequence separately to determine the probability of each word in each text sequence matching a preset fine-grained event.

[0046] In some embodiments of this application, the encoder module 310 can be implemented using existing sequence encoding models such as the Bi-LSTM model (a long short-term memory model), the HBTNGMA model, and the DMBERT model (a deep neural network model). The encoding process of the encoder module 310 on the input text sequence can be represented as: (p1, p2, ..., p N )=E(w1,w2,…,w N ), where (w1,w2,…,w N () represents the text sequence; E represents the encoder module 310; (p1,p2,…,p N Let p represent a probability sequence, where p t Indicator w t In the probability distribution of the fine-grained event label space, p t Indicative word w t Match the probability of each fine-grained event category.

[0047] Then, the probability of each text sequence matching fine-grained events is mapped to obtain the probability of each text sequence matching coarse-grained events at each level.

[0048] The probability mapping module 320 performs probability mapping based on a predefined event category hierarchy. In some embodiments of this application, the probability mapping module maps the probability of each word in each text sequence matching a preset fine-grained event to determine the probability of each word in each text sequence matching a preset coarse-grained event at each level. This includes: mapping the probability of each word in each text sequence matching a preset fine-grained event for the coarse-grained event above the fine-grained event to determine the probability of each word in each text sequence matching the coarse-grained event above the fine-grained event; and mapping the probability of each word in each text sequence matching a preset coarse-grained event layer by layer according to the hierarchical relationship of each coarse-grained event to sequentially determine the probability of each word in each text sequence matching a preset coarse-grained event at each level.

[0049] In other words, when determining the probability that a word in a text sequence matches a specified lowest-level coarse-grained event category, the probability of the specified word matching that specified coarse-grained event category is determined based on the probabilities of the fine-grained categories included in that specified coarse-grained event category. This yields the probability distribution of the coarse-grained event label space corresponding to the specified word in the text sequence. When determining the probability that a word in a text sequence matches an upper-level coarse-grained event category, the probability of the word matching that specific coarse-grained event category is determined based on the probabilities of all lower-level coarse-grained event categories included in that coarse-grained event category.

[0050] In some embodiments of this application, the step of mapping the probability of each word in each text sequence matching each preset fine-grained event for the coarse-grained event above the fine-grained event, and determining the probability of each word in each text sequence matching the coarse-grained event above the fine-grained event, includes: for each word in each text sequence, determining the probability of the word matching the specified coarse-grained event by summing the probabilities of the word matching each specified fine-grained event; or, for each word in each text sequence, determining the probability of the word matching the specified coarse-grained event by the maximum probability of the word matching each specified fine-grained event; wherein, the specified coarse-grained event is selected from the preset coarse-grained events above the fine-grained event (i.e., the lowest level coarse-grained event), and the specified fine-grained event is all the preset fine-grained events included in the specified coarse-grained and fine-grained events.

[0051] The following example illustrates a specific implementation of the probability mapping module 320 determining the probability distribution of a specified word in a coarse-grained event category space based on the probability distribution of the specified word in the fine-grained event category space.

[0052] In some embodiments of this application, for a specified coarse-grained event category within the lowest-level coarse-grained events, the probability of a specified word matching a specified coarse-grained event is determined by summing the probabilities of a specified word matching each fine-grained event included in the specified coarse-grained event within the text sequence. For example, the mapping scheme performed by the probability mapping module 320, which maps the probability distribution of the fine-grained event label space to the probability distribution of the coarse-grained event label space (i.e., mapping the probability of matching the lowest-level coarse-grained event to the probability of matching the fine-grained event), can be represented by the following formula:

[0053] p t,i =∑ j∈i p t,j ;

[0054] Where i is used to identify coarse-grained events, j is used to identify fine-grained events, j∈i indicates that fine-grained event j belongs to coarse-grained event i, t is used to identify words in the text sequence, and p t,j This represents the word w in the text sequence. t The probability p of matching fine-grained event j t,i This represents the word w in the text sequence. t Match the probability of coarse-grained event i. Taking the coarse-grained event B-Life, which includes fine-grained events B-Be-Born, B-Die, B-Marry, B-Divorce, and B-Injure, as an example, the word w tThe probability of being labeled as a coarse-grained event B-Life is w t The sum of probabilities of events labeled as fine-grained events B-Be-Born, B-Die, B-Marry, B-Divorce, and B-Injure.

[0055] In other embodiments of this application, for a specified coarse-grained event, the probability of a specified word matching the specified coarse-grained event can be determined based on the maximum probability of a specified word matching each fine-grained event included in the specified coarse-grained event in the text sequence. For example, the mapping scheme performed by the probability mapping module 320 to obtain the probability distribution of the coarse-grained event label space from the probability distribution of the fine-grained event label space (i.e., obtaining the probability of matching the lowest-level coarse-grained event from the probability mapping of matching the fine-grained event) can be expressed by the following formula:

[0056] p t,i =maxj ∈ IP t,j ;

[0057] Where i is used to identify coarse-grained events, j is used to identify fine-grained events, j∈i means that fine-grained event j belongs to coarse-grained event i, t is used to identify words in the text sequence, and p t,j This represents the word w in the text sequence. t The probability p of matching fine-grained event j t,i This represents the word w in the text sequence. t Match the probability of coarse-grained event i. Taking the coarse-grained event B-Life, which includes fine-grained events B-Be-Born, B-Die, B-Marry, B-Divorce, and B-Injure, as an example, the word w... t The probability of being labeled as a coarse-grained event B-Life is w t The highest probability among the probabilities labeled as fine-grained events B-Be-Born, B-Die, B-Marry, B-Divorce, and B-Injure.

[0058] Furthermore, based on the probability of matching the lowest-level coarse-grained event category with words, the probability of matching other coarse-grained events at each level is determined layer by layer.

[0059] In some embodiments of this application, the step of using the probability mapping module to perform layer-by-layer mapping processing on the probability of each word in each text sequence matching each preset coarse-grained event according to the hierarchical relationship of each coarse-grained event, and sequentially determining the probability of each word in each text sequence matching each preset coarse-grained event at each level, includes: for each word in each text sequence, determining the probability of the word matching a second coarse-grained event by summing the probabilities of the word matching each specified first coarse-grained event; or, for each word in each text sequence, determining the probability of the word matching a second coarse-grained event by the maximum probability of the word matching each specified first coarse-grained event; wherein, the specified second coarse-grained event and the second specified coarse-grained event are selected from the coarse-grained events at least one preset level, and the first specified coarse-grained event is the next level of coarse-grained event included by the second specified coarse-grained event.

[0060] The following example illustrates the specific implementation of the probability mapping module 320 determining the probability of a specified word matching the previous coarse-grained event based on the probability of a specified word matching the current coarse-grained event in the text sequence.

[0061] In some embodiments of this application, an additive probability mapping method can be used for probability mapping. For example, the probability mapping scheme performed by the probability mapping module 320 to obtain the probability of the second coarse-grained event from the probability mapping of the first coarse-grained event can be represented by the following formula:

[0062] p t,k =∑ i∈k p t,i ;

[0063] Where i is used to identify the first coarse-grained event (i.e., the current layer coarse-grained event), k is used to identify the second coarse-grained event (i.e., the previous layer coarse-grained event), i∈k indicates that the first coarse-grained event i belongs to the second coarse-grained event k, t is used to identify words in the text sequence, p t,i This represents the word w in the text sequence. t The probability p of matching the first coarse-grained event i t,k This represents the word w in the text sequence. t The probability of matching the second coarse-grained event k. Taking the second coarse-grained event B-Event, which includes the first coarse-grained events B-Life, B-Movement, B-Transcation, B-Business, B-Conflict, and B-Contact, as an example, the word w t The probability p that is labeled as a second coarse-grained B-Eventt,k It is w t The sum of probabilities of being labeled as the first coarse-grained events: B-Life, B-Movement, B-Transcation, B-Business, B-Conflict, and B-Contact.

[0064] In other embodiments of this application, a probability mapping method based on extreme values ​​can be used for probability mapping. For example, the probability mapping scheme performed by the probability mapping module 320 to obtain the probability of the second coarse-grained event from the probability mapping of the first coarse-grained event can be represented by the following formula:

[0065] p t,k =max i∈k p t,i ;

[0066] Where i is used to identify the first coarse-grained event (i.e., the current layer coarse-grained event), k is used to identify the second coarse-grained event (i.e., the previous layer coarse-grained event), i∈k indicates that the first coarse-grained event i belongs to the second coarse-grained event k, t is used to identify words in the text sequence, p t,i This represents the word w in the text sequence. t The probability p of matching the first coarse-grained event i t,k This represents the word w in the text sequence. t The probability of matching the second coarse-grained event k. Taking the second coarse-grained event B-Event, which includes the first coarse-grained events B-Life, B-Movement, B-Transcation, B-Business, B-Conflict, and B-Contact, as an example, the word w t The probability p that is labeled as a second coarse-grained B-Event t,k It is w t The highest probability among the probabilities labeled as the first coarse-grained events B-Life, B-Movement, B-Transcation, B-Business, B-Conflict, and B-Contact.

[0067] Next, the classifier module 330 performs classification mapping on the probability of each word in each text sequence matching each level of event, obtaining the estimated value of each level of event matched by each word in each text sequence. For example, the probability of each word in a text sequence matching each fine-grained event (i.e., the probability output by the encoder module 310) is input into the classifier module 330 in the form of a probability sequence. The classifier module 330 combines the probability of each word in the text sequence matching each fine-grained event to output the estimated value of the fine-grained event matched by each word in the text sequence; and the probability of each word in the text sequence matching the lowest level coarse-grained event (i.e., the coarse-grained event above the fine-grained event) (i.e., the probability of matching the coarse-grained event output by the probability mapping module 310) is... The probability sequence is input to the classifier module 330. The classifier module 330 combines the probability of each word in the text sequence matching each coarse-grained event and outputs the estimated value of the coarse-grained event matched by each word in the text sequence. The probability of each word in the text sequence matching the top-level coarse-grained event is also input to the classifier module 330 in the form of a probability sequence. The classifier module 330 combines the probability of each word in the text sequence matching each top-level coarse-grained event and outputs the estimated value of the top-level coarse-grained event matched by each word in the text sequence.

[0068] In some embodiments of this application, the classifier module 330 can be implemented by a softmax classifier, or other classifiers in the prior art can be used. This application does not limit this.

[0069] In some embodiments of this application, multiple tasks can be created to estimate the probability of each word in the input text sequence matching different levels of events. Taking coarse-grained events including two levels as an example, task 3 can be created to estimate the probability of each word in the input text sequence matching each fine-grained event, task 2 can be created to estimate the probability of each word in the input text sequence matching each lowest-level coarse-grained event, and task 1 can be created to estimate the probability of each word in the input text sequence matching the highest-level coarse-grained event. In specific implementation, each task shares the encoder module 310, task 2 and task 1 respectively call different branches in the probability mapping module 320, each task respectively call different branches in the classifier module 330, or share the classifier module 330.

[0070] During the forward propagation process, in this embodiment, the probability of the text sequence matching fine-grained events is further generated based on the probability of the text sequence matching coarse-grained events at each level. If the probability of the text sequence matching fine-grained events is inaccurate, then the mapped probability of the text sequence matching coarse-grained events at each level will also be inaccurate. Therefore, the probability prediction loss of matching coarse-grained events at each level can be added as a penalty term to the probability prediction loss of matching fine-grained events. Through backpropagation and parameter updates, the model's probability prediction of matching fine-grained events will be more accurate.

[0071] In the process of optimizing the parameters of the event detection model based on the prediction results of one round, the embodiments of this application combine the prediction results of the aforementioned multiple levels of events to optimize the parameters. The loss value of the event detection model is determined based on the predicted values ​​of events at each level matched by each word in each text sequence and the actual values ​​of events at the corresponding level matched by each word in the text sequence as indicated by the multi-level event labels set for the text sequence. This includes: determining a fine-grained prediction loss value of the event detection model based on the predicted values ​​of fine-grained events matched by each word in each text sequence and the actual values ​​of fine-grained events matched by each word in the text sequence as indicated by the fine-grained event labels set for the text sequence; determining a corresponding level coarse-grained prediction loss value of the event detection model based on the predicted values ​​of coarse-grained events matched by each word in each text sequence and the actual values ​​of coarse-grained events matched by each word in the text sequence as indicated by the corresponding level coarse-grained event labels set for the text sequence; and weighted summing the fine-grained prediction loss value and each corresponding level coarse-grained prediction loss value to obtain the loss value of the event detection model.

[0072] In some embodiments of this application, the loss of the model predicting the probability of the several text sequences matching fine-grained events can be calculated using the following loss function:

[0073] Where m is the number of text sequences, i is the text sequence identifier, and N is the number of text sequences. i Let j be the number of words in text sequence i, and j be the number of words in text sequence N. i The word identifier in y i,j Represents text sequence N i The true values ​​of each fine-grained event matched by word j in the text. Represents text sequence N i L(θ) is the estimated value of each fine-grained event matching word j in the event detection model, which is the loss of the probability of the m text sequences matching fine-grained events, i.e., the fine-grained prediction loss value.

[0074] In some embodiments of this application, the loss of the model predicting the probability of the several text sequences matching the coarse-grained event of the previous layer of fine-grained events can be calculated using the following loss function:

[0075] Where m is the number of text sequences, i is the text sequence identifier, and N is the number of text sequences. i Let j be the number of words in text sequence i, and j be the number of words in text sequence N. i Word identifiers in Represents text sequence N i The true values ​​of the coarse-grained events (i.e., the lowest-level coarse-grained events) above the fine-grained events for the word j in the matching context. Represents text sequence N i L1(θ) is the estimated value of each coarse-grained event in the layer above the fine-grained event matching word j in the event detection model, which is the loss of the probability of the coarse-grained event in the layer above the fine-grained event matching m text sequences, i.e. the lowest layer coarse-grained prediction loss value.

[0076] In some embodiments of this application, the loss of the model predicting the probability of the plurality of text sequences matching the next lower coarse-grained event can be calculated using the following loss function:

[0077] Where m is the number of text sequences, i is the text sequence identifier, and N is the number of text sequences. i Let j be the number of words in text sequence i, and j be the number of words in text sequence N. i Word identifiers in Represents text sequence N i The true values ​​of each coarse-grained event in the k-th layer are matched with word j. Represents text sequence N i The estimated values ​​of each coarse-grained event in the k-th layer for matching word j in L k (θ) is the loss of the event detection model in predicting the probability of matching each coarse-grained event in the k-th layer among m text sequences, i.e., the coarse-grained prediction loss value of the k-th layer, where the k-th layer is the next lower layer.

[0078] Then, the fine-grained prediction loss value and the coarse-grained prediction loss values ​​of each layer are weighted and summed to obtain the loss value of the event detection model. For example, using the formula... Calculate the loss value of the event detection model, where γ k γ is the probability prediction loss weight for matching the coarse-grained events at the k-th layer. k γ is a positive number less than 1. k The value of θ is determined based on the model's running results, where θ represents the network parameters of the event detection model.

[0079] After calculating the predicted loss value for the current training round, the network parameters of the model are adjusted with the goal of minimizing the loss value, and the event detection model is iteratively trained until the loss value converges to a preset range or the predicted iterative training rounds are obtained.

[0080] Step 140: Detect event information included in the target text sequence using the trained event detection model.

[0081] The trained event detection model can be used to detect whether a target text sequence contains events, and what the fine-grained events are. Furthermore, based on the aforementioned event hierarchy, the coarse-grained events contained in the target text sequence can be determined.

[0082] In some embodiments of this application, the detection of event information included in a target text sequence by the trained event detection model includes: determining the probability of each word in the target text sequence matching each preset fine-grained event using the encoder module of the trained event detection model; and classifying and mapping the probability of each word in the target text sequence matching each preset fine-grained event using the classifier module of the trained event detection model to determine the fine-grained event matched by each word in the target text sequence. During the event detection stage, the trained event detection model can be pruned, retaining only the encoder module 310 and the classifier module 330. For a target text sequence input to the event detection model, the encoder module 310 first encodes each word in the target text sequence to determine the probability of each word matching each preset fine-grained event. Then, the classifier module 330 classifies and maps the probability of each word matching each preset fine-grained event output by the encoder module 310 to determine the fine-grained event matched by each word in the target text sequence.

[0083] The event detection method disclosed in this application involves acquiring several text sequences with fine-grained event labels; setting at least one level of coarse-grained event labels for each text sequence according to a preset event hierarchy based on the fine-grained event labels set for each text sequence; training an event detection model based on the several text sequences and the multi-level event labels set for each text sequence, wherein the multi-level event labels include: fine-grained event labels and at least one level of coarse-grained event labels; and detecting event information included in the target text sequence through the trained event detection model, which helps to improve the accuracy of event detection.

[0084] The event detection method disclosed in this application improves the accuracy of event detection by using coarse-grained label information from training samples to assist in the detection of fine-grained events during the training of the event detection model. Furthermore, by setting multi-level event labels for the training samples and implementing coarse-grained label event detection through a probability mapping mechanism, additional supervision signals can be introduced without changing the fine-grained event detection task model, thereby increasing the probability of the encoder module in the fine-grained event detection task outputting more accurate results.

[0085] Example 2

[0086] An event detection device disclosed in the embodiments of this application, such as Figure 4 As shown, the device includes:

[0087] The training sample acquisition module 410 is used to acquire several text sequences with fine-grained event labels.

[0088] The multi-level event label setting module 420 is used to set at least one level of coarse-grained event labels for each text sequence according to the fine-grained event labels set for each text sequence and according to a preset event hierarchy relationship.

[0089] The model training module 430 is used to train an event detection model based on the plurality of text sequences and multi-level event labels set for each of the text sequences, wherein the multi-level event labels include: fine-grained event labels and at least one level of coarse-grained event labels.

[0090] The event detection module 440 is used to detect event information included in the target text sequence through the trained event detection model.

[0091] In some embodiments of this application, such as Figure 3 As shown, the event detection model includes: an encoder module 310, a probability mapping module 320, and a classifier module 330. The model training module 430 is further used for:

[0092] The encoder module encodes each text sequence separately to determine the probability of each word in each text sequence matching a preset fine-grained event.

[0093] The probability mapping module maps the probability of each word in each text sequence matching each preset fine-grained event, thereby determining the probability of each word in each text sequence matching each preset coarse-grained event at each level.

[0094] The classifier module performs classification mapping on the probability of each word in each text sequence matching each preset fine-grained event and the probability of matching each preset coarse-grained event at each level, thereby determining the estimated value of each level of events matched by each word in each text sequence; wherein, each level of events includes: the preset fine-grained events and the preset coarse-grained events at each level.

[0095] The loss value of the event detection model is determined based on the estimated value of each level of event matched by each word in each text sequence and the true value of each level of event matched by each word in the text sequence as indicated in the multi-level event labels set in the text sequence.

[0096] The event detection model is iteratively optimized with the goal of minimizing the loss value until the training termination condition is met.

[0097] In some embodiments of this application, the step of mapping the probability of each word in each text sequence matching a preset fine-grained event through the probability mapping module, and determining the probability of each word in each text sequence matching a preset coarse-grained event at each level, includes:

[0098] Through the probability mapping module, for the coarse-grained event above the fine-grained event, the probability of each word in each text sequence matching each preset fine-grained event is mapped to determine the probability of each word in each text sequence matching the coarse-grained event above the fine-grained event.

[0099] The probability mapping module maps the probability of each word in each text sequence matching each preset coarse-grained event according to the hierarchical relationship of each coarse-grained event, and determines the probability of each word in each text sequence matching each preset coarse-grained event at each level in turn.

[0100] In some embodiments of this application, the step of mapping the probability of each word in each text sequence matching a preset fine-grained event to determine the probability of each word in each text sequence matching the coarse-grained event at the next higher level of the fine-grained event includes:

[0101] For each word in each of the text sequences, the sum of the probabilities that the word matches each specified fine-grained event is determined as the probability that the word matches the specified coarse-grained event; or,

[0102] For each word in each of the text sequences, the maximum probability of the word matching each specified fine-grained event is determined as the probability of the word matching the specified coarse-grained event;

[0103] Wherein, the specified coarse-grained event is selected from the preset coarse-grained events at the next higher level of the fine-grained event, and the specified fine-grained event is all the preset fine-grained events included in the specified coarse-grained and fine-grained events.

[0104] In some embodiments of this application, determining the loss value of the event detection model based on the estimated value of each level of event matched by each word in each text sequence and the true value of each level of event matched by each word in the text sequence as indicated in the multi-level event labels set for the text sequence includes:

[0105] Based on the predicted values ​​of fine-grained events matching each word in each text sequence and the actual values ​​of fine-grained events matching each word in the text sequence as indicated in the fine-grained event labels set for the text sequence, the fine-grained prediction loss value of the event detection model is determined; based on the predicted values ​​of coarse-grained events matching each word at each level in each text sequence, and the actual values ​​of coarse-grained events matching each word at the corresponding level in the text sequence as indicated in the corresponding coarse-grained event labels set for the text sequence, the corresponding level coarse-grained prediction loss value of the event detection model is determined; the fine-grained prediction loss value and each of the corresponding level coarse-grained prediction loss values ​​are weighted and summed to obtain the loss value of the event detection model.

[0106] In some embodiments of this application, the event detection module 440 is further configured to:

[0107] The encoder module of the event detection model, obtained through training, determines the probability of each word in the target text sequence matching each preset fine-grained event.

[0108] The classifier module of the event detection model, which has been trained, classifies and maps the probability of each word in the target text sequence matching each preset fine-grained event, thereby determining the fine-grained event matched by each word in the target text sequence.

[0109] The event detection device disclosed in this application is used to implement the event detection method described in Embodiment 1 of this application. The specific implementation methods of each module of the device will not be repeated here, but can be found in the specific implementation methods of the corresponding steps in the method embodiment.

[0110] The event detection device disclosed in this application acquires several text sequences with fine-grained event tags; based on the fine-grained event tags set for each text sequence, and according to a preset event hierarchy, sets at least one level of coarse-grained event tags for each text sequence; and trains an event detection model based on the several text sequences and the multi-level event tags set for each text sequence, wherein the multi-level event tags include: fine-grained event tags and at least one level of coarse-grained event tags; the event detection model obtained through training detects event information included in the target text sequence, which helps to improve the accuracy of event detection.

[0111] The event detection apparatus disclosed in this application improves the accuracy of event detection by using coarse-grained label information from training samples to assist in the detection of fine-grained events during the training of the event detection model. Furthermore, by setting multi-level event labels for the training samples and implementing coarse-grained label event detection through a probability mapping mechanism, additional supervision signals can be introduced without changing the fine-grained event detection task model, thereby increasing the accuracy of the encoder module's output probability in the fine-grained event detection task.

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

[0113] The above provides a detailed description of the event detection method and apparatus provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and its core idea. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the idea of ​​this application. Therefore, the content of this specification should not be construed as a limitation of this application.

[0114] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0115] The various component embodiments of this application can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components in the electronic device according to the embodiments of this application. This application can also be implemented as a device or apparatus program (e.g., a computer program and computer program product) for performing part or all of the methods described herein. Such a program implementing this application can be stored on a computer-readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.

[0116] For example, Figure 5 An electronic device is shown that can implement the methods according to this application. The electronic device may be a PC, mobile terminal, personal digital assistant, tablet computer, etc. The electronic device conventionally includes a processor 510 and a memory 520, and program code 530 stored in the memory 520 and executable on the processor 510, which, when executing the program code 530, implements the methods described in the above embodiments. The memory 520 may be a computer program product or a computer-readable medium. The memory 520 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. The memory 520 has a storage space 5201 for the program code 530 of a computer program for performing any of the method steps described above. For example, the storage space 5201 for the program code 530 may include various computer programs for implementing the various steps in the above methods. The program code 530 is computer-readable code. These computer programs can be read from or written to one or more computer program products. These computer program products include program code carriers such as hard disks, CDs, memory cards, or floppy disks. The computer program includes computer-readable code that, when executed on an electronic device, causes the electronic device to perform the method according to the above embodiments.

[0117] This application also discloses a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the event detection method as described in Embodiment 1 of this application.

[0118] Such a computer program product can be a computer-readable storage medium, which can have the same characteristics as... Figure 5The memory 520 in the illustrated electronic device is similarly arranged with storage segments, storage spaces, etc. Program code can be stored, for example, in a compressed form on the computer-readable storage medium. The computer-readable storage medium is typically as shown in the reference. Figure 6 The portable or fixed storage unit is described above. Typically, the storage unit includes computer-readable code 530', which is code read by a processor and, when executed by the processor, implements the various steps of the method described above.

[0119] The terms "an embodiment," "embodiment," or "one or more embodiments" as used herein mean that a particular feature, structure, or characteristic described in connection with an embodiment is included in at least one embodiment of this application. Furthermore, please note that the examples of the phrase "in one embodiment" do not necessarily all refer to the same embodiment.

[0120] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of this application may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.

[0121] In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. This application can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.

[0122] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. An event detection method, characterized by, include: Retrieve a sequence of texts with fine-grained event labels; Based on the fine-grained event labels set for each text sequence, and in accordance with a preset event hierarchy, at least one level of coarse-grained event labels are set for each text sequence. An event detection model is trained based on the aforementioned text sequences and the multi-level event labels set for each text sequence, wherein the multi-level event labels include: fine-grained event labels and at least one level of coarse-grained event labels. The event detection model, obtained through training, detects event information included in the target text sequence. The event detection model includes an encoder module, a probability mapping module, and a classifier module. The step of training the event detection model based on the plurality of text sequences and multi-level event labels set for each text sequence includes: The encoder module encodes each text sequence separately to determine the probability of each word in each text sequence matching a preset fine-grained event. The probability mapping module maps the probability of each word in each text sequence matching each preset fine-grained event, thereby determining the probability of each word in each text sequence matching each preset coarse-grained event at each level. The classifier module performs classification mapping on the probability of each word in each text sequence matching each preset fine-grained event and the probability of matching each preset coarse-grained event at each level, thereby determining the estimated value of each level of events matched by each word in each text sequence; wherein, each level of events includes: the preset fine-grained events and the preset coarse-grained events at each level. The loss value of the event detection model is determined based on the estimated value of each level of event matched by each word in each text sequence and the true value of each level of event matched by each word in the text sequence as indicated in the multi-level event labels set in the text sequence. The event detection model is iteratively optimized with the goal of minimizing the loss value until the training termination condition is met.

2. The method of claim 1, wherein, The step of mapping the probability of each word in each text sequence matching a preset fine-grained event using the probability mapping module, and determining the probability of each word in each text sequence matching a preset coarse-grained event at each level, includes: Through the probability mapping module, for the coarse-grained event above the fine-grained event, the probability of each word in each text sequence matching each preset fine-grained event is mapped to determine the probability of each word in each text sequence matching the coarse-grained event above the fine-grained event. The probability mapping module maps the probability of each word in each text sequence matching each preset coarse-grained event according to the hierarchical relationship of each coarse-grained event, and determines the probability of each word in each text sequence matching each preset coarse-grained event at each level in turn.

3. The method according to claim 2, characterized in that, The step of mapping the probability of each word in each text sequence matching a preset fine-grained event to the coarse-grained event above the fine-grained event, and determining the probability of each word in each text sequence matching the coarse-grained event above the fine-grained event, includes: For each word in each of the text sequences, the sum of the probabilities of the word matching each specified fine-grained event is determined as the probability of the word matching the specified coarse-grained event; or, for each word in each of the text sequences, the maximum probability of the word matching each specified fine-grained event is determined as the probability of the word matching the specified coarse-grained event. The specified coarse-grained event is selected from the preset coarse-grained events at the next higher level of the fine-grained event, and the specified fine-grained event is all the preset fine-grained events included in the specified coarse-grained event.

4. The method according to claim 1, characterized in that, The step of determining the loss value of the event detection model based on the estimated value of each level of event matched by each word in each text sequence and the true value of each level of event matched by each word in the text sequence as indicated in the multi-level event labels set for the text sequence includes: The fine-grained prediction loss value of the event detection model is determined based on the estimated value of the fine-grained event matching each word in each text sequence and the true value of the fine-grained event matching each word in the text sequence indicated in the fine-grained event label set in the text sequence. Based on the estimated values ​​of each level of coarse-grained events matched by each word in each text sequence, and the true values ​​of each word in the text sequence matched by the corresponding level of coarse-grained events indicated in the corresponding level of coarse-grained event labels set for the text sequence, the corresponding level of coarse-grained prediction loss value of the event detection model is determined. The loss value of the event detection model is obtained by weighted summing of the fine-grained prediction loss value and the corresponding coarse-grained prediction loss value at each level.

5. The method according to any one of claims 1 to 4, characterized in that, The step of detecting event information included in a target text sequence using the event detection model obtained through training includes: The encoder module of the event detection model, obtained through training, determines the probability of each word in the target text sequence matching each preset fine-grained event. The classifier module of the trained event detection model classifies and maps the probability of each word in the target text sequence matching each preset fine-grained event, thereby determining the fine-grained event matched by each word in the target text sequence.

6. An event detection device, characterized in that, include: The training sample acquisition module is used to acquire several text sequences with fine-grained event labels. A multi-level event label setting module is used to set at least one level of coarse-grained event labels for each text sequence according to the fine-grained event labels set for each text sequence and according to a preset event hierarchy relationship. The model training module is used to train an event detection model based on the plurality of text sequences and multi-level event labels set for each of the text sequences, wherein the multi-level event labels include: fine-grained event labels and at least one level of coarse-grained event labels. The event detection module is used to detect event information included in the target text sequence using the trained event detection model. The event detection model includes an encoder module, a probability mapping module, and a classifier module. The model training module is further used for: The encoder module encodes each text sequence separately to determine the probability of each word in each text sequence matching a preset fine-grained event. The probability mapping module maps the probability of each word in each text sequence matching each preset fine-grained event, thereby determining the probability of each word in each text sequence matching each preset coarse-grained event at each level. The classifier module performs classification mapping on the probability of each word in each text sequence matching each preset fine-grained event and the probability of matching each preset coarse-grained event at each level, thereby determining the estimated value of each level of events matched by each word in each text sequence; wherein, each level of events includes: the preset fine-grained events and the preset coarse-grained events at each level. The loss value of the event detection model is determined based on the estimated value of each level of event matched by each word in each text sequence and the true value of each level of event matched by each word in the text sequence as indicated in the multi-level event labels set in the text sequence. The event detection model is iteratively optimized with the goal of minimizing the loss value until the training termination condition is met.

7. An electronic device, comprising a memory, a processor, and program code stored in the memory and executable on the processor, characterized in that, When the processor executes the program code, it implements the event detection method according to any one of claims 1 to 5.

8. A computer-readable storage medium having program code stored thereon, characterized in that, When the program code is executed by the processor, it implements the steps of the event detection method according to any one of claims 1 to 5.