An event extraction method based on dynamic prefix prompt information

By introducing dynamic prefix prompt information and correlation classifiers into the event extraction method, the problem of excitation text and isolation of event type information in the prior art is solved, and more efficient data utilization and more accurate event extraction are achieved.

CN115017316BActive Publication Date: 2025-04-08BEIJING INST OF TECH +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210669824.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-14
Publication Date
2025-04-08
Estimated Expiration
2042-06-14

AI Technical Summary

Technical Problem

The existing generation-based event extraction method faces the problems of manually constructing the suboptimality of discrete prompt text and the isolation of event type information from the text context, resulting in low data utilization and unrelated information interference.

Method used

An event extraction method based on dynamic prefix prompt information is proposed. By training an event extractor, including a correlation classifier, a prompt information constructor and a conditional text generator, dynamically construct adjustable dense prefix information, and using the correlation classifier to exclude text that does not contain event instances.

Benefits of technology

It improves data utilization, enhances the expressiveness of prefix information, reduces interference from irrelevant information, and significantly improves accuracy, recall and F1 values ​​in trigger word classification and element classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115017316B_ABST
    Figure CN115017316B_ABST
Patent Text Reader

Abstract

The present invention relates to an event extraction method based on dynamic prefix prompt information, and belongs to the technical field of computer natural language processing. The method dynamically constructs adjustable dense prefix information based on input text combined with all possible event types, thereby enhancing the expressiveness of the prefix information and improving the utilization rate of the data. At the same time, the text that does not contain event instances is excluded by using a relevance classifier, reducing the interference of irrelevant information. The method overcomes the technical defects of the existing generation-based event extraction method, such as the suboptimality of manually constructing discrete prompt texts and the isolation of event type information from the text context. The method has significant improvements in precision, recall, F1 value evaluation indicators, etc.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to an event extraction method based on dynamic prefix prompt information, belonging to the technical field of computer natural language processing. Background Art

[0002] Event extraction refers to the process of extracting event instances from unstructured text based on a predefined event ontology. It is a technology that can enhance downstream applications and is also an important technical means for computers to understand and process natural language text.

[0003] In the event extraction task, an event instance consists of an event trigger word and an event element. An event trigger word is an action-oriented word or phrase that indicates the occurrence of an event and has a specific event category. An event element is an entity that participates in an event and has a specific role.

[0004] Before event extraction, the event ontology is usually defined, including event types and the roles that each type focuses on. For example, in the sentence "The man returned to Los Angeles from Mexico following his capture Tuesday by bounty hunters." there are two event instances, a transport type event triggered by "returned", and an arrest-jail type event triggered by "capture".

[0005] In recent years, with the widespread application of sequence-to-sequence pre-trained language models, methods that use text generation to solve information extraction tasks have received a lot of attention. Different from the traditional method of dividing event trigger words and event element extraction into recognition and classification, this type of method is a generation-based event extraction method.

[0006] Currently, generation-based event extraction methods face many challenges.

[0007] First, existing methods are limited by the suboptimality of manually constructed discrete prompt texts. Existing methods manually design natural language prompts for each event type as conditional generation templates that describe the structure of the event. Related work has shown that the construction method of prompt text has a great impact on downstream tasks. However, the prompt template is not adjusted during the training process and is a suboptimal text combination constructed manually, which greatly limits the ultimate performance ceiling of the model.

[0008] Secondly, the event type information is isolated from the text context in existing methods. When extracting a specific type of event, the generation-based event extraction method only focuses on the information of the event type, without considering the association between other possible event types.

[0009] In summary, these two challenges hinder classification-based methods from achieving more competitive results. Existing methods have not yet disclosed a technical solution that can dynamically construct prompt information related to event categories based on input text or use relevance classifiers to exclude text that does not contain event instances. The data utilization rate is low and is interfered by irrelevant information. Summary of the invention

[0010] The purpose of the present invention is to overcome the technical defects of the existing generation-based event extraction methods, such as the suboptimality of artificially constructed discrete prompt texts and the isolation of event type information from text contexts, and creatively propose an event extraction method based on dynamic prefix prompt information.

