A BERT-based interactive meta-learning event detection method
Through the interactive meta-learning method based on BERT, the problem of lack of semantic information by obtaining the target support set and the target data for splicing and encoding is solved, and high-precision event detection is achieved.
Patent Information
- Application Number
- CN202211476055.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-23
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2042-11-23
AI Technical Summary
In the existing small sample event detection technology, sentence encoding lacks sufficient semantic information, resulting in inaccurate query results.
Using BERT-based interactive meta-learning method, we obtain the target support set and the target data for splicing and encoding, and enrich sentence encoding using the information of the target reference data set to realize information interaction between the query set and the support set.
Improve the accuracy of event detection and achieve high-precision event detection.
Smart Images

Figure CN115712702B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of text detection, in particular to a method based on BERT An interactive meta-learning event detection method. Background Art
[0002] With the widespread adoption of network technology, the internet is generating massive amounts of natural language data every moment. Extracting event information from natural language has become a crucial application scenario. However, due to the high cost of event annotation and the lack of annotated corpus for some events in real-world applications, it is difficult to obtain sufficient annotated data to train models for event extraction tasks in some scenarios. As a key subtask of event extraction, event detection poses a pressing challenge in achieving effective models using minimal data.
[0003] Most existing small sample event detection technologies are based on meta-learning architectures, that is, the model needs to learn event features from a support set consisting of a small amount of labeled data, and then use the learned knowledge to reason on a query set consisting of unlabeled data. Currently, related technologies generally focus on using various complex network structures to obtain better support set encoding and query set encoding, such as using CNN , RNN , GCN Others use various neural networks to encode the support set to obtain prototypes of various event types, or design a feature encoding method based on memory mechanism to obtain robust sentence encoding, and some use sequence labeling tasks to make event detection models, drawing on CRF Based on the idea of transfer matrix, the transfer score is introduced into the model to design an end-to-end event detection model.
[0004] However, these models only focus on designing complex network structures and only encode the support set and query set separately. During the encoding process, the support set cannot see the information from the query set, and the query set cannot see the information from the support set. The resulting sentence encoding lacks sufficiently rich semantic information, and the query results are not accurate enough.
[0005] Therefore, the existing technology still needs to be improved and enhanced. Summary of the Invention
[0006] In view of the above defects of the prior art, a BERT The interactive meta-learning event detection method and related equipment are designed to solve the problem in the existing technology that sentence encoding lacks sufficient semantic information and query results are not accurate when performing small sample event detection.
[0007] The first aspect of the present invention provides a BERTThe interactive meta-learning event detection method includes:
[0008] Acquire a target support set, where the target support set includes at least one reference data set, where the reference data set includes at least one reference data, where the reference data is a sentence annotated with an event trigger word and an event type;
[0009] Acquire target data, where the target data is a sentence without an event trigger word;
[0010] Concatenate and encode the target support set and the target data to obtain an event type corresponding to the target data;
[0011] A target reference data set is obtained, wherein the event type corresponding to the target reference data set is the same as the event type corresponding to the target data, and the target reference data set and the target data are concatenated and encoded to obtain event trigger words in the target data.
[0012] The said based on BERT An interactive meta-learning event detection method, wherein the target support set includes at least one event type, and each event type corresponds to one reference data set;
[0013] The expression of the target support set is:
[0014] ;
[0015] in, S is the target support set, N is the number of reference datasets, K is the number of reference data in each set of reference data sets, and for each reference data , For the i The first j sentences corresponding to the reference data, For the i The first j The position corresponding to the trigger word in the reference data, For the i The event type corresponding to the reference dataset.
[0016] The said based on BERT The interactive meta-learning event detection method of FIG. 1 is provided, wherein the step of concatenating and encoding the target support set and the target data to obtain the event type corresponding to the target data comprises:
[0017] Splicing the target data with each piece of the reference data in the target support set to obtain a first target sequence;
[0018] Encoding the first target sequence to obtain a first target sequence code;
[0019] Obtaining a first target similarity according to the first target sequence code;
[0020] The event type corresponding to the target data is obtained according to the first target similarity.
[0021] The said based on BERT The interactive meta-learning event detection method of FIG. 1 , wherein the step of obtaining the first target similarity according to the first target sequence encoding includes:
[0022] Passing the first target sequence encoding through a fully connected layer to obtain a similarity score between two sentences spliced in each of the first target sequence encodings;
[0023] The similarities corresponding to the reference data sets are summed and averaged respectively to obtain the first target similarities of the event types corresponding to one or more target data and the current reference data set.
[0024] The said based on BERT An interactive meta-learning event detection method, wherein the target reference dataset and the target data are concatenated and encoded to obtain event trigger words in the target data, comprises:
[0025] Splicing the target data with each piece of reference data in the target reference data set to obtain a second target sequence;
[0026] Encoding the second target sequence to obtain a second target sequence code;
[0027] splicing the target data with the trigger words in each piece of the reference data in the target reference data set to obtain a third target sequence;
[0028] Encoding the third target sequence to obtain a third target sequence code;
[0029] Obtaining a label type for each word in the target data according to the second target sequence code and the third target sequence code;
[0030] The event trigger words in the target data are obtained according to the tag type of each word in the target data.
[0031] The said based on BERT The interactive meta-learning event detection method of the embodiment of the present invention further comprises: encoding the second target sequence to obtain the second target sequence encoding;
[0032] Obtaining trigger word vectors and non-trigger word vectors in the second target sequence encoding, where the trigger word vectors and the non-trigger word vectors are converted from words in the target reference dataset;
[0033] Add and average each of the trigger word vectors to obtain the target trigger word prototype;
[0034] Each of the non-trigger word vectors is summed and averaged to obtain the target non-trigger word prototype.
[0035] The said based on BERT The interactive meta-learning event detection method of FIG. 1 , wherein the step of obtaining the label type of each word in the target data according to the second target sequence encoding and the third target sequence encoding includes:
[0036] Obtaining a target vector in the third target sequence encoding, where the target vector is a vector representation of each word in the target data;
[0037] The similarity between each target vector and the target trigger word prototype and the target non-trigger word prototype is obtained respectively, and a label type with a higher similarity is selected as the label type of the target vector.
[0038] The second aspect of the present invention provides a BERT The interactive meta-learning event detection device includes:
[0039] A support set acquisition module, wherein the support set acquisition module is used to acquire a target support set, wherein the target support set includes at least one reference data set, wherein the reference data set includes at least one reference data, wherein the reference data is a sentence annotated with an event trigger word and an event type;
[0040] A target data acquisition module, wherein the target data acquisition module is used to acquire target data, wherein the target data is a sentence without an event trigger word;
[0041] An event classification module, configured to concatenate and encode the target support set and the target data to obtain an event type corresponding to the target data;
[0042] A trigger word extraction module is used to obtain a target reference data set, the event type corresponding to the target reference data set is the same as the event type corresponding to the target data, and the target reference data set and the target data are concatenated and encoded to obtain the event trigger words in the target data.
[0043] In a third aspect of the present invention, a terminal is provided, comprising a processor, a computer-readable storage medium in communication with the processor, the computer-readable storage medium being adapted to store a plurality of instructions, the processor being adapted to call the instructions in the computer-readable storage medium to execute the above-mentioned instructions based on BERT Steps of the interactive meta-learning event detection method.
[0044] In a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement any of the above-mentioned BERT Steps of the interactive meta-learning event detection method.
[0045] Beneficial effect: Compared with the prior art, the present invention provides a BERT The interactive meta-learning event detection method and related equipment provided by the present invention are based on BERT In the interactive meta-learning event detection method, a target support set is obtained, the target support set includes at least one reference data set, the reference data set includes at least one reference data, wherein the reference data is a sentence marked with event trigger words and event types; target data is obtained, wherein the target data is a sentence without event trigger words; then the target support set is concatenated and encoded with the target data to obtain the event type corresponding to the target data; after obtaining the event type corresponding to the target data, a target reference data set is obtained according to the event type corresponding to the target data, that is, the event type corresponding to the target reference data set is the same as the event type corresponding to the target data; finally, the target reference data set is concatenated and encoded with the target data to obtain the event trigger words in the target data. The method provided by the present invention is based on BERT The interactive meta-learning event detection method based on the input BERT During encoding, both the query set and the support set can see each other's information. In this way, by obtaining information-rich encoding, event words in sentences can be better detected, the accuracy of detecting event words in sentences can be improved, and ultimately high-precision event detection can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 The present invention provides BERT A flowchart of an embodiment of an interactive meta-learning event detection method;
[0047] Figure 2 The present invention provides BERT Model structure diagram in an embodiment of an interactive meta-learning event detection method;
[0048] Figure 3 The present invention provides BERT A schematic structural diagram of an embodiment of an interactive meta-learning event detection device;
[0049] Figure 4 This is a structural principle diagram of an embodiment of a terminal provided by the present invention. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0051] It will be understood by those skilled in the art that, unless expressly stated otherwise, the singular forms "a", "an", "said" and "the" used herein may also include the plural forms. It should be further understood that the term "comprising" used in the description of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, "connected" or "coupled" as used herein may include wireless connections or wireless couplings. The term "and / or" used herein includes all or any units and all combinations of one or more associated listed items.
[0052] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in common dictionaries should be understood to have meanings consistent with their meanings in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0053] The present invention provides a method based on BERT The interactive meta-learning event detection method can be applied to a terminal with computing capabilities, and the terminal can execute the method based on the present invention. BERT The interactive meta-learning event detection method detects and locates trigger words in the processed data.
[0054] Example 1
[0055] In this embodiment, a method based on BERT Interactive meta-learning event detection method. Figure 1As shown, the present invention provides BERT The interactive meta-learning event detection method includes the following steps:
[0056] S 100. Obtain a target support set, where the target support set includes at least one reference data set, where the reference data set includes at least one reference data, and the reference data is a sentence annotated with an event trigger word and an event type.
[0057] The target support set includes N time types, where N is greater than or equal to 1, and each event type corresponds to one reference data set;
[0058] The expression of the target support set is:
[0059] ;
[0060] in, S is the target support set, N is the number of reference datasets, K is the number of reference data in each set of reference data sets, and for each reference data , For the i The first j sentences corresponding to the reference data, For the i The first j The position corresponding to the trigger word in the reference data, For the i The event type corresponding to the reference dataset.
[0061] Specifically, a target support set is obtained and input into a target model, wherein the target model includes an event classification model and a trigger word extraction model, such as Figure 2 As shown. The target support set is a N * K The support set consists of annotated data. N Representatives include N event types, each event type corresponds to a reference data set, K Each event type has K There are annotated data, that is, each set of reference data has K Each piece of reference data is annotated with the position of the corresponding trigger word in the sentence.
[0062] S 200. Obtain target data, where the target data is a sentence without an event trigger word labeled.
[0063] Obtain target data and input the target support set into the event classification model. The target data may be one or more, and all the target data constitute a target query set. In this embodiment, the target query set includes only one target data as an example for description.
[0064] Specifically, in this embodiment, the target data is a sentence without an event trigger word, and the event type appearing in the target data is not in the target support set. N event types.
[0065] set up The task to be completed by the event classification model described in this embodiment is defined as follows:
[0066] ;
[0067] in, represents the target data, q represents the sentence corresponding to the target data, Respectively represent the trigger word position of the target data and the corresponding event type, It is only used when evaluating the model prediction results. Represents the target support set, s represents the sentence corresponding to the reference data, and N * K Each of the reference data Representatives in the i The first j The sentences corresponding to the reference data In The word is the trigger word, and the corresponding event type is The event classification model needs to use the data in the target support set to predict the event type and event trigger words of the data in the target query set.
[0068] S 300. Concatenate and encode the target support set and the target data to obtain an event type corresponding to the target data.
[0069] When predicting the event type corresponding to the target data, it is necessary to perform splicing encoding with the support set.
[0070] Specifically, the target support set and the target data are concatenated and encoded to obtain the event type corresponding to the target data, including:
[0071] S310. Concatenate the target data with each piece of the reference data in the target support set to obtain a first target sequence;
[0072] S 320. Encode the first target sequence to obtain a first target sequence code.
[0073] Specifically, the sentences in the target support set are compared with the target data using special characters [ SEP ] and add a special character [ CLS ] to obtain the first target sequence.
[0074] Then use BERT Encode the first target sequence and map each word in the first target sequence to a continuous high-dimensional vector to obtain N * K The encoding of a sequence uses the special characters [ CLS ] to represent the entire sequence.
[0075] The encoding expression of the first target sequence is:
[0076] ;
[0077] in[ C ]represent[ CLS ],[ S ]represent[ SEP ], s represents the sentence corresponding to the reference data, q Represents the sentence corresponding to the target data.
[0078] S 330. Obtain a first target similarity according to the first target sequence code.
[0079] Specifically, the first target sequence encoding is passed through a target fully connected layer to obtain a similarity score between two sentences spliced in each of the first target sequence encodings.
[0080] The expression of sentence similarity score is:
[0081] ;
[0082] in, Supports the corresponding event type for the target en The reference data set k The reference data and the target data are spliced together to obtain [CLS] express, Support centralized correspondence for the stated goals enThe event type in the reference data set k The similarity score between the reference data and the target data, W and b represents the parameters of the target fully connected layer, where , b is a constant, W and b Perform random initialization and optimize during subsequent training.
[0083] Then, the similarities corresponding to the respective reference data sets are summed and averaged to obtain the first target similarity of the event type corresponding to one or more target data and the current reference data set.
[0084] That is, the first target similarity between the target data and each event type in the target support set is obtained.
[0085] The first target similarity is expressed as follows:
[0086] ;
[0087] in, The first target similarity score corresponding to each event type in the target support set and the target data.
[0088] S 340. Obtain an event type corresponding to the target data according to the first target similarity.
[0089] The event type corresponding to the highest score value in the first target similarity is selected as the event type corresponding to the target data.
[0090] In this embodiment, when obtaining the event type corresponding to the target data, the target data and the target support set are jointly encoded to calculate the similarity, rather than encoding them separately and then calculating the similarity. This allows the two to have a closer connection and more fully utilizes the information of the labeled data in the support set. The structure of the event classification model is as follows: Figure 2 Shown in the middle left half.
[0091] After obtaining the event type corresponding to the target data, the trigger words in the target data are identified and queried.
[0092] S 400. Obtain a target reference data set, wherein the event type corresponding to the target reference data set is the same as the event type corresponding to the target data, concatenate and encode the target reference data set and the target data to obtain event trigger words in the target data.
[0093] Specifically, according to the event type corresponding to the target data, a reference data set corresponding to the event type in the target support set is obtained as the target reference data set.
[0094] S 410. Concatenate the target data with each piece of the reference data in the target reference data set to obtain a second target sequence.
[0095] Specifically, the target data are respectively compared with the corresponding K The reference data are input into the trigger word extraction model together. The trigger word extraction model is as follows Figure 2 As shown in the right half, each sentence in the target reference data set is separated from the target data by special characters [ CLS ] and add a [ CLS ] special characters, thus obtaining the target second sequence, which is K , ti The second sequence of the target is as follows:
[0096] ;
[0097] ;
[0098] in,[ etp ] represents the event type corresponding to the target data.
[0099] S 420. Encode the second target sequence to obtain a second target sequence code;
[0100] use BERT The target second sequence is encoded to obtain the second target sequence encoding, which is expressed as:
[0101]
[0102] in tig Represents trigger words, E A vector representation of each word.
[0103] After encoding the second target sequence to obtain the second target sequence code, the method further includes:
[0104] Obtaining trigger word vectors and non-trigger word vectors in the second target sequence encoding, where the trigger word vectors and the non-trigger word vectors are converted from words in the target reference dataset;
[0105] Add and average each of the trigger word vectors to obtain the target trigger word prototype;
[0106] Each of the non-trigger word vectors is summed and averaged to obtain the target non-trigger word prototype.
[0107] Specifically, for the word vectors belonging to the trigger word in the original sentence of the target reference dataset, add and average them to obtain the target trigger word prototype. In this embodiment, the target trigger word prototype for B Prototype representation of the label. For the word vectors that do not belong to the trigger words in the original sentence of the support set, they are also summed and averaged to obtain the target non-trigger word prototype. In this embodiment, the target non-trigger word prototype for O The prototype of the tag is expressed as:
[0108] ;
[0109] in, l represent B Tags or O Label, S ( l ) represents the tag type l All words of .
[0110] S 430. Concatenate the target data with the trigger words in each piece of reference data in the target reference data set to obtain a third target sequence.
[0111] Specifically, the target data is compared with the trigger words appearing in each target reference data set using special characters [ CLS ] to obtain the third target sequence, the ti The third target sequence expression is:
[0112] ;
[0113] ;
[0114] in, Represents the trigger words that appear in the target reference dataset.
[0115] S 440. Encode the third target sequence to obtain a third target sequence code.
[0116] use BERT The third target sequence is encoded to obtain the third target sequence encoding, which is expressed as:
[0117] .
[0118] S 450. Obtain a label type for each word in the target data according to the second target sequence code and the third target sequence code.
[0119] The acquiring the label type of each word in the target data according to the second target sequence code and the third target sequence code includes:
[0120] S 451. Obtain a target vector in the third target sequence encoding, where the target vector is a vector representation of each word in the target data;
[0121] S 452. Obtain similarities between each target vector and the target trigger word prototype and the target non-trigger word prototype, and select a label type with a higher similarity as the label type of the target vector.
[0122] Specifically, the target vector representing each word in the target data in the second half of the third target sequence code is respectively similar to the target trigger word prototype and the target non-trigger word prototype, and the one with the higher similarity is selected as the label corresponding to the current word. For example, w The expression of the similarity between the target vector and the target trigger word prototype is:
[0123] ;
[0124] in, represents the probability that the label of word w is B, B represents the label of the target trigger word prototype, e represents the event type, represents the target reference dataset, exp(*) represents the *th power exponent of e, is the target vector corresponding to word w, d(*) is the dot product operation used to calculate the vector distance, is the target trigger word prototype, is the target non-trigger word prototype.
[0125] S 460. Acquire event trigger words in the target data according to the tag type of each word in the target data.
[0126] Specifically, after obtaining the label type of each target vector, the label type is obtained as B The target vector is used as the event trigger word in the target data.
[0127] In summary, this embodiment provides a BERTThe interactive meta-learning event detection method is provided, by obtaining a target support set, the target support set including at least one reference data set, the reference data set including at least one reference data, wherein the reference data is a sentence marked with event trigger words and event types; obtaining target data, wherein the target data is a sentence without event trigger words; then concatenating and encoding the target support set with the target data to obtain the event type corresponding to the target data; after obtaining the event type corresponding to the target data, obtaining a target reference data set according to the event type corresponding to the target data, that is, the event type corresponding to the target reference data set is the same as the event type corresponding to the target data; finally, concatenating and encoding the target reference data set with the target data to obtain the event trigger words in the target data. The method provided by the present invention is based on BERT The interactive meta-learning event detection method based on the input BERT During encoding, both the query set and the support set can see each other's information. In this way, by obtaining information-rich encoding, event words in sentences can be better detected, the accuracy of detecting event words in sentences can be improved, and ultimately high-precision event detection can be achieved.
[0128] It should be understood that, although the steps in the flowcharts provided in the accompanying drawings of the present invention are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of the steps in the present invention, and these steps may be performed in other orders. Moreover, at least a portion of the steps of the present invention may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily performed at the same time, but may be performed at different times. The execution order of these sub-steps or stages is not necessarily to be performed in sequence, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0129] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory ( ROM ), programmable ROM ( PROM ), electrically programmable ROM ( EPROM ), electrically erasable programmable ROM( EEPROM ) or flash memory. Volatile memory may include random access memory ( RAM ) or external cache memory. By way of illustration and not limitation, RAM Available in various forms, such as static RAM ( SRAM ),dynamic RAM ( DRAM ),synchronous DRAM ( SDRAM ), Double Data Rate SDRAM ( DDR SDRAM ), enhanced SDRAM ( ESDRAM ), Synchronous Link ( Synchlink ) DRAM ( SLDRAM ), memory bus ( Rambus )direct RAM ( RDRAM ), Direct Memory Bus Dynamics RAM ( DRDRAM ), and memory bus dynamics RAM ( RDRAM )wait.
[0130] Example 2
[0131] Based on the above embodiments, the present invention also provides a BERT The interactive meta-learning event detection device is shown in the following figure. Figure 3 As shown, this is based on BERT The interactive meta-learning event detection device includes:
[0132] A support set acquisition module, the support set acquisition module is used to acquire a target support set, the target support set includes at least one reference data set, the reference data set includes at least one reference data, the reference data is a sentence annotated with an event trigger word and an event type, as described in Example 1;
[0133] A target data acquisition module, which is used to acquire target data, wherein the target data is a sentence without an event trigger word, as described in the first embodiment;
[0134] An event classification module, configured to concatenate and encode the target support set and the target data to obtain an event type corresponding to the target data, as specifically described in the first embodiment;
[0135] A trigger word extraction module is used to obtain a target reference data set, the event type corresponding to the target reference data set is the same as the event type corresponding to the target data, and the target reference data set and the target data are concatenated and encoded to obtain event trigger words in the target data, as specifically described in Example 1.
[0136] Example 3
[0137] Based on the above embodiments, the present invention also provides a terminal, such as Figure 4 As shown, the terminal includes a processor 10 and a memory 20. Figure 4 Only some of the components of the terminal are shown, but it should be understood that implementation of all of the shown components is not required, and more or fewer components may be implemented instead.
[0138] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory of the terminal. In other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard disk equipped on the terminal, a smart memory card ( Smart Media Card , SMC ), Safety Numbers ( Secure Digital , SD ) card, flash memory card ( Flash Card ) etc. Further, the memory 20 may also include both the internal storage unit of the terminal and an external storage device. The memory 20 is used to store application software installed on the terminal and various data. The memory 20 may also be used to temporarily store data that has been output or is to be output. In one embodiment, the memory 20 stores data based on BERT The interactive meta-learning event detection procedure 30 based on BERT The interactive meta-learning event detection program 30 can be executed by the processor 10, thereby realizing the interactive meta-learning event detection program 30 based on the present application. BERT An interactive meta-learning event detection method.
[0139] In some embodiments, the processor 10 may be a central processing unit (CPU). Central Processing Unit , CPU ), a microprocessor or other chip, for running the program code stored in the memory 20 or processing data, such as executing the BERT Interactive meta-learning event detection method, etc.
[0140] In one embodiment, when the processor 10 executes the memory 20 based on BERT The interactive meta-learning event detection procedure 30 implements the following steps:
[0141] Acquire a target support set, where the target support set includes at least one reference data set, where the reference data set includes at least one reference data, where the reference data is a sentence annotated with an event trigger word and an event type;
[0142] Acquire target data, where the target data is a sentence without an event trigger word;
[0143] Concatenate and encode the target support set and the target data to obtain an event type corresponding to the target data;
[0144] A target reference data set is obtained, wherein the event type corresponding to the target reference data set is the same as the event type corresponding to the target data, and the target reference data set and the target data are concatenated and encoded to obtain event trigger words in the target data.
[0145] The target support set includes at least one event type, and each event type corresponds to one reference data set;
[0146] The expression of the target support set is:
[0147] ;
[0148] in, S is the target support set, N is the number of reference datasets, K is the number of reference data in each set of reference data sets, and for each reference data , For the i The first j sentences corresponding to the reference data, For the i The first j The position corresponding to the trigger word in the reference data, For the i The event type corresponding to the reference dataset.
[0149] The step of concatenating and encoding the target support set and the target data to obtain the event type corresponding to the target data includes:
[0150] Splicing the target data with each piece of the reference data in the target support set to obtain a first target sequence;
[0151] Encoding the first target sequence to obtain a first target sequence code;
[0152] Obtaining a first target similarity according to the first target sequence code;
[0153] The event type corresponding to the target data is obtained according to the first target similarity.
[0154] The step of obtaining the first target similarity according to the first target sequence encoding includes:
[0155] Passing the first target sequence encoding through a fully connected layer to obtain a similarity score between two sentences spliced in each of the first target sequence encodings;
[0156] The similarities corresponding to the reference data sets are summed and averaged respectively to obtain the first target similarities of the event types corresponding to one or more target data and the current reference data set.
[0157] The step of concatenating and encoding the target reference data set and the target data to obtain event trigger words in the target data includes:
[0158] Splicing the target data with each piece of reference data in the target reference data set to obtain a second target sequence;
[0159] Encoding the second target sequence to obtain a second target sequence code;
[0160] splicing the target data with the trigger words in each piece of the reference data in the target reference data set to obtain a third target sequence;
[0161] Encoding the third target sequence to obtain a third target sequence code;
[0162] Obtaining a label type for each word in the target data according to the second target sequence code and the third target sequence code;
[0163] The event trigger words in the target data are obtained according to the tag type of each word in the target data.
[0164] Wherein, after encoding the second target sequence to obtain the second target sequence code, the method further includes:
[0165] Obtaining trigger word vectors and non-trigger word vectors in the second target sequence encoding, where the trigger word vectors and the non-trigger word vectors are converted from words in the target reference dataset;
[0166] Add and average each of the trigger word vectors to obtain the target trigger word prototype;
[0167] Each of the non-trigger word vectors is summed and averaged to obtain the target non-trigger word prototype.
[0168] Wherein, obtaining the label type of each word in the target data according to the second target sequence code and the third target sequence code includes:
[0169] Obtaining a target vector in the third target sequence encoding, where the target vector is a vector representation of each word in the target data;
[0170] The similarity between each target vector and the target trigger word prototype and the target non-trigger word prototype is obtained respectively, and a label type with a higher similarity is selected as the label type of the target vector.
[0171] Example 4
[0172] The present invention also provides a storage medium, which stores one or more programs, which can be executed by one or more processors to implement the above embodiment based on BERT Steps of the interactive meta-learning event detection method.
[0173] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A BERT-based interactive meta-learning event detection method, characterized by: include: Acquire a target support set, where the target support set includes at least one reference data set, where the reference data set includes at least one reference data, where the reference data is a sentence annotated with an event trigger word and an event type; Acquire target data, where the target data is a sentence without an event trigger word; Concatenate and encode the target support set and the target data to obtain an event type corresponding to the target data; Acquire a target reference data set, wherein the event type corresponding to the target reference data set is the same as the event type corresponding to the target data, concatenate and encode the target reference data set and the target data to obtain an event trigger word in the target data; The step of concatenating and encoding the target support set and the target data to obtain an event type corresponding to the target data includes: Splicing the target data with each piece of the reference data in the target support set to obtain a first target sequence; Encoding the first target sequence to obtain a first target sequence code; Obtaining a first target similarity according to the first target sequence code; Acquire the event type corresponding to the target data according to the first target similarity; The obtaining of the first target similarity according to the first target sequence encoding includes: Passing the first target sequence encoding through a fully connected layer to obtain a similarity score between two sentences spliced in each of the first target sequence encodings; After respectively adding and averaging the similarities corresponding to the reference data sets, the first target similarity of the event type corresponding to one or more target data and the current reference data set is obtained; The step of concatenating and encoding the target reference data set and the target data to obtain event trigger words in the target data includes: Splicing the target data with each piece of reference data in the target reference data set to obtain a second target sequence; Encoding the second target sequence to obtain a second target sequence code; splicing the target data with the trigger words in each piece of the reference data in the target reference data set to obtain a third target sequence; Encoding the third target sequence to obtain a third target sequence code; Obtaining a label type for each word in the target data according to the second target sequence code and the third target sequence code; The event trigger words in the target data are obtained according to the tag type of each word in the target data.
2. The BERT-based interactive meta-learning event detection method according to claim 1, characterized in that: The target support set includes at least one event type, and each event type corresponds to one reference data set; The expression of the target support set is: Where S is the target support set, N is the number of reference data sets, K is the number of reference data in each reference data set, and for each reference data is the sentence corresponding to the jth reference data in the i-th reference data set, is the position corresponding to the trigger word in the jth reference data in the i-th reference data set, e i is the event type corresponding to the i-th reference data set.
3. The BERT-based interactive meta-learning event detection method according to claim 1, characterized in that: After encoding the second target sequence to obtain the second target sequence code, the method further includes: Obtaining trigger word vectors and non-trigger word vectors in the second target sequence encoding, where the trigger word vectors and the non-trigger word vectors are converted from words in the target reference dataset; Add and average each of the trigger word vectors to obtain the target trigger word prototype; Each of the non-trigger word vectors is summed and averaged to obtain the target non-trigger word prototype.
4. The BERT-based interactive meta-learning event detection method according to claim 3, characterized in that: The acquiring the label type of each word in the target data according to the second target sequence code and the third target sequence code includes: Obtaining a target vector in the third target sequence encoding, where the target vector is a vector representation of each word in the target data; The similarity between each target vector and the target trigger word prototype and the target non-trigger word prototype is obtained respectively, and a label type with a higher similarity is selected as the label type of the target vector.
5. A BERT-based interactive meta-learning event detection device, characterized in that: The device comprises: A support set acquisition module, wherein the support set acquisition module is used to acquire a target support set, wherein the target support set includes at least one reference data set, wherein the reference data set includes at least one reference data, wherein the reference data is a sentence annotated with an event trigger word and an event type; A target data acquisition module, wherein the target data acquisition module is used to acquire target data, wherein the target data is a sentence without an event trigger word; An event classification module, configured to concatenate and encode the target support set and the target data to obtain an event type corresponding to the target data; A trigger word extraction module is used to obtain a target reference data set, the event type corresponding to the target reference data set is the same as the event type corresponding to the target data, and the target reference data set is concatenated and encoded with the target data to obtain event trigger words in the target data; The step of concatenating and encoding the target support set and the target data to obtain an event type corresponding to the target data includes: Splicing the target data with each piece of the reference data in the target support set to obtain a first target sequence; Encoding the first target sequence to obtain a first target sequence code; Obtaining a first target similarity according to the first target sequence code; Acquire the event type corresponding to the target data according to the first target similarity; The obtaining of the first target similarity according to the first target sequence encoding includes: Passing the first target sequence encoding through a fully connected layer to obtain a similarity score between two sentences spliced in each of the first target sequence encodings; After respectively adding and averaging the similarities corresponding to the reference data sets, the first target similarity of the event type corresponding to one or more target data and the current reference data set is obtained; The step of concatenating and encoding the target reference data set and the target data to obtain event trigger words in the target data includes: Splicing the target data with each piece of reference data in the target reference data set to obtain a second target sequence; Encoding the second target sequence to obtain a second target sequence code; splicing the target data with the trigger words in each piece of the reference data in the target reference data set to obtain a third target sequence; Encoding the third target sequence to obtain a third target sequence code; Obtaining a label type for each word in the target data according to the second target sequence code and the third target sequence code; The event trigger words in the target data are obtained according to the tag type of each word in the target data.
6. A terminal, characterized in that: The terminal includes: a processor, a computer-readable storage medium communicatively connected to the processor, the computer-readable storage medium being suitable for storing a plurality of instructions, and the processor being suitable for calling the instructions in the storage medium to execute the steps of implementing the BERT-based interactive meta-learning event detection method described in any one of claims 1-4 above.
7. A storage medium, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the BERT-based interactive meta-learning event detection method as described in any one of claims 1-4.
Citation Information
Patent Citations
Text event element extraction method
CN112541341A
Event extraction from documents with co-reference
US20220100963A1