A method, device and equipment for event extraction based on question-answering mode
By using the method of question -and -answer mode in the event extraction, combined with characteristic words and problem templates, the problems of inaccurate extraction of events in existing technology have been solved, and higher events are used to extract accuracy.
Patent Information
- Application Number
- CN202210323185.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-30
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2042-03-30
AI Technical Summary
The prior art is difficult to perform event extraction quickly and accurately from the target text, resulting in low accuracy of event extraction results.
Adopt an event -based event drawing method, to obtain the target text and problem templates, determine the characteristic words, identify the trigger and event type, select the corresponding problem template according to the type of event, further determine the type of theory and the meta -type type, and finally determine the event extraction extraction. result.
Based on characteristic words and problem templates, the accuracy of event extraction has been significantly improved, and it can accurately identify the trigger, event type, theory of the event, and the meta -type type in the target text, thereby improving the accuracy of event extraction results.
Smart Images

Figure CN114661881B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information extraction, and in particular to an event extraction method, device and equipment based on a question-and-answer mode. Background Art
[0002] With the popularization and development of the Internet, the text data on the Internet has shown explosive growth. Since these text data are fragmented and low-information data, they need to be further processed. In order to improve the efficient processing capabilities of text data, the demand for natural language processing technology has increased dramatically. As a subtask in the field of natural language processing, event extraction has a broad application market. For example, event extraction has important applications in text summarization, automatic question answering, information retrieval and other fields.
[0003] Therefore, there is an urgent need for a method to quickly and accurately extract events from target text. Summary of the invention
[0004] In view of this, the present application provides an event extraction method, apparatus and device based on a question-answering mode for extracting events from a target text, and its technical solution is as follows:
[0005] An event extraction method based on question-answering mode, comprising:
[0006] Obtaining a target text and a first question template, wherein the first question template is a text that asks questions about a trigger word of a target event involved in the target text;
[0007] Identify the characteristic words related to the target event from the target text;
[0008] Determine the trigger word and event type of the target event according to the target text, the first question template and the characteristic words;
[0009] According to the event type of the target event, determine a question template matching the argument of the target event from a preset question template set as a second question template, wherein the second question template is a text for asking questions about the argument of the target event;
[0010] Determine the arguments and argument types of the target event based on the target text, the second question template and the characteristic words;
[0011] According to the trigger words, event types, arguments and argument types, the event extraction results of the target text are determined.
[0012] Optionally, determining the trigger word and event type of the target event according to the target text, the first question template and the feature word includes:
[0013] Convert the feature words into vector form, and use the converted vector as the target grammar feature vector;
[0014] The trigger word extraction model obtained by pre-training is used to process the first question template, the target text and the target grammar feature vector to obtain a trigger word label sequence output by the trigger word extraction model, wherein the trigger word extraction model adopts the first question template, the training text, and the trigger word annotation sequence corresponding to the training text, and is assisted by the corresponding grammar feature vector training, and the corresponding grammar feature vector is obtained by converting the feature words related to the event involved in the training text into a vector form;
[0015] According to the trigger word label sequence, the trigger word and event type of the target event are determined.
[0016] Optionally, the trigger word extraction model includes: a first word embedding module, a first feature fusion module, a first classifier module and a first sequence search module;
[0017] The first word embedding module encodes the first question template and the target text to obtain an encoded semantic feature vector as a first semantic feature vector;
[0018] The first feature fusion module performs nonlinear fusion on the first semantic feature vector and the target grammar feature vector to obtain a first fused feature vector;
[0019] The first classifier module determines the probability value of each word of the target text on each trigger word label according to the first fused feature vector and the normalized exponential function;
[0020] The first sequence search module uses the Viterbi algorithm to determine the trigger word label sequence according to the probability value of each word in the target text on each trigger word label and the randomly initialized state transfer matrix.
[0021] Optionally, the first word embedding module encodes the first question template and the target text to obtain an encoded semantic feature vector, including:
[0022] The first word embedding module concatenates the first question template and the target text to obtain a first concatenated text;
[0023] The first word embedding module performs a first word segmentation process on the first spliced text to obtain a digital index sequence, a segmentation mark and a mask sequence corresponding to the first spliced text, wherein the digital index sequence corresponding to the first spliced text includes a digital index corresponding to each word of the first spliced text and a digital index corresponding to a special character, the special character is used to pad the spliced text to a set length, the segmentation mark corresponding to the first spliced text is used to distinguish the first question template and the target text contained in the first spliced text, and the mask sequence corresponding to the first spliced text is used to distinguish the digital index corresponding to each word of the first spliced text and the digital index corresponding to the special character;
[0024] The first word embedding module encodes the digital index sequence, segmentation mark and mask sequence corresponding to the first concatenated text through a target encoder to obtain a first semantic feature vector.
[0025] Optionally, the first feature fusion module performs nonlinear fusion on the first semantic feature vector and the target grammar feature vector to obtain a first fused feature vector, including:
[0026] The first feature fusion module concatenates the first semantic feature vector and the target grammatical feature vector to obtain a first concatenated vector;
[0027] The first feature fusion module obtains a first fused feature vector according to the target activation function and the first concatenated vector.
[0028] Optionally, the first classifier module determines the probability value of each word of the target text on each trigger word label according to the first fused feature vector and the normalized exponential function, including:
[0029] The first classifier module performs dimensionality reduction processing on the first fused feature vector to obtain a first fused feature vector after dimensionality reduction, wherein the number of components contained in the first fused feature vector after dimensionality reduction is the same as the number of words contained in the target text;
[0030] The first classifier module calculates the probability value corresponding to each component contained in the first fused feature vector after dimensionality reduction and the normalized exponential function as the probability value of each word in the target text on each trigger word label.
[0031] Optionally, the arguments and argument types of the target event are determined according to the target text, the second question template and the characteristic words, including:
[0032] The second question template, the target text and the target grammar feature vector are processed by using the pre-trained argument extraction model to obtain an argument label sequence output by the argument extraction model, wherein the argument extraction model is trained using a training question template, a training text, and an argument label sequence corresponding to the training text, and is supplemented by the corresponding grammar feature vector, and the training question template is a question template in the question template set;
[0033] Determine the arguments and argument types of the target event based on the argument label sequence.
[0034] Optionally, the argument extraction model includes: a second word embedding module, a second feature fusion module, a second classifier module, and a second sequence search module;
[0035] The second word embedding module encodes the second question template and the target text to obtain an encoded semantic feature vector as a second semantic feature vector;
[0036] The second feature fusion module performs nonlinear fusion on the second semantic feature vector and the target grammar feature vector to obtain a second fused feature vector;
[0037] The second classifier module determines the probability value of each word of the target text on each argument label according to the second fused feature vector and the normalized exponential function;
[0038] The second sequence search module uses the Viterbi algorithm to determine the argument label sequence according to the probability value of each word in the target text on each argument label and the randomly initialized state transition matrix.
[0039] An event extraction device based on a question-answering mode comprises: a text information acquisition module, a feature word determination module, a trigger word information determination module, a second question template determination module, an argument information determination module and an event extraction result determination module;
[0040] A text information acquisition module, used to acquire a target text and a first question template, wherein the first question template is a text that asks questions about a trigger word of a target event involved in the target text;
[0041] A feature word determination module is used to determine feature words related to a target event from a target text;
[0042] A trigger word information determination module, used to determine the trigger word and event type of the target event according to the target text, the first question template and the feature words;
[0043] A second question template determination module is used to determine, according to the event type of the target event, a question template that matches the argument of the target event from a preset question template set as a second question template, wherein the second question template is a text for asking questions about the argument of the target event;
[0044] An argument information determination module is used to determine the arguments and argument types of the target event based on the target text, the second question template and the characteristic words;
[0045] The event extraction result determination module is used to determine the event extraction result of the target text according to the trigger word, event type, argument and argument type.
[0046] An event extraction device based on a question-answering mode includes a memory and a processor;
[0047] Memory, used to store programs;
[0048] The processor is used to execute the program to implement each step of the event extraction method based on the question-answer mode as described above.
[0049] It can be seen from the above technical solution that the event extraction method based on the question-answer mode provided by the present application first obtains the target text and the first question template, and determines the feature words related to the target event from the target text, and then determines the trigger words and event type of the target event based on the target text, the first question template and the feature words, and then determines the question template that matches the argument of the target event from a preset question template set based on the event type of the target event, as the second question template, and then determines the arguments and argument types of the target event based on the target text, the second question template and the feature words, and finally determines the event extraction result of the target text based on the trigger words, event types, arguments and argument types. The event extraction method based on the question-answer mode provided by the present application effectively enhances the feature expression and improves the accuracy of the event extraction results by combining feature words when determining the trigger words, event types, arguments and argument types; at the same time, the first question template is combined when determining the trigger words and event types, so that the present application can accurately identify the trigger words in the target text and accurately determine the event type, and then determine the second question template that matches the arguments of the target event according to the event type, and then determine the arguments and argument types of the target event in combination with the second question template, so that the present application can accurately identify the arguments in the target text and accurately determine the argument type, further improving the accuracy of the event extraction results. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0051] Figure 1 A flowchart of an event extraction method based on a question-and-answer mode provided in an embodiment of the present application;
[0052] Figure 2 A schematic diagram of an optional structure of a trigger word extraction model provided in an embodiment of the present application;
[0053] Figure 3 Schematic diagram of the process of determining the trigger word label sequence for the trigger word extraction model;
[0054] Figure 4 Schematic diagram of the process of determining the argument label sequence for the argument extraction model;
[0055] Figure 5 A schematic diagram of the structure of an event extraction device based on a question-and-answer mode provided in an embodiment of the present application;
[0056] Figure 6A hardware structure block diagram of an event extraction device based on a question-and-answer mode provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0058] Since there is no method in the prior art to quickly and accurately extract events from the target text, the inventor of this case conducted research. In the initial stage, the target text is encoded into a vector, and the probability value of each word in the target text on each trigger word label is determined based on the encoded vector and the normalized exponential function. Then, based on the probability value of each word in the target text on each trigger word label and the randomly initialized state transfer matrix, the Viterbi algorithm is used to determine the label sequence corresponding to the trigger word and the argument, so as to determine the trigger word, event type, argument and argument type from the label sequence. Finally, based on the trigger word, event type, argument and argument type, the event extraction result of the target text is determined.
[0059] However, research has found that although the above method can extract the target event from the target text, the accuracy of the label sequence obtained based only on the target text is not high, so the accuracy of the event extraction result is not high.
[0060] In view of the problems existing in the above ideas, the inventor of this case conducted further in-depth research and thought that it is possible to learn from the question answering system (Question Answer, QA) to splice the question and the target text containing the answer to improve the present application's ability to characterize the target event contained in the target text for a specific downstream task, namely, event extraction; at the same time, it is possible to combine maturely designed artificial features, that is, extract specific grammatical features in the target text, to improve the feature extraction capability of the present application, thereby improving the effect of event extraction. Based on this, a method for event extraction based on the question-answering model is proposed. Next, the event extraction method based on the question-answering model provided by the present application is introduced in detail through the following embodiments.
[0061] See also Figure 1 , shows a schematic flow chart of an event extraction method based on a question-and-answer mode provided in an embodiment of the present application. The event extraction method based on a question-and-answer mode may include:
[0062] Step S101, obtaining a target text and a first question template.
[0063] The first question template is a text that asks questions about the trigger word of the target event involved in the target text. For example, the first question template may be “What is the trigger word?”.
[0064] In this step, the target text is structured text data containing the target event. Optionally, the process of obtaining the target text in this step may include: crawling the text data containing the target event through the network, cleaning the data through regularization filtering and structured organization, and obtaining the target text.
[0065] It should be noted that this step does not limit the specific type of the target event. For example, the target event may be an event related to a sports figure.
[0066] Step S102: Determine feature words related to the target event from the target text.
[0067] Those skilled in the art should understand that there are some typical words in the target text that are closely related to the target event, and the real event type of the target event can be determined with a high probability based on the characteristic words. For example, in a conflict event, "protest" is a characteristic word of the conflict event.
[0068] Optionally, this step can pre-construct a feature word list for each event type, and then determine the feature words related to the target event from the target text based on the feature word list; of course, this step may not construct a feature word list, but directly determine the feature words related to the target event from the target text, and this application does not limit this.
[0069] Step S103: Determine the trigger word and event type of the target event according to the target text, the first question template and the feature words.
[0070] In existing question-answering systems, questions and text containing answers are generally given. The question system needs to give appropriate and correct answers to the questions asked and highlight the answers. In this application, event extraction can be regarded as a question-answering system. In this step, the answer that best matches the first question template in the target text needs to be found based on the first question template related to the trigger word, as the trigger word of the target event.
[0071] In order to make the found trigger words more accurate, when determining the trigger words and event types based on the first question template and the target text, feature words can also be combined. Since feature words are words closely related to the target events, more complete features can be extracted in the process of determining the trigger words and event types, thereby determining more accurate trigger words and event types based on more complete features.
[0072] In an optional embodiment, the process of determining the trigger word and event type of the target event according to the target text, the first question template and the feature word includes:
[0073] Step S1031: convert the feature words into vector form, and use the converted vector as the target grammar feature vector.
[0074] Optionally, this step may use the word2vec method to convert the feature words into a vector form to obtain a target grammar feature vector.
[0075] Step S1032: Determine a trigger word tag sequence corresponding to the target text according to the first question template, the target text and the target grammar feature vector.
[0076] Specifically, this step can splice the first question template and the target text, and convert them into vector form after splicing, and use the obtained vector as the first semantic feature vector. Then, the first semantic feature vector and the target grammar feature vector are fused, and based on the fused first fused feature vector, the trigger word label sequence corresponding to the target text is determined.
[0077] In an optional embodiment, the trigger word label sequence in this step is a BIO label sequence. Here, BIO is a labeling method in event extraction, B refers to "begin", representing the beginning word of the extraction object (trigger word, argument, etc.); I refers to "inside", representing other words in the extraction object; O refers to "outside", representing not the extraction object (trigger word, argument, etc.).
[0078] For example, if the target text is "Xiao Ming serves as the mayor of City A", the trigger word tag sequence obtained in this step is "OO B-personal I-personal OOOOO".
[0079] Step S1033: Determine the trigger word and event type of the target event according to the trigger word label sequence.
[0080] For example, for the trigger word label sequence obtained in the previous step, this step can determine that the trigger word of the target event is "take charge" and the event type is the personnel type.
[0081] Step S104: According to the event type of the target event, determine a question template that matches the argument of the target event from a preset question template set as a second question template.
[0082] The second question template is a text for asking questions about the arguments of the target event.
[0083] Specifically, there are many types of event arguments. This application predefines a question template for each type of argument. The question templates corresponding to each type of argument constitute the question template set in this step.
[0084] For example, the argument types of an event may be attacker, victim, time, place, etc. Correspondingly, the question template defined for the attacker (or victim) may be "Who is the attacker (or victim)?", the question template defined for the place may be "Where did the incident occur?", the question template defined for the time may be "When did the incident occur?", and so on.
[0085] Since the argument type is related to the specific event, the argument type is also related to the event type. In order to accurately determine the arguments of the target event, this step can be performed after the event type of the target event is determined in the previous step. Then, based on the event type of the target event, a second question template that matches the arguments of the target event is determined from a preset question template set.
[0086] Optionally, this step may predefine the correspondence between event types and question templates (argument correlation), and then based on the correspondence, determine the question template corresponding to the event type of the target event from a preset question template set, and this question template is the second question template.
[0087] Optionally, this step may describe the correspondence in a table form, for example, see Table 1 below, which shows the correspondence between event types and question templates (argument correlation).
[0088] Table 1 Correspondence between event types and question templates (argument correlation)
[0089]
[0090] In Table 1 above, the present application defines event categories and event subcategories. It can be seen that when the event types (event categories or event subcategories) of various events are different, the argument types may be different.
[0091] It should be noted that when defining event major categories and event minor categories at the same time, the event type determined in the above steps can be an event major category or an event minor category, which is determined according to the actual situation.
[0092] It should also be noted that Table 1 is only an example and is not intended to limit the present application. For example, the present application may only define the correspondence between major event categories and question templates, or only define the correspondence between minor event categories and question templates, and so on.
[0093] Step S105: Determine the arguments and argument types of the target event according to the target text, the second question template and the feature words.
[0094] In this step, the second question template is a text that asks questions about the arguments of the target event. Combined with the second question template and the feature words, this step can find the answer that best matches the second question template from the target text as the argument of the target event. At the same time, this step can determine the argument type of the target event.
[0095] It should be noted that the argument type of the target event determined in this step corresponds to the specific content of the second question template. For example, if the second question template is "Where did the event occur?", the argument type determined in this step is the location type.
[0096] In an optional embodiment, the process of determining the arguments and argument types of the target event according to the target text, the second question template and the feature words includes:
[0097] Step S1051: Determine an argument label sequence corresponding to the target text according to the second question template, the target text and the target grammar feature vector.
[0098] The process of this step is similar to the process of the above-mentioned step S1032. For details, please refer to the introduction in the above-mentioned steps, which will not be repeated here.
[0099] For example, if the target text is "Xiao Ming serves as the mayor of City A" and the second question template is "Who is the person in the event?", the trigger word label sequence obtained in this step is "B-person I-person OO OO OOO".
[0100] Step S1052: Determine the arguments and argument types of the target event according to the argument label sequence.
[0101] For example, for the argument label sequence obtained in the previous step, this step can determine that the argument of the target event is "Xiao Ming" and the event type is the character type.
[0102] It is worth noting that the target text may include multiple types of arguments. In this case, the present embodiment can determine each type of argument in turn through step S105 (in this case, each argument type corresponds to a second question template), or can determine multiple types of arguments at the same time (in this case, multiple argument types correspond to a unique second question template); of course, the present embodiment can also use other methods to determine each argument and the corresponding argument type contained in the target event, and the present application does not limit this.
[0103] Step S106: Determine the event extraction result of the target text according to the trigger word, event type, argument and argument type.
[0104] Specifically, any event includes a trigger word, an event type, an argument, and an argument type. This embodiment obtains the trigger word, event type, argument, and argument type of the target event, which is equivalent to extracting the target event from the target text.
[0105] The event extraction method based on the question-answer mode provided in the present application first obtains the target text and the first question template, and determines the feature words related to the target event from the target text, and then determines the trigger words and event type of the target event based on the target text, the first question template and the feature words, and then determines the question template that matches the argument of the target event from a preset question template set based on the event type of the target event as the second question template, and then determines the arguments and argument types of the target event based on the target text, the second question template and the feature words, and finally determines the event extraction result of the target text based on the trigger words, event type, arguments and argument types. The event extraction method based on the question-answer mode provided by the present application effectively enhances the feature expression and improves the accuracy of the event extraction results by combining feature words when determining the trigger words, event types, arguments and argument types; at the same time, the first question template is combined when determining the trigger words and event types, so that the present application can accurately identify the trigger words in the target text and accurately determine the event type, and then determine the second question template that matches the arguments of the target event according to the event type, and then determine the arguments and argument types of the target event in combination with the second question template, so that the present application can accurately identify the arguments in the target text and accurately determine the argument type, further improving the accuracy of the event extraction results.
[0106] In one possible implementation, the "determining the trigger word label sequence corresponding to the target text according to the first question template, the target text and the target grammar feature vector" provided in the above step S1032 can be implemented by a pre-trained trigger word extraction model, which has the ability to receive and process the first concatenated text and the target grammar feature vector to obtain a trigger word label sequence.
[0107] Specifically, the trigger word extraction model processes the first question template, the target text, and the target grammar feature vector to obtain a trigger word label sequence corresponding to the target text.
[0108] See also Figure 2 , shows an optional structural diagram of a trigger word extraction model, which may include: a first word embedding module, a first feature fusion module, a first classifier module and a first sequence search module, see Figure 3 , showing Figure 2 The flowchart of determining the trigger word label sequence by the trigger word extraction model in may include:
[0109] Step S301: The first word embedding module encodes the first question template and the target text to obtain an encoded semantic feature vector as a first semantic feature vector.
[0110] Here, the first word embedding module can be a word embedding module based on a BERT (Bidirectional Encoder Representation from Transformers) pre-trained model. Here, the BERT pre-trained model is proposed by Google, and uses two layers of transformers for bidirectional stacking and self-supervised training on a large-scale data set. The obtained first semantic feature vector contains rich semantics in the target text. As long as it is fine-tuned in downstream tasks, it can greatly improve performance. Especially for downstream tasks with a small number of data sets and low information, the effect of the BERT pre-trained model is more obvious compared to other models.
[0111] Optionally, the first word embedding module encodes the first question template and the target text to obtain an encoded semantic feature vector, which includes:
[0112] Step a1: The first word embedding module concatenates the first question template and the target text to obtain a first concatenated text.
[0113] This module can concatenate the first question template and the target text to form a compound sentence, and the compound sentence is also the first concatenated text in this step.
[0114] Optionally, in order to distinguish which part is the first question template and which part is the target text after splicing, this step can separate the first question template and the target text with special characters during splicing.
[0115] For example, take the first question template as "What is the trigger word?" and the target text as "The masses are demonstrating in City A". Figure 2 As shown, there is a special word [SEP] between the first question template and the target text.
[0116] It should be noted that the process of splicing the first question template and the target text in the above embodiment is implemented by the first word embedding module included in the trigger word extraction model. In an optional embodiment, the splicing process can also be implemented outside the trigger word extraction model, that is, the first question template and the target text are first spliced to obtain a first spliced text, and then the first spliced text and the target grammatical features are input into the trigger word extraction model.
[0117] Step a2: The first word embedding module performs a first word segmentation process on the first concatenated text to obtain a digital index sequence, a segmentation mark, and a mask sequence corresponding to the first concatenated text.
[0118] Among them, the digital index sequence corresponding to the first spliced text includes the digital index corresponding to each word of the first spliced text and the digital index corresponding to the special character, the special character is used to pad the spliced text to a set length, the segmentation mark corresponding to the first spliced text is used to distinguish the first question template and the target text contained in the first spliced text, and the mask sequence corresponding to the first spliced text is used to distinguish the digital index corresponding to each word of the first spliced text and the digital index corresponding to the special character.
[0119] See also Figure 2 As shown, the first concatenated text corresponding sequence is also the digital index sequence, segmentation mark and mask sequence in this step.
[0120] Since computers cannot process characters directly, it is necessary to build a vocabulary in advance and set a digital index for each word (for Chinese, each word is each character) in the vocabulary. The digital index is also the ID of the word.
[0121] After constructing the words, this module can perform word segmentation on the first spliced text according to the constructed word library. Optionally, the Tokenizer (word segmentation module) method can be used for word segmentation to obtain a digital index sequence corresponding to the first spliced text. Specifically, since the number of words contained in the first spliced text input into this module each time may be different, in order to facilitate processing, the first spliced text can be padded to a set length by the special character "[PAD]", and then the digital index corresponding to each word of the first spliced text and the digital index corresponding to the special character are determined. The digital index corresponding to each word of the first spliced text and the digital index corresponding to the special character form a digital index sequence corresponding to the first spliced text.
[0122] This module performs the first word segmentation processing on the first concatenated text, and also obtains the segmentation markers and mask sequences corresponding to the first concatenated text.
[0123] For example, the segmentation mark corresponding to the first concatenated text can be: [0,0,0,0,…,1,1,1,1], where 0 represents the first question template and 1 represents the template text; the mask sequence corresponding to the first concatenated text can be [0,0,0,0,…,0,0,0,1], where 0 represents the first concatenated text (that is, 0 represents the word that the trigger word extraction model needs to process and pay attention to), and 1 represents a special word (that is, 1 represents the word that the trigger word extraction model does not need to process and pay attention to).
[0124] Step a3: The first word embedding module encodes the digital index sequence, segmentation mark and mask sequence corresponding to the first concatenated text through the target encoder to obtain a semantic feature vector corresponding to the first concatenated text.
[0125] As described in the previous steps, the first word embedding module can be a word embedding module based on the BERT pre-training model. Based on this, optionally, the target encoder can be a BERT encoder. Then, in this step, the digital index sequence, segmentation mark and mask sequence corresponding to the first spliced text can be input into the BERT encoder to obtain the semantic feature vector corresponding to the first spliced text. For example, the 768-dimensional semantic feature vector obtained in this step can be: [0.2359, 1.2356, 2.3656, ..., -1.3569, 0.8424, 0.3651].
[0126] In summary, this embodiment can combine QA with BERT, and concatenate the first question template and the target text containing the answer as the input of the first word embedding module. The first word embedding module can explicitly input the trigger words involved in the first concatenated text, thereby improving the representation ability of the first semantic feature vector obtained by BERT.
[0127] At the same time, maturely designed artificial features (i.e., feature words) can extract specific grammatical features in the target text, while feature extraction based on BERT cannot extract a certain required specific grammatical feature in a targeted manner. Therefore, the fusion of artificially designed feature words with the features learned by BERT can enhance the feature extraction capability of the trigger word extraction model, improve the extraction effect of trigger words and event types, and accordingly improve the effect of event extraction in this embodiment.
[0128] Step S302: The first feature fusion module performs nonlinear fusion on the first semantic feature vector and the target grammatical feature vector to obtain a first fused feature vector.
[0129] Optionally, the first feature fusion module may perform Bi-LSTM (Bi-directional Long Short-Term Memory) nonlinear fusion on the first semantic feature vector and the target grammar feature vector. The specific fusion process includes:
[0130] Step b1: The first feature fusion module concatenates the first semantic feature vector and the target grammatical feature vector to obtain a first concatenated vector.
[0131] For example, see Figure 2 As shown, the first feature fusion module first transforms the first semantic feature vector (it is worth noting that in order to facilitate the description of the splicing process, Figure 2 Two kinds of graphics are used to represent the first semantic feature vector. In fact, the first semantic feature vectors represented by these two graphics are the same) are concatenated with the target grammar feature vector, and then the obtained first concatenated vector is processed.
[0132] Step b2: The first feature fusion module obtains a first fused feature vector according to the target activation function and the first concatenated vector.
[0133] Specifically, the first feature fusion module can directly perform an activation function on the first concatenated vector to obtain a first fused feature vector. Preferably, in order to increase the nonlinear expression of the trigger word extraction model and enhance the feature expression ability of the trigger word extraction model, the first concatenated vector can be first dimensionally transformed through MLP (Multilayer Perceptron), and then the first concatenated vector after the dimension transformation is activated by an activation function to obtain a first fused feature vector.
[0134] Step S303: The first classifier module determines the probability value of each word in the target text on each trigger word label according to the first fused feature vector and the normalized exponential function.
[0135] Specifically, the first classifier module uses a multi-layer perceptron and a normalized exponential function to process and calculate the first fused feature vector to obtain a probability value of each word in the target text on each trigger word label.
[0136] Optionally, the process of determining the probability value of each word of the target text on each trigger word label by the first classifier module according to the first fused feature vector and the normalized exponential function includes:
[0137] Step c1: The first classifier module performs dimensionality reduction processing on the first fused feature vector to obtain a first fused feature vector after dimensionality reduction.
[0138] The number of components contained in the first fused feature vector after dimensionality reduction is the same as the number of words contained in the target text.
[0139] Specifically, Figure 2 As shown, the first classifier module can input the first fused feature vector into the MLP for dimensionality reduction processing, and the dimension size of the first fused feature vector after dimensionality reduction is equal to the number of categories, which is the number of words contained in the target text.
[0140] Step c2: the first classifier module calculates the probability value corresponding to each component contained in the first fused feature vector after dimensionality reduction according to the first fused feature vector after dimensionality reduction and the normalized exponential function, as the probability value of each word in the target text on each trigger word label.
[0141] Here, the normalized exponential function refers to the softmax function, which is a commonly used probability calculation formula. The specific calculation formula is: Among them, x i and x jThey represent the i-th and j-th numbers in the vector output by the last layer respectively.
[0142] Step S304: The first sequence search module uses the Viterbi algorithm to determine the trigger word label sequence according to the probability value of each word in the target text on each trigger word label and the randomly initialized state transition matrix.
[0143] In this step, the first sequence search module may be a CRF (Conditional Random Field) sequence search module.
[0144] The probability value obtained in the above steps refers to the probability value of each word in the target text on each real trigger word label. The probability value does not take into account the constraints of the labels of adjacent words (such as grammatical constraints). In practical applications, the trigger words to be extracted are often multi-morphemes. If the trigger word label sequence is simply determined based on the probability value obtained in the above steps, it is very likely that there will be multiple morphemes without a connection path between the optimal label predictions, thus falling into a local optimum.
[0145] Based on this, the trigger word extraction model also includes a first sequence search module, which can model the relationship between the words contained in the target text and convert it into the state transition probability between the words in the target text (that is, it can learn the label constraints between morphemes). It can well solve the problem that there is no connection between local optimal states or the connection is not the global optimal state, thereby obtaining the globally optimal trigger word label sequence of the target text.
[0146] In this embodiment, the training process of the trigger word extraction model may include: obtaining a structured training text and a first question template, annotating the training text with trigger words, and indicating its event type, obtaining a trigger word annotation sequence corresponding to the training text, and obtaining the entire data set (optionally, including a training set, a development set, and a test set) after verification; determining feature words related to the corresponding event from the data set, and converting them into vector form to obtain a corresponding grammatical feature vector; inputting the first question template, the training text (i.e., the text in the training set), and the corresponding grammatical feature vector into the trigger word extraction model to obtain a trigger word prediction sequence output by the trigger word extraction model; determining the cross-entropy loss of the trigger word extraction model based on the trigger word prediction sequence and the trigger word annotation sequence corresponding to the training text, and using a back propagation algorithm to update the parameters of the trigger word extraction model based on the cross-entropy loss, and performing multiple iterative training according to the above process until the training end condition is met.
[0147] Here, the calculation formula for cross entropy loss is: Among them, y ic and p icThey respectively represent the trigger word annotation sequence and trigger word prediction sequence corresponding to the training text.
[0148] Among them, the process in which the trigger word extraction model receives and processes the first question template, the training text and the corresponding grammatical feature vector to obtain the trigger word prediction sequence is similar to the process in which the above-mentioned trigger word extraction model receives and processes the first question template, the target text and the target grammatical feature vector to obtain the trigger word label sequence, which is not elaborated here in this embodiment.
[0149] In summary, the trigger word extraction model provided in this embodiment integrates the QA-based BERT semantic encoding and traditional grammar features to improve the prediction accuracy, and uses CRF to model the constraints between morphemes to obtain the optimal trigger word label sequence, thereby greatly improving the performance of the trigger word extraction model.
[0150] In one possible implementation, the "determining the argument label sequence corresponding to the target text based on the second question template, the target text and the target grammar feature vector" provided in the above step S1051 can be implemented by a pre-trained argument extraction model, which has the ability to receive and process the second concatenated text and the target grammar feature vector to obtain an argument label sequence.
[0151] Specifically, the argument extraction model processes the second question template, the target text, and the target grammar feature vector to obtain an argument label sequence corresponding to the target text.
[0152] In this embodiment, an optional structure of the argument extraction model is Figure 2 The optional structure of the trigger word extraction model shown is similar, and may include: a second word embedding module, a second feature fusion module, a second classifier module, and a second sequence search module, see Figure 4 , which shows a schematic diagram of the process of determining the argument label sequence by the argument extraction model, which may include:
[0153] Step S401: The second word embedding module encodes the second question template and the target text to obtain an encoded semantic feature vector as a second semantic feature vector.
[0154] Optionally, the second word embedding module encodes the second question template and the target text to obtain the encoded semantic feature vector, which includes:
[0155] Step d1: The second word embedding module concatenates the second question template and the target text to obtain a second concatenated text.
[0156] Step d2: The second word embedding module performs a second word segmentation process on the second concatenated text to obtain a digital index sequence, a segmentation mark, and a mask sequence corresponding to the second concatenated text.
[0157] Among them, the digital index sequence corresponding to the second spliced text includes the digital index corresponding to each word of the second spliced text and the digital index corresponding to the special character, the special character is used to pad the spliced text to a set length, the segmentation mark corresponding to the second spliced text is used to distinguish the second question template and the target text contained in the second spliced text, and the mask sequence corresponding to the second spliced text is used to distinguish the digital index corresponding to each word of the second spliced text and the digital index corresponding to the special character.
[0158] Step d3: The second word embedding module encodes the digital index sequence, segmentation mark and mask sequence corresponding to the second concatenated text through the target encoder to obtain a semantic feature vector corresponding to the second concatenated text.
[0159] This step is similar to the process of the aforementioned step S301. For details, please refer to the introduction in the aforementioned steps and will not be repeated here.
[0160] This embodiment can combine QA with BERT, and concatenate the second question template and the target text containing the answer as the input of the second word embedding module. The second word embedding module can explicitly input the arguments involved in the second concatenated text, thereby improving the representation ability of the second semantic feature vector obtained by BERT.
[0161] At the same time, maturely designed artificial features (i.e., feature words) can extract specific grammatical features in the target text, while feature extraction based on BERT cannot extract a certain required specific grammatical feature in a targeted manner. Therefore, the fusion of artificially designed feature words with the features learned by BERT can enhance the feature extraction capability of the argument extraction model, improve the extraction effect of arguments and argument types, and accordingly improve the effect of event extraction in this embodiment.
[0162] Step S402: The second feature fusion module performs nonlinear fusion on the second semantic feature vector and the target grammatical feature vector to obtain a second fused feature vector.
[0163] Optionally, the second feature fusion module may perform Bi-LSTM nonlinear fusion on the second semantic feature vector and the target grammar feature vector. The specific fusion process includes:
[0164] Step e1, the second feature fusion module concatenates the second semantic feature vector and the target grammatical feature vector to obtain a second concatenated vector.
[0165] Step e2: The second feature fusion module obtains a second fused feature vector according to the target activation function and the second concatenated vector.
[0166] Step S403: The second classifier module determines the probability value of each word in the target text on each argument label according to the second fused feature vector and the normalized exponential function.
[0167] Optionally, the process of the second classifier module determining the probability value of each word of the target text on each argument label according to the second fused feature vector and the normalized exponential function includes:
[0168] Step f1: The second classifier module performs dimensionality reduction processing on the second fused feature vector to obtain a second fused feature vector after dimensionality reduction.
[0169] The number of components contained in the second fused feature vector after dimensionality reduction is the same as the number of words contained in the target text.
[0170] Step f2, the second classifier module calculates the probability value corresponding to each component contained in the second fused feature vector after dimensionality reduction and the normalized exponential function as the probability value of each word in the target text on each argument label.
[0171] Step S404: The second sequence search module uses the Viterbi algorithm to determine the argument label sequence according to the probability value of each word in the target text on each argument label and the randomly initialized state transition matrix.
[0172] In this embodiment, the training process of the argument extraction model may include: obtaining structured training text and training question templates (i.e., question templates in a question template set), marking the participating arguments related to the trigger words in the training text, and marking the argument types, to obtain the argument annotation sequence corresponding to the training text, and after verification, obtaining the entire data set annotated with the arguments and argument types; inputting the training question template, the training text, and the corresponding grammar feature vector into the argument extraction model to obtain the argument prediction sequence output by the argument extraction model; determining the cross entropy loss of the argument extraction model according to the argument prediction sequence and the argument annotation sequence corresponding to the training text, and using the back propagation algorithm to update the parameters of the argument extraction model according to the cross entropy loss, and performing multiple iterative training according to the above process until the training end condition is met.
[0173] Among them, the process in which the argument extraction model receives and processes the second question template, the training text and the corresponding grammatical feature vector to obtain the argument prediction sequence is similar to the process in which the above-mentioned argument extraction model receives and processes the second question template, the target text and the target grammatical feature vector to obtain the argument label sequence, which is not elaborated here in this embodiment.
[0174] This embodiment is similar to the introduction of the trigger word extraction model in the previous embodiment. For details, please refer to the introduction in the previous embodiment, and this embodiment will not be repeated here.
[0175] In summary, the argument extraction model provided in this embodiment integrates the QA-based BERT semantic encoding and traditional grammar features to improve the prediction accuracy. At the same time, CRF is used to model the constraints between morphemes to obtain the optimal argument label sequence, thereby greatly improving the performance of the argument extraction model.
[0176] An embodiment of the present application also provides an event extraction device based on a question-and-answer mode. The event extraction device based on a question-and-answer mode provided in the embodiment of the present application is described below. The event extraction device based on a question-and-answer mode described below and the event extraction method based on a question-and-answer mode described above can refer to each other.
[0177] See also Figure 5 , which shows a schematic diagram of the structure of an event extraction device based on a question-answering mode provided in an embodiment of the present application, such as Figure 5 As shown, the event extraction device based on the question-answer mode may include: a text information acquisition module 501, a feature word determination module 502, a trigger word information determination module 503, a second question template determination module 504, an argument information determination module 505 and an event extraction result determination module 506.
[0178] The text information acquisition module 501 is used to acquire a target text and a first question template, wherein the first question template is a text that asks questions about a trigger word of a target event involved in the target text.
[0179] The feature word determination module 502 is used to determine the feature words related to the target event from the target text.
[0180] The trigger word information determination module 503 is used to determine the trigger word and event type of the target event according to the target text, the first question template and the feature words.
[0181] The second question template determination module 504 is used to determine a question template matching the argument of the target event from a preset question template set according to the event type of the target event, as the second question template, wherein the second question template is a text asking questions about the argument of the target event.
[0182] The argument information determination module 505 is used to determine the arguments and argument types of the target event according to the target text, the second question template and the characteristic words.
[0183] The event extraction result determination module 506 is used to determine the event extraction result of the target text according to the trigger word, event type, argument and argument type.
[0184] The event extraction device based on the question-answer mode provided by the present application comprises: a text information acquisition module acquiring a target text and a first question template; a feature word determination module determining feature words related to a target event from the target text; a trigger word information determination module determining a trigger word and an event type of the target event according to the target text, the first question template and the feature words; a second question template determination module determining a question template matching the arguments of the target event from a preset question template set according to the event type of the target event as the second question template; an argument information determination module determining the arguments and argument types of the target event according to the target text, the second question template and the feature words; and an event extraction result determination module determining an event extraction result of the target text according to the trigger words, event type, arguments and argument types. The event extraction device based on the question-answer mode provided by the present application effectively enhances the feature expression and improves the accuracy of the event extraction results by combining feature words when determining the trigger words, event types, arguments and argument types; at the same time, the first question template is combined when determining the trigger words and event types, so that the present application can accurately identify the trigger words in the target text and accurately determine the event type, and then determine the second question template that matches the arguments of the target event according to the event type, and then determine the arguments and argument types of the target event in combination with the second question template, so that the present application can accurately identify the arguments in the target text and accurately determine the argument type, further improving the accuracy of the event extraction results.
[0185] Optionally, the trigger word information determination module 503 is implemented by a vector conversion module, a trigger word extraction model and a trigger word label sequence reference module.
[0186] The vector conversion module is used to convert the feature words into vector form, and the converted vector is used as the target grammar feature vector.
[0187] A trigger word extraction model is used to process the first question template, the target text and the target grammar feature vector to obtain a trigger word label sequence, wherein the trigger word extraction model adopts the first question template, the training text, the trigger word annotation sequence corresponding to the training text, and is assisted by the corresponding grammar feature vector training. The corresponding grammar feature vector is obtained by converting the feature words related to the event involved in the training text into a vector form.
[0188] The trigger word label sequence reference module is used to determine the trigger word and event type of the target event according to the trigger word label sequence.
[0189] Optionally, the trigger word extraction model in the trigger word extraction model processing module includes: a first word embedding module, a first feature fusion module, a first classifier module and a first sequence search module.
[0190] The first word embedding module encodes the first question template and the target text to obtain an encoded semantic feature vector as a first semantic feature vector.
[0191] The first feature fusion module performs nonlinear fusion on the first semantic feature vector and the target grammar feature vector to obtain a first fused feature vector.
[0192] The first classifier module determines the probability value of each word of the target text on each trigger word label according to the first fused feature vector and the normalized exponential function.
[0193] The first sequence search module uses the Viterbi algorithm to determine the trigger word label sequence according to the probability value of each word in the target text on each trigger word label and the randomly initialized state transfer matrix.
[0194] Optionally, the first word embedding module encodes the first question template and the target text to obtain an encoded semantic feature vector, including:
[0195] The first word embedding module concatenates the first question template and the target text to obtain a first concatenated text;
[0196] The first word embedding module performs a first word segmentation process on the first spliced text to obtain a digital index sequence, a segmentation mark and a mask sequence corresponding to the first spliced text, wherein the digital index sequence corresponding to the first spliced text includes a digital index corresponding to each word of the first spliced text and a digital index corresponding to a special character, the special character is used to pad the spliced text to a set length, the segmentation mark corresponding to the first spliced text is used to distinguish the first question template and the target text contained in the first spliced text, and the mask sequence corresponding to the first spliced text is used to distinguish the digital index corresponding to each word of the first spliced text and the digital index corresponding to the special character;
[0197] The first word embedding module encodes the digital index sequence, segmentation mark and mask sequence corresponding to the first concatenated text through a target encoder to obtain a first semantic feature vector.
[0198] Optionally, the first feature fusion module performs nonlinear fusion on the first semantic feature vector and the target grammar feature vector to obtain a first fused feature vector, including:
[0199] The first feature fusion module concatenates the first semantic feature vector and the target grammatical feature vector to obtain a first concatenated vector;
[0200] The first feature fusion module obtains a first fused feature vector according to the target activation function and the first concatenated vector.
[0201] Optionally, the first classifier module determines the probability value of each word of the target text on each trigger word label according to the first fused feature vector and the normalized exponential function, including:
[0202] The first classifier module performs dimensionality reduction processing on the first fused feature vector to obtain a first fused feature vector after dimensionality reduction, wherein the number of components contained in the first fused feature vector after dimensionality reduction is the same as the number of words contained in the target text;
[0203] The first classifier module calculates the probability value corresponding to each component contained in the first fused feature vector after dimensionality reduction and the normalized exponential function as the probability value of each word in the target text on each trigger word label.
[0204] Optionally, the argument information determination module 505 is implemented by an argument extraction model and an argument label sequence reference module.
[0205] The argument extraction model is used to process the second question template, the target text and the target grammar feature vector to obtain an argument label sequence, wherein the argument extraction model adopts the training question template, the training text, the argument label sequence corresponding to the training text, and is assisted by the corresponding grammar feature vector training, and the training question template is a question template in the question template set.
[0206] The argument label sequence reference module is used to determine the arguments and argument types of the target event based on the argument label sequence.
[0207] Optionally, the argument extraction model in the argument extraction model processing module includes: a second word embedding module, a second feature fusion module, a second classifier module and a second sequence search module;
[0208] The second word embedding module encodes the second question template and the target text to obtain an encoded semantic feature vector as a second semantic feature vector;
[0209] The second feature fusion module performs nonlinear fusion on the second semantic feature vector and the target grammar feature vector to obtain a second fused feature vector;
[0210] The second classifier module determines the probability value of each word of the target text on each argument label according to the second fused feature vector and the normalized exponential function;
[0211] The second sequence search module uses the Viterbi algorithm to determine the argument label sequence according to the probability value of each word in the target text on each argument label and the randomly initialized state transition matrix.
[0212] The embodiment of the present application also provides an event extraction device based on a question-answering mode. Optionally, Figure 6The hardware structure diagram of the event extraction device based on the question-answer mode is shown. Figure 6 , the hardware structure of the event extraction device based on the question-answer mode may include: at least one processor 601, at least one communication interface 602, at least one memory 603 and at least one communication bus 604;
[0213] In the embodiment of the present application, the number of the processor 601, the communication interface 602, the memory 603, and the communication bus 604 is at least one, and the processor 601, the communication interface 602, and the memory 603 communicate with each other through the communication bus 604;
[0214] The processor 601 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention;
[0215] The memory 603 may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory;
[0216] The memory 603 stores a program, and the processor 601 can call the program stored in the memory 603, and the program is used to:
[0217] Obtaining a target text and a first question template, wherein the first question template is a text that asks questions about a trigger word of a target event involved in the target text;
[0218] Identify the characteristic words related to the target event from the target text;
[0219] Determine the trigger word and event type of the target event according to the target text, the first question template and the characteristic words;
[0220] According to the event type of the target event, determine a question template matching the argument of the target event from a preset question template set as a second question template, wherein the second question template is a text for asking questions about the argument of the target event;
[0221] Determine the arguments and argument types of the target event based on the target text, the second question template and the characteristic words;
[0222] According to the trigger words, event types, arguments and argument types, the event extraction results of the target text are determined.
[0223] Optionally, the detailed functions and extended functions of the program may refer to the above description.
[0224] An embodiment of the present application also provides a readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the event extraction method based on the question-and-answer mode as described above is implemented.
[0225] Optionally, the detailed functions and extended functions of the program may refer to the above description.
[0226] Finally, it should be noted that, in this article, relational terms such as and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprises a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0227] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0228] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An event extraction method based on question-answering mode, characterized in that: include: Acquire a target text and a first question template, wherein the first question template is a text that asks questions about a trigger word of a target event involved in the target text; Determining feature words related to the target event from the target text; Determining a trigger word and an event type of the target event according to the target text, the first question template and the feature word; According to the event type of the target event, determine a question template matching the argument of the target event from a preset question template set as a second question template, wherein the second question template is a text for asking questions about the argument of the target event; Determining the arguments and argument types of the target event according to the target text, the second question template and the feature words; Determining an event extraction result of the target text according to the trigger word, the event type, the argument and the argument type; The step of determining the trigger word and event type of the target event according to the target text, the first question template and the feature word includes: Convert the feature words into vector form, and use the converted vector as the target grammar feature vector; Processing the first question template, the target text and the target grammatical feature vector using a pre-trained trigger word extraction model to obtain a trigger word label sequence output by the trigger word extraction model, wherein the trigger word extraction model is obtained by using the first question template, the training text, and the trigger word annotation sequence corresponding to the training text, and is assisted by the corresponding grammatical feature vector training, and the corresponding grammatical feature vector is obtained by converting feature words related to the event involved in the training text into a vector form; Determining the trigger word and event type of the target event according to the trigger word label sequence; The trigger word extraction model includes: a first word embedding module, a first feature fusion module, a first classifier module and a first sequence search module; The first word embedding module encodes the first question template and the target text to obtain an encoded semantic feature vector as a first semantic feature vector; The first feature fusion module performs nonlinear fusion on the first semantic feature vector and the target grammar feature vector to obtain a first fused feature vector; The first classifier module determines the probability value of each word of the target text on each trigger word label according to the first fused feature vector and the normalized exponential function; The first sequence search module determines the trigger word label sequence by using the Viterbi algorithm according to the probability value of each word in the target text on each trigger word label and a randomly initialized state transition matrix.
2. The event extraction method based on the question-answer mode according to claim 1 is characterized in that: The first word embedding module encodes the first question template and the target text to obtain an encoded semantic feature vector, including: The first word embedding module concatenates the first question template and the target text to obtain a first concatenated text; The first word embedding module performs a first word segmentation process on the first spliced text to obtain a digital index sequence, a segmentation mark and a mask sequence corresponding to the first spliced text, wherein the digital index sequence corresponding to the first spliced text includes a digital index corresponding to each word of the first spliced text and a digital index corresponding to a special character, the special character is used to pad the spliced text to a set length, the segmentation mark corresponding to the first spliced text is used to distinguish the first question template and the target text contained in the first spliced text, and the mask sequence corresponding to the first spliced text is used to distinguish the digital index corresponding to each word of the first spliced text and the digital index corresponding to the special character; The first word embedding module encodes the digital index sequence, segmentation mark and mask sequence corresponding to the first concatenated text through a target encoder to obtain the first semantic feature vector.
3. The event extraction method based on the question-answer mode according to claim 1, characterized in that: The first feature fusion module performs nonlinear fusion on the first semantic feature vector and the target grammar feature vector to obtain a first fused feature vector, including: The first feature fusion module concatenates the first semantic feature vector and the target grammatical feature vector to obtain a first concatenated vector; The first feature fusion module obtains the first fused feature vector according to the target activation function and the first concatenated vector.
4. The event extraction method based on the question-answer mode according to claim 1, characterized in that: The first classifier module determines the probability value of each word of the target text on each trigger word label according to the first fused feature vector and the normalized exponential function, including: The first classifier module performs dimensionality reduction processing on the first fused feature vector to obtain a first fused feature vector after dimensionality reduction, wherein the number of components contained in the first fused feature vector after dimensionality reduction is the same as the number of words contained in the target text; The first classifier module calculates the probability value corresponding to each component contained in the first fused feature vector after dimensionality reduction and the normalized exponential function as the probability value of each word in the target text on each trigger word label.
5. The event extraction method based on the question-answer mode according to claim 1, characterized in that: The step of determining the arguments and argument types of the target event according to the target text, the second question template, and the feature words includes: Processing the second question template, the target text and the target grammar feature vector using a pre-trained argument extraction model to obtain an argument label sequence output by the argument extraction model, wherein the argument extraction model is obtained by using a training question template, the training text, and an argument label sequence corresponding to the training text, and is assisted by corresponding grammar feature vector training, and the training question template is a question template in the question template set; The arguments and argument types of the target event are determined according to the argument label sequence.
6. The event extraction method based on the question-answer mode according to claim 5 is characterized in that: The argument extraction model includes: a second word embedding module, a second feature fusion module, a second classifier module and a second sequence search module; The second word embedding module encodes the second question template and the target text to obtain an encoded semantic feature vector as a second semantic feature vector; The second feature fusion module performs nonlinear fusion on the second semantic feature vector and the target grammar feature vector to obtain a second fused feature vector; The second classifier module determines the probability value of each word of the target text on each argument label according to the second fused feature vector and the normalized exponential function; The second sequence search module determines the argument label sequence by using the Viterbi algorithm according to the probability value of each word of the target text on each argument label and a randomly initialized state transfer matrix.
7. An event extraction device based on a question-answering mode, used to implement the event extraction method based on a question-answering mode according to any one of claims 1 to 6, characterized in that: include: A text information acquisition module, a feature word determination module, a trigger word information determination module, a second question template determination module, an argument information determination module and an event extraction result determination module; The text information acquisition module is used to acquire a target text and a first question template, wherein the first question template is a text that asks questions about a trigger word of a target event involved in the target text; The feature word determination module is used to determine the feature words related to the target event from the target text; The trigger word information determination module is used to determine the trigger word and event type of the target event according to the target text, the first question template and the feature word; The second question template determination module is used to determine, according to the event type of the target event, a question template matching the argument of the target event from a preset question template set as the second question template, wherein the second question template is a text for asking questions about the argument of the target event; The argument information determination module is used to determine the arguments and argument types of the target event according to the target text, the second question template and the characteristic words; The event extraction result determination module is used to determine the event extraction result of the target text according to the trigger word, the event type, the argument and the argument type.
8. An event extraction device based on a question-answering model, characterized in that: including memory and processor; The memory is used to store programs; The processor is used to execute the program to implement the various steps of the event extraction method based on the question-answer mode as described in any one of claims 1-6.
Citation Information
Patent Citations
Method, device and equipment for generating questions of reading comprehension and storage medium
CN111428467A
Target event extraction data processing system
CN113704476A