[0011] The innovation of the present invention is that: according to the input text and all possible event types, the adjustable dense prefix information is dynamically constructed, thereby enhancing the expressiveness of the prefix information and improving the utilization rate of the data. At the same time, the text that does not contain event instances is excluded by using the correlation classifier, reducing the interference of irrelevant information.

[0012] The technical solution adopted by the present invention is as follows:

[0013] An event extraction method based on dynamic prefix prompt information.

[0014] First, an event extractor is trained, which includes a relevance classifier, a prompt message constructor, and a conditional text generator.

[0015] Among them, the relevance classifier is a BERT text classifier whose parameters are fine-tuned during training;

[0016] The prompt information constructor is a BERT text encoder and a set of prefix vector sequences. Each prefix vector sequence corresponds to an event type supported by the event extractor, which contains multiple real-valued vectors, and the number of vectors contained in each sequence is the same;

[0017] The conditional text generator is a pre-trained sequence-to-sequence language model BART whose parameters are fine-tuned during training.

[0018] Step 1: Create "event instance set-text pair" training samples and event ontology O with event instance annotations;

[0019] A correlation classifier is trained according to the event types in the event instance set, and the event types are enumerated in sequence; a target text is constructed according to the annotation results of each event type, thereby training an event extractor.

[0020] Specifically, step 1 may include the following steps:

[0021] Step 1.1: Manually annotate the texts in the corpus to form “event instance set-text pair” training samples and an ontology O that describes event types and structures.

[0022] Step 1.2: Determine whether the event instance set of the text in the "event instance set-text pair" training sample is empty. If it is empty, the correlation is "0", if it is not empty, the correlation is "1", and then form a "correlation-text pair" training sample.

[0023] Step 1.3: Input each text in the "relevance-text pair" training sample into the relevance classifier, perform binary classification with the target as "0" and "1", and calculate the cross entropy loss function; use the Adam optimization algorithm for training to optimize the parameters in the relevance classifier.

[0024] Preferably, step 1.3 can be implemented by the following method:

[0025] Step 1.3.1: Use BERT tokenizer to split the input text c into subword sequences and add special symbols "[CLS]" and "[SEP]" at the beginning and end of the sequence respectively;

[0026] Step 1.3.2: Input the subword sequence with the first and last tags into the BERT encoder to obtain the output vector v corresponding to the special symbol "[CLS]" in the last layer of the model r ;

[0027] Step 1.3.3: Output vector v r Input the multi-layer feedforward neural network for binary classification;

[0028] Step 1.3.4: Calculate the cross entropy loss function based on the probability logits of the binary classification and the correct correlation of the input text c;

[0029] Step 1.3.5: Use the Adam optimization algorithm to train and optimize the parameters in the relevance classifier, including a BERT encoder and a multi-layer feedforward neural network.

[0030] Step 1.4: For each event type e∈O, initialize an independent prefix vector sequence as a parameter and design a generation template t e .

[0031] Specifically, step 1.4 can be implemented by the following method:

[0032] Step 1.4.1: Initialize a prefix vector sequence for each event type e. Each sequence contains L vectors, denoted as Each vector is independent of each other and satisfies represents the real number domain, D represents The vector dimension of

[0033] Step 1.4.2: Design a generation template t for each event type e e ;

[0034] Generate Template e It provides slots for trigger words and event elements to be filled in, thereby converting a single type of event instance structure into a natural language text sequence.

[0035] For example, the generation template for the Be-Born type event is "Trigger is <trg> <sep1> <arg1>wasborn in <arg2>place", where the special symbol " <sep1>" is used to separate trigger words and event elements; in the trigger word part, the special symbol " <trg>" is the slot where the real trigger word needs to be filled; in the event element part, the special symbol " <arg1>"and" <arg2>” represent the two roles that birth type events focus on, namely, person and place.

[0036] Step 1.5: Select the training samples with a correlation of "1" in the "event instance set-text pair" to form a training sample subset, and perform the "event instance set-text pair" in the training sample subset.<S,c> , S represents the event instance set, c represents the input text; enumerate the event types, set the currently processed event type to e, and proceed to the subsequent steps.

[0037] Step 1.6: Use the BERT text encoder to calculate the representation vector of the input text c.

[0038] Specifically, step 1.6 can be implemented by the following method:

[0039] Step 1.6.1: Use BERT tokenizer to split the input text c into subword sequences and add special symbols "[CLS]" and "[SEP]" at the beginning and end of the sequence respectively.

[0040] Step 1.6.2: Input the subword sequence with the first and last tags into the BERT encoder to obtain the output vector v corresponding to the special symbol "[CLS]" in the last layer of the model c .

[0041] Step 1.7: Use the representation vector to aggregate the prefix vector sequences representing each event type to form a set of dynamically constructed prefix vector sequences P c .

[0042] Specifically, step 1.7 can be implemented by the following method:

[0043] Step 1.7.1: Process the L vectors in the sequence one by one. For position i∈[1,L], use the multi-head attention mechanism to calculate the vector v c The set of vectors at position i in the prefix vector sequence corresponding to each event type The weight between

[0044] Step 1.7.2: Aggregate the weighted sum vector Sort by position to form a set of dynamically constructed prefix vector sequences P c ,

[0045] Step 1.8: Construct the target text g based on the event instance subset of event type e in the event instance set S e .

[0046] Specifically, step 1.8 can be implemented by the following method:

[0047] Step 1.8.1: Find the event instance subset E with event type e based on the annotation results of the input text c.

[0048] Step 1.8.2: Fill each event instance in the subset E into the generated template t e middle.

[0049] If |E|≥1, use the special symbol " <sep2>" is connected as the target text g e ;

[0050] If |E|=0, the target text g e Set to "Trigger is <trg>”.

[0051] Step 1.9: The dynamically constructed prefix vector sequence P c , Generate template e , text c is input into the conditional text generator, and the output target text g is calculated e The negative log-likelihood of is used as the loss function. Then, the AdamW optimization algorithm is used for training to optimize the parameters in the prompt information constructor and the conditional text generator.

[0052] Specifically, step 1.9 can be implemented by the following method:

[0053] Step 1.9.1: Set the dynamically constructed prefix vector sequence P c , Generate template e , text c is input into the conditional text generator, and the output target text g is calculated e The negative log-likelihood of .

[0054] Step 1.9.2: Use the AdamW optimization algorithm to minimize the negative log-likelihood for training and optimize the parameters in the prompt information constructor and the conditional text generator. The parameters in the prompt information constructor include a BERT encoder and several prefix vector sequences, and the parameters in the conditional text generator include a BART encoder-decoder model.

[0055] After the optimization is completed, an event extractor containing the optimal parameters is obtained.

[0056] Step 2: For the input text to be calculated, first use the relevance classifier to predict the input text to determine whether it contains an event;

[0057] If it does not contain events, an empty event instance set is output;

[0058] If events are included, the event types are enumerated in turn, and for each event type, a prefix vector sequence is dynamically constructed using a prompt information constructor, the generated text is output using a conditional text generator, and a set of event instances is obtained by parsing according to the rules.

[0059] Specifically, step 2 may include the following steps:

[0060] Step 2.1: Classify the input text c to be calculated using the relevance classifier;

[0061] If the result is "0", that is, irrelevant, then directly output an empty event instance set and end the step;

[0062] If the result is "1", that is, relevant, go to step 2.2;

[0063] Step 2.2: Use the prompt information constructor to generate a dynamically constructed prefix vector sequence P c .

[0064] Step 2.3: Enumerate event types and set the event type currently being processed to e.

[0065] Step 2.4: The dynamically constructed prefix vector sequence P c , Generate template e , text c is input into the conditional text generator and the output text o is obtained.

[0066] Step 2.5: Parse the output text o according to the construction rules in step 1.8 to obtain a set of event instances.

[0067] Specifically, step 2.5 can be implemented by the following method:

[0068] Step 2.5.1: Determine whether the output text o is "Trigger is <trg>", if yes, then the event instance set for event type e is an empty set; otherwise, go to step 2.5.2.

[0069] Step 2.5.2: Output text o according to the special symbol " <sep2>" is segmented to obtain the output text substring set O = {o i |o1+ <sep2> +o2+ <sep2>…=o}.

[0070] Step 2.5.3: Substring the strings in the substring set O in turn according to the generated template t e Parse to obtain a set of event instances, and merge all the sets to obtain a set of event instances for event type e.

[0071] Step 2.6: Merge the event instance sets of all event types in the enumeration process to obtain the final event instance set.

[0072] Beneficial Effects

[0073] Compared with the prior art, the method of the present invention has the following advantages:

[0074] 1. It overcomes the technical defects of the current generation-based event extraction method, such as the suboptimality of manually constructing discrete prompt text and the isolation of event type information from text context;

[0075] 2. According to the input text combined with all possible event types, the dense and adjustable prefix information is dynamically constructed, which enhances the expressiveness of the prefix information and improves the utilization of data. The relevance classifier is used to exclude the text that does not contain event instances, reducing the interference of irrelevant information.

[0076] 3. The event extraction task was evaluated using the ACE 2005 and ERE English event extraction datasets. The experimental results show that, under the same dataset, the event extraction method based on dynamic prefix prompt information adopted by the present invention has significant improvements in precision, recall, and F1 value evaluation indicators in terms of trigger word classification and element classification, compared with the traditional classification-based method OneIE, and the traditional generation-based methods Text2Event and DEGREE-e2e. BRIEF DESCRIPTION OF THE DRAWINGS

[0077] Figure 1 The figure is a flow chart of the overall framework of the method of the present invention.

[0078] Figure 2 This is a schematic diagram of the results of each stage when the method of the present invention processes an input text sample. DETAILED DESCRIPTION

[0079] The method of the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0080] Example 1

[0081] like Figure 1 As shown, an event extraction method based on dynamic prefix prompt information.

[0082] First, train the event extractor, which includes a relevance classifier, a prompt information builder, and a conditional text generator. The relevance classifier is a BERT text classifier whose parameters are fine-tuned during training; the prompt information builder is a BERT text encoder and a set consisting of multiple prefix vector sequences; each prefix vector sequence corresponds to an event type supported by the event extractor, which contains multiple real-valued vectors, and the number of vectors contained in each sequence is the same; the conditional text generator is a pre-trained sequence-to-sequence language model BART whose parameters are fine-tuned during training.

[0083] This embodiment provides the process and specific embodiments of the method of the present invention.

[0084] The data used in this embodiment comes from ACE 2005 and ERE English event extraction datasets.

[0085] The method comprises:

[0086] Step 1: Establish "event instance set-text pair" training samples and event ontology O with event instance annotations, train the correlation classifier according to the event types in the event instance set, enumerate the event types in turn, construct the target text according to the annotation results of each event type, and thus train the event extractor;

[0087] The step 1 specifically includes:

[0088] Step 1.1: Manually annotate the texts in the corpus to form "event instance set-text pair" training samples and ontology O that describes event types and structures. For example, given the sentence "Hariri submitted his resignation during a 10-minute meeting with the head of state at the Baabda presidential palace.", the event instance is a Contact:Meet type event triggered by "meeting", which involves two roles, Entity "Hariri" and "head of state", and Place "palace". For details, see Figure 2 ;

[0089] Step 1.2: Determine whether the event instance set of the text in the "event instance set-text pair" training sample is empty, and define the correlation as "0" if it is empty and "1" if it is not empty, to form a "correlation-text pair" training sample. For example, the correlation in the above example sentence is "1";

[0090] Step 1.3: Input each text in the "relevance-text pair" training sample into the relevance classifier, perform binary classification with the target as "0" and "1", and calculate the cross entropy loss function; use the Adam optimization algorithm for training to optimize the parameters in the relevance classifier.

[0091] The specific implementation process of step 1.3 is as follows:

