Event processing method and device
Through the combination of entity recognition and pruning processing, the problem of information not sharing in event extraction is solved, the efficiency and accuracy of event extraction is improved, and efficient extraction of event trigger words and elements is achieved.
Patent Information
- Application Number
- CN202011529993.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-22
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2040-12-22
AI Technical Summary
In the prior art, in event extraction, information is not shared between the event trigger words and the extraction tasks of event elements, resulting in low efficiency and accuracy, and errors affect each other, making it difficult to effectively solve.
By obtaining the encoding vectors and scores of candidate entity fragments, the entity recognition model is used for entity recognition and scoring, and combining the trigger word extraction model and element extraction model for pruning processing and prediction, the simultaneous extraction of event trigger words and elements is realized, and the event is used to obtain the event trigger words and elements at the same time. Type tags improve extraction efficiency and accuracy.
The efficiency and accuracy of event extraction are improved, the impact of error on the extraction task is avoided, and the performance of multi-task model during event extraction is enhanced.
Smart Images

Figure CN114722817B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of machine learning technology, and in particular to an event processing method and device. Background Art
[0002] With the development of Internet technology, machine learning technology has been applied in more and more fields, which has further promoted the rapid development of machine learning technology, so as to meet more user needs. In the event extraction scenario, an event is usually composed of an event trigger word (Event Trigger) and an event element (Argument) describing the event structure. Through machine learning technology, event trigger words and event elements can be automatically extracted, so as to automatically complete the generation of abstracts, automatic question and answer or information retrieval and other text processing processes, which can not only effectively save manpower and material resources, but also improve text processing efficiency. However, when implementing event extraction, the existing technology usually extracts event trigger words first, and then extracts event element composition. The information between the two tasks is not shared, resulting in insufficient mutual constraints, affecting the extraction efficiency and accuracy; or the event trigger words and event element composition are extracted as a relationship at the same time, and there is also the possibility that the error in the event trigger word extraction is introduced into the event element composition task, resulting in poor extraction efficiency. Therefore, an effective solution is urgently needed to solve the above problems. Summary of the invention
[0003] In view of this, the embodiment of the present application provides an event processing method to solve the technical defects existing in the prior art. The embodiment of the present application also provides an event processing device, a model training method, a model training device, a computing device, and a computer-readable storage medium.
[0004] According to a first aspect of an embodiment of the present application, there is provided an event processing method, including:
[0005] Obtaining a candidate entity segment, and determining a candidate entity segment encoding vector corresponding to the candidate entity segment;
[0006] Performing entity recognition and scoring processing on the candidate entity segment encoding vector through an entity recognition model to obtain a candidate entity encoding vector and a candidate entity score corresponding to the candidate entity encoding vector;
[0007] Inputting the candidate entity encoding vector and the candidate entity score into a trigger word extraction model for pruning and prediction processing to obtain the target event trigger word in the candidate entity segment;
[0008] Determine the event type label vector corresponding to the candidate entity segment, and input the candidate entity encoding vector, the candidate entity score and the event type label vector into the element extraction model for pruning processing, and concatenate the pruning processing result and the event type label vector for prediction processing to obtain the target event element in the candidate entity segment.
[0009] Optionally, before the step of obtaining candidate entity fragments is performed, the step further includes:
[0010] Acquire a sentence to be processed, and perform word segmentation processing on the sentence to be processed to obtain multiple word units;
[0011] Accordingly, obtaining the candidate entity fragment includes:
[0012] The candidate entity segment is determined based on at least one of the word units.
[0013] Optionally, the determining a candidate entity segment encoding vector corresponding to the candidate entity segment includes:
[0014] Inputting the candidate entity segment into an encoding module, processing the candidate entity segment through a sentence encoding network in the encoding module to obtain a sentence feature vector, and processing the candidate entity segment through a character encoding network in the encoding module to obtain a character feature vector;
[0015] splicing the sentence feature vector and the character feature vector into a target feature vector, and processing the target feature vector through a text encoding network in the encoding module to obtain a text feature vector;
[0016] Attention processing is performed on the text feature vector to obtain the candidate entity segment encoding vector corresponding to the candidate entity segment.
[0017] Optionally, performing entity recognition processing and scoring processing on the candidate entity segment encoding vector by an entity recognition model to obtain a candidate entity encoding vector and a candidate entity score corresponding to the candidate entity encoding vector includes:
[0018] Inputting the candidate entity segment encoding vector into the entity recognition model, and performing entity recognition processing on the candidate entity segment encoding vector to obtain the candidate entity encoding vector;
[0019] The candidate entity encoding vector is scored by a feedforward neural network in the entity recognition model to obtain the candidate entity score corresponding to the candidate entity encoding vector.
[0020] Optionally, the step of inputting the candidate entity encoding vector and the candidate entity score into a trigger word extraction model for pruning and prediction to obtain a target event trigger word in the candidate entity segment includes:
[0021] Inputting the candidate entity encoding vector and the candidate entity score into the trigger word extraction model, and pruning the candidate entity encoding vector according to the parameters set by the trigger word extraction model to obtain a first recognition pruned encoding vector;
[0022] A first target recognition pruned coding vector is determined based on the candidate entity score and the first recognition pruned coding vector, and the first target recognition pruned coding vector is predicted and processed through the trigger word extraction model to obtain the target event trigger word.
[0023] Optionally, the predicting process of the first target recognition pruning coding vector by the trigger word extraction model to obtain the target event trigger word includes:
[0024] Inputting the first target recognition pruned coding vector into the trigger word extraction model, and encoding the classification label of the first target recognition pruned coding vector to generate a first label vector;
[0025] A target event trigger word encoding vector is determined based on the first label vector and the first target recognition pruning encoding vector, and the target event trigger word is output through the trigger word extraction model.
[0026] Optionally, determining the event type label vector corresponding to the candidate entity segment includes:
[0027] The first target recognition pruned coding vector is classified and processed by the trigger word extraction model to obtain the event type label vector corresponding to the first target recognition pruned coding vector.
[0028] Optionally, the step of inputting the candidate entity encoding vector, the candidate entity score and the event type label vector into an element extraction model for pruning, and concatenating the pruning result and the event type label vector for prediction to obtain the target event element in the candidate entity segment includes:
[0029] Inputting the candidate entity encoding vector, the candidate entity score and the event type label vector into the element extraction model, and performing pruning processing on the candidate entity encoding vector according to the parameters set by the element extraction model to obtain a second recognition pruned encoding vector;
[0030] Determine a second target recognition pruned coding vector based on the candidate entity score and the second recognition pruned coding vector, and concatenate the second target recognition pruned coding vector and the event type label vector to obtain a concatenated coding vector;
[0031] The concatenated coding vector is predicted and processed by the element extraction model to obtain the target event element in the candidate entity segment.
[0032] Optionally, the predicting process of the concatenated coding vector by the element extraction model to obtain the target event element in the candidate entity segment includes:
[0033] generating an initial element encoding vector based on the concatenated encoding vector and the classification label of the concatenated encoding vector;
[0034] Classify and predict the initial element encoding vector to obtain an intermediate element encoding vector, and score the intermediate element encoding vector through a feedforward neural network in the element extraction model;
[0035] A target element encoding vector is obtained according to the scoring processing result and the intermediate element encoding vector, the target element encoding vector is processed through the output layer in the element extraction model, and the target event element is output.
[0036] Optionally, obtaining the target element encoding vector according to the scoring processing result and the intermediate element encoding vector includes:
[0037] Generate a weight score based on the scoring result of the intermediate element encoding vector, and perform attention processing on the element extraction encoding vector corresponding to the intermediate element encoding vector in sequence based on the weight score to obtain an intermediate vector;
[0038] Perform gating processing on the element extraction coding vector corresponding to the intermediate vector and the intermediate element coding vector to obtain a gating vector;
[0039] Re-encode the element extraction code vector corresponding to the gating vector, the intermediate vector, and the intermediate element code vector to generate a re-encoded updated code vector;
[0040] The target element encoding vector is generated based on the updated encoding vector and the classification label of the updated encoding vector.
[0041] Optionally, generating an initial element encoding vector based on the concatenated encoding vector and the classification label of the concatenated encoding vector comprises:
[0042] Encoding the classification labels of the concatenated coding vector to generate a second label vector;
[0043] The second label vector and the concatenated encoding vector are integrated, and the initial element encoding vector is generated according to the integration result.
[0044] Optionally, generating an initial element encoding vector based on the concatenated encoding vector and the classification label of the concatenated encoding vector comprises:
[0045] Encoding the classification labels of the concatenated coding vector to generate a second label vector;
[0046] Determine a semantic vector corresponding to the concatenated encoding vector based on a position of the second target recognition pruned encoding vector in the candidate entity segment;
[0047] The semantic vector, the second label vector and the concatenated encoding vector are integrated, and the initial element encoding vector is generated according to the integration result.
[0048] Optionally, the method further comprises:
[0049] The context information of the candidate entity fragment corresponding to the semantic identification position of the encoding module is used as an event classification task.
[0050] Optionally, the entity recognition model, the trigger word extraction model and the element extraction model share a feedforward neural network for scoring.
[0051] According to a second aspect of an embodiment of the present application, there is provided an event processing device, including:
[0052] An acquisition module is configured to acquire a candidate entity segment and determine a candidate entity segment encoding vector corresponding to the candidate entity segment;
[0053] An entity processing module is configured to perform entity recognition processing and scoring processing on the candidate entity segment encoding vector through an entity recognition model to obtain a candidate entity encoding vector and a candidate entity score corresponding to the candidate entity encoding vector;
[0054] A trigger word extraction module is configured to input the candidate entity encoding vector and the candidate entity score into a trigger word extraction model for pruning and prediction processing to obtain a target event trigger word in the candidate entity segment;
[0055] The element extraction module is configured to determine the event type label vector corresponding to the candidate entity segment, and input the candidate entity encoding vector, the candidate entity score and the event type label vector into the element extraction model for pruning, and perform prediction processing on the pruning result and the event type label vector after splicing to obtain the target event element in the candidate entity segment.
[0056] According to a third aspect of an embodiment of the present application, a model training method is provided, including:
[0057] Obtain a sample candidate entity pair and a sample event type label vector, and determine a sample candidate entity encoding vector and a sample candidate entity score of the sample candidate entity pair through an entity recognition model;
[0058] Inputting the sample candidate entity encoding vector and the sample candidate entity score into a trigger word extraction model for processing to obtain a sample event trigger word; and
[0059] Inputting the sample candidate entity encoding vector, the sample candidate entity score and the sample event type label vector into an element extraction model for processing to obtain a sample event element;
[0060] Based on the sample event trigger words and the sample event elements, the loss values of the entity recognition model, the trigger word extraction model and the element extraction model are respectively determined, and the entity recognition model, the trigger word extraction model and the element extraction model are trained.
[0061] According to a fourth aspect of an embodiment of the present application, a model training device is provided, comprising:
[0062] A sample acquisition module is configured to acquire a sample candidate entity pair and a sample event type label vector, and determine a sample candidate entity encoding vector and a sample candidate entity score of the sample candidate entity pair through an entity recognition model;
[0063] A first processing module is configured to input the sample candidate entity encoding vector and the sample candidate entity score into a trigger word extraction model for processing to obtain a sample event trigger word; and
[0064] A second processing module is configured to input the sample candidate entity encoding vector, the sample candidate entity score and the sample event type label vector into an element extraction model for processing to obtain a sample event element;
[0065] A training module is configured to determine the loss values of the entity recognition model, the trigger word extraction model and the element extraction model based on the sample event trigger word and the sample event element, respectively, and train the entity recognition model, the trigger word extraction model and the element extraction model.
[0066] According to a fifth aspect of an embodiment of the present application, a computing device is provided, including:
[0067] Memory and processor;
[0068] The memory is used to store computer-executable instructions, and the processor implements the steps of the event processing and the model training method when executing the computer-executable instructions.
[0069] According to a sixth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores computer-executable instructions, which, when executed by a processor, implement the steps of the event processing and the model training method.
[0070] The event processing method provided in the present application, after obtaining the candidate entity fragment, will determine the candidate entity fragment encoding vector corresponding to the candidate entity fragment, and then identify and score the entity fragment encoding vector through the entity recognition model to obtain the candidate entity encoding vector and the candidate entity score. At this time, the candidate entity encoding vector and the candidate entity score are input into the trigger word extraction model for processing, and the target event trigger word in the candidate entity fragment is extracted. At the same time, the candidate entity encoding vector, the candidate entity score and the event type label vector are input into the element extraction model for processing, and the target event element in the candidate entity fragment is extracted, thereby completing the event extraction task in the candidate entity fragment. By using the classification label of the trigger word when extracting the element, not only the event extraction efficiency can be improved, but also the influence of the error on the two extraction tasks can be avoided, which effectively improves the accuracy and efficiency of the multi-task model when performing event extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] Figure 1 is a flow chart of an event processing method provided by an embodiment of the present application;
[0072] Figure 2 is a schematic diagram of an event processing method provided by an embodiment of the present application;
[0073] Figure 3 It is a processing flow chart of an event processing method applied to an event extraction scenario provided by an embodiment of the present application;
[0074] Figure 4 It is a structural diagram of an event processing device provided by an embodiment of the present application;
[0075] Figure 5 is a flow chart of a model training method provided by an embodiment of the present application;
[0076] Figure 6 It is a structural schematic diagram of a model training device provided in one embodiment of the present application;
[0077] Figure 7 It is a structural block diagram of a computing device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0078] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.
[0079] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present application. The singular forms of "a", "said" and "the" used in one or more embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to and includes any or all possible combinations of one or more associated listed items.
[0080] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present application, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first.
[0081] First, the terms involved in one or more embodiments of the present invention are explained.
[0082] Event Extraction: It is to present unstructured text containing event information in a structured form. It has a wide range of applications in automatic summarization, automatic question answering, information retrieval and other fields.
[0083] Event: It is composed of event trigger words (Event Trigger) and elements (Argument) that describe the event structure. Event trigger words (trigger) are words that can trigger the occurrence of events. They are the most important feature words that determine the event type and determine the event category / subcategory. Event elements refer to the participants of the event. Trigger words and event elements are generally composed of entities.
[0084] Entity recognition: It is a basic task in natural language processing and has a wide range of applications. Named entities generally refer to entities with specific meanings or strong referentiality in the text, usually including names of people, places, names of organizations, dates and times, proper nouns, etc. The entity recognition model needs to extract the above entities from the unstructured input text, and can identify more categories of entities according to business needs, such as product names, models, prices, etc. Therefore, the concept of entity can be very broad, as long as it is a special text fragment required by the business, it can be called an entity.
[0085] Relation extraction: A relationship is defined as a connection between two or more entities. Entity relationship learning is to automatically detect and identify a semantic relationship between entities from text, which is also called relationship extraction. The output of relationship extraction is usually a triple (entity 1, relationship, entity 2). For example, the relationship expressed in the sentence "Beijing is the capital, political center and cultural center of China" can be expressed as (China, capital, Beijing), (China, political center, Beijing) and (China, cultural center, Beijing).
[0086] Encoding vector: refers to a vector expression obtained after encoding the feature.
[0087] Pruning: Removing less important data or nodes to reduce the complexity of calculation or processing.
[0088] Scoring: refers to the process of evaluating / predicting the score of a feature through a scoring strategy or model that matches the scenario; a specific score can be given for the feature based on the score evaluation / prediction result.
[0089] Feedforward Neural Network (FFNN): One of the simplest neural networks, in which neurons are arranged in layers. Each neuron is only connected to the neurons in the previous layer, receives the output of the previous layer, and outputs it to the next layer. There is no feedback between layers. It is one of the most widely used and fastest-growing artificial neural networks.
[0090] Convolutional Neural Networks (CNN): is a type of feedforward neural network that includes convolution calculations and has a deep structure. It is one of the representative algorithms of deep learning. In this application, the character-level features corresponding to each word are obtained through CNN network encoding.
[0091] Classification label: A label used to identify the type of encoded vector.
[0092] Accuracy: refers to the ratio of the number of correctly identified entities to the number of identified entities. The value is between 0 and 1. The larger the value, the higher the accuracy.
[0093] Recall rate: refers to the ratio of the number of correctly identified entities to the number of entities in the sample. The value is between 0 and 1. The larger the value, the higher the recall rate.
[0094] Weighted harmonic mean: also known as F1 value, F1 value = (2*accuracy*recall) / (accuracy+recall).
[0095] In the present application, an event processing method is provided. The embodiments of the present application also provide an event processing device, a model training method, a model training device, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
[0096] In the event extraction scenario, an event is usually composed of an event trigger word (Event Trigger) and an event element (Argument) that describes the event structure. Through machine learning technology, event trigger words and event elements can be automatically extracted, thereby realizing the automatic completion of text processing processes such as abstract generation, automatic question answering or information retrieval, which can not only effectively save manpower and material resources, but also improve text processing efficiency; however, when implementing event extraction, the existing technology usually extracts event trigger words first, and then extracts event element composition. The information between the two tasks is not shared, resulting in insufficient mutual constraints, affecting the extraction efficiency and accuracy; or the event trigger words and event element composition are extracted at the same time as a relationship, and there is also the possibility that the error in the event trigger word extraction will be introduced into the event element composition task, resulting in poor extraction efficiency. Therefore, an effective solution is urgently needed to solve the above problems.
[0097] The event processing method provided in the present application, after obtaining the candidate entity fragment, will determine the candidate entity fragment encoding vector corresponding to the candidate entity fragment, and then identify and score the entity fragment encoding vector through the entity recognition model to obtain the candidate entity encoding vector and the candidate entity score. At this time, the candidate entity encoding vector and the candidate entity score are input into the trigger word extraction model for processing, and the target event trigger word in the candidate entity fragment is extracted. At the same time, the candidate entity encoding vector, the candidate entity score and the event type label vector are input into the element extraction model for processing, and the target event element in the candidate entity fragment is extracted, thereby completing the event extraction task in the candidate entity fragment. By using the classification label of the trigger word when extracting the element, not only the event extraction efficiency can be improved, but also the influence of the error on the two extraction tasks can be avoided, which effectively improves the accuracy and efficiency of the multi-task model when performing event extraction.
[0098] Figure 1 A flowchart of an event processing method provided according to an embodiment of the present application is shown, which specifically includes the following steps:
[0099] Step S102: Acquire a candidate entity segment, and determine a candidate entity segment encoding vector corresponding to the candidate entity segment.
[0100] Specifically, the candidate entity fragment specifically refers to a fragment composed of candidate entities in the sentence, text, paragraph waiting to be processed, that is, the candidate entity fragment is a fragment composed of candidate entities of event trigger words and event elements in the sentence, text, paragraph waiting to be processed; the candidate entity fragment encoding vector is the encoding vector corresponding to the candidate entity fragment after encoding processing.
[0101] Furthermore, since the target event trigger words and target event elements to be extracted belong to the sentence to be processed, the candidate entity fragments will also belong to the sentence to be processed. Only after the sentence to be processed is the candidate entity fragment obtained for subsequent trigger word and event extraction, in this embodiment, the process of processing the sentence to be processed is as follows:
[0102] Acquire a sentence to be processed, and perform word segmentation processing on the sentence to be processed to obtain multiple word units;
[0103] The candidate entity segment is determined based on at least one of the word units.
[0104] Specifically, the sentence to be processed is the sentence that needs to be processed in the event extraction task. The sentence can be an article, a text paragraph, or a sentence, etc. In actual applications, the sentence to be processed is the text for which the user needs to perform event extraction. The text to be processed is set according to the user's input requirements, and this embodiment does not make any limitations here; accordingly, the word unit specifically refers to the word unit obtained after word segmentation processing of the text to be processed.
[0105] Based on this, after obtaining the sentence to be processed, it is determined that the trigger words and elements in the sentence to be processed need to be extracted. In order to improve the extraction accuracy and efficiency, the sentence to be processed will be segmented to obtain multiple word units corresponding to the sentence to be processed, and then the candidate entity fragments can be screened out from the multiple word units. It should be noted that since each candidate entity fragment is composed of at least one character unit, and the word unit is also composed of at least one character unit, the candidate entity fragment can be screened out from the multiple word units, that is, the candidate entity fragment can be composed of at least one word unit, or multiple word units.
[0106] Furthermore, after determining the candidate entity fragments, in order to facilitate the subsequent model to extract elements and trigger words, each candidate entity fragment can be preferentially converted into a candidate entity fragment encoding vector, thereby laying a foundation for subsequent processing. In this embodiment, the specific implementation method is as follows:
[0107] Inputting the candidate entity segment into an encoding module, processing the candidate entity segment through a sentence encoding network in the encoding module to obtain a sentence feature vector, and processing the candidate entity segment through a character encoding network in the encoding module to obtain a character feature vector;
[0108] splicing the sentence feature vector and the character feature vector into a target feature vector, and processing the target feature vector through a text encoding network in the encoding module to obtain a text feature vector;
[0109] After the text feature vector is introduced into the attention mechanism, the candidate entity segment encoding vector corresponding to the candidate entity segment is calculated.
[0110] Specifically, the encoding network that encodes the candidate entity fragment into a candidate entity fragment encoding vector can be an LSTM network or a pre-trained BERT network, and in order to be able to encode the candidate entity fragment into a candidate entity fragment encoding vector, no matter which of the above two networks is used, it needs to be trained, and the training requirements must meet the requirements required for use in this embodiment, that is, samples that meet the event extraction scenario are pre-acquired to train the above network, so that the above network can encode the candidate entity fragment encoding vector. In actual applications, the encoding network can be selected according to the actual application scenario, and this embodiment does not make any limitations here.
[0111] Furthermore, after obtaining the candidate entity fragments in the sentence to be processed, the candidate entity fragment is first input into the encoding module, and the candidate entity fragment is processed by the sentence encoding network in the encoding module to obtain the sentence feature vector; then, in order to improve the encoding accuracy, the candidate entity fragment is processed by the character encoding network in the encoding module to obtain the character feature vector; secondly, the sentence feature vector and the character feature vector are concatenated into a target feature vector, and the target feature vector is processed by the text encoding network in the encoding module to obtain the text feature vector; finally, the text feature vector is subjected to attention processing to obtain the candidate entity fragment encoding vector corresponding to the candidate entity fragment.
[0112] In practical applications, performing attention processing on the text feature vector specifically refers to introducing an attention mechanism to process the text feature before determining the candidate entity encoding vector. The attention mechanism can extract corresponding information from the source text information as an aid to provide accuracy in determining the candidate entity encoding vector, wherein the auxiliary information refers to attribute information related to the source text, such as the number of words in the text, text paragraphs, paragraph tags, etc.
[0113] It should be noted that the components in this embodiment should be understood as the functional modules required to implement the steps of the process or the method, and the functional modules are not actually divided or separated. The definition of such a group of functional modules should be understood as the functional module architecture of the solution mainly implemented through the contents recorded in the specification, and should not be understood as the physical device that mainly implements the solution through hardware.
[0114] For example, the sentence to be processed is "Xiao Ming bought a pencil worth two yuan". At this time, the sentence to be processed will be segmented and processed to obtain character units respectively, and then the multiple character units will be input into the pre-trained BERT model for encoding processing to obtain character feature vectors W1, W2...W13; then based on the character feature vectors, the candidate entity fragment encoding vectors can be determined, that is, the encoding vector of the candidate entity fragment A1 corresponding to the character feature vector [W1, W2] is determined to be E1, the encoding vector of the candidate entity fragment A2 corresponding to the character feature vector [W1, W2, W3] is determined to be E2, the encoding vector of the candidate entity fragment A3 corresponding to the character feature vector [W2, W3] is E3...the encoding vector of the candidate entity fragment A13 corresponding to the character feature vector [W12, W13] is E13.
[0115] In addition, after obtaining the sentence to be processed, in order to improve the accuracy of extracting trigger words and elements in the sentence, the sentence to be processed can also be standardized, that is, deleting punctuation marks in the sentence, re-segmenting the sentence, etc., so as to obtain a standard sentence to be processed, and then processing the standard sentence to be processed to improve the accuracy of obtaining the candidate entity fragment.
[0116] In addition, the context information of the candidate entity fragment corresponding to the semantic identification bit of the encoding module can also be used as an event classification task. That is, when the BERT model is used as the encoding network, the sentence to be processed can also be classified, and the text classification task can be implemented according to the [CLS] identification bit of the BERT model. Specifically, the BERT model inserts a [CLS] symbol before the text, and uses the output vector corresponding to the symbol as the semantic identification of the sentence to be processed for text classification, thereby completing the event classification task.
[0117] Furthermore, in the process of extracting candidate entity fragments, the sentence to be processed can be converted into a character feature vector, and the candidate entity fragment can be composed based on each character feature vector. The candidate entity fragment encoding vector corresponding to the candidate entity fragment can also be determined according to the composed vector.
[0118] In summary, by processing the sentence to be processed in a set manner, the candidate entity fragments in the sentence to be processed can be quickly extracted, and the encoding vectors of the candidate entity fragments are converted through the encoding network, which further improves the efficiency of subsequent element and trigger word extraction and lays a good foundation for the subsequent processing process.
[0119] Step S104, performing entity recognition processing and scoring processing on the candidate entity segment encoding vector through an entity recognition model to obtain a candidate entity encoding vector and a candidate entity score corresponding to the candidate entity encoding vector.
[0120] Specifically, on the basis of obtaining the candidate entity fragment encoding vector as mentioned above, further, in order to accurately extract the target event trigger words and the target event elements, entity recognition and scoring processing will be performed through the entity recognition model, that is, the candidate entity fragment is input into the entity recognition model for entity recognition processing to obtain the candidate entity encoding vector; at the same time, the candidate entity encoding vector is scored through the feedforward neural network in the entity recognition model to obtain the candidate entity score corresponding to the candidate entity encoding vector; wherein, the candidate entity encoding vector specifically refers to the encoding vector corresponding to the candidate entity extracted from each candidate entity fragment, and the candidate entity score specifically refers to the score corresponding to each candidate entity, which can be used for subsequent auxiliary extraction of event trigger words and event elements.
[0121] In this embodiment, entity recognition processing and scoring processing are performed on the candidate entity segment encoding vector through an entity recognition model to obtain a candidate entity encoding vector and a candidate entity score corresponding to the candidate entity encoding vector. The specific implementation method is as follows:
[0122] Inputting the candidate entity segment encoding vector into the entity recognition model, and performing entity recognition processing on the candidate entity segment encoding vector to obtain the candidate entity encoding vector;
[0123] The candidate entity encoding vector is scored by a feedforward neural network in the entity recognition model to obtain the candidate entity score corresponding to the candidate entity encoding vector.
[0124] Continuing with the above example, after obtaining the candidate entity fragment coding vectors E1~E13 corresponding to the sentence to be processed, each candidate entity fragment coding vector is input into the entity recognition model for entity recognition processing to obtain candidate entity coding vectors En1~En13; and each candidate entity coding vector is scored through the feedforward neural network in the entity recognition model, and the candidate entity score of candidate entity coding vector En1 is S1, the candidate entity score of candidate entity coding vector En2 is S2... The candidate entity score of candidate entity coding vector En13 is S13.
[0125] In summary, in order to accurately extract the target event trigger words and target event elements, the entity recognition model will be used to perform entity recognition and scoring on the encoding vectors of each candidate entity fragment, so as to accurately extract the candidate entities in the sentence to be processed in advance, and then score the candidate entity encoding vectors corresponding to each candidate entity, so that the target event trigger words and target event elements can be extracted more accurately in the future, ensuring the accuracy of the extraction of trigger words and elements.
[0126] Step S106, inputting the candidate entity encoding vector and the candidate entity score into a trigger word extraction model for pruning and prediction processing to obtain the target event trigger word in the candidate entity segment.
[0127] Specifically, after the candidate entity fragment encoding vector is processed by the entity recognition model as mentioned above, the candidate entity encoding vector and the candidate entity score corresponding to the candidate entity encoding vector are obtained. Furthermore, the target event trigger word can be determined according to the candidate entity encoding vector and the candidate entity score. That is, the candidate entity encoding vector and the candidate entity score are input into the trigger word extraction model for pruning and prediction. After processing by the trigger word extraction model, the target event trigger word output by the model can be obtained.
[0128] Among them, the trigger word extraction model specifically refers to a model for extracting target event trigger words in the sentence to be processed, and the target event trigger words specifically refer to words that can trigger the occurrence of an event, which are the most important feature words that determine the event type, that is, the feature words that can express the event type in the sentence to be processed; correspondingly, pruning processing through the trigger word extraction model specifically refers to the processing of eliminating the coding vectors with a lower degree of relevance to the event in the candidate entity coding vectors, and the prediction processing specifically refers to the processing of predicting the target event trigger words based on the candidate entity coding vectors with a higher degree of relevance to the event.
[0129] In this embodiment, the candidate entity encoding vector and the candidate entity score are input into the trigger word extraction model for pruning and prediction processing to obtain the target event trigger word in the candidate entity segment, that is, step S106 can be implemented by steps S1062 to S1064, and the specific implementation is as follows:
[0130] Step S1062, input the candidate entity encoding vector and the candidate entity score into the trigger word extraction model, prune the candidate entity encoding vector according to the parameters set by the trigger word extraction model, and obtain a first recognition pruned encoding vector.
[0131] Specifically, the first identified pruned coding vector specifically refers to the coding vector obtained after pruning the candidate entity coding vector through the trigger word extraction model; based on this, after identifying the candidate entity coding vector and the candidate entity score, in order to be able to delete the candidate entities with lower relevance in the candidate entity coding, the trigger word extraction model will be used for pruning, that is, the candidate entity coding vector and the candidate entity score are input into the trigger word extraction model, and the candidate entity coding vector is pruned according to the parameters set by the trigger word extraction model, so as to obtain the first identified pruned coding vector.
[0132] In practical applications, the candidate entity coding vectors are pruned through the parameters set in the trigger word extraction model. Specifically, the entity category corresponding to each candidate entity coding vector is determined, that is, whether the candidate entity coding vector is a positive class or a negative class is determined. Then, the candidate entity coding vectors belonging to the negative class are pruned to obtain the first identified pruned coding vector that meets the subsequent processing requirements, that is, the candidate entity coding vectors that do not meet the processing requirements are deleted.
[0133] Continuing with the above example, the case where there are five categories of candidate entity coding vectors is described. After obtaining the candidate entity coding vectors En1 to En13, it is determined that En1, En2 and En3 belong to the first category, the candidate entity coding vectors En4, En5 and En7 belong to the second category, the candidate entity coding vectors En6, En8 and En9 belong to the third category, the candidate entity coding vectors En10 and En11 belong to the fourth category, the candidate entity coding vectors En12 and En13 belong to the fifth category, and the fifth category is determined to be a negative category. According to the hyperparameters set by the trigger word extraction model, the candidate entity coding vectors En1 to En13 are pruned, that is, only the candidate entity coding vectors of the fifth category are pruned by p%, and the other categories remain unchanged. The remaining candidate entity coding vectors are used as the first recognition pruned coding vectors, that is, the first recognition pruned coding vector includes the candidate entity coding vectors En1, En2, En3, En4, En5, En6, En7, En8, En9, En10, En11, and En12.
[0134] In summary, after the candidate entity encoding vector is input into the trigger word extraction model, in order to improve the extraction accuracy and efficiency of the target event trigger words, the candidate entity encoding vector will be pruned according to the set parameters, thereby reducing the number of encoding vectors and improving the subsequent prediction accuracy and efficiency of the target event trigger words.
[0135] Step S1064, determining a first target recognition pruned coding vector based on the candidate entity score and the first recognition pruned coding vector, and performing prediction processing on the first target recognition pruned coding vector through the trigger word extraction model to obtain the target event trigger word.
[0136] Specifically, the first target recognition pruned coding vector specifically refers to the coding vector obtained after secondary pruning of the first recognition pruned coding vector according to the candidate entity score; based on this, after the first recognition pruned coding vector is obtained after pruning processing according to the parameters set by the trigger word extraction model, in order to improve processing efficiency, the first recognition pruned coding vector can also be pruned secondary in combination with the candidate entity score to obtain the first target recognition pruned coding vector, and finally the first target recognition pruned coding vector is predicted by the trigger word extraction model to obtain the target event trigger word.
[0137] Furthermore, in the process of prediction processing by the trigger word extraction model, in order to accurately predict the target event trigger word, the classification label of the pruned coding vector can also be combined with the first target recognition, that is, step S1064 can be implemented through steps S10642 to S10644, and the specific implementation is as follows:
[0138] Step S10642, inputting the first target recognition pruned coding vector into the trigger word extraction model, and encoding the classification label of the first target recognition pruned coding vector to generate a first label vector;
[0139] Step S10644, determining the target event trigger word encoding vector based on the first label vector and the first target recognition pruning encoding vector, and outputting the target event trigger word through the trigger word extraction model.
[0140] Specifically, the first label vector specifically refers to the classification label of the first target recognition pruned coding vector. It should be noted that since there is not only one first target recognition pruned coding vector obtained through secondary pruning, each first target recognition pruned coding vector corresponds to its own classification label, and when the target event trigger word is subsequently determined, it is also necessary to determine it based on the first target recognition pruned coding vector and its corresponding first label vector.
[0141] Based on this, the first target recognition pruned coding vector is first input into the trigger word extraction model, and the classification labels corresponding to each first target recognition pruned coding vector are determined by the trigger word extraction model. Then, each classification label is encoded to obtain the first label coding vector corresponding to the first target recognition pruned coding vector. Finally, the target event trigger word coding vector can be determined according to the first label vector and the first target recognition pruned coding vector. The target event trigger word coding vector is then converted through the output layer in the trigger word extraction model to obtain the target event trigger word of the sentence to be processed.
[0142] Continuing with the above example, after obtaining the first recognition pruning code vector (En1, En2, En3, En4, En5, En6, En7, En8, En9, En10, En11, En12), secondary pruning is performed according to the candidate entity scores of each first recognition pruning code vector to obtain a first target recognition pruning code vector that meets the subsequent processing requirements, that is, the candidate entity scores corresponding to each first recognition pruning code vector are compared with the preset score threshold, and the first recognition pruning code vectors that are less than the preset score threshold are deleted according to the comparison result, and the remaining first recognition pruning code vectors are used as the first target recognition pruning code vector, and the first target recognition pruning code vector is determined to be (En4, En5, En6).
[0143] Then, it is determined that the classification label of the first target recognition pruned coding vector En4 is label_4, the classification label of the first target recognition pruned coding vector En5 is label_5, and the classification label of the first target recognition pruned coding vector En6 is label_6. Then, each classification label is encoded to generate a first label vector span4_label_embedding corresponding to the classification label label_4, a first label vector span5_label_embedding corresponding to the classification label label_5, and a first label vector span6_label_embedding corresponding to the classification label label_6. Finally, the trigger word extraction model is used to predict the target event trigger word, and it is determined that the target event trigger word encoding vector output by the trigger word extraction model is L4, that is, the target event trigger word encoding vector L4 is converted according to the output layer of the trigger word extraction model, and the target event trigger word is determined to be purchase, that is, the target event trigger word in the sentence to be processed "Xiao Ming bought a pencil worth two yuan" is determined to be purchase.
[0144] In summary, by determining the target event trigger word in combination with the first label encoding vector, the accuracy of determining the target event trigger word is effectively improved, so that in the process of processing the statement to be processed, the trigger word in the statement to be processed can be accurately extracted, thereby improving the processing accuracy of the upstream and downstream business processing of the statement to be processed.
[0145] Step S108, determine the event type label vector corresponding to the candidate entity segment, and input the candidate entity encoding vector, the candidate entity score and the event type label vector into the element extraction model for pruning, and concatenate the pruning result and the event type label vector for prediction to obtain the target event element in the candidate entity segment.
[0146] Specifically, after completing the task of extracting the target event trigger words as mentioned above, the target event elements in the candidate entity fragment will be further extracted. In order to improve the extraction accuracy and consider the influence of the extracted target event trigger words, the event type label vector will be determined before the target event element is extracted. Then, the candidate entity encoding vector, the candidate entity score and the event type label vector will be input into the element extraction model for pruning. The pruning result and the event type label vector will be concatenated and predicted to obtain the target event elements in the candidate entity fragment.
[0147] Among them, the event label vector specifically refers to the vector corresponding to the label applied when determining the target event trigger word, the element extraction model specifically refers to a model that can prune the encoding vector and predict the target event elements, and the target event elements specifically refer to the participants of the event. For example, if A participates in a football match, then A and the football match are both participants in the event.
[0148] Based on this, in order to improve the accuracy of predicting target event trigger words and target event elements, and to improve the mutual constraints between the two, in the process of predicting the target event elements, the vector corresponding to the event type label involved in predicting the target event trigger words will be introduced. After that, the target event elements will be obtained by pruning and predicting the element extraction model, that is, the extraction of the target event trigger words and target event elements in the sentence to be processed is completed, thereby determining the main event content corresponding to the sentence to be processed.
[0149] It should be noted that the trigger word extraction model and the element extraction model involved in this embodiment should be understood as models required to implement trigger word prediction and element prediction, and the various models are not actually functionally divided or separated; the two can each complete their own prediction processing, or they can be encapsulated in the same neural network to complete the prediction processing. The specific implementation method can be set according to the actual application scenario, and this embodiment does not make any limitations here.
[0150] Furthermore, in order to improve the accuracy of subsequent determination of target event elements, an event type label vector is introduced in the process of predicting target event elements, that is, a label vector involved in determining the target event trigger word is introduced. In this embodiment, the specific implementation method of determining the event type label vector is as follows:
[0151] The first target recognition pruned coding vector is classified and processed by the trigger word extraction model to obtain the event type label vector corresponding to the first target recognition pruned coding vector.
[0152] Specifically, since there are many labels involved in determining the target event trigger word, and not all labels are applied in the process of determining the target event element, in order to avoid the influence of too many labels on the accuracy of determining the target event element, the first target recognition pruned coding vector can be classified through the trigger word extraction model, and the label corresponding to the first target recognition pruned coding vector can be used as the event type label applied in the process of extracting the target event element, thereby improving the accuracy of subsequent prediction of the target event element.
[0153] In this embodiment, the candidate entity encoding vector, the candidate entity score and the event type label vector are input into the element extraction model for pruning processing, and the pruning processing result and the event type label vector are spliced and then predicted to obtain the target event element in the candidate entity segment, that is, step S108 can be implemented by steps S1082 to S1086, and the specific implementation is as follows:
[0154] Step S1082: input the candidate entity encoding vector, the candidate entity score and the event type label vector into the element extraction model, prune the candidate entity encoding vector according to the parameters set by the element extraction model, and obtain a second recognition pruned encoding vector.
[0155] Specifically, the second identification pruned coding vector specifically refers to the coding vector obtained after pruning the candidate entity coding vector through the element extraction model; based on this, in the process of determining the target event element, in order to improve the efficiency of determining the target event element, the candidate entity coding vector will be pruned according to the parameters set by the element extraction model to obtain the second identification pruned coding vector.
[0156] In practical applications, the candidate entity coding vectors are pruned through the parameters set in the element extraction model, specifically, the entity category corresponding to each candidate entity coding vector is determined, that is, whether the candidate entity coding vector is a positive class or a negative class is determined, and then the candidate entity coding vectors belonging to the negative class are pruned to obtain a second identified pruned coding vector that meets the subsequent processing requirements, that is, the candidate entity coding vectors that do not meet the processing requirements are deleted.
[0157] Continuing with the above example, after determining that the first target recognition pruning encoding vector is (En4, En5, En6), the classification labels corresponding to each vector are determined to be label_4, label_5, and label_6. Correspondingly, the first label vectors are span4_label_embedding, span5_label_embedding, and span6_label_embedding, respectively. Based on this, according to the target event trigger word A4, span4_label_embedding can be determined as the event type label vector, that is, when determining the target event element, the label vector when determining the target event trigger word is introduced.
[0158] Furthermore, at this time, the candidate entity encoding vectors En1~En13, the candidate entity scores S1~S13 corresponding to each candidate entity encoding vector, and the event type label vector span4_label_embedding are input into the element extraction model, and the candidate entity encoding vectors are pruned by the hyperparameters preset by the element extraction model to determine that the candidate entity encoding vectors En1, En2 and En3 belong to the first category, the candidate entity encoding vectors En4, En5 and En6 belong to the second category, the candidate entity encoding vectors En7, En8 and En9 belong to the third category, and the candidate entity encoding vector En10 , En11 and En12 belong to the fourth category, and the candidate entity encoding vector En13 belongs to the fifth category, where the fifth category is the negative category; then the candidate entities of the first category are pruned by p1%, the candidate entities of the second category are pruned by p2%, the candidate entities of the third category are pruned by p3%, the candidate entities of the fourth category are pruned by p4%, and the candidate entities of the fifth category are pruned by p5%, and the remaining candidate entity encoding vectors are used as the second recognition pruned encoding vectors, that is, the second recognition pruned encoding vector includes the candidate entity encoding vectors En1, En3, En5, En6, En7, and En13.
[0159] Step S1084, determining a second target recognition pruned coding vector based on the candidate entity score and the second recognition pruned coding vector, and concatenating the second target recognition pruned coding vector and the event type label vector to obtain a concatenated coding vector.
[0160] Specifically, the second target recognition pruned coding vector specifically refers to the coding vector obtained after secondary pruning of the second recognition pruned coding vector according to the candidate entity score; the spliced coding vector specifically refers to the coding vector generated after splicing each second target recognition pruned coding vector with the event type label vector.
[0161] Based on this, after the candidate entity coding vector is pruned once through the element extraction model, the second recognition pruned coding vector is obtained. At this time, in order to improve the efficiency of subsequent prediction of the target event elements, the second recognition pruned coding vector is pruned twice in combination with the candidate entity score to obtain the second target recognition pruned coding vector, and the spliced coding vector can be spliced in combination with the event type label vector, so as to be used for subsequent accurate extraction of the target event elements.
[0162] Continuing with the above example, after obtaining the second recognition pruning coding vector (En1, En3, En5, En6, En7, En13), in order to further improve the accuracy of determining the target event elements, secondary pruning can be performed through the candidate entity scores to obtain a second target recognition pruning coding vector that meets the subsequent processing requirements, that is, the candidate entity scores corresponding to each second recognition pruning coding vector are compared with the preset score threshold, and the second recognition pruning coding vectors that are less than the preset score threshold are deleted according to the comparison results, and the remaining second recognition pruning coding vectors are used as the second target recognition pruning coding vector, and the second target recognition pruning coding vector is determined to be (En3, En7, En13).
[0163] Based on this, each second target recognition pruned coding vector is spliced with the event type label vector, that is, span4_label_embedding and the second target recognition pruned coding vector En3 are spliced to obtain the spliced coding vector En3*span4_label_embedding, span4_label_embedding and the second target recognition pruned coding vector En7 are spliced to obtain the spliced coding vector En7*span4_label_embedding, span4_label_embedding and the second target recognition pruned coding vector En13 are spliced to obtain the spliced coding vector En13*span4_label_embedding.
[0164] In summary, considering that there may be mutual influence between event trigger words and event elements, in order to accurately extract the target event elements, the label vector involved in extracting the target event trigger words will be introduced when extracting the target event elements, so as to consider the extraction accuracy of the target event elements from multiple angles and accurately determine the events in the sentences to be processed.
[0165] Step S1086: Predictively process the concatenated coding vector using the element extraction model to obtain the target event element in the candidate entity segment.
[0166] Specifically, after introducing the event type label vector, a plurality of concatenated coding vectors can be obtained, and finally the concatenated coding vectors are predicted and processed by the element extraction model to obtain the target event element in the candidate entity segment.
[0167] In this embodiment, the concatenated coding vector is predicted and processed by the element extraction model to obtain the target event element in the candidate entity segment, that is, step S1086 can be implemented by steps S10862 to S10866, and the specific implementation method is as follows:
[0168] Step S10862, generating an initial element coding vector based on the concatenated coding vector and the classification label of the concatenated coding vector.
[0169] Specifically, in order to improve the accuracy of determining the target event element, it is also necessary to combine the classification label of the spliced coding vector to generate the initial element coding vector. The initial element coding vector specifically refers to the coding vector corresponding to the element prepared before predicting the target event element; accordingly, the initial element coding vector can be determined in the following way: determine the classification label of the spliced coding vector through the element extraction model, and then encode the classification label of the spliced coding vector to generate a second label vector; integrate the second label vector and the spliced coding vector, and generate the initial element coding vector according to the integration result.
[0170] Continuing with the above example, after determining the concatenated coding vectors En3*span4_label_embedding, En7*span4_label_embedding, and En13*span4_label_embedding, the second label coding vector of each concatenated coding vector is concatenated with its corresponding concatenated coding vector to obtain the initial element coding vector, which are El3=span3_element_embeddings=torch.cat([En3*span4_label_embedding]); El7=span7_element_embeddings=torch.cat([En7*span4_label_embedding]); El13=span13_element_embeddings=torch.cat([En13*span4_label_embedding]).
[0171] In addition, the initial element coding vector can also be determined in the following manner: encoding the classification label of the spliced coding vector to generate a second label vector; determining the semantic vector corresponding to the spliced coding vector based on the position of the second target recognition pruning coding vector in the candidate entity fragment; integrating the semantic vector, the second label vector and the spliced coding vector, and generating the initial element coding vector according to the integration result.
[0172] In summary, by integrating the second label vectors corresponding to each concatenated coding vector with the concatenated coding vector, the accuracy of the element extraction model in predicting the target event element can be further improved, thereby improving the accuracy of identifying the event in the sentence to be processed.
[0173] Step S10864, classify and predict the initial element coding vector to obtain an intermediate element coding vector, and score the intermediate element coding vector through the feedforward neural network in the element extraction model.
[0174] Specifically, the intermediate element coding vector specifically refers to the coding vector obtained after classifying and predicting the initial element coding vector through the element extraction model; correspondingly, the scoring process specifically refers to the prediction and scoring process of each intermediate element coding vector through the feedforward neural network in the element extraction model; based on this, in order to be able to accurately predict the target event element in the subsequent time, each initial element coding vector is first classified and predicted, and the intermediate element coding vector is obtained according to the classification prediction result; then, the intermediate element coding vector is scored through the feedforward neural network in the element extraction model to obtain the score corresponding to each intermediate element coding vector.
[0175] Continuing with the above example, after obtaining the initial element coding vectors El3, El7 and El13, each initial element coding vector will be classified and predicted, and the intermediate element coding vector corresponding to the initial element coding vector El3 is Elm3; the intermediate element coding vector corresponding to the initial element coding vector El7 is Elm7; the intermediate element coding vector corresponding to the initial element coding vector El13 is Elm13; then the intermediate element coding vectors are scored through the feedforward neural network in the element extraction model, which is equivalent to a secondary scoring of the screened candidate entity coding vectors, and it is determined that the score corresponding to the intermediate element coding vector Elm3 is Slm3, the score corresponding to the intermediate element coding vector Elm7 is Slm7, and the score corresponding to the intermediate element coding vector Elm13 is Slm13.
[0176] Step S10866, obtain the target element encoding vector according to the scoring processing result and the intermediate element encoding vector, process the target element encoding vector through the output layer in the element extraction model, and output the target event element.
[0177] Specifically, the target element encoding vector specifically refers to the vector corresponding to the target event trigger word predicted by the element extraction model; based on this, the target element encoding vector can be predicted according to the scoring results corresponding to each intermediate element encoding vector and the intermediate element encoding vector, and finally the target element encoding vector is processed by the output layer in the element extraction model to output the target event element.
[0178] Continuing with the above example, after obtaining the scores corresponding to the intermediate element coding vectors, the target element coding vector can be determined by selecting the one with the highest score. By comparison, it is determined that the score Slm3=Slm7>Slm13, and the intermediate element coding vector Elm3 corresponding to the score Slm3 and the intermediate element coding vector Elm7 corresponding to the score Slm7 can be selected as the target element coding vector; finally, A3 and A7 can be determined as the target event elements in the sentence to be processed through the intermediate element coding vector Elm3 and the intermediate element coding vector Elm7, and the target element coding vectors (intermediate element coding vector Elm3 and intermediate element coding vector Elm7) are converted through the output layer in the element extraction network to obtain the target event element output by the element extraction model for the text to be processed - (Xiao Ming, pencil).
[0179] In summary, introducing the event type label when determining the target event trigger word in the process of determining the target event element can not only reduce the mutual interference between the trigger word and the element extraction, but also improve the constraint between the two, thereby improving the extraction accuracy of the trigger word and the element.
[0180] In addition, in the process of determining the target element encoding vector, in order to accurately screen out the target element encoding vector, it can be determined in combination with the weight. In this embodiment, the specific implementation method is as follows:
[0181] Generate a weight score based on the scoring result of the intermediate element encoding vector, and perform attention processing on the element extraction encoding vector corresponding to the intermediate element encoding vector in sequence based on the weight score to obtain an intermediate vector;
[0182] Perform gating processing on the element extraction coding vector corresponding to the intermediate vector and the intermediate element coding vector to obtain a gating vector;
[0183] Re-encode the element extraction code vector corresponding to the gating vector, the intermediate vector, and the intermediate element code vector to generate a re-encoded updated code vector;
[0184] The target element encoding vector is generated based on the updated encoding vector and the classification label of the updated encoding vector.
[0185] Specifically, the weight score refers to the weight value obtained according to the score of each intermediate element encoding vector after scoring; the intermediate vector refers to the vector obtained according to the intermediate element encoding vector after the attention mechanism is introduced.
[0186] Based on this, first determine the scoring results corresponding to each intermediate element coding vector, generate a weight score for each intermediate element coding vector according to the scoring results, and perform attention processing on the element extraction coding vector corresponding to the intermediate element coding vector in turn based on the weight score to obtain the intermediate vector; secondly, perform gate processing based on the intermediate vector and the element extraction coding vector corresponding to the intermediate element coding vector to obtain a gated vector; and re-encode based on the gated vector, the intermediate vector and the element extraction coding vector corresponding to the intermediate element coding vector to generate a re-encoded updated coding vector; finally, determine the classification label of the updated coding vector according to the element extraction model, and then generate the target element coding vector based on the updated coding vector and the classification label of the updated coding vector.
[0187] In practical applications, in the process of generating the target element coding vector based on the updated coding vector and the classification label of the updated coding vector, it specifically refers to encoding the classification label of the updated coding vector, and then concatenating the vector corresponding to the encoded classification label and the updated coding vector to generate the target element coding vector.
[0188] In specific implementation, the entity recognition model, the trigger word extraction model and the element extraction model provided in this embodiment can share a feedforward neural network for scoring; by organically combining the entity extraction model, the trigger word extraction model and the element extraction model, the three share a feedforward neural network for scoring, which can realize information sharing among the entity extraction model, the trigger word extraction model and the element extraction model, thereby improving the accuracy and recall rate of the above-mentioned entity extraction model, trigger word extraction model and element extraction model.
[0189] The event processing method provided in the present application, after obtaining the candidate entity fragment, will determine the candidate entity fragment encoding vector and the corresponding event type label vector corresponding to the candidate entity fragment, and then identify and score the entity fragment encoding vector through the entity recognition model to obtain the candidate entity encoding vector and the candidate entity score. At this time, the candidate entity encoding vector and the candidate entity score are input into the trigger word extraction model for processing, and the target event trigger word in the candidate entity fragment is extracted. At the same time, the candidate entity encoding vector, the candidate entity score and the event type label vector are input into the element extraction model for processing, and the target event element in the candidate entity fragment is extracted, thereby completing the event extraction task in the candidate entity fragment, which can not only improve the event extraction efficiency, but also avoid the influence of errors on the two extraction tasks, and effectively improve the accuracy and efficiency of the multi-task model in event extraction.
[0190] The following combination Figure 3, taking the event processing method provided in this application for event extraction application as an example, the event processing method is further explained. Figure 3 A processing flow chart of an event processing method applied to an event extraction scenario provided by an embodiment of the present application is shown, which specifically includes the following steps:
[0191] Step S302, obtaining the text to be processed, and preprocessing the text to be processed to obtain the standard text to be processed.
[0192] Step S304: input the standard text to be processed into the encoder for encoding processing to generate a candidate entity segment encoding vector.
[0193] This embodiment will take the text to be processed as "...Place A established a research institute worth 1 billion yuan..." as an example. It should be noted that since the text to be processed is relatively long, for the convenience of description, only the characters mainly involved in this embodiment will be specifically described, and other omitted characters will be expressed in the form of letters, and no further elaboration will be given later.
[0194] Based on this, after obtaining the text to be processed, the text to be processed is first segmented to obtain multiple character units O1, O2...Om, and then the multiple character units are input into the pre-trained BERT model to encode the standard text to be processed to obtain a character-level character feature vector. At the same time, the sentence feature vector and the character feature vector are concatenated into a target feature vector, and the target feature vector is encoded through a bidirectional LSTM network to obtain a text feature vector with contextual features. Finally, the text feature vector is introduced into the attention mechanism to calculate the candidate entity fragment encoding vector corresponding to the candidate entity fragment.
[0195] That is: determine that the character feature vectors corresponding to each word unit are O1=W1, O2=W2...Om=Wm, based on this, extract candidate entity fragments based on the character feature vectors, determine that the character feature vector [W1, W2] corresponds to the candidate entity fragment A1, the character feature vector [W1, W2, W3] corresponds to the candidate entity fragment A2, the character feature vector [W2, W3] corresponds to the candidate entity fragment A3...; finally, the candidate entity encoding vectors corresponding to each candidate entity fragment are obtained as follows: determine that the encoding vector corresponding to A1 is E1, the encoding vector corresponding to A2 is E2, the encoding vector corresponding to A3 is E3, the encoding vector corresponding to A4 is E4, the encoding vector corresponding to A5 is E5, the encoding vector corresponding to A6 is E6, the encoding vector corresponding to A7 is E7, the encoding vector corresponding to A8 is E8, and the encoding vector corresponding to A9 is E9, so as to obtain the candidate entity fragments and encode them, so as to make adequate preparations for the subsequent event extraction tasks and improve the processing efficiency of the subsequent event extraction tasks.
[0196] In addition, after encoding is achieved through the pre-trained BERT model, the text classification task can also be implemented based on the [CLS] identifier of the BERT model. Specifically, the BERT model inserts a [CLS] symbol before the text and uses the output vector corresponding to the symbol as the semantic identifier of the text to be processed for text classification. That is, the event classification task is completed based on the BERT model.
[0197] Step S306: input the candidate entity segment coding vector into an entity recognition model, and obtain a candidate entity coding vector by performing entity recognition processing on the candidate entity segment coding vector.
[0198] Step S308, scoring the candidate entity encoding vector through the feedforward neural network in the entity recognition model to obtain the candidate entity score corresponding to the candidate entity encoding vector.
[0199] Specifically, after obtaining the encoding vectors corresponding to A1~A9 respectively, in order to accurately extract the target event trigger words and target event elements from the text to be processed, the entity recognition model will be used for entity recognition and scoring. That is, the encoding vectors E1~E9 are input into the entity recognition model for entity recognition to obtain candidate entity encoding vectors (En1, En2, En3, En4, En5, En6, En7, En8, En9), and the feedforward neural network in the entity recognition model is used to score each candidate entity encoding vector to obtain the candidate entity encoding vector. The candidate entity score of the candidate entity coding vector En1 is S1, the candidate entity score of the candidate entity coding vector En2 is S2, the candidate entity score of the candidate entity coding vector En3 is S3, the candidate entity score of the candidate entity coding vector En4 is S4, the candidate entity score of the candidate entity coding vector En5 is S5, the candidate entity score of the candidate entity coding vector En6 is S6, the candidate entity score of the candidate entity coding vector En7 is S7, the candidate entity score of the candidate entity coding vector En8 is S8, and the candidate entity score of the candidate entity coding vector En9 is S9.
[0200] Step S310, inputting the candidate entity encoding vector and the candidate entity score into the trigger word extraction model, pruning the candidate entity encoding vector according to the parameters set by the trigger word extraction model, and obtaining a first recognition pruned encoding vector.
[0201] Specifically, the example in which there are five categories of candidate entity coding vectors in this embodiment is used for description, wherein candidate entity coding vectors En1 and En2 belong to the first category, candidate entity coding vectors En3 and En7 belong to the second category, candidate entity coding vector En4 belongs to the third category, candidate entity coding vectors En5 and En6 belong to the fourth category, and candidate entity coding vectors En8 and En9 belong to the fifth category, wherein the fifth category is a negative category, and the candidate entity coding vectors En1 to En9 are pruned according to the hyperparameters set by the trigger word extraction model, that is, only the candidate entity coding vectors of the fifth category are pruned by p%, and the other categories remain unchanged, and the remaining candidate entity coding vectors are used as the first recognition pruned coding vectors, that is, the first recognition pruned coding vectors include candidate entity coding vectors En1, En2, En3, En4, En5, En6, En7, and En8.
[0202] Step S312: determining a first target recognition pruned coding vector based on the candidate entity scores and the first recognition pruned coding vector.
[0203] Specifically, after obtaining the pruned first recognition pruning coding vector (En1, En2, En3, En4, En5, En6, En7, En8), in order to further improve the accuracy of determining the target event trigger word, secondary pruning can be performed through the candidate entity scores to obtain a first target recognition pruning coding vector that meets subsequent processing requirements, that is, the candidate entity scores corresponding to each first recognition pruning coding vector are compared with a preset score threshold, and the first recognition pruning coding vectors that are less than the preset score threshold are deleted according to the comparison results, and the remaining first recognition pruning coding vectors are used as the first target recognition pruning coding vector, and the first target recognition pruning coding vector is determined to be (En4, En5, En6).
[0204] Step S314, determining the classification label of the first target recognition pruning coding vector, and encoding the classification label to generate a first label vector.
[0205] Step S316, determining the target event trigger word based on the first target recognition pruning coding vector and the first label vector.
[0206] Specifically, determine that the classification label of the first target recognition pruned coding vector En4 is label_4, the classification label of the first target recognition pruned coding vector En5 is label_5, and the classification label of the first target recognition pruned coding vector En6 is label_6. Then, encode each classification label to generate a first label vector span4_label_embedding corresponding to the classification label label_4, span5_label_embedding corresponding to the classification label label_5, and span6_label_embedding corresponding to the classification label label_6.
[0207] Based on this, after determining the first target recognition pruning coding vector and the first label vector, A4 can be determined as the target event trigger word in the text to be processed. Finally, the target trigger word coding vector is converted through the output layer in the trigger word extraction model to obtain the target event trigger word output by the trigger word extraction model for the text to be processed - establishment.
[0208] Step S318, determine the event type label vector in the first label vector, and input the event type label vector, the candidate entity coding vector and the candidate entity score into the element extraction model, prune the candidate entity coding vector according to the parameters set by the element extraction model, and obtain a second recognition pruned coding vector.
[0209] Specifically, after determining that the first label vectors are span4_label_embedding, span5_label_embedding and span6_label_embedding respectively, span4_label_embedding is determined as the event type label vector according to the target event trigger word A4 of the text to be processed, and then the event type label vector span4_label_embedding, the candidate entity encoding vector (En1, En2, En3, En4, En5, En6, En7, En8, En9) and the candidate entity scores (S1, S2, S3, S4, S5, S6, S7, S8, S9) are input into the element extraction model.
[0210] The candidate entity encoding vectors are pruned through the hyperparameters preset by the element extraction model, and it is determined that the candidate entity encoding vectors En1 and En2 belong to the first category, the candidate entity encoding vectors En3, En7 and En9 belong to the second category, the candidate entity encoding vector En4 belongs to the third category, the candidate entity encoding vectors En5 and En6 belong to the fourth category, and the candidate entity encoding vector En8 belongs to the fifth category, where the fifth category is a negative category; then the candidate entities of the first category are pruned by p1%, the candidate entities of the second category are pruned by p2%, the candidate entities of the third category are pruned by p3%, the candidate entities of the fourth category are pruned by p4%, and the candidate entities of the fifth category are pruned by p5%, and the remaining candidate entity encoding vectors are used as the second recognition pruned encoding vectors, that is, the second recognition pruned encoding vector includes the candidate entity encoding vectors En1, En3, En5, En6, En7, and En9.
[0211] Step S320: determining a second target recognition pruned coding vector based on the candidate entity score and the second recognition pruned coding vector.
[0212] Specifically, after obtaining the second recognition pruning coding vector (En1, En3, En5, En6, En7, En9), in order to further improve the accuracy of determining the target event elements, secondary pruning can be performed through the candidate entity scores to obtain a second target recognition pruning coding vector that meets the subsequent processing requirements, that is, the candidate entity scores corresponding to each second recognition pruning coding vector are compared with the preset score threshold, and the second recognition pruning coding vectors that are less than the preset score threshold are deleted according to the comparison results, and the remaining second recognition pruning coding vectors are used as the second target recognition pruning coding vector, and the second target recognition pruning coding vector is determined to be (En3, En7, En9).
[0213] Step S322, concatenate the second target recognition pruning coding vector and the event type label vector to obtain a concatenated coding vector.
[0214] Specifically, taking into account the mutual influence between event trigger words and event elements, and in order to accurately determine the events of the text to be processed, the classification labels obtained when the trigger word extraction model performs trigger word extraction can be introduced into the element extraction model, so that the two can constrain and influence each other, thereby promoting the extraction accuracy of the target event elements, that is, the target event elements have a higher correlation with the target event trigger words, thereby better indicating the target events in the text to be processed.
[0215] Based on this, each second target recognition pruned coding vector is spliced with the event type label vector, that is, span4_label_embedding and the second target recognition pruned coding vector En3 are spliced to obtain the spliced coding vector En3*span4_label_embedding, span4_label_embedding and the second target recognition pruned coding vector En7 are spliced to obtain the spliced coding vector En7*span4_label_embedding, span4_label_embedding and the second target recognition pruned coding vector En9 are spliced to obtain the spliced coding vector En9*span4_label_embedding.
[0216] Step S324, determining the classification label of the concatenated coding vector, and encoding the classification label to obtain a second label vector.
[0217] Step S326, concatenate the second label vector and the concatenated coding vector to obtain an initial element coding vector.
[0218] Specifically, the initial element encoding vector El3 obtained after splicing = span3_element_embeddings = torch.cat([En3*span4_label_embedding]); El7 = span7_element_embeddings = torch.cat([En7*span4_label_embedding]); El9 = span9_element_embeddings = torch.cat([En9*span4_label_embedding]).
[0219] Step S328, classify and predict the initial element coding vector to obtain the intermediate element coding vector, and score the intermediate element coding vector through the feedforward neural network in the element extraction network.
[0220] Specifically, after obtaining the initial element coding vector (El3, El7, El9), in order to more accurately determine the target event element in the text to be processed, each initial element coding vector is classified and predicted to obtain the intermediate element coding vector (Elm3, Elm7, Elm9), wherein the intermediate element coding vector Elm3 corresponds to the initial element coding vector El3, the intermediate element coding vector Elm7 corresponds to the initial element coding vector El7, and the intermediate element coding vector Elm9 corresponds to the initial element coding vector El9; then, the intermediate element coding vectors are scored through the feedforward neural network in the element extraction model, which is equivalent to a secondary scoring of the screened candidate entity coding vectors, and it is determined that the score corresponding to the intermediate element coding vector Elm3 is Slm3, the score corresponding to the intermediate element coding vector Elm7 is Slm7, and the score corresponding to the intermediate element coding vector Elm9 is Slm9.
[0221] Step S330, obtaining a target element encoding vector according to the scoring processing result and the intermediate element encoding vector, and processing the target element encoding vector through the output layer in the element extraction model to output the target event element.
[0222] Specifically, after obtaining the scores corresponding to the intermediate element coding vectors, the target element coding vector can be determined by selecting the one with the higher score. By comparison, it is determined that the score Slm3=Slm7>Slm9, then the intermediate element coding vector Elm3 corresponding to the score Slm3 and the intermediate element coding vector Elm7 corresponding to the score Slm7 can be selected as the target element coding vector.
[0223] Finally, the intermediate element encoding vector Elm3 and the intermediate element encoding vector Elm7 can be used to determine that A3 and A7 are the target event elements in the text to be processed. The target element encoding vectors (intermediate element encoding vector Elm3 and intermediate element encoding vector Elm7) are converted through the output layer in the element extraction network to obtain the target event element output by the element extraction model for the text to be processed - (A, Research Institute).
[0224] In summary, through the target event trigger word - establishment output by the trigger word extraction model, and the target event element - (A, Institute) output by the element extraction model, it can be determined that the event of the text to be processed is [Establishing a Research Institute in Place A].
[0225] The event processing method provided in the present application, after obtaining the candidate entity fragment, will determine the candidate entity fragment encoding vector corresponding to the candidate entity fragment, and then identify and score the entity fragment encoding vector through the entity recognition model to obtain the candidate entity encoding vector and the candidate entity score. At this time, the candidate entity encoding vector and the candidate entity score are input into the trigger word extraction model for processing, and the target event trigger word in the candidate entity fragment is extracted. At the same time, the candidate entity encoding vector, the candidate entity score and the event type label vector are input into the element extraction model for processing, and the target event element in the candidate entity fragment is extracted, thereby completing the event extraction task in the candidate entity fragment. By introducing the classification label of the trigger word when extracting the element, not only the event extraction efficiency can be improved, but also the influence of the error on the two extraction tasks can be avoided, which effectively improves the accuracy and efficiency of the multi-task model when performing event extraction.
[0226] Corresponding to the above method embodiment, the present application also provides an event processing device embodiment, Figure 4 FIG. 1 is a schematic diagram showing the structure of an event processing device provided by an embodiment of the present application. Figure 4 As shown, the device comprises:
[0227] The acquisition module 402 is configured to acquire a candidate entity segment and determine a candidate entity segment encoding vector corresponding to the candidate entity segment;
[0228] The entity processing module 404 is configured to perform entity recognition processing and scoring processing on the candidate entity segment encoding vector through an entity recognition model to obtain a candidate entity encoding vector and a candidate entity score corresponding to the candidate entity encoding vector;
[0229] The trigger word extraction module 406 is configured to input the candidate entity encoding vector and the candidate entity score into the trigger word extraction model for pruning and prediction processing to obtain the target event trigger word in the candidate entity segment;
[0230] The element extraction module 408 is configured to determine the event type label vector corresponding to the candidate entity segment, and input the candidate entity encoding vector, the candidate entity score and the event type label vector into the element extraction model for pruning, and perform prediction processing on the pruning result and the event type label vector after splicing to obtain the target event element in the candidate entity segment.
[0231] In an optional embodiment, the event processing device further includes:
[0232] A module for obtaining sentences to be processed is configured to obtain sentences to be processed and perform word segmentation on the sentences to be processed to obtain a plurality of word units;
[0233] Accordingly, the acquisition module 402 is further configured to:
[0234] The candidate entity segment is determined based on at least one of the word units.
[0235] In an optional embodiment, the acquisition module 402 is further configured to:
[0236] The candidate entity segment is input into the encoding module, the sentence encoding network in the encoding module is used to process the candidate entity segment to obtain a sentence feature vector, and the character encoding network in the encoding module is used to process the candidate entity segment to obtain a character feature vector; the sentence feature vector and the character feature vector are concatenated into a target feature vector, and the target feature vector is processed by the text encoding network in the encoding module to obtain a text feature vector; and attention processing is performed on the text feature vector to obtain the candidate entity segment encoding vector corresponding to the candidate entity segment.
[0237] In an optional embodiment, the acquisition module 402 is further configured to:
[0238] The candidate entity segment vector is input into the event type extraction model for classification processing to obtain the event type label corresponding to the candidate entity segment; the event type label is converted to obtain the event type label vector.
[0239] In an optional embodiment, the entity processing module 404 is further configured to:
[0240] The candidate entity fragment encoding vector is input into the entity recognition model, and the candidate entity encoding vector is obtained by performing entity recognition processing on the candidate entity fragment encoding vector; the candidate entity encoding vector is scored by the feedforward neural network in the entity recognition model to obtain the candidate entity score corresponding to the candidate entity encoding vector.
[0241] In an optional embodiment, the trigger word extraction module 406 is further configured to:
[0242] The candidate entity coding vector and the candidate entity score are input into the trigger word extraction model, and the candidate entity coding vector is pruned according to the parameters set by the trigger word extraction model to obtain a first recognition pruned coding vector; a first target recognition pruned coding vector is determined based on the candidate entity score and the first recognition pruned coding vector, and the first target recognition pruned coding vector is predicted according to the trigger word extraction model to obtain the target event trigger word.
[0243] In an optional embodiment, the trigger word extraction module 406 is further configured to:
[0244] The first target recognition pruned coding vector is input into the trigger word extraction model, and the first label vector is generated by encoding the classification label of the first target recognition pruned coding vector; the target event trigger word coding vector is determined based on the first label vector and the first target recognition pruned coding vector, and the target event trigger word is output through the trigger word extraction model.
[0245] In an optional embodiment, the element extraction module 408 is further configured to:
[0246] The first target recognition pruned coding vector is classified and processed by the trigger word extraction model to obtain the event type label vector corresponding to the first target recognition pruned coding vector.
[0247] In an optional embodiment, the element extraction module 408 is further configured to:
[0248] The candidate entity coding vector, the candidate entity score and the event type label vector are input into the element extraction model, and the candidate entity coding vector is pruned according to the parameters set by the element extraction model to obtain a second recognition pruned coding vector; a second target recognition pruned coding vector is determined based on the candidate entity score and the second recognition pruned coding vector, and the second target recognition pruned coding vector and the event type label vector are spliced to obtain a spliced coding vector; the spliced coding vector is predicted by the element extraction model to obtain the target event element in the candidate entity segment.
[0249] In an optional embodiment, the element extraction module 408 is further configured to:
[0250] Based on the concatenated coding vector and the classification label of the concatenated coding vector, an initial element coding vector is generated; the initial element coding vector is classified and predicted to obtain an intermediate element coding vector, and the intermediate element coding vector is scored through the feedforward neural network in the element extraction model; a target element coding vector is obtained based on the scoring result and the intermediate element coding vector, and the target element coding vector is processed through the output layer in the element extraction model to output the target event element.
[0251] In an optional embodiment, the element extraction module 408 is further configured to:
[0252] A weight score is generated based on the scoring result of the intermediate element coding vector, and attention processing is performed on the element extraction coding vector corresponding to the intermediate element coding vector in sequence based on the weight score to obtain an intermediate vector; gating processing is performed based on the intermediate vector and the element extraction coding vector corresponding to the intermediate element coding vector to obtain a gated vector; re-encoding is performed according to the gated vector, the intermediate vector and the element extraction coding vector corresponding to the intermediate element coding vector to generate a re-encoded updated coding vector; the target element coding vector is generated based on the updated coding vector and the classification label of the updated coding vector.
[0253] In an optional embodiment, the element extraction module 408 is further configured to:
[0254] The classification labels of the concatenated coding vector are encoded to generate a second label vector; the second label vector and the concatenated coding vector are integrated, and the initial element coding vector is generated according to the integration result.
[0255] In an optional embodiment, the element extraction module 408 is further configured to:
[0256] The classification label of the spliced coding vector is encoded to generate a second label vector; based on the position of the second target recognition pruning coding vector in the candidate entity fragment, the semantic vector corresponding to the spliced coding vector is determined; the semantic vector, the second label vector and the spliced coding vector are integrated, and the initial element coding vector is generated according to the integration result.
[0257] In an optional embodiment, the event processing device further includes:
[0258] The event classification module is configured to use the context information of the candidate entity fragment corresponding to the semantic identification bit of the encoding module as an event classification task.
[0259] In an optional embodiment, the entity recognition model, the trigger word extraction model and the element extraction model share a feedforward neural network for scoring.
[0260] The event processing device provided in the present application, after obtaining the candidate entity fragment, will determine the candidate entity fragment encoding vector corresponding to the candidate entity fragment, and then identify and score the entity fragment encoding vector through the entity recognition model to obtain the candidate entity encoding vector and the candidate entity score. At this time, the candidate entity encoding vector and the candidate entity score are input into the trigger word extraction model for processing, and the target event trigger word in the candidate entity fragment is extracted. At the same time, the candidate entity encoding vector, the candidate entity score and the event type label vector are input into the element extraction model for processing, and the target event element in the candidate entity fragment is extracted, thereby completing the event extraction task in the candidate entity fragment. By introducing the classification label of the trigger word when extracting the element, not only the event extraction efficiency can be improved, but also the influence of the error on the two extraction tasks can be avoided, which effectively improves the accuracy and efficiency of the multi-task model when performing event extraction.
[0261] The above is a schematic scheme of an event processing device of the present embodiment. It should be noted that the technical scheme of the event processing device and the technical scheme of the event processing method described above belong to the same concept. For details not described in detail in the technical scheme of the event processing device, please refer to the description of the technical scheme of the event processing method described above. In addition, each component in the device embodiment should be understood as a functional module that must be established to implement each step of the program flow or each step of the method, and each functional module is not an actual functional division or separation definition. The device claim defined by such a group of functional modules should be understood as a functional module architecture that mainly implements the solution through the computer program recorded in the specification, and should not be understood as a physical device that mainly implements the solution through hardware.
[0262] Figure 5 A flow chart of a model training method provided according to an embodiment of the present application is shown, which specifically includes the following steps:
[0263] Step S502: Obtain a sample candidate entity pair and a sample event type label vector, and determine a sample candidate entity encoding vector and a sample candidate entity score of the sample candidate entity pair through an entity recognition model.
[0264] Step S504: input the sample candidate entity encoding vector and the sample candidate entity score into a trigger word extraction model for processing to obtain a sample event trigger word.
[0265] Step S506: input the sample candidate entity encoding vector, the sample candidate entity score and the sample event type label vector into an element extraction model for processing to obtain a sample event element.
[0266] Step S508, based on the sample event trigger word and the sample event element, respectively determine the loss values of the entity recognition model, the trigger word extraction model and the element extraction model, and train the entity recognition model, the trigger word extraction model and the element extraction model.
[0267] Corresponding to the above method embodiment, the present application also provides a model training device embodiment, Figure 6 FIG. 1 is a schematic diagram showing the structure of a model training device provided by an embodiment of the present application. Figure 6 As shown, the device comprises:
[0268] The sample acquisition module 602 is configured to acquire a sample candidate entity pair and a sample event type label vector, and determine a sample candidate entity encoding vector and a sample candidate entity score of the sample candidate entity pair through an entity recognition model;
[0269] A first processing module 604 is configured to input the sample candidate entity encoding vector and the sample candidate entity score into a trigger word extraction model for processing to obtain a sample event trigger word; and
[0270] The second processing module 606 is configured to input the sample candidate entity encoding vector, the sample candidate entity score and the sample event type label vector into an element extraction model for processing to obtain a sample event element;
[0271] The training module 608 is configured to respectively determine the loss values of the entity recognition model, the trigger word extraction model and the element extraction model based on the sample event trigger word and the sample event element, and train the entity recognition model, the trigger word extraction model and the element extraction model.
[0272] The above is a schematic scheme of a model training device of the present embodiment. It should be noted that the technical scheme of the model training device and the technical scheme of the above-mentioned model training method belong to the same concept. For details not described in detail in the technical scheme of the model training device, please refer to the description of the technical scheme of the above-mentioned model training method. In addition, each component in the device embodiment should be understood as a functional module that must be established to implement each step of the program flow or each step of the method, and each functional module is not an actual functional division or separation definition. The device claim defined by such a group of functional modules should be understood as a functional module architecture that mainly implements the solution through the computer program recorded in the specification, and should not be understood as a physical device that mainly implements the solution through hardware.
[0273] Figure 7The structure block diagram of a computing device 700 provided according to an embodiment of the present application is shown. The components of the computing device 700 include but are not limited to a memory 710 and a processor 720. The processor 720 is connected to the memory 710 via a bus 730, and the database 750 is used to store data.
[0274] The computing device 700 also includes an access device 740 that enables the computing device 700 to communicate via one or more networks 760. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 740 may include one or more of any type of network interface (e.g., a network interface card (NIC)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0275] In one embodiment of the present application, the above components of the computing device 700 and Figure 7 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 7 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as needed.
[0276] The computing device 700 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 700 may also be a mobile or stationary server.
[0277] The processor 720 is used to execute the following computer executable instructions:
[0278] Obtain a candidate entity segment, and determine a candidate entity segment encoding vector and an event type label vector corresponding to the candidate entity segment;
[0279] Performing entity recognition and scoring processing on the candidate entity segment encoding vector through an entity recognition model to obtain a candidate entity encoding vector and a candidate entity score corresponding to the candidate entity encoding vector;
[0280] Inputting the candidate entity encoding vector and the candidate entity score into a trigger word extraction model for pruning and prediction processing to obtain the target event trigger word in the candidate entity segment;
[0281] The candidate entity encoding vector, the candidate entity score and the event type label vector are input into the element extraction model for pruning, and the pruning result and the event type label vector are concatenated and then predicted to obtain the target event element in the candidate entity segment.
[0282] or,
[0283] Obtain a sample candidate entity pair and a sample event type label vector, and determine a sample candidate entity encoding vector and a sample candidate entity score of the sample candidate entity pair through an entity recognition model;
[0284] Inputting the sample candidate entity encoding vector and the sample candidate entity score into a trigger word extraction model for processing to obtain a sample event trigger word; and
[0285] Inputting the sample candidate entity encoding vector, the sample candidate entity score and the sample event type label vector into an element extraction model for processing to obtain a sample event element;
[0286] Based on the sample event trigger words and the sample event elements, the loss values of the entity recognition model, the trigger word extraction model and the element extraction model are respectively determined, and the entity recognition model, the trigger word extraction model and the element extraction model are trained.
[0287] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical schemes of the above two methods belong to the same concept, and the details of the technical scheme of the computing device that are not described in detail can be found in the description of the technical schemes of the above two methods.
[0288] An embodiment of the present application further provides a computer-readable storage medium storing computer instructions, which are used when executed by a processor to:
[0289] Obtain a candidate entity segment, and determine a candidate entity segment encoding vector and an event type label vector corresponding to the candidate entity segment;
[0290] Performing entity recognition and scoring processing on the candidate entity segment encoding vector through an entity recognition model to obtain a candidate entity encoding vector and a candidate entity score corresponding to the candidate entity encoding vector;
[0291] Inputting the candidate entity encoding vector and the candidate entity score into a trigger word extraction model for pruning and prediction processing to obtain the target event trigger word in the candidate entity segment;
[0292] The candidate entity encoding vector, the candidate entity score and the event type label vector are input into the element extraction model for pruning, and the pruning result and the event type label vector are concatenated and then predicted to obtain the target event element in the candidate entity segment.
[0293] or,
[0294] Obtain a sample candidate entity pair and a sample event type label vector, and determine a sample candidate entity encoding vector and a sample candidate entity score of the sample candidate entity pair through an entity recognition model;
[0295] Inputting the sample candidate entity encoding vector and the sample candidate entity score into a trigger word extraction model for processing to obtain a sample event trigger word; and
[0296] Inputting the sample candidate entity encoding vector, the sample candidate entity score and the sample event type label vector into an element extraction model for processing to obtain a sample event element;
[0297] Based on the sample event trigger words and the sample event elements, the loss values of the entity recognition model, the trigger word extraction model and the element extraction model are respectively determined, and the entity recognition model, the trigger word extraction model and the element extraction model are trained.
[0298] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical schemes of the above two methods belong to the same concept, and the details of the technical scheme of the storage medium that are not described in detail can be found in the description of the technical schemes of the above two methods.
[0299] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0300] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0301] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0302] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0303] The preferred embodiments of the present application disclosed above are only used to help explain the present application. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many changes and variations can be made according to the content of the present application. The present application selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present application, so that those skilled in the art can understand and use the present application well. The present application is limited only by the claims and their full scope and equivalents.
Claims
1. An event handling method, It is characterized in that include: Obtaining a candidate entity segment, and determining a candidate entity segment encoding vector corresponding to the candidate entity segment, wherein the candidate entity segment encoding vector is obtained by introducing an attention mechanism to process a text feature vector, wherein the attention mechanism is used to extract attribute information related to the source text from the information of the source text as an auxiliary; Performing entity recognition and scoring processing on the candidate entity segment encoding vector through an entity recognition model to obtain a candidate entity encoding vector and a candidate entity score corresponding to the candidate entity encoding vector; Inputting the candidate entity encoding vector and the candidate entity score into a trigger word extraction model for pruning and prediction processing to obtain the target event trigger word in the candidate entity segment; Determine the event type label vector corresponding to the candidate entity segment, and input the candidate entity encoding vector, the candidate entity score and the event type label vector into the element extraction model for pruning processing, and concatenate the pruning processing result and the event type label vector for prediction processing to obtain the target event element in the candidate entity segment.
2. The method according to claim 1, It is characterized in that Before the step of obtaining the candidate entity fragment is performed, the method further includes: Acquire a sentence to be processed, and perform word segmentation processing on the sentence to be processed to obtain multiple word units; Accordingly, obtaining the candidate entity fragment includes: The candidate entity segment is determined based on at least one of the word units.
3. The method according to claim 1, It is characterized in that The determining the candidate entity segment encoding vector corresponding to the candidate entity segment includes: Inputting the candidate entity segment into an encoding module, processing the candidate entity segment through a sentence encoding network in the encoding module to obtain a sentence feature vector, and processing the candidate entity segment through a character encoding network in the encoding module to obtain a character feature vector; splicing the sentence feature vector and the character feature vector into a target feature vector, and processing the target feature vector through a text encoding network in the encoding module to obtain a text feature vector; Attention processing is performed on the text feature vector to obtain the candidate entity segment encoding vector corresponding to the candidate entity segment.
4. The method according to claim 1, It is characterized in that The step of performing entity recognition processing and scoring processing on the candidate entity segment encoding vector by an entity recognition model to obtain a candidate entity encoding vector and a candidate entity score corresponding to the candidate entity encoding vector includes: Inputting the candidate entity segment encoding vector into the entity recognition model, and performing entity recognition processing on the candidate entity segment encoding vector to obtain the candidate entity encoding vector; The candidate entity encoding vector is scored by a feedforward neural network in the entity recognition model to obtain the candidate entity score corresponding to the candidate entity encoding vector.
5. The method according to claim 1, It is characterized in that The step of inputting the candidate entity encoding vector and the candidate entity score into a trigger word extraction model for pruning and prediction processing to obtain a target event trigger word in the candidate entity segment includes: Inputting the candidate entity encoding vector and the candidate entity score into the trigger word extraction model, and pruning the candidate entity encoding vector according to the parameters set by the trigger word extraction model to obtain a first recognition pruned encoding vector; A first target recognition pruned coding vector is determined based on the candidate entity score and the first recognition pruned coding vector, and the first target recognition pruned coding vector is predicted and processed through the trigger word extraction model to obtain the target event trigger word.
6. The method according to claim 5, It is characterized in that The step of performing prediction processing on the first target recognition pruning coding vector by using the trigger word extraction model to obtain the target event trigger word includes: Inputting the first target recognition pruned coding vector into the trigger word extraction model, and encoding the classification label of the first target recognition pruned coding vector to generate a first label vector; A target event trigger word encoding vector is determined based on the first label vector and the first target recognition pruning encoding vector, and the target event trigger word is output through the trigger word extraction model.
7. The method according to claim 5, It is characterized in that The determining the event type label vector corresponding to the candidate entity segment includes: The first target recognition pruned coding vector is classified and processed by the trigger word extraction model to obtain the event type label vector corresponding to the first target recognition pruned coding vector.
8. The method according to claim 1, It is characterized in that The step of inputting the candidate entity encoding vector, the candidate entity score and the event type label vector into the element extraction model for pruning, and performing prediction processing on the pruning result and the event type label vector after splicing to obtain the target event element in the candidate entity segment includes: Inputting the candidate entity encoding vector, the candidate entity score and the event type label vector into the element extraction model, and performing pruning processing on the candidate entity encoding vector according to the parameters set by the element extraction model to obtain a second recognition pruned encoding vector; Determine a second target recognition pruned coding vector based on the candidate entity score and the second recognition pruned coding vector, and concatenate the second target recognition pruned coding vector and the event type label vector to obtain a concatenated coding vector; The concatenated coding vector is predicted and processed by the element extraction model to obtain the target event element in the candidate entity segment.
9. The method according to claim 8, It is characterized in that The predicting process of the concatenated coding vector by the element extraction model to obtain the target event element in the candidate entity segment includes: generating an initial element encoding vector based on the concatenated encoding vector and the classification label of the concatenated encoding vector; Classify and predict the initial element encoding vector to obtain an intermediate element encoding vector, and score the intermediate element encoding vector through a feedforward neural network in the element extraction model; A target element encoding vector is obtained according to the scoring processing result and the intermediate element encoding vector, the target element encoding vector is processed through the output layer in the element extraction model, and the target event element is output.
10. The method according to claim 9, It is characterized in that The step of obtaining the target element encoding vector according to the scoring processing result and the intermediate element encoding vector includes: Generate a weight score based on the scoring result of the intermediate element encoding vector, and perform attention processing on the element extraction encoding vector corresponding to the intermediate element encoding vector in sequence based on the weight score to obtain an intermediate vector; Perform gating processing on the element extraction coding vector corresponding to the intermediate vector and the intermediate element coding vector to obtain a gating vector; Re-encode the element extraction code vector corresponding to the gating vector, the intermediate vector, and the intermediate element code vector to generate a re-encoded updated code vector; The target element encoding vector is generated based on the updated encoding vector and the classification label of the updated encoding vector.
11. The method according to claim 9, It is characterized in that The step of generating an initial element encoding vector based on the concatenated encoding vector and the classification label of the concatenated encoding vector comprises: Encoding the classification labels of the concatenated coding vector to generate a second label vector; The second label vector and the concatenated encoding vector are integrated, and the initial element encoding vector is generated according to the integration result.
12. The method according to claim 9, It is characterized in that The step of generating an initial element encoding vector based on the concatenated encoding vector and the classification label of the concatenated encoding vector comprises: Encoding the classification labels of the concatenated coding vector to generate a second label vector; Determine a semantic vector corresponding to the concatenated encoding vector based on a position of the second target recognition pruned encoding vector in the candidate entity segment; The semantic vector, the second label vector and the concatenated encoding vector are integrated, and the initial element encoding vector is generated according to the integration result.
13. The method according to claim 3, It is characterized in that The method further comprises: The context information of the candidate entity fragment corresponding to the semantic identification position of the encoding module is used as an event classification task.
14. The method according to claim 3 or 9, It is characterized in that The entity recognition model, the trigger word extraction model and the element extraction model share a feedforward neural network for scoring.
15. An event processing device, It is characterized in that include: an acquisition module, configured to acquire a candidate entity segment and determine a candidate entity segment encoding vector corresponding to the candidate entity segment, wherein the candidate entity segment encoding vector is obtained by introducing an attention mechanism into a text feature vector, wherein the attention mechanism is used to extract attribute information related to the source text from the information of the source text as an auxiliary; An entity processing module is configured to perform entity recognition processing and scoring processing on the candidate entity segment encoding vector through an entity recognition model to obtain a candidate entity encoding vector and a candidate entity score corresponding to the candidate entity encoding vector; A trigger word extraction module is configured to input the candidate entity encoding vector and the candidate entity score into a trigger word extraction model for pruning and prediction processing to obtain a target event trigger word in the candidate entity segment; The element extraction module is configured to determine the event type label vector corresponding to the candidate entity segment, and input the candidate entity encoding vector, the candidate entity score and the event type label vector into the element extraction model for pruning, and perform prediction processing on the pruning result and the event type label vector after splicing to obtain the target event element in the candidate entity segment.
16. A model training method, It is characterized in that include: Obtaining a sample candidate entity pair and a sample event type label vector, and determining a sample candidate entity encoding vector and a sample candidate entity score of the sample candidate entity pair through an entity recognition model, wherein before determining the candidate entity encoding vector, an attention mechanism is introduced through a text feature vector to process text features, and the attention mechanism is used to extract attribute information related to the source text from the information of the source text as an auxiliary; Inputting the sample candidate entity encoding vector and the sample candidate entity score into a trigger word extraction model for processing to obtain a sample event trigger word; and Inputting the sample candidate entity encoding vector, the sample candidate entity score and the sample event type label vector into an element extraction model for processing to obtain a sample event element; Based on the sample event trigger words and the sample event elements, the loss values of the entity recognition model, the trigger word extraction model and the element extraction model are respectively determined, and the entity recognition model, the trigger word extraction model and the element extraction model are trained.
17. A model training device, It is characterized in that include: A sample acquisition module is configured to acquire a sample candidate entity pair and a sample event type label vector, and determine a sample candidate entity encoding vector and a sample candidate entity score of the sample candidate entity pair through an entity recognition model, wherein before determining the candidate entity encoding vector, an attention mechanism is introduced through a text feature vector to process text features, and the attention mechanism is used to extract attribute information related to the source text from the information of the source text as an auxiliary; A first processing module is configured to input the sample candidate entity encoding vector and the sample candidate entity score into a trigger word extraction model for processing to obtain a sample event trigger word; and A second processing module is configured to input the sample candidate entity encoding vector, the sample candidate entity score and the sample event type label vector into an element extraction model for processing to obtain a sample event element; A training module is configured to determine the loss values of the entity recognition model, the trigger word extraction model and the element extraction model based on the sample event trigger word and the sample event element, respectively, and train the entity recognition model, the trigger word extraction model and the element extraction model.
18. A computing device, It is characterized in that include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of any one of the methods of claims 1 to 14 or 16.
19. A computer-readable storage medium storing computer instructions. It is characterized in that When the instruction is executed by a processor, the steps of the method described in any one of claims 1 to 14 or 16 are implemented.
