Event extraction method and related apparatus, electronic device, and storage medium
By using a fusion representation of pre-trained language models such as BERT and a dual extraction network in long texts to predict event arguments and coreference, the problem of multiple argument extraction is solved, and the accuracy and efficiency of event extraction are improved.
Patent Information
- Application Number
- CN202111650051.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2041-12-30
AI Technical Summary
Existing technologies are prone to extracting too many arguments when extracting events from long texts, which affects the extraction results.
By extracting the semantic representation of the text, semantic extraction is performed using a pre-trained language model such as BERT. The fusion representation of the first and second extraction networks is combined to perform argument prediction and coreference prediction, thereby optimizing the selection of candidate event arguments and reducing the problem of multiple argument extraction.
It improves the accuracy and efficiency of event extraction, reduces the problem of multiple arguments being extracted, and enhances the event extraction effect in long texts.
Smart Images

Figure CN114330366B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of natural language understanding technology, and in particular to an event extraction method and related apparatus, electronic device and storage medium. Background Technology
[0002] In recent years, artificial intelligence technology has flourished in the field of natural language understanding, and has been widely applied in all aspects of daily life and work, providing great convenience to people. For example, in customer service scenarios, various customer inquiries, complaints, and suggestions can be handled through telephone hotlines, helping to improve customer satisfaction. Furthermore, similar applications exist in other scenarios such as government services and business offices, which will not be listed here.
[0003] One typical application is extracting event-related content from text, such as event types, roles, and arguments. Based on this, an event description is generated, serving as a summary for tasks like customer service communication. However, in real-world scenarios, texts are typically quite long; a single conversation can last dozens of rounds. This often leads to issues like excessive argument extraction, impacting the effectiveness of event extraction. Therefore, improving event extraction efficiency is a pressing issue. Summary of the Invention
[0004] The main technical problem addressed by this application is to provide an event extraction method and related apparatus, electronic devices, and storage media that can improve the event extraction effect and minimize problems such as excessive argument extraction, even when dealing with long texts.
[0005] To address the aforementioned technical problems, the first aspect of this application provides an event extraction method, comprising: extracting a semantic representation of a text; wherein the semantic representation includes the first character representation of each character in the text, and the text involves several event types; performing argument prediction on the text based on the semantic representation to obtain several candidate event arguments belonging to a target event role; wherein each event type corresponds to several candidate event roles, and the target event role is selected from the several candidate event roles; performing coreference prediction on the text based on the semantic representation of the text and the semantic representation of the arguments of each candidate event argument to obtain a set of coreference arguments for each candidate event argument; selecting at least one candidate event argument as the target event argument for the target event role based on the set of reference arguments and the set of coreference arguments for each candidate event argument; wherein the set of reference arguments for the candidate event argument includes other candidate event arguments besides the candidate event argument.
[0006] To address the aforementioned technical problems, a second aspect of this application provides an event extraction device, comprising: a text semantic extraction module, an event argument prediction module, a coreference argument prediction module, and a target argument optimization module. The text semantic extraction module is used to extract the text semantic representation of a text; wherein the text semantic representation includes the first character representation of each character in the text, and the text involves several event types; the event argument prediction module is used to perform argument prediction on the text based on the text semantic representation to obtain several candidate event arguments belonging to the target event role; wherein each event type is respectively optimized for... There should be several candidate event roles, and the target event role is selected from these candidate event roles. The coreference argument prediction module is used to perform coreference prediction on the text based on the text semantic representation and the argument semantic representation of each candidate event argument, respectively, to obtain the coreference argument set of each candidate event argument. The target argument optimization module is used to select at least one candidate event argument as the target event argument of the target event role based on the reference argument set and the coreference argument set of each candidate event argument, respectively. The reference argument set of the candidate event argument includes other candidate event arguments besides the candidate event argument.
[0007] To address the aforementioned technical problems, a third aspect of this application provides an electronic device including a memory and a processor coupled to each other. The memory stores program instructions, and the processor executes the program instructions to implement the event extraction method described in the first aspect.
[0008] To address the aforementioned technical problems, a fourth aspect of this application provides a computer-readable storage medium storing program instructions executable by a processor, the program instructions being used to implement the event extraction method described in the first aspect.
[0009] The above scheme extracts the semantic representation of the text, which includes the first character representation of each character in the text. The text involves several event types. Based on this, argument prediction is performed on the text using the semantic representation to obtain several candidate event arguments belonging to the target event role. Each event type corresponds to several candidate event roles, and the target event role is selected from these candidate roles. Coreference prediction is then performed on the text based on both the semantic representation and the argument semantic representation of each candidate event argument to obtain a set of coreference arguments for each candidate event argument. Finally, based on each candidate event argument... The event extraction process involves using a set of reference arguments and a set of core reference arguments for each candidate event argument. At least one candidate event argument is selected as the target event argument for the target event role. The set of reference arguments for each candidate event argument includes other candidate event arguments besides the candidate event argument itself. In other words, during the event extraction process, the set of core reference arguments for each candidate event argument can be predicted. For each candidate event argument, based on its set of core reference arguments and the set of reference arguments, it is determined whether it is the target event argument for the target event role. This allows for the optimization of the event argument extraction results through core reference relationships, thereby greatly reducing problems such as multiple argument extraction and improving the event extraction effect. Attached Figure Description
[0010] Figure 1 This is a flowchart illustrating an embodiment of the event extraction method of this application;
[0011] Figure 2 yes Figure 1 A flowchart illustrating an embodiment of step S11;
[0012] Figure 3 yes Figure 1 A flowchart illustrating an embodiment of step S12;
[0013] Figure 4 This is a schematic diagram of the framework of an embodiment of the event extraction device of this application;
[0014] Figure 5 This is a schematic diagram of the framework of an embodiment of the electronic device of this application;
[0015] Figure 6 This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium of this application. Detailed Implementation
[0016] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0017] In the following description, specific details such as particular system architectures, interfaces, and technologies are presented for illustrative purposes rather than for limiting purposes, in order to provide a thorough understanding of this application.
[0018] In this paper, the terms "system" and "network" are often used interchangeably. The term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this paper means two or more.
[0019] Please see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the event extraction method of this application.
[0020] Specifically, this may include the following steps:
[0021] Step S11: Extract the semantic representation of the text.
[0022] In this embodiment of the disclosure, the semantic representation of the text includes the first character representation of each character in the text, and the text involves several event types. It should be noted that the text referred to in the embodiments of this application is not limited to the text generated by speech recognition of voice calls, but can also be the text generated during text interaction, and is not limited here.
[0023] In one implementation scenario, semantic extraction of text can be performed using pre-trained language models such as BERT (Bidirectional Encoder Representation from Transformers), resulting in a semantic representation of the text. For details on the extraction process, please refer to the technical details of pre-trained language models such as BERT; these will not be elaborated upon here.
[0024] In one implementation scenario, to further improve the accuracy of text semantic representation, the text semantic representation can be obtained by fusing the first text representation extracted by the first extraction network and the second extraction network, respectively. The first extraction network and the second extraction network are jointly trained based on the relative difference between the first and second sample representations extracted from the sample text. It should be noted that the relative difference can be measured using relative entropy, such as KL divergence, which can be referred to in the relevant description below and will not be elaborated here. In addition, the first extraction network and the second extraction network can use the same or similar network structures, and their network parameters are not exactly the same or completely different. For example, two BERTs with different network parameters can be used as the first extraction network and the second extraction network, respectively. The above method extracts semantics from the text by using a first extraction network and a second extraction network respectively, resulting in a first text representation and a second text representation. The first text representation and the second text representation are then fused to obtain the text semantic representation. Furthermore, the first extraction network and the second extraction network are jointly trained based on the relative differences between the first sample representation and the second sample representation extracted from the sample text respectively. Therefore, the robustness of the text semantic representation can be improved, which is beneficial to improving the robustness of subsequent event extraction. This ensures that even if the text is slightly adjusted without affecting the semantics, the event extraction result can be kept as consistent as possible with the original extraction result.
[0025] In one implementation scenario, a text may involve one event type, or it may involve two, three, four, or so on; there is no limitation here. For example, a text may involve both the event type "consumer dispute" and the event type "fighting." Other situations can be deduced similarly, and will not be listed in detail here.
[0026] In one implementation scenario, the various event types involved in a text can be included in a preset event set. This preset event set can include unknown events and several preset events, with each unknown event and preset event corresponding to its own candidate event roles. The candidate event roles for unknown events can be abstracted from the candidate event roles corresponding to each preset event. In other words, the candidate event roles for unknown events can be derived by removing roles specific to each preset event, thus obtaining general roles unrelated to each preset event, which can then be used as candidate event roles for unknown events. For example, candidate event roles for unknown events can include, but are not limited to, "time," "location," "organization / person," "related matters," and "related amounts," etc., without further limitation. This approach, where the text involves several event types included in a preset event set, which includes unknown events and several preset events, and each unknown event and preset event corresponding to its own candidate event roles, and the candidate event roles for unknown events are abstracted from the candidate event roles corresponding to each preset event, can accommodate unknown event types during the event extraction process, thus further improving the event extraction effect.
[0027] Step S12: Based on the semantic representation of the text, perform argument prediction in the text to obtain several candidate event arguments belonging to the target event role.
[0028] In this embodiment of the disclosure, each event type corresponds to several candidate event roles, and the target event role is selected from these candidate event roles. For example, taking the event type "consumer dispute" as an example, it may correspond to the following candidate event roles: "consumer dispute - time of occurrence," "consumer dispute - location of occurrence," "consumer dispute - complainant," "consumer dispute - matters involved," "consumer dispute - amount," etc., without limitation. Other event types can be deduced similarly, and will not be listed individually here.
[0029] In one implementation scenario, each time, one can select an unselected candidate event role from several candidate event roles as the target event role. For example, still using the event type "consumer dispute" as an example, the first time, one can select the candidate event role "consumer dispute - time of occurrence" as the target event role. After extracting the target event arguments for this target event role, the second time, one can select the candidate event role "consumer dispute - location of occurrence" as the target event role. After extracting the target event arguments for this target event role, the third time, one can select the candidate event role "consumer dispute - complainant" as the target event role, and so on, until all candidate event roles have been selected. It should be noted that when the text involves multiple event types, one can first select an unselected event type, and then select several candidate event roles corresponding to that event type as target event roles to extract the target event arguments for each target event role. After extracting the target event arguments for each candidate event role corresponding to that event type, one can then select another unselected event type and extract arguments under that event type, and so on, until all event types have completed argument extraction.
[0030] In one implementation scenario, based on the target event role, argument extraction can be performed on the text using methods such as Machine Reading Comprehension (MRC) to obtain several candidate event arguments for that target event role.
[0031] In one implementation scenario, unlike the aforementioned methods, argument prediction can be performed based on both static and dynamic description texts of the target event role. As mentioned earlier, during event extraction, target event arguments for each candidate event role are predicted sequentially. The specific process of argument prediction based on static and dynamic role description texts can be found in the following descriptions and will not be elaborated upon here. It should be noted that the static role description text can be pre-constructed based on words related to the target event role, while the dynamic role description text can be updated using the event type's dynamic description template based on the predicted target event arguments. This method, performing argument prediction based on both static and dynamic role description texts of the target event role, incorporates static and dynamic constraints during the event extraction process, which helps to further reduce issues such as multiple argument extractions and improves the event extraction effect.
[0032] In a specific implementation scenario, for static character description text, words with high relevance to the character can be obtained through statistical analysis from a large amount of call text. Combining these words yields the static character description text for that character. It should be noted that the relevance can be measured by the co-occurrence frequency of words and characters, and the specificity of the words; the higher the co-occurrence frequency and specificity, the higher the relevance. Please refer to Table 1, which uses the event type "consumer dispute" as an example to provide exemplary static character description texts for various candidate event characters corresponding to the event type "consumer dispute".
[0033] Table 1. Static role description text for each candidate event role corresponding to the event type "Consumer Dispute".
[0034]
[0035] In a specific implementation scenario, the event dynamic description template for an event type includes preset template text for each candidate event role of the event type. The dynamic role description text is obtained by replacing the preset template text in the event dynamic description template with the target event arguments that have been predicted and belong to the same candidate event role. Please refer to Table 2, which still uses the event type "Consumer Dispute" as an example to provide an exemplary event dynamic description template for the event type "Consumer Dispute". As shown in Table 2, the preset template text for each candidate event role is marked with a preset symbol (e.g., @). For example, the preset template text for the candidate event role "Consumer Dispute - Purchase Time" is "@Purchase Time", or the preset template text for the candidate event role "Consumer Dispute - Purchase Location" is "@Consumer Dispute Location". Other examples can be deduced similarly and will not be listed here. For a text involving the event type "consumer dispute" such as "A membership card purchased for 5000 yuan has resulted in a consumer dispute with XX store in XX shopping mall, and a refund is requested," the first prediction can select the candidate argument role "consumer dispute - purchase time" as the target argument role. Since this is the first prediction, there are no predicted target event arguments yet. In this case, the event dynamic description template can be directly used as the dynamic role description text. Similarly, the third prediction of the candidate event role "consumer dispute - location of consumer dispute" will use "XX shopping mall" as the target event argument. Based on this, in the fourth prediction of the candidate event role "consumer dispute - the reported party," the event... In the dynamic description template, the pre-set template text "@Consumer Dispute Location" for the candidate event role "Consumer Dispute - The Accused" is replaced with "XX Shopping Mall". Similarly, in the fourth prediction of the candidate event role "Consumer Dispute - The Accused", the target event argument is "XX Shop". Based on this, in the fifth prediction of the candidate event role "Consumer Dispute - Amount Involved", the pre-set template text "@The Accused" for the candidate event role "Consumer Dispute - The Accused" and the pre-set template text "@Consumer Dispute Location" for the candidate event role "Consumer Dispute - The Accused" can be replaced with "XX Shop" and "XX Shopping Mall" respectively. And so on, without further examples.
[0036] Table 2. Event Dynamic Description Template for Event Type "Consumer Dispute"
[0037]
[0038] It should be noted that during replacement, the event type corresponding to the event dynamic description template of the replaced preset template text must be consistent with the event type of the candidate event role corresponding to the target event argument. In the above method, the event dynamic description template of the event type includes the preset template texts of each candidate event role of the event type; the dynamic role description text is obtained by replacing the preset template text in the event dynamic description template with the target event argument that has been predicted and belongs to the same candidate event role. Therefore, the dynamic role description text can be dynamically updated with each argument prediction, allowing the argument results of other roles predicted in the past to serve as additional related knowledge and constraints. This helps to minimize the problem of multiple argument extractions and improves the argument extraction effect.
[0039] Step S13: Based on the semantic representation of the text and the semantic representation of each candidate event argument, perform coreference prediction on the text to obtain the coreference argument set of each candidate event argument.
[0040] It should be noted that coreference mainly refers to two nouns (including pronouns, noun phrases, etc.) pointing to the same reference point in the real world. Furthermore, this reference can still be valid even without context. For example, "end of June" and "June 30th" point to the same reference point in the real world; or, "Hefei" and "capital of Anhui Province" point to the same reference point in the real world, and so on. Further examples will not be provided here.
[0041] Specifically, predictions can be made based on the semantic representation of the text and the semantic representation of the arguments of candidate event arguments to obtain the coreference prediction results of each character in the text. Each character's coreference prediction result includes the probability that the character belongs to the start and end characters of the coreference arguments of the candidate event arguments. Based on this, the set of coreference arguments of the candidate event arguments can be obtained. This method, by predicting the coreference prediction results of each character, and including the probability that the character belongs to the start and end characters of the coreference arguments of the candidate event arguments, can improve the accuracy of coreference prediction.
[0042] In one implementation scenario, to improve the efficiency of extracting argument semantic representations, an argument semantic extraction network can be pre-trained. This network can include, but is not limited to, convolutional neural networks, etc., and is not restricted here. It should be noted that candidate event arguments can contain several characters. For ease of description, the m-th candidate event argument under the k-th candidate event role can be denoted as... Furthermore, the i-th character in the m-th candidate event argument under the k-th candidate event role can be denoted as... When using a convolutional neural network to extract argument semantic representations, the argument semantic representation of the m-th candidate event argument under the k-th candidate event role. It can be represented as:
[0043]
[0044]
[0045] In the above formulas (1) and (2), This represents the text length of the m-th candidate event argument under the k-th candidate event role. This represents the encoded representation of the i-th character in the m-th candidate event argument under the k-th candidate event role.
[0046] In one implementation scenario, the document semantic representation can be used as the document representation for Machine Reading Comprehension (MRC), and the argument semantic representation of candidate event arguments can be used as the query representation for MRC. The query is then used to search the document for a specific segment that represents other arguments related to the candidate event arguments. For ease of description, let's take the m-th candidate event argument under the k-th candidate event role as an example. The argument semantic representation can be max-pooled along its length dimension to obtain a new argument semantic representation for that candidate event argument. Specifically, it can be expressed as:
[0047]
[0048] Based on this, the probability values of the start and end characters of the core reference arguments of the candidate event arguments can be predicted. and
[0049]
[0050]
[0051]
[0052]
[0053] In formulas (4) and (5) above, The network parameters representing machine reading comprehension can be adjusted during training. This represents the semantic representation of a text. This represents the probability that the i-th character in the text belongs to the starting character of the core argument of the candidate event argument. This represents the probability that the i-th character in the text belongs to the terminating character of the coreference argument of the candidate event argument. Furthermore, l 通 Indicates the length of the text in the chapter.
[0054] In one implementation scenario, arguments greater than the coreference threshold (e.g., 0) can be... and Candidate event arguments correspond to the character positions in the text. The starting and ending positions of the coreference arguments are determined. Based on this, for each starting position, the ending position that is closest to and following the starting position can be selected, and the text segment from the starting position to the selected ending position in the text is taken as the coreference arguments of the candidate event arguments. Thus, the set of obtained text segments can be taken as the set of coreference arguments of the candidate event arguments.
[0055] In one implementation scenario, during the training process of machine reading comprehension, the cross-entropy loss between the predicted start and end probabilities of coreference arguments and the actual start and end positions of coreference arguments can be calculated. coref :
[0056]
[0057] In the above formula (8), This flag determines whether the i-th character in the text is the starting position of the core reference argument of the m-th candidate event argument under the k-th candidate event role. If it is, the value is 1; otherwise, it is 0. This flag indicates whether the i-th character in the text is the termination position of the core reference argument of the m-th candidate event argument under the k-th candidate event role. If so, its value is 1; otherwise, it is 0. For the specific meaning of the above loss, please refer to the technical details of cross-entropy loss, which will not be elaborated here.
[0058] Step S14: Based on the reference argument set and core reference argument set of each candidate event argument, select at least one candidate event argument as the target event argument for the target event role.
[0059] In this embodiment of the disclosure, the reference argument set for candidate event arguments includes other candidate event arguments besides the candidate event arguments themselves. For ease of description, the m-th candidate event argument under the k-th candidate event role can be denoted as... In addition to the k-th candidate event role The set of other original candidate event arguments is the reference argument set.
[0060]
[0061] In the above formula (9), Let be the total number of candidate event arguments extracted under the k-th candidate event role. Let n be the nth candidate event argument extracted from the kth candidate event role. Furthermore, the set of coreference arguments of the mth candidate event argument under the kth candidate event role can be denoted as...
[0062]
[0063] In the above formula (10), Let be the total number of core reference arguments contained in the core reference argument set of the m-th candidate event arguments extracted under the k-th candidate event role. Let n be the nth coreference argument. Other cases can be deduced similarly, and will not be listed here.
[0064] In one implementation scenario, candidate event arguments can be selected to be retained or eliminated based on whether there is an intersection between the reference argument set and the coreference argument set of each candidate event argument. Based on the retained candidate event arguments, the target event argument for the target event role is obtained. Let's take the m-th candidate event argument under the k-th candidate event role as an example. For example, if its set of core arguments and the set of reference arguments If the set is not empty, then the m-th candidate event argument under the k-th candidate event role can be considered as... This candidate event argument has a coreference relationship with other arguments under this role, therefore it can be retained. As the argument of the target event; conversely, if its set of coreferenced arguments and the set of reference arguments If the set is empty, then the m-th candidate event argument under the k-th candidate event role can be considered as... Since this candidate event argument has no coreference with other arguments under this role, it can be eliminated. This is not used as the target event argument. Furthermore, the other candidate event arguments under the k-th candidate event role can be deduced similarly, and will not be listed here. Thus, all the retained candidate event arguments can be used as the target event arguments under the k-th candidate event role. The above method selects whether to retain or discard candidate event arguments based on whether there is an intersection between the reference argument set and the coreference argument set of each candidate event argument. Then, based on the retained candidate event arguments, the target event arguments for the target event role are obtained. Therefore, the existence of an intersection between the coreference argument set and the reference argument set determines whether to retain a candidate event argument as a target event argument, which greatly reduces the complexity of argument optimization and improves event extraction efficiency.
[0065] In one implementation scenario, if all candidate event arguments for a given event role are eliminated during argument optimization, at least one candidate event argument can be selected as the target event argument for the target event role based on the frequency of each argument's occurrence in the text. For example, the candidate event argument with the highest frequency can be selected as the target event argument for the target event role; alternatively, the frequencies can be sorted from high to low, and the candidate event arguments ranked at the top (e.g., the first two, first three, etc.) can be selected as the target event arguments for the target event role. This approach, by selecting at least one candidate event argument based on its frequency of occurrence in the text when all other candidate event arguments have been eliminated, can improve the robustness of argument extraction.
[0066] The above scheme extracts the semantic representation of the text, which includes the first character representation of each character in the text. The text involves several event types. Based on this, argument prediction is performed on the text using the semantic representation to obtain several candidate event arguments belonging to the target event role. Each event type corresponds to several candidate event roles, and the target event role is selected from these candidate roles. Coreference prediction is then performed on the text based on both the semantic representation and the argument semantic representation of each candidate event argument to obtain a set of coreference arguments for each candidate event argument. Finally, based on each candidate event argument... The event extraction process involves using a set of reference arguments and a set of core reference arguments for each candidate event argument. At least one candidate event argument is selected as the target event argument for the target event role. The set of reference arguments for each candidate event argument includes other candidate event arguments besides the candidate event argument itself. In other words, during the event extraction process, the set of core reference arguments for each candidate event argument can be predicted. For each candidate event argument, based on its set of core reference arguments and the set of reference arguments, it is determined whether it is the target event argument for the target event role. This allows for the optimization of the event argument extraction results through core reference relationships, thereby greatly reducing problems such as multiple argument extraction and improving the event extraction effect.
[0067] Please see Figure 2 , Figure 2 yes Figure 1 A flowchart illustrating an embodiment of step S11. Specifically, Figure 2 This is a schematic diagram illustrating the specific process when the semantic representation of a text is obtained by fusing the first text representation extracted by the first extraction network and the second text representation extracted by the second extraction network, respectively. Specifically, this disclosure may include the following steps:
[0068] Step S21: Perform named entity recognition on the text to obtain several candidate entities and the part-of-speech tag of each candidate entity.
[0069] In one implementation scenario, named entity recognition tools such as LAC (Lexical Analysis of Chinese) and Jieba segmentation can be used to perform named entity recognition on the text, obtaining several candidate entities and their parts of speech. It should be noted that the specific process of named entity recognition can be found in the technical details of the aforementioned named entity tools such as LAC and Jieba segmentation, and will not be repeated here. Furthermore, please refer to Table 3, which is a comparison table of parts of speech and proper noun category labels in one embodiment.
[0070] Table 3. Comparison Table of Parts of Speech and Proper Noun Category Tags in One Example
[0071]
[0072] Step S22: Based on the pre-labeling model and the part-of-speech tags of each candidate entity, perform argument prediction to obtain the predicted event arguments in the text.
[0073] In an implementation scenario, the pre-tagging model maliciously includes mapping rules for several preset event roles, and the mapping rules for each preset event role define the word types and / or words related to the preset event role. Exemplarily, for the tag "per" (i.e., personal name), the mapping rule "PER" -> "institutional person" can be defined, that is, the preset event role related to the word type "personal name" is "institutional person"; or, for the tag "loc" (i.e., place name), the mapping rule "LOC" -> "location" can be defined, that is, the preset event role related to the word type "place name" is "location"; or, for the tag "org" (i.e., institutional name), the mapping rule "ORG" -> "institutional person" can be defined, that is, the preset event role related to the word type "institutional name" is "institutional person"; or, for the tag "time" (i.e., time), the mapping rule "TIME" -> "time" can be defined, that is, the preset event role related to the word type "time" is "time"; or, for the tag "nz" (i.e., other proper names), the mapping rule "nz" -> "thing" can be defined, that is, the preset event role related to the word type "other proper names" is "thing"; or, for the tag "vn" (i.e., nominal verb), the mapping rule "vn" -> "thing" can be defined, that is, the preset event role related to the word type "nominal verb" is "thing"; or, for the tag "m" (i.e., quantifier), it can be defined that if the previous or subsequent segment contains "yuan | block | billion | ten thousand | thousand | hundred | ten | text", then it can be determined to be mapped to the preset event role "amount"; or, for the tag "m" (i.e., quantifier), it can be defined that if the previous or subsequent segment contains "person", then it can be determined to be mapped to the preset event role "number of people"; or, for the tag "m" (i.e., quantifier), it can be defined that if the previous or subsequent segment contains "year | month | day | hour | minute | second | week | week" and does not contain Chinese numerals, then it can be determined to be mapped to the preset event role "time"; or, if the segment contains "refund | return goods | exchange goods | refund deposit | exchange", then it can be determined to be mapped to the preset event role "consumption dispute - trigger word". Other situations can be deduced by analogy and will not be elaborated here one by one. In the above manner, the pre-tagging model includes mapping rules for several preset event roles, and the mapping rules for each preset event role define the word types and / or words related to the preset event role, which can introduce the prior knowledge of the general entity field into the subsequent event extraction process, assist the subsequent event extraction, and is beneficial to alleviating the problem of missed detection of event extraction arguments to a certain extent and improving the event extraction effect.
[0074] Step S23: Based on whether each character belongs to the estimated event argument, perform semantic extraction to obtain the text representation of the text passage.
[0075] Specifically, the input embedding representation of a character can be obtained based on its character embedding representation, positional embedding representation, and fragment embedding representation. When a character belongs to a predicted event argument, its fragment embedding representation is the first embedding representation (e.g., 1); when a character does not belong to a predicted event argument, its fragment embedding representation is the second embedding representation (e.g., 0). Then, semantic extraction is performed based on the input embedding representations of each character to obtain the document representation of the text. For example, BERT can be used as the network model for semantic extraction. It should be noted that BERT utilizes a multi-head attention mechanism, which, compared to LSTM (Long Short-Term Memory), has stronger semantic feature extraction and long-range capture capabilities. For ease of description, the document text can be denoted as... Among them, l 通 The text length of the passage is represented by each character. Its input embedding representation It can be represented as:
[0076]
[0077] In formula (11) above, WE represents character embedding, which can be obtained through character lookup table operation; PE represents positional embedding, which is determined by the position of the character in the text; and SE represents fragment embedding, which, as mentioned above, is determined by whether the character belongs to the predicted event argument. After this, the input embedding representations of all characters in the text can be concatenated to obtain the input embedding representation of the text.
[0078]
[0079] Based on this, the input of the aforementioned text can be embedded into the representation. Given L stacked blocks of a pre-trained language model such as BERT, where each block contains a self-attention layer and a feedforward network connection layer, the output of the l-th stacked block is... It can be represented as:
[0080]
[0081] In the above formula (13), FNN is a feedforward neural network, dropout is a random dropout network function, which means that during the training process of a deep learning network, a portion of neural network units are temporarily dropped from the network according to a certain probability, multihead(Q,K,V) is a multi-head attention function, where Q,K,V correspond to the attention query input, key input, and value input, respectively. The feedforward neural network sub-layer and multi-head attention sub-layer in each stack block have residual connection structures and normalization structures, and the output of the last stack block is used as the basis for the function. As a representation of the text, it can be represented as follows. For ease of description, it can be represented as... in, Let i represent the i-th character in the text.
[0082] In this embodiment of the disclosure, when semantic extraction is performed using a first extraction network, the document representation is a first document representation; when semantic extraction is performed using a second extraction network, the document representation is a second document representation. Furthermore, as mentioned above, the first and second extraction networks are jointly trained based on the relative differences between the first and second sample representations extracted from the sample text, respectively. That is, contrastive learning can be used to improve the robustness of the document representation. The standard procedure for contrastive learning is to treat the results obtained from the same sample through different data augmentation methods as positive sample pairs, and then use a loss function to narrow the distance between positive samples in order to improve semantic generalization.
[0083] In one implementation scenario, a first loss is obtained based on the relative entropy of the first sample representation relative to the second sample representation, and a second loss is obtained based on the relative entropy of the second sample representation relative to the first sample representation. Based on these two losses, the network parameters of both the first and second extraction networks can be adjusted. It should be noted that the relative entropy can be measured using loss functions such as KL divergence; details can be found in the relevant descriptions below, which will not be elaborated here. This method, by calculating the relative entropy between the first and second sample representations and using this to adjust the network parameters of both the first and second extraction networks, improves robustness through comparative learning. This ensures that even minor adjustments to local content within the text that do not affect semantics will not impact subsequent event extraction, thus improving the overall robustness of event extraction.
[0084] In one implementation scenario, a "dropout twice" approach can be used as a data augmentation technique to obtain different text representations of the same text input and treat them as positive sample pairs. Specifically, as mentioned earlier, two extraction networks with built-in dropout (i.e., the first extraction network and the second extraction network) can be used to obtain the first sample representation and the second sample representation, respectively. For ease of description, they can be denoted as... and Furthermore, to facilitate subsequent processing, the first and second sample representations can be normalized along the length dimension of the text to obtain the normalized first sample representation. Second Sample Representation
[0085]
[0086]
[0087] Based on this, the KL divergence measure can be used to measure the relative entropy of the first sample representation with respect to the second sample representation, thus obtaining the first loss. The KL divergence metric is used to measure the relative entropy of the second sample representation relative to the first sample representation, thus obtaining the second loss.
[0088]
[0089] In the above formulas (16) and (17), express The representation of the i-th character in the text. express The representation of the i-th character is used as the basis for averaging the two methods to obtain the final loss for contrastive learning. cont :
[0090]
[0091] Based on this, through the final loss cont Backpropagation mechanism, for the final loss contThe number of extraction networks is reduced, and the first and second extraction networks are optimized until training converges. After this, the first extraction network is used to extract the first chapter representation, and the second extraction network is used to extract the second chapter representation. This method, through named entity recognition of the text, obtains several candidate entities and their part-of-speech tags. Argument prediction is performed based on the pre-labeling model and the part-of-speech tags of the candidate entities to obtain the predicted event arguments in the text. Semantic extraction is then performed based on whether each character belongs to the predicted event argument to obtain the chapter representation. When semantic extraction is performed using the first extraction network, the chapter representation is the first chapter representation; when semantic extraction is performed using the second extraction network, the chapter representation is the second chapter representation. Therefore, prior knowledge from the entity domain can be introduced into the subsequent event extraction process to assist in the extraction, which helps to alleviate the problem of missed arguments in event extraction to a certain extent and improves the event extraction effect.
[0092] Step S24: Merge the first chapter representation and the second chapter representation to obtain the fused semantic representation of the chapter text.
[0093] In this embodiment of the disclosure, the fused semantic representation may include the second character representation of each character. For ease of description, the first chapter representation can be denoted as... The second chapter is denoted as Based on this, the first chapter can be represented The second chapter indicates The average document representation H is obtained by summing the data along the character dimension and then averaging the results. 通 To facilitate subsequent operations, the average chapter representation H can be further... 通 Average pooling is performed along the length dimension to obtain the fused semantic representation of the text.
[0094]
[0095]
[0096] In the above formula (20), H represents 通 The representation of the i-th character. Furthermore, after obtaining the fused semantic representation... This allows us to predict the types of events involved in a text. Specifically, it can integrate semantic representations. After a linear transformation, the vector dimension is changed from the original number to the total number of preset event types in the preset event set, resulting in a text classification representation.
[0097]
[0098] In the above formula (21), n h Representation fusion semantic representation The vector dimension, n event W represents the total number of preset event types in the preset event set. CLS This can be adjusted during training. Based on this, the text classification representation... The text can be normalized (e.g., using sigmoid) to the range of 0 to 1 to obtain a normalized text classification representation.
[0099]
[0100] In the above formula (22), the normalized text classification representation The vector dimension is the total number of events in the preset event set, where, for The predicted probability corresponding to the j-th preset event type, and if Greater than threshold T CLS (For example, it can be set to 0.5), then it can be determined that the text involves the j-th preset event type; otherwise, if The predicted probability at all locations is no greater than the threshold T. CLS If so, the text can be considered to involve unknown events. It should be noted that during training, the difference between the predicted event types and the actually labeled event types can be calculated to obtain the event type classification loss. CLS Specifically, the event type classification loss (LOss) can be obtained by calculating the cross-entropy between the normalized text classification representation and the one-hot encoding of the event type in the actual labeled text. CLs :
[0101]
[0102] In the above formula (23), N e Indicates the number of event types. This flag determines whether the j-th event type is a true event type annotated in the text. If it is, its value is 1; otherwise, its value is 0. For details, please refer to the technical specifications of loss functions such as cross-entropy, which will not be elaborated upon here.
[0103] Step S25: Merge the preset type representations corresponding to each event type to obtain the event type representation of the text.
[0104] Specifically, the preset type representations corresponding to each event type can be obtained through a table lookup operation. For ease of description, the preset type representation corresponding to the j-th event type can be denoted as c. j :
[0105] c j =I j W event ……(twenty four)
[0106] In the above formula (24), I j ∈[0,n event ] represents the index value of the event type, where 0 corresponds to an unknown event. W can be obtained by looking up a table. event Middle I j The vector of rows serves as the default type representation for the event type. It should be noted that W... event Adjustments can be made during training. Based on this, the average of the preset type representations corresponding to each event type can be used to obtain the event type representation c of the text:
[0107]
[0108] In the above formula (25), s event This refers to the collection of all event types involved in the text. This represents the total number of event types covered in the text.
[0109] Step S26: Based on the event type representation and the fused semantic representation, fuse them to obtain the discourse semantic representation.
[0110] Specifically, the mean and variance of the second character representation of each character can be obtained, and the fusion weight and fusion bias can be predicted based on the event type representation. Then, for each character, it can be standardized based on its second character representation, mean, and variance to obtain its standard character representation. The weighted sum of the fusion weights on the standard character representation and the fusion bias is then used as the character's first character representation. This combination of first character representations serves as the semantic representation of the text. This method, by fusing character semantic representation and event type representation at the character level, allows for further semantic reference to the various event types involved in the text during subsequent event extraction. This enables the explicit encoding of event type identification results into the event argument extraction model, allowing for joint modeling of both event type identification and event argument extraction. This significantly reduces cascading errors and improves event extraction performance.
[0111] In one implementation scenario, for ease of description, the second character of each character in the text can be represented as... The mean is denoted as μ, the variance as σ, and the fusion weight as γ. c The fusion bias is denoted as β. c Then the first character represents It can be represented as:
[0112]
[0113]
[0114] γ c =W γ c+b γ β c =W β c+b β ……(28)
[0115] In the above formulas (26), (27) and (28), W γ W β b γ b β All of these can be adjusted during training. Furthermore, The standard character representation of the i-th character.
[0116] The above scheme introduces prior knowledge from the general entity domain into the subsequent event extraction process to assist in the extraction, which helps to alleviate the problem of missed arguments in event extraction to a certain extent and improve the event extraction effect. Furthermore, by explicitly encoding the event type identification results into the event argument extraction model, it is possible to explicitly model the two stages of event type identification and event argument extraction together, which helps to greatly reduce cascade errors and improve the event extraction effect.
[0117] Please see Figure 3 , Figure 3 yes Figure 1 A flowchart illustrating one embodiment of step S12. Specifically, Figure 3 This is a flowchart illustrating an embodiment of performing argument prediction based on static and dynamic role description texts for a target event role. This embodiment may include the following steps:
[0118] Step S31: Based on the first semantic representation of the static character description text, the second semantic representation of the dynamic character description text, and the text semantic representation, predictions are made to obtain the first prediction result and the second prediction result for each character.
[0119] In this embodiment of the disclosure, the first prediction result of each character includes the first probability that the character belongs to the start character and the end character of the event argument of the target event role, and the second prediction result of each character includes the second probability that the character belongs to the start character and the end character of the event argument of the target event role.
[0120] Specifically, for ease of description, for the k-th candidate event role, its first semantic representation of the static role description text can be denoted as: And denote the second semantic representation of its dynamic role description text as
[0121]
[0122]
[0123]
[0124]
[0125] In the above formulas (29) to (32), and Let represent the static and dynamic character description texts of the k-th candidate event character, respectively. These represent the i-th character in the static character description text and the dynamic character description text, respectively. These represent the encoded representations of the i-th character in the static and dynamic character description texts, respectively. These represent the text lengths of the static character description text and the dynamic character description text, respectively. Furthermore, as described in the formula above, the first and second semantic representations can be extracted using a convolutional neural network; other networks can also be used for extraction, and this is not limited here.
[0126] Based on this, machine reading comprehension can be used to predict the first and second prediction results for each character. Specifically, the semantic representation of the text after incorporating event types can be used. As a document representation of MRC, and in and As two query representations in MRC, a query is performed to find a specific segment in the text as the corresponding answer, thus obtaining the first prediction result for a static query and the second prediction result for a dynamic query. Specifically, this can be represented as:
[0127]
[0128]
[0129]
[0130]
[0131]
[0132]
[0133] In the above formulas (33) to (38), The result of max pooling the first semantic representation within the static role description text of the k-th candidate event role according to its length dimension. The result of max-pooling the second semantic representation within the dynamic role description text of the k-th candidate event role along its length dimension. Adjustments can be made during training. After the above parameters are predicted, the first initial probability of each character in the first prediction result belonging to the starting character of the event argument of the target event role can be obtained. The first termination probability of the termination character belonging to the event argument of the target event role for each character. And the second initial probability of each character in the second prediction result belonging to the starting character of the event argument of the target event role. The second termination probability of the termination character belonging to the event argument of the target event role for each character.
[0134] Step S32: Based on the first and second prediction results of each character, obtain several candidate event arguments belonging to the target event role.
[0135] In one implementation scenario, for each character, the first and second probabilities of the starting character of the event argument belonging to the target event role can be weighted to obtain the first weighted probability of the character. Similarly, the first and second probabilities of the ending character of the event argument belonging to the target event role can be weighted to obtain the second weighted probability of the character. Based on these first and second weighted probabilities, several candidate event arguments belonging to the target event role can be obtained. This method, by weighting the first and second probabilities to obtain weighted probabilities, and then performing argument extraction based on these probabilities, combines both static and dynamic aspects for argument extraction, significantly reducing the problem of over-extracted arguments and improving the event extraction effect.
[0136] In a specific implementation scenario, the weights during weighted processing can be adjusted according to the actual application needs. For example, if the prediction result of a static query is relatively reliable, the weight of the first prediction result can be set higher than the weight of the second prediction result; or, if the prediction result of a dynamic query is relatively reliable, the weight of the second prediction result can be set higher than the weight of the first prediction result; or, if the prediction results of both static and dynamic queries are relatively reliable, the weight of the first prediction result can be set equal to the weight of the second prediction result. There are no restrictions here.
[0137] In a specific implementation scenario, for ease of calculation, both weights can be 0.5, meaning the average of the two values is taken. In this case, the first weighted probability... Second weighted probability They can be represented as follows:
[0138]
[0139]
[0140]
[0141]
[0142] In the above formulas (39) to (42), Predict the probability (i.e., the first weighted probability) of the starting position of the argument answer fragment of the i-th character in the text for the k-th candidate event character. The probability (i.e., the second weighted probability) of the argument answer fragment ending position of the k-th candidate event role at the i-th character in the text is predicted. Based on this, values greater than the argument answer threshold (e.g., 0) can be... and The starting and ending positions of candidate event arguments are determined by the character positions in the text. Specifically, for any character at the starting position, the character at the ending position that is closest to it can be selected, and the text segment from the starting character to the selected character can be used as a candidate event argument. This process can be repeated to obtain several candidate event arguments for the candidate event roles extracted from the text.
[0143] It should be noted that since the start and end positions of argument answer fragments are calculated separately for different roles, and are independent of each other without conflict, this naturally solves the problem of nested argument answers between different roles. The event argument extraction loss (Loss) is obtained by calculating the distance between the probabilities of the start and end positions of the argument answer fragments predicted by the model and the actual start and end positions of the argument answer fragments. EE Specifically, the cross-entropy between the predicted argument start and end positions and the actual labeled argument start and end positions can be calculated to obtain the event argument extraction loss. EE :
[0144]
[0145] In the above formula (43), This indicates whether the i-th character of the k-th candidate event character in the text is truly marked as the starting position of an argument; if so, its value is 1, otherwise its value is 0. Similarly, This indicates whether the i-th character of the k-th candidate event role in the text is truly marked as the argument termination position. If so, its value is 1; otherwise, its value is 0. For details on the calculation process, please refer to the technical details of loss functions such as cross-entropy, which will not be elaborated here.
[0146] In one implementation scenario, unlike the aforementioned direct extraction of candidate event arguments from the entire text, before making predictions based on the first semantic representation of the static character description text, the second semantic representation of the dynamic character description text, and the text semantic representation, the text can be first divided into several sub-texts based on a preset sliding window. For example, the window length of the preset sliding window can be set to 512 (i.e., 512 characters long), and the step size to 256 (i.e., sliding 256 characters at a time). Other values can also be used, without limitation. Based on this, predictions can be made for each sub-text based on the first semantic representation, the second semantic representation, and the text semantic representation of the sub-text, respectively, to obtain the first and second prediction results for each character in the sub-text. Based on the first and second prediction results for each character in the sub-text, predicted event arguments belonging to the target event character in the sub-text are obtained. Post-processing is then performed based on the predicted event arguments in each sub-text to obtain several candidate event arguments. For example, the predicted event arguments in each sub-text can be examined. If the predicted event arguments overlap (e.g., one predicted event argument is part of another), the union of the two predicted event arguments can be used as the candidate event argument. Taking the aforementioned preset sliding window as an example, since half the length of different passage sub-texts overlaps, this allows the contextual information of two adjacent passage sub-texts to be seen when encoding the passage sub-texts. Machine reading comprehension methods based on sliding windows only need to find the start and end positions of the argument answer fragment, without needing to focus on the internal position of the argument answer fragment. This can alleviate the problem of long arguments easily breaking in the middle to a certain extent, which is conducive to further improving the event extraction effect.
[0147] The above scheme makes predictions based on the first semantic representation of the static character description text, the second semantic representation of the dynamic character description text, and the discourse semantic representation, respectively, to obtain the first and second prediction results for each character. Based on the first and second prediction results for each character, several candidate event arguments belonging to the target event character are obtained. This allows for the combined use of statistical prior knowledge and historical argument prediction to predict arguments, which greatly reduces the problem of multiple argument extraction and improves the argument extraction effect.
[0148] Please see Figure 4 , Figure 4 This is a schematic diagram of the framework of an embodiment of the event extraction device 40 of this application. The event extraction device 40 includes: a text semantic extraction module 41, an event argument prediction module 42, a coreference argument prediction module 43, and a target argument optimization module 44. The text semantic extraction module 41 is used to extract the text semantic representation of the text; wherein, the text semantic representation includes the first character representation of each character in the text, and the text involves several event types; the event argument prediction module 42 is used to perform argument prediction on the text based on the text semantic representation to obtain several candidate event arguments belonging to the target event role; wherein, each event type corresponds to several candidate event arguments. The target event role is selected from several candidate event roles; the coreference prediction module 43 is used to perform coreference prediction on the text based on the text semantic representation and the argument semantic representation of each candidate event argument to obtain the coreference argument set of each candidate event argument; the target argument optimization module 44 is used to select at least one candidate event argument as the target event argument of the target event role based on the reference argument set and the coreference argument set of each candidate event argument; wherein, the reference argument set of the candidate event argument includes other candidate event arguments besides the candidate event argument.
[0149] The above scheme can predict the set of core reference arguments for each candidate event argument during the event extraction process. For each candidate event argument, it determines whether it is a target event argument for the target event role based on its set of core reference arguments and the set of reference arguments. This can optimize the event argument extraction results through core reference relations, thereby greatly reducing problems such as multiple argument extraction and improving the event extraction effect.
[0150] In some disclosed embodiments, the coreference prediction module 43 includes a coreference prediction submodule, which is used to predict the coreference of each character based on the discourse semantic representation and the argument semantic representation of the candidate event arguments; wherein, the coreference prediction result of each character includes the probability that the character belongs to the start character and the end character of the coreference arguments of the candidate event arguments; the coreference prediction module 43 includes a set acquisition submodule, which is used to obtain the coreference argument set of the candidate event arguments based on the coreference prediction results of each character.
[0151] In some disclosed embodiments, the target argument optimization module 44 includes an argument selection submodule, which is used to select and retain or remove candidate event arguments based on whether there is an intersection between the reference argument set and the core reference argument set of each candidate event argument; the target argument optimization module 44 includes an argument acquisition submodule, which is used to obtain the target event argument of the target event role based on the retained candidate event arguments.
[0152] In some disclosed embodiments, the target argument optimization module 44 includes an argument reselection submodule, which, in response to the elimination of all candidate event arguments, selects at least one candidate event argument as the target event argument for the target event role based on the frequency of occurrence of each candidate event argument in the text.
[0153] In some disclosed embodiments, argument prediction is performed based on the static and dynamic character description texts of the target event character, and during the event extraction process, the target event arguments of each candidate event character are predicted sequentially; wherein, the static character description text is pre-constructed based on words related to the target event character, and the dynamic character description text is updated based on the predicted target event arguments to the event type dynamic description template.
[0154] In some disclosed embodiments, the event dynamic description template of the event type includes preset template text for each candidate event role of the event type; wherein, the dynamic role description text is obtained by replacing the preset template text in the event dynamic description template with target event arguments that have been predicted and belong to the same candidate event role.
[0155] In some disclosed embodiments, the event argument prediction module 42 includes a prediction result acquisition submodule, used to predict based on the first semantic representation of the static role description text, the second semantic representation of the dynamic role description text, and the text semantic representation, respectively, to obtain a first prediction result and a second prediction result for each character; the event argument prediction module 42 includes a prediction result fusion submodule, used to obtain a number of candidate event arguments belonging to the target event role based on the first prediction result and the second prediction result for each character; wherein, the first prediction result for each character includes a first probability that the character belongs to the starting character and the ending character of the event argument of the target event role, and the second prediction result for each character includes a second probability that the character belongs to the starting character and the ending character of the event argument of the target event role.
[0156] In some disclosed embodiments, the prediction result fusion submodule includes a probability weighting unit, used to weight the first probability and the second probability of the starting character of the event argument of the target event role for each character to obtain a first weighted probability of the character, and to weight the first probability and the second probability of the ending character of the event argument of the target event role to obtain a second weighted probability of the character; the prediction result fusion submodule includes an argument determination unit, used to obtain a number of candidate event arguments belonging to the target event role based on the first weighted probability and the second weighted probability of each character.
[0157] In some disclosed embodiments, the event argument prediction module 42 includes a text segmentation submodule, used to segment the text based on a preset sliding window to obtain several subtexts; a prediction result acquisition submodule is specifically used to predict each subtext based on a first semantic representation, a second semantic representation, and the text semantic representation of the subtext, respectively, to obtain a first prediction result and a second prediction result for each character in the subtext; a prediction result fusion submodule is specifically used to obtain predicted event arguments belonging to the target event role in the subtext based on the first prediction result and the second prediction result for each character in the subtext; and to perform post-processing based on the predicted event arguments in each subtext to obtain several candidate event arguments.
[0158] In some disclosed embodiments, the text semantic representation is obtained by fusing the first text representation and the second text representation extracted by the first extraction network and the second extraction network, respectively. The first extraction network and the second extraction network are jointly trained based on the relative differences between the first sample representation and the second sample representation extracted from the sample text.
[0159] In some disclosed embodiments, the event extraction device 40 includes an extraction network training module, which includes a loss calculation submodule for obtaining a first loss based on the relative entropy of the first sample representation relative to the second sample representation, and obtaining a second loss based on the relative entropy of the second sample representation relative to the first sample representation; the extraction network training module includes a parameter adjustment submodule for adjusting the network parameters of both the first extraction network and the second extraction network based on the first loss and the second loss.
[0160] In some disclosed embodiments, the event extraction device 40 includes a document representation extraction module for extracting a first document representation or a second document representation. The document representation extraction module includes a named entity recognition submodule for performing named entity recognition on the document text to obtain several candidate entities and the part-of-speech tags of each candidate entity. The document representation extraction module includes an argument prediction submodule for performing argument prediction based on a pre-labeling model and the part-of-speech tags of each candidate entity to obtain predicted event arguments in the document text. The document representation extraction module includes a semantic extraction submodule for performing semantic extraction based on whether each character belongs to the predicted event arguments to obtain the document representation of the document text. Wherein, when semantic extraction is performed using a first extraction network, the document representation is the first document representation; when semantic extraction is performed using a second extraction network, the document representation is the second document representation.
[0161] In some disclosed embodiments, the pre-labeling model includes several mapping rules for preset event roles, and each mapping rule for a preset event role defines parts of speech and / or words related to the preset event role.
[0162] In some disclosed embodiments, the semantic extraction submodule includes an embedding representation unit, used to obtain the input embedding representation of a character based on the character embedding representation, position embedding representation, and fragment embedding representation of each character, respectively; wherein, when the character belongs to the predicted event argument, the fragment embedding representation of the character is the first embedding representation, and when the character does not belong to the predicted event argument, the fragment embedding representation of the character is the second embedding representation; the semantic extraction submodule includes a representation extraction unit, used to perform semantic extraction based on the input embedding representation of each character to obtain the document representation of the document text.
[0163] In some disclosed embodiments, the event extraction device 40 further includes a representation fusion module, which includes a first fusion submodule for fusing the first chapter representation and the second chapter representation to obtain a fused semantic representation of the chapter text; wherein the fused semantic representation includes the second character representation of each character; the representation fusion module includes a second fusion submodule for fusing the preset type representations corresponding to each event type to obtain the event type representation of the chapter text; the representation fusion module includes a third fusion submodule for fusing the event type representation and the fused semantic representation to obtain the chapter semantic representation.
[0164] In some disclosed embodiments, the third fusion submodule includes a parameter acquisition unit for acquiring the mean and variance of the second character representation of each character, and predicting the fusion weight and fusion bias based on the event type representation; the third fusion submodule includes a standardization unit for standardizing each character based on the second character representation, mean, and variance of the character to obtain the standard character representation of the character; the third fusion submodule includes a fusion unit for summing the weighted result of the fusion weight on the standard character representation of the character and the fusion bias as the first character representation of the character.
[0165] In some disclosed embodiments, the chapter text involves several event types contained in a preset event set. The preset event set includes unknown events and several preset events, and the unknown events and preset events are respectively provided with their own candidate event roles. The candidate event roles corresponding to the unknown events are abstracted from the candidate event roles corresponding to each preset event.
[0166] Please see Figure 5 , Figure 5 This is a schematic diagram of a framework of an embodiment of the electronic device 50 of this application. The electronic device 50 includes a memory 51 and a processor 52 coupled to each other. The memory 51 stores program instructions, and the processor 52 is used to execute the program instructions to implement the steps in any of the above-described event extraction method embodiments. Specifically, the electronic device 50 may include, but is not limited to, desktop computers, laptops, servers, mobile phones, tablet computers, etc., and is not limited thereto.
[0167] Specifically, processor 52 controls itself and memory 51 to implement the steps in any of the above-described event extraction method embodiments. Processor 52 can also be referred to as a CPU (Central Processing Unit). Processor 52 may be an integrated circuit chip with signal processing capabilities. Processor 52 can also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor. Furthermore, processor 52 can be implemented using integrated circuit chips.
[0168] The above scheme can predict the set of core reference arguments for each candidate event argument during the event extraction process. For each candidate event argument, it determines whether it is a target event argument for the target event role based on its set of core reference arguments and the set of reference arguments. This can optimize the event argument extraction results through core reference relations, thereby greatly reducing problems such as multiple argument extraction and improving the event extraction effect.
[0169] Please see Figure 6 , Figure 6 This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium 60 of this application. The computer-readable storage medium 60 stores program instructions 61 that can be executed by a processor. The program instructions 61 are used to implement the steps in any of the above-described event extraction method embodiments.
[0170] The above scheme can predict the set of core reference arguments for each candidate event argument during the event extraction process. For each candidate event argument, it determines whether it is a target event argument for the target event role based on its set of core reference arguments and the set of reference arguments. This can optimize the event argument extraction results through core reference relations, thereby greatly reducing problems such as multiple argument extraction and improving the event extraction effect.
[0171] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0172] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.
[0173] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0174] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0175] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0176] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
Claims
1. An event extraction method, characterized in that, include: Extract the semantic representation of the text; wherein the semantic representation includes the first character representation of each character in the text, and the text involves several event types; Argument prediction is performed on the text based on the semantic representation of the text to obtain several candidate event arguments belonging to the target event role; wherein, each event type corresponds to several candidate event roles, the target event role is selected from the several candidate event roles, the argument prediction is performed based on the static role description text and dynamic role description text of the target event role, and during the event extraction process, the target event arguments of each candidate event role are predicted sequentially, the static role description text is pre-constructed based on words related to the target event role, and the dynamic role description text is updated based on the predicted target event arguments to the event dynamic description template of the event type; Based on the semantic representation of the text and the semantic representation of each candidate event argument, coreference prediction is performed on the text to obtain the coreference argument set of each candidate event argument; Based on the reference argument set and core reference argument set of each candidate event argument, at least one candidate event argument is selected as the target event argument for the target event role; wherein, the reference argument set of the candidate event argument includes other candidate event arguments besides the candidate event argument.
2. The method according to claim 1, characterized in that, The coreference prediction based on the discourse semantic representation and the argument semantic representation of each candidate event argument is performed on the discourse text to obtain the coreference argument set of each candidate event argument, including: Based on the semantic representation of the text and the semantic representation of the argument of the candidate event argument, prediction is performed to obtain the coreference prediction result of each character; wherein, the coreference prediction result of each character includes the probability that the character belongs to the start character and the end character of the coreference argument of the candidate event argument respectively. Based on the coreference prediction results of each character, the coreference argument set of the candidate event arguments is obtained.
3. The method according to claim 1, characterized in that, The step of selecting at least one of the candidate event arguments as the target event argument for the target event role based on the reference argument set and the core reference argument set of each candidate event argument includes: Based on whether there is an intersection between the reference argument set and the core reference argument set of each candidate event argument, the candidate event arguments are selected to be retained or eliminated. Based on the retained candidate event arguments, the target event arguments of the target event role are obtained.
4. The method according to claim 3, characterized in that, The method further includes: In response to the elimination of all candidate event arguments, at least one candidate event argument is selected as the target event argument for the target event role based on the frequency of occurrence of each candidate event argument in the text.
5. The method according to claim 1, characterized in that, The event dynamic description template for the event type includes preset template text for each candidate event role of the event type; The dynamic role description text is obtained by replacing the preset template text in the event dynamic description template with the target event argument that has been predicted and belongs to the same candidate event role.
6. The method according to claim 1, characterized in that, The argument prediction based on the semantic representation of the text yields several candidate event arguments belonging to the target event role, including: Based on the first semantic representation of the static character description text, the second semantic representation of the dynamic character description text, and the text semantic representation, predictions are made to obtain the first and second prediction results for each character. Based on the first and second prediction results of each character, several candidate event arguments belonging to the target event role are obtained; The first prediction result for each character includes the first probability that the character belongs to the start character and the end character of the event argument of the target event role, and the second prediction result for each character includes the second probability that the character belongs to the start character and the end character of the event argument of the target event role.
7. The method according to claim 6, characterized in that, Based on the first and second prediction results of each character, several candidate event arguments belonging to the target event role are obtained, including: For each character, the first probability and the second probability of the character belonging to the starting character of the event argument of the target event role are weighted to obtain the first weighted probability of the character, and the first probability and the second probability of the character belonging to the ending character of the event argument of the target event role are weighted to obtain the second weighted probability of the character. Based on the first weighted probability and the second weighted probability of each character, several candidate event arguments belonging to the target event role are obtained.
8. The method according to claim 6, characterized in that, Before predicting each character based on the first semantic representation of the static character description text, the second semantic representation of the dynamic character description text, and the text semantic representation to obtain the first and second prediction results, the method further includes: The text is divided into several sub-texts based on a preset sliding window; The prediction is performed based on the first semantic representation of the static character description text, the second semantic representation of the dynamic character description text, and the text semantic representation to obtain the first prediction result and the second prediction result for each character, including: For each of the sub-texts, predictions are made based on the first semantic representation, the second semantic representation, and the text semantic representation of the sub-text, respectively, to obtain the first prediction result and the second prediction result for each character in the sub-text; Based on the first and second prediction results of each character, several candidate event arguments belonging to the target event role are obtained, including: Based on the first and second prediction results of each character in the subtext, the predicted event arguments belonging to the target event role in the subtext are obtained. Post-processing is performed on the predicted event arguments in each of the sub-texts to obtain the several candidate event arguments.
9. The method according to claim 1, characterized in that, The text semantic representation is obtained by fusing the first text representation and the second text representation extracted by the first extraction network and the second extraction network, respectively. The first extraction network and the second extraction network are jointly trained based on the relative differences between the first sample representation and the second sample representation extracted from the sample text.
10. The method according to claim 9, characterized in that, The training steps for the first extraction network and the second extraction network include: A first loss is obtained based on the relative entropy of the first sample representation with respect to the second sample representation, and a second loss is obtained based on the relative entropy of the second sample representation with respect to the first sample representation; Based on the first loss and the second loss, adjust the network parameters of both the first extraction network and the second extraction network.
11. The method according to claim 9, characterized in that, The extraction steps for the first or second chapter representation include: Named entity recognition is performed on the text to obtain several candidate entities and the part-of-speech tag of each candidate entity; Argument prediction is performed based on the pre-labeling model and the part-of-speech tags of each candidate entity to obtain the predicted event arguments in the text. Semantic extraction is performed based on whether each character belongs to the predicted event argument to obtain the text representation of the text. Wherein, when the semantic extraction is performed using the first extraction network, the chapter representation is the first chapter representation; when the semantic extraction is performed using the second extraction network, the chapter representation is the second chapter representation.
12. The method according to claim 11, characterized in that, The pre-labeling model includes several mapping rules for preset event roles, and each mapping rule for a preset event role defines a part of speech and / or words related to the preset event role.
13. The method according to claim 11, characterized in that, The semantic extraction based on whether each character belongs to the estimated event argument to obtain the text representation of the text includes: The input embedding representation of the character is obtained based on the character embedding representation, position embedding representation, and fragment embedding representation of each character, respectively; wherein, when the character belongs to the estimated event argument, the fragment embedding representation of the character is the first embedding representation, and when the character does not belong to the estimated event argument, the fragment embedding representation of the character is the second embedding representation. Semantic extraction is performed based on the input embedding representation of each character to obtain the text representation of the text.
14. The method according to claim 9, characterized in that, The steps for fusing the first chapter representation and the second chapter representation include: The first chapter representation and the second chapter representation are fused to obtain the fused semantic representation of the chapter text; wherein, the fused semantic representation includes the second character representation of each character; The preset type representations corresponding to each of the event types are merged to obtain the event type representation of the text. The text semantic representation is obtained by fusing the event type representation and the fused semantic representation.
15. The method according to claim 14, characterized in that, The process of fusing the event type representation and the fused semantic representation to obtain the text semantic representation includes: Obtain the mean and variance of the second character representation of each character, and predict the fusion weight and fusion bias based on the event type representation; For each character, the standard character representation of the character is obtained by standardizing based on the second character representation of the character, the mean, and the variance. The first character representation of the character is obtained by summing the weighted result of the fusion weight on the standard character representation of the character and the fusion bias.
16. The method according to claim 1, characterized in that, The text involves several event types contained in a preset event set. The preset event set includes unknown events and several preset events. The unknown events and the preset events each have their own candidate event roles. The candidate event roles corresponding to the unknown events are abstracted from the candidate event roles corresponding to each preset event.
17. An event extraction device, characterized in that, include: The text semantic extraction module is used to extract the text semantic representation of the text; wherein, the text semantic representation includes the first character representation of each character in the text, and the text involves several event types; The event argument prediction module is used to predict arguments in the text based on the semantic representation of the text, and obtain several candidate event arguments belonging to the target event role; wherein, each event type corresponds to several candidate event roles, the target event role is selected from the several candidate event roles, the argument prediction is performed based on the static role description text and dynamic role description text of the target event role, and during the event extraction process, the target event arguments of each candidate event role are predicted sequentially, the static role description text is pre-constructed based on words related to the target event role, and the dynamic role description text is updated based on the predicted target event arguments to the event dynamic description template of the event type; The coreference argument prediction module is used to perform coreference prediction on the text based on the semantic representation of the text and the argument semantic representation of each candidate event argument, so as to obtain the coreference argument set of each candidate event argument; The target argument optimization module is used to select at least one of the candidate event arguments as the target event argument for the target event role based on the reference argument set and the coreference argument set of each candidate event argument; wherein, the reference argument set of the candidate event argument includes other candidate event arguments besides the candidate event argument.
18. An electronic device, characterized in that, The method includes a memory and a processor coupled to each other, wherein the memory stores program instructions and the processor executes the program instructions to implement the event extraction method according to any one of claims 1 to 16.
19. A computer-readable storage medium, characterized in that, The system stores program instructions that can be executed by a processor, the program instructions being used to implement the event extraction method according to any one of claims 1 to 16.
Citation Information
Patent Citations
Event extraction method and device, computer equipment and storage medium
CN112580346A