[0092] Step 1.3.1: Use BERT tokenizer to split the input text c into subword sequences and add special symbols "[CLS]" and "[SEP]" at the beginning and end of the sequence respectively. For example, the above sentence will be transformed into the following subword sequence: "[CLS]", "Hariri", "submit", "#ted", "his", "resignation", "during", "a", "10", "#-", "#minute", "meeting", "with", "the", "head", "of", "state", "at", "the", "Baabda", "president", "#ial", "palace", ".", "[SEP]";

[0093] Step 1.3.2: Input the subword sequence with the first and last tags into the BERT encoder to obtain the output vector v corresponding to the special symbol "[CLS]" in the last layer of the model r ;

[0094] Step 1.3.3: Output vector v r Input the multi-layer feedforward neural network for binary classification;

[0095] Step 1.3.4: Calculate the cross entropy loss function based on the probability logits of the binary classification and the correct correlation of the input text c;

[0096] Step 1.3.5: Use the Adam optimization algorithm to train and optimize the parameters in the relevance classifier, including a BERT encoder and a multi-layer feedforward neural network;

[0097] Step 1.4: Initialize an independent prefix vector sequence as a parameter for each event type e∈O and design a generation template t e ;

[0098] The specific implementation process of step 1.4 is as follows:

[0099] Step 1.4.1: Initialize a prefix vector sequence for each event type e. Each sequence contains L vectors, denoted as Each vector is independent of each other and satisfies

[0100] Step 1.4.2: Design a generation template t for each event type e e , the generation template provides slots for trigger words and event elements to be filled in, thereby converting a single type of event instance structure into a natural language text sequence, such as Figure 2 As shown, the generation template for the Contact:Meet type event is "Trigger is <trg> <sep1> <arg1>met with <arg2>in <arg3>place", where the special symbol " <sep1>" is used to separate trigger words and event elements. In the trigger word part, the special symbol " <trg>" is the slot where the real trigger word needs to be filled in the event element part, special symbol" <arg1> ”、" <arg2> ”、" <arg3>"represent the roles that need to be paid attention to in the three meeting type events: meeting entity, meeting entity, and meeting place;

[0101] Step 1.5: Select the training samples with a correlation of "1" in the "event instance set-text pair" to form a training sample subset, and perform the "event instance set-text pair" in the training sample subset.<S,c> , enumerate the event types, assuming that the event type currently being processed is e, and proceed to the subsequent steps;

[0102] Step 1.6: Use the BERT text encoder to calculate the representation vector of the text c;

[0103] The specific implementation process of step 1.6 is as follows:

[0104] Step 1.6.1: Use BERT tokenizer to split the input text c into subword sequences and add special symbols "[CLS]" and "[SEP]" at the beginning and end of the sequence respectively;

[0105] Step 1.6.2: Input the subword sequence with the first and last tags into the BERT encoder to obtain the output vector v corresponding to the special symbol "[CLS]" in the last layer of the model c ;

[0106] Step 1.7: Use the representation vector to aggregate the prefix vector sequences representing each event type to form a set of dynamically constructed prefix vector sequences P c ;

[0107] The specific implementation process of step 1.7 is as follows:

[0108] Step 1.7.1: Process the L vectors in the sequence one by one. For position i∈[1,L], use the multi-head attention mechanism to calculate the vector v c The set of vectors at position i in the prefix vector sequence corresponding to each event type The weight between

[0109] Step 1.7.2: Aggregate the weighted sum vector Sort by position to form a set of dynamically constructed prefix vector sequences

[0110] Step 1.8: Construct the target text g based on the subset of event instances with event type e in the event instance set S e ;

[0111] The specific implementation process of step 1.8 is as follows:

[0112] Step 1.8.1: Find the event instance subset E of event type e based on the annotation results of the input text c;

[0113] Step 1.8.2: Fill each event instance in the subset E into the generated template t e middle;

[0114] Step 1.8.3: If |E|≥1, use the special symbol " <sep2>" are connected as the target text g e ; If |E|=0, the target text g e Set to "Trigger is <trg>"; The above example sentence outputs the text for the target of type Contact:Meet as follows Figure 2 "Trigger meeting<IN_SEP> Hariri met with head of state in palace place”;

[0115] Step 1.9: The dynamically constructed prefix vector sequence P c , Generate template e , text c is input into the conditional text generator, and the output target text g is calculated e The negative log-likelihood of is used as the loss function, and the AdamW optimization algorithm is used for training to optimize the parameters in the prompt information constructor and the conditional text generator.

[0116] The specific implementation process of step 1.9 is as follows:

[0117] Step 1.9.1: Set the dynamically constructed prefix vector sequence P c , Generate template e , text c is input into the conditional text generator, and the output target text g is calculated e The negative log-likelihood of ;

[0118] Step 1.9.2: Use the AdamW optimization algorithm to minimize the negative log-likelihood for training and optimize the parameters in the prompt information constructor and the conditional text generator. The parameters in the prompt information constructor include a BERT encoder and multiple prefix vector sequences, and the parameters in the conditional text generator include a BART encoder-decoder model. After the optimization is completed, an event extractor with optimal parameters is obtained.

[0119] Step 2: For the input text to be calculated, first use the relevance classifier to predict the input text to determine whether it contains events. If it does not contain events, output an empty event instance set. If it contains events, enumerate the event types in sequence. For each event type, use the prompt information constructor to dynamically construct a prefix vector sequence, use the conditional text generator to output the generated text, and parse it according to the rules to obtain a set of event instances;

[0120] Step 2.1: Classify the input text c to be calculated using the relevance classifier. If the result is "0", that is, irrelevant, directly output an empty event instance set and end the step; if the result is "1", that is, relevant, proceed to step 2.2;

[0121] Step 2.2: Use the prompt information constructor to generate a dynamically constructed prefix vector sequence P c ;

[0122] Step 2.3: Enumerate event types, assuming that the event type currently being processed is e;

[0123] Step 2.4: The dynamically constructed prefix vector sequence P c , Generate template e , text c is input into the conditional text generator to obtain the output text o;

[0124] Step 2.5: Parse the output text o according to the construction rules in step 1.8 to obtain a set of event instances;

[0125] The specific implementation process of step 2.5 is as follows:

[0126] Step 2.5.1: Determine whether the output text o is "Trigger is <trg>", if yes, then the event instance set for event type e is an empty set; otherwise, go to step 2.5.2;

[0127] Step 2.5.2: Output text o according to the special symbol " <sep2>" is segmented to obtain the output text substring set O = {o i |o1+ <sep2> +o2+ <sep2>…=o};

[0128] Step 2.5.3: Substring the strings in the substring set O in turn according to the generated template t e Parse to obtain a set of event instances, and merge all the sets to obtain a set of event instances for event type e;

[0129] Step 2.6: Merge the event instance sets of all event types in the enumeration process to obtain the final event instance set.

[0130] Example 2

[0131] The event extraction task is evaluated using the ACE 2005 and ERE English event extraction data sets. The experimental results show that, under the same data set, the event extraction method based on dynamic prefix prompt information adopted by the present invention is superior to the traditional classification-based method OneIE, the traditional generation-based methods Text2Event and DEGREE-e2e in terms of trigger word classification (Trg-C) and element classification (Arg-C). The precision (P), recall (R) and F1 value (F1) are used as evaluation indicators, and the experimental results shown in Table 1 can be obtained.

[0132] Table 1 Performance comparison between the method of the present invention and the traditional method

[0133]

[0134]

[0135] The experimental results in Table 1 prove that: under the same data condition, the method of the present invention is compared with the method not using the present invention, in terms of trigger word classification (Trg-C) and element classification (Arg-C), the precision rate Precision (P), recall rate Recall (R), and F1 value (F1) evaluation indicators are significantly improved.

[0136] The above is only a preferred embodiment of the present invention, and the present invention should not be limited to the contents disclosed in the examples and drawings. Any equivalent or modification completed without departing from the spirit disclosed in the present invention shall fall within the protection scope of the present invention. < / sep2> < / trg> < / trg> < / arg2> < / arg1> < / trg> < / sep1> < / trg> < / sep2> < / trg> < / trg> < / trg> < / sep1> < / trg>

Claims

1. An event extraction method based on dynamic prefix prompt information, characterized in that: First, train an event extractor, which includes a relevance classifier, a prompt information constructor, and a conditional text generator; Among them, the relevance classifier is a BERT text classifier whose parameters are fine-tuned during training; The prompt information constructor is a BERT text encoder and a set of several prefix vector sequences; each prefix vector sequence corresponds to an event type supported by the event extractor, which contains multiple real-valued vectors, and the number of vectors contained in each sequence is the same; The conditional text generator is a pre-trained sequence-to-sequence language model BART whose parameters are fine-tuned during training; Step 1: Create "event instance set-text pair" training samples and event ontology A with event instance annotations; train a relevance classifier according to the event types in the event instance set, and enumerate the event types in sequence; construct the target text according to the annotation results of each event type, and thus train an event extractor; Step 1.1: Manually annotate the texts in the corpus to form "event instance set-text pair" training samples and ontology A that describes event types and structures; Step 1.2: Determine whether the event instance set of the text in the "event instance set-text pair" training sample is empty. If it is empty, the correlation is "0", and if it is not empty, the correlation is "1", and then form a "correlation-text pair" training sample; Step 1.3: Input each text in the "relevance-text pair" training sample into the relevance classifier, perform binary classification with the target as "0" and "1", and calculate the cross entropy loss function; use the Adam optimization algorithm for training to optimize the parameters in the relevance classifier; Step 1.4: For each event type e∈A, initialize an independent prefix vector sequence as a parameter and design a generation template t e ; Step 1.5: Select the training samples with a correlation of "1" in the "event instance set-text pair" to form a training sample subset, and perform the "event instance set-text pair" in the training sample subset.<S,c> , S represents the event instance set, c represents the input text; enumerate the event types, set the current event type to be processed as e, and proceed to the subsequent steps; Step 1.6: Use the BERT text encoder to calculate the representation vector of the input text c; Step 1.7: Use the representation vector to aggregate the prefix vector sequences representing each event type to form a set of dynamically constructed prefix vector sequences P c ; Step 1.8: Construct the target text g based on the event instance subset of event type e in the event instance set S e ; Step 1.9: The dynamically constructed prefix vector sequence P c , Generate template e , text c is input into the conditional text generator, and the output target text g is calculated e The negative log-likelihood of is used as the loss function; then, the AdamW optimization algorithm is used for training to optimize the parameters in the prompt information constructor and the conditional text generator; After the optimization is completed, an event extractor containing the optimal parameters is obtained; Step 2: For the input text to be calculated, first use the relevance classifier to predict the input text to determine whether it contains an event; If it does not contain events, an empty event instance set is output; If events are included, enumerate the event types in turn, dynamically construct a prefix vector sequence for each event type using the prompt information constructor, output the generated text using the conditional text generator, and parse according to the rules to obtain a set of event instances; Step 2.1: Classify the input text c to be calculated using the relevance classifier; If the result is "0", that is, irrelevant, then directly output an empty event instance set and end the step; If the result is "1", that is, relevant, go to step 2.2; Step 2.2: Use the prompt information constructor to generate a dynamically constructed prefix vector sequence P c ; Step 2.3: Enumerate event types and set the event type currently being processed to e; Step 2.4: The dynamically constructed prefix vector sequence P c , Generate template e , text c is input into the conditional text generator, and output text a is obtained; Step 2.5: Parse the output text a according to the construction rules of step 1.8 to obtain a set of event instances; Step 2.6: Merge the event instance sets of all event types in the enumeration process to obtain the final event instance set.

2. The event extraction method based on dynamic prefix prompt information as claimed in claim 1, characterized in that: Step 1.3 includes the following steps: Step 1.3.1: Use BERT tokenizer to split the input text c into subword sequences and add special symbols "[CLS]" and "[SEP]" at the beginning and end of the sequence respectively; Step 1.3.2: Input the subword sequence with the first and last tags into the BERT encoder to obtain the output vector v corresponding to the special symbol "[CLS]" in the last layer of the model r ; Step 1.3.3: Output vector v r Input the multi-layer feedforward neural network for binary classification; Step 1.3.4: Calculate the cross entropy loss function based on the probability logits of the binary classification and the correct correlation of the input text c; Step 1.3.5: Use the Adam optimization algorithm to train and optimize the parameters in the relevance classifier, including a BERT encoder and a multi-layer feedforward neural network.

3. The event extraction method based on dynamic prefix prompt information as claimed in claim 1, characterized in that: Step 1.4 includes the following steps: Step 1.4.1: Initialize a prefix vector sequence for each event type e. Each sequence contains L vectors, denoted as Each vector is independent of each other and satisfies represents the real number domain, and D represents The vector dimension of Step 1.4.2: Design a generation template t for each event type e e ; Generate Template e Provides slots for trigger words and event elements to be filled in, thereby converting a single type of event instance structure into a natural language text sequence; Use special symbols" <sep1>" is used to separate trigger words and event elements; in the trigger word part, the special symbol " <trg>" is the slot where the real trigger word needs to be filled; in the event element part, the special symbol " <arg1>"and" <arg2> "represents the two roles that birth type events focus on, namely, person and place.< / arg2> < / trg> 4. The event extraction method based on dynamic prefix prompt information as claimed in claim 1, characterized in that: Step 1.6 includes the following steps: Step 1.6.1: Use BERT tokenizer to split the input text c into subword sequences and add special symbols "[CLS]" and "[SEP]" at the beginning and end of the sequence respectively; Step 1.6.2: Input the subword sequence with the first and last tags into the BERT encoder to obtain the output vector v corresponding to the special symbol "[CLS]" in the last layer of the model c .

5. The event extraction method based on dynamic prefix prompt information as claimed in claim 1, characterized in that: Step 1.7 includes the following steps: Step 1.7.1: Process the L vectors in the sequence in turn; for position i∈[1,L], use the multi-head attention mechanism to calculate the vector v c The set of vectors at position i in the prefix vector sequence corresponding to each event type The weight between Step 1.7.2: Aggregate the weighted sum vector Sort by position to form a set of dynamically constructed prefix vector sequences P c , 6. The event extraction method based on dynamic prefix prompt information as claimed in claim 1, characterized in that: Step 1.8 includes the following steps: Step 1.8.1: Find the event instance subset E of event type e based on the annotation results of the input text c; Step 1.8.2: Fill each event instance in the subset E into the generated template t e middle; If |E|≥1, use the special symbol " <sep2>" is connected as the target text g e ; If |E|=0, the target text g e Set to "Triggeris <trg> ”。< / trg> 7. The event extraction method based on dynamic prefix prompt information as claimed in claim 1, characterized in that: Step 1.9 includes the following steps: Step 1.9.1: Set the dynamically constructed prefix vector sequence P c , Generate template e , text c is input into the conditional text generator, and the output target text g is calculated e The negative log-likelihood of ; Step 1.9.2: Use the AdamW optimization algorithm to minimize the negative log-likelihood for training and optimize the parameters in the prompt information constructor and the conditional text generator. The parameters in the prompt information constructor include a BERT encoder and several prefix vector sequences, and the parameters in the conditional text generator include a BART encoder-decoder model.

8. The event extraction method based on dynamic prefix prompt information as claimed in claim 1, characterized in that: Step 2.5 includes the following steps: Step 2.5.1: Determine whether the output text a is "Trigger is <trg> ", if yes, then the event instance set for event type e is an empty set; otherwise, go to step 2.5.2;< / trg> Step 2.5.2: Output text a according to the special symbol " <sep2>" is segmented to obtain the output text substring set B = {a i |a1+ <sep2> +a2+ <sep2> …=a};< / sep2> < / sep2> Step 2.5.3: Substrings in substring set B are generated according to template t e Parse to obtain a set of event instances, and merge all the sets to obtain a set of event instances for event type e.

Citation Information

Patent Citations

  • Event extraction method and system and computer readable storage medium

    CN114239536A

  • Judicial domain depth event extraction method fusing multi-task and multi-label learning

    CN114580428A