Script event extraction method, device, electronic device and storage medium

By introducing dependency analysis and graph attention mechanisms in the extraction of film and television scripts, the problem of low accuracy caused by single factors in the prior art is solved, and higher extraction accuracy and semantic expression ability are achieved.

CN115221858BActive Publication Date: 2025-04-29INST OF AUTOMATION CHINESE ACAD OF SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210707469.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-21
Publication Date
2025-04-29
Estimated Expiration
2042-06-21

AI Technical Summary

Technical Problem

In the prior art, when extracting film and television script events, the considerations are too single, resulting in low accuracy of the extraction results.

Method used

By obtaining the script text to be extracted, the dependency relationship analysis is carried out to determine the dependency relationship diagram, and input it into the event extraction model. Combined with the graph attention mechanism, the event type and the categories of structural elements in the script text are determined.

Benefits of technology

It improves the accuracy of script event extraction, enhances the semantic expression ability of feature vectors, and makes the extraction results more accurate and reliable.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115221858B_ABST
    Figure CN115221858B_ABST
Patent Text Reader

Abstract

The present invention provides a script event extraction method, device, electronic device and storage medium. First, the script text to be extracted is obtained; then, dependency analysis is performed on the script text to be extracted to determine the dependency graph corresponding to the script text to be extracted; finally, the dependency graph is input into an event extraction model to obtain the target category of the target event structure element of the script text to be extracted under the target event type. The method introduces dependency analysis to determine the dependency graph in view of the characteristics that the script event structure elements have hierarchical correlation, and adopts a combination of dependency analysis, attention mechanism and graph attention mechanism to semantically supplement the words in the dependency graph, realize script event extraction, determine the event type in the script text and the category of each event structure element under the specific event type, can have good universality, enhance the semantic expression ability of the feature vector, and improve the accuracy of script event extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer software technology, and in particular to a script event extraction method, device, electronic equipment and storage medium. Background Art

[0002] In recent years, with the popularization of Internet technology, there is a great demand for automated analysis technology for scripts with events as the main content, especially in the film and television industry. Extracting events and related elements from film and television scripts can enable users to quickly grasp the content of film and television scripts, and then realize the analysis and promotion of film and television scripts.

[0003] In the prior art, when extracting events from film and television scripts, the temporal relationship of events and the contextual relationship of words in the film and television scripts are usually considered. This is too single a factor, which will lead to a low accuracy of the extraction results.

[0004] Therefore, how to improve the accuracy of script event extraction methods has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] The present invention provides a script event extraction method, device, electronic device and storage medium to solve the defects in the prior art.

[0006] The present invention provides a script event extraction method, comprising:

[0007] Get the script text to be extracted;

[0008] Performing dependency analysis on the script text to be extracted to determine a dependency graph corresponding to the script text to be extracted;

[0009] Inputting the dependency graph into an event extraction model to obtain a target category of a target event structural element of the to-be-extracted script text under a target event type output by the event extraction model;

[0010] Among them, the event extraction model is trained based on a sample script text carrying category labels of each sample event structural element under the sample event type. The event extraction model is used to determine the first type of feature vectors of nouns and the second type of feature vectors of verbs in the dependency graph, and based on the first type of feature vectors, the second type of feature vectors and the dependency graph, combined with the graph attention mechanism, determine the target event type of the script text to be extracted and the target category of the target event structural element, and the first type of feature vector is an attention feature vector.

[0011] According to a script event extraction method provided by the present invention, the dependency graph is input into an event extraction model to obtain a target category of a target event structural element of the script text to be extracted under a target event type output by the event extraction model, specifically comprising:

[0012] Inputting the first word vector of the noun into the first feature extraction module of the event extraction model to obtain the first type of feature vector output by the first feature extraction module;

[0013] Inputting the second word vector of the verb into the second feature extraction module of the event extraction model to obtain the second type of feature vector output by the second feature extraction module;

[0014] Inputting the first-category feature vector, the second-category feature vector, and the dependency graph into a first-level graph attention module of the event extraction model, and determining the target event type and candidate event structure elements in the dependency graph based on a first output result of the first-level graph attention module;

[0015] The third type of feature vector of the alternative event structure element and the dependency graph are input into the second-level graph attention module corresponding to the target event type in the event extraction model, and based on the second output result of the second-level graph attention module, the target category of the target event structure element under the target event type is determined; wherein the third type of feature vector is an attention feature vector.

[0016] According to a script event extraction method provided by the present invention, the first word vector of the noun is input into the first feature extraction module of the event extraction model to obtain the first type of feature vector output by the first feature extraction module, specifically including:

[0017] Inputting the first word vector into the feature concatenation layer of the first feature extraction module to obtain a concatenation vector output by the feature concatenation layer after concatenating the first word vector with a predetermined event structure element category feature vector;

[0018] Inputting the concatenated vector into the linear transformation layer of the first feature extraction module to obtain a first type of attention weight feature vector output by the linear transformation layer;

[0019] The first-category attention weight feature vector is input into the classification layer, and the classification layer normalizes the first-category attention weight feature vector and performs weighted summation on the first-category attention weight feature vector with the event structure element category feature vector to obtain and output the first-category feature vector.

[0020] According to a script event extraction method provided by the present invention, the first output result includes a first probability vector of whether the noun belongs to an event structure element and a second probability vector of whether the target event in the script text to be extracted belongs to each event type; accordingly,

[0021] The determining, based on the first output result of the first-level graph attention module, the target event type and the candidate event structure elements in the dependency graph comprises:

[0022] If the probability of belonging to an event structure element in the first probability vector is greater than a preset threshold, taking the noun as the candidate event structure element;

[0023] The event type corresponding to the maximum probability component in the second probability vector is used as the target event type.

[0024] According to a script event extraction method provided by the present invention, the first type of feature vector, the second type of feature vector and the dependency graph are input into the first-level graph attention module of the event extraction model, and then include:

[0025] Inputting the first-category feature vector and the dependency graph into a first attention unit in the first-level graph attention module, a first fusion subunit in the first attention unit fuses the first-category feature vector and the dependency graph, and a first classification subunit in the first attention unit classifies the noun based on a first fusion result, and outputs a first probability vector of whether the noun belongs to each event structure element category;

[0026] The second-category feature vector and the dependency graph are input into the second attention unit in the first-level graph attention module, the second fusion subunit in the second attention unit fuses the second-category feature vector and the dependency graph, and the second classification subunit in the second attention unit classifies the verb based on a second result obtained by the fusion, and outputs a second probability vector that the verb belongs to each event type.

[0027] According to a script event extraction method provided by the present invention, the first fusion subunit in the first attention unit fuses the first type of feature vector with the dependency graph, specifically comprising:

[0028] Determine a fourth type of feature vector of adjacent words of the noun corresponding to the first type of feature vector in the dependency graph;

[0029] The first type of feature vector and the fourth type of feature vector are input into the first fusion subunit, and the first fusion subunit concatenates the first type of feature vector and the fourth type of feature vector, performs linear transformation on the concatenated result to obtain a second type of attention weight feature vector, normalizes the second type of attention weight feature vector, performs weighted summation on the normalized result and the fourth type of feature vector, and obtains and outputs the first result.

[0030] According to a script event extraction method provided by the present invention, the third type feature vector of the candidate event structural element and the dependency graph are input into the second level graph attention module corresponding to the target event type in the event extraction model, and then include:

[0031] The second-level graph attention module classifies the candidate event structure elements based on the third type of feature vectors and the dependency graph, and outputs a third probability vector that the candidate event structure elements belong to each event structure element category.

[0032] The present invention also provides a script event extraction device, comprising:

[0033] An acquisition module is used to obtain the script text to be extracted;

[0034] An analysis module, used for performing dependency analysis on the script text to be extracted, and determining a dependency graph corresponding to the script text to be extracted;

[0035] An extraction module, used for inputting the dependency graph into an event extraction model to obtain a target category of a target event structural element of the to-be-extracted script text under a target event type output by the event extraction model;

[0036] Among them, the event extraction model is trained based on a sample script text carrying category labels of each sample event structural element under the sample event type. The event extraction model is used to determine the first type of feature vectors of nouns and the second type of feature vectors of verbs in the dependency graph, and based on the first type of feature vectors, the second type of feature vectors and the dependency graph, combined with the graph attention mechanism, determine the target event type of the script text to be extracted and the target category of the target event structural element, and the first type of feature vector is an attention feature vector.

[0037] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a script event extraction method as described in any one of the above is implemented.

[0038] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the script event extraction method as described in any one of the above is implemented.

[0039] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the script event extraction methods described above.

[0040] The script event extraction method, device, electronic device and storage medium provided by the present invention first obtain the script text to be extracted; then perform dependency analysis on the script text to be extracted to determine the dependency graph corresponding to the script text to be extracted; finally, input the dependency graph into the event extraction model to obtain the target category of the target event structure element of the script text to be extracted under the target event type. The method introduces dependency analysis to determine the dependency graph in view of the characteristics that the script event structure elements have hierarchical correlation, and adopts a combination of dependency analysis, attention mechanism and graph attention mechanism to semantically supplement the words in the dependency graph, realize script event extraction, determine the event type in the script text and the category of each event structure element under the specific event type, can have good universality, enhance the semantic expression ability of the feature vector, and improve the accuracy of script event extraction. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on the drawings in the following description without creative work.

[0042] Figure 1 It is a flow chart of the script event extraction method provided by the present invention;

[0043] Figure 2 It is a schematic diagram of the dependency relationship between words in the script text to be extracted in the script event extraction method provided by the present invention;

[0044] Figure 3 It is a structural schematic diagram of the script event extraction device provided by the present invention;

[0045] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] In the prior art, when extracting events from film and television scripts, the temporal relationship of events in the film and television scripts and the contextual relationship of words are usually considered, and the factors considered are too single, which will lead to low accuracy of the extraction results. To this end, an embodiment of the present invention provides a script event extraction method, which can be applied not only to film and television scripts, but also to other scripts containing events, such as security operation scripts.

[0048] Figure 1 A schematic diagram of a process flow of a script event extraction method provided in an embodiment of the present invention is shown in FIG. Figure 1 As shown, the method includes:

[0049] S1, obtain the script text to be extracted;

[0050] S2, performing dependency analysis on the script text to be extracted to determine a dependency graph corresponding to the script text to be extracted;

[0051] S3, inputting the dependency graph into an event extraction model to obtain a target category of a target event structural element of the to-be-extracted script text under a target event type output by the event extraction model;

[0052] Among them, the event extraction model is trained based on a sample script text carrying category labels of each sample event structural element under the sample event type. The event extraction model is used to determine the first type of feature vectors of nouns and the second type of feature vectors of verbs in the dependency graph, and based on the first type of feature vectors, the second type of feature vectors and the dependency graph, combined with the graph attention mechanism, determine the target event type of the script text to be extracted and the target category of the target event structural element, and the first type of feature vector is an attention feature vector.

[0053] Specifically, the script event extraction method provided in the embodiment of the present invention has a script event extraction device as its executor, which can be configured in a server. The server can be a local server or a cloud server. The local server can specifically be a computer, etc., which is not specifically limited in the embodiment of the present invention.

[0054] First, step S1 is performed to obtain the script text to be extracted. The script text to be extracted refers to the script to be extracted in text form, which can be in Chinese or in foreign languages ​​such as English, and is not specifically limited here. The script to be extracted can be a film and television script, or other scripts containing events, such as safety operation scripts. Film and television scripts include TV drama scripts, movie scripts, short film scripts, and event scripts.

[0055] Then, step S2 is executed to perform dependency analysis on the script text to be extracted, and determine the dependency graph corresponding to the script text to be extracted. Here, an open source dependency analysis algorithm can be used to perform dependency analysis on the script text to be extracted, and then determine the dependency graph corresponding to the script text to be extracted. The dependency graph may include the part of speech of each word in the script text to be extracted and the dependency relationship between each word. The number of words in the script text to be extracted can be set as needed, and the part of speech of each word may include noun, verb, etc.

[0056] For example, if the script text to be extracted is "Peter picks up the pistol and shoots Ruth.", the dependency relationship between the words in the script text to be extracted can be expressed as Figure 2 .

[0057] After obtaining the dependency graph, the dependency graph can be used to represent the script text to be extracted. Each word in the dependency graph can be used as a candidate element in the script text to be extracted. Candidate elements refer to all words that may be event structure elements or event trigger elements. Event structure elements refer to elements used to represent event structure information, which can be nouns. Event trigger elements refer to elements used to represent event core action information, which can be verbs.

[0058] Finally, step S3 is executed to introduce the event extraction model, and the dependency graph is used as the input of the event extraction model to obtain the target category of the target event structure element under the target event type of the script text to be extracted output by the event extraction model. The event extraction model includes two outputs, one is the target event type of the script text to be extracted, and the other is the target category of the target event structure element under the event type. The target event type refers to the type of each event contained in the script text to be extracted, which may include one or more, and the target event type can be determined by the verbs in the script text to be extracted. The target event structure element refers to the event structure element contained in each type of event in the script text to be extracted, which may include one or more, and the target event structure element can be determined by the noun in the script text to be extracted. For example, the target event type includes a football match, and the target event structure element includes the time, place, and warring parties of the football match.

[0059] Since the event structure elements under each event type are quite different, their attributes can be distinguished by categories. Therefore, in the embodiment of the present invention, the event structure element categories are defined as including people, time, organization, object and location. The target category of the target event structure element is one of the above five event structure element categories.

[0060] The event extraction model used in the embodiment of the present invention may include a feature extraction module and a graph attention module connected in sequence. The feature extraction module is used to take the nouns and verbs in the dependency graph as input, determine the first-class feature vectors of the nouns and the second-class feature vectors of the verbs in the dependency graph and output them. The graph attention module is used to take the first-class feature vector, the second-class feature vector and the dependency graph as input, and based on the first-class feature vector, the second-class feature vector and the dependency graph, combined with the graph attention mechanism, determine the target event type of the script text to be extracted and the target category of the target event structure element and output them.

[0061] Since the first type of feature vector is an attention feature vector, and the second type of feature vector is not specifically limited and can be either an attention feature vector or a general feature vector, the feature extraction module can be either a single module or include a first feature extraction module and a second feature extraction module in parallel. The first feature extraction module is used to determine the first type of feature vector, and the second feature extraction module is used to determine the second type of feature vector.

[0062] Since the target event type and the target category of the target event structure element under the target event type need to be determined in the embodiment of the present invention, the graph attention module can be either a single module or a cascade of two-level graph attention modules. At this time, the graph attention module includes a first-level graph attention module and a second-level graph attention module. The number of the first-level graph attention module is one, which is used to determine the target event type of the script text to be extracted and the alternative event structure elements in the dependency graph based on the first-class feature vector, the second-class feature vector and the dependency graph, combined with the graph attention mechanism. The alternative event structure elements are all event structure elements that exist in the dependency relationship, which are not associated with specific event types.

[0063] The number of second-level graph attention modules is the same as the number of event types. Each second-level graph attention module can be used to classify the alternative event structure elements based on the attention feature vectors of the alternative event structure elements in combination with the graph attention mechanism to determine the target category of the target event structure element under the target event type for the script text to be extracted.

[0064] The event extraction model can be obtained by training the initial event extraction model in a supervised training manner using a sample script text carrying the category labels of each sample event structure element under the sample event type. The initial event extraction model can include an initial feature extraction module and an initial graph attention module connected in sequence, and the initial feature extraction module can include a first initial feature extraction module and a second initial feature extraction module, and the initial graph attention module can include a first initial graph attention module and a second initial attention module.

[0065] The initial feature extraction module or the first initial feature extraction module and the second initial feature extraction module, together with the first initial graph attention module, can be jointly trained using sample script texts and the sample event types and sample event structural elements they carry. The second initial attention module can be separately trained using the attention feature vectors and category labels of each sample event structural element under a certain sample event type.

[0066] It is understandable that, whether in joint training or separate training, the back propagation algorithm can be used to optimize the error of the target model and then iteratively update the parameters of the target model.

[0067] The error of the target model can be calculated by the cross entropy loss function. The specific formula of the cross entropy loss function is:

[0068]

[0069] Among them, crossentropy is the error of the target model, n is the number of training samples of the target model, x and y are the probability vector output by the target model and the actual probability vector of the training samples, respectively.

[0070] It is understandable that the target model can be formed by the initial feature extraction module and the first initial graph attention module connected in sequence, or it can be the second initial attention module. Accordingly, the training sample of the target model can be the sample script text and the sample event type and sample event structure elements it carries, or it can be the attention feature vector and category label of each sample event structure element under a certain sample event type, which is not specifically limited here.

[0071] On this basis, a regularization term can be added to the specific formula of the cross entropy loss function. The regularization term can be the sum of the 2 norms of all weight matrices and bias vectors in the target model. This can make the trained target model more accurate and have better performance.

[0072] The script event extraction method provided in the embodiment of the present invention first obtains the script text to be extracted; then performs dependency analysis on the script text to be extracted to determine the dependency graph corresponding to the script text to be extracted; finally, inputs the dependency graph into the event extraction model to obtain the target category of the target event structure element of the script text to be extracted under the target event type. The method introduces dependency analysis to determine the dependency graph in view of the characteristics of hierarchical correlation of script event structure elements, and adopts a combination of dependency analysis, attention mechanism and graph attention mechanism to semantically supplement the words in the dependency graph, realize script event extraction, determine the event type in the script text and the category of each event structure element under the specific event type, which can have good universality, enhance the semantic expression ability of the feature vector, and improve the accuracy of script event extraction.

[0073] On the basis of the above-mentioned embodiment, the script event extraction method provided in the embodiment of the present invention, wherein the dependency graph is input into the event extraction model, and the target category of the target event structure element of the script text to be extracted under the target event type output by the event extraction model is obtained, specifically comprising:

[0074] Inputting the first word vector of the noun into the first feature extraction module of the event extraction model to obtain the first type of feature vector output by the first feature extraction module;

[0075] Inputting the second word vector of the verb into the second feature extraction module of the event extraction model to obtain the second type of feature vector output by the second feature extraction module;

[0076] Inputting the first-category feature vector, the second-category feature vector, and the dependency graph into a first-level graph attention module of the event extraction model, and determining the target event type and candidate event structure elements in the dependency graph based on a first output result of the first-level graph attention module;

[0077] The third type of feature vector of the alternative event structure element and the dependency graph are input into the second-level graph attention module corresponding to the target event type in the event extraction model, and based on the second output result of the second-level graph attention module, the target category of the target event structure element under the target event type is determined; wherein the third type of feature vector is an attention feature vector.

[0078] Specifically, when the dependency graph is input into the event extraction model, the first word vector of the noun and the second word vector of the verb in the dependency graph can be determined first, and then the first word vector of the noun is input into the first feature extraction module. The first feature extraction module performs feature extraction on the first word vector based on the attention mechanism, and then obtains and outputs a first type of feature vector, which is the attention feature vector of the noun.

[0079] The second word vector of the verb is input into the second feature extraction module. The function of the second feature extraction module can be to adjust the second word vector to a second type of feature vector with the same dimension as the first type of feature vector. In this case, the second type of feature vector is a general feature vector. The function of the second feature extraction module can also be the same as that of the first feature extraction module, both of which are used to extract features from the second word vector based on the attention mechanism. In this case, the second type of feature vector is the attention feature vector of the verb.

[0080] For example, if the dimension of the first type of feature vector is higher than that of the second word vector, the dimension of the second word vector can be adjusted to be the same as that of the first type of feature vector by padding with 0, so as to obtain the second type of feature vector.

[0081] After that, the first-class feature vector, the second-class feature vector and the dependency graph are input into the first-level graph attention module, and the feature vector and the dependency graph are fused through the first-level graph attention module, and the nouns and verbs are classified. The first-level graph attention module can be a module, in which case the module has three inputs and two outputs. The three inputs are the first-class feature vector, the second-class feature vector and the dependency graph, and the two outputs are the first probability vector of whether the noun corresponding to the first word vector belongs to the event structure element and the second probability vector of whether the target event in the script text to be extracted belongs to each event type.

[0082] The first-level graph attention module may also include a first graph attention unit and a second graph attention unit, wherein the first graph attention unit takes as input a first-type feature vector and a dependency graph, and outputs a first probability vector of whether the noun corresponding to the first word vector belongs to an event structure element. The second graph attention unit takes as input a second-type feature vector and a dependency graph, and outputs a second probability vector of whether the target event in the script text to be extracted belongs to each event type.

[0083] It can be seen that no matter how the structure of the first-level graph attention module is, its first output result is the first probability vector and the second probability vector. Each noun in the dependency graph corresponds to a first probability vector, and each verb, that is, each target event corresponds to a second probability vector. The first probability vector can include two probability components, which are used to represent the probability that the corresponding noun belongs to the event structure element and the probability that the corresponding noun does not belong to the event structure element.

[0084] The second probability vector may include multiple probability components. The probability components in the second probability vector correspond one-to-one to the verbs in the dependency graph, that is, correspond one-to-one to the target events, to indicate the probability that the corresponding target event belongs to each event type.

[0085] Finally, the candidate event structure elements in the dependency graph can be determined according to the first probability vector, and the target event type can be determined according to the second probability vector. For example, for each noun, it can be determined whether the probability of belonging to the event structure element in the first probability vector is greater than a preset threshold. If it is greater than the preset threshold, the noun can be used as a candidate event structure element. The preset threshold can be set as needed, for example, it can be set to be greater than 80%. The maximum probability component can also be selected from the second probability vector, and the corresponding event type is used as the target event type.

[0086] After the first-level graph attention module determines the target event type, the second-level graph attention module corresponding to the target event type can be selected from the second-level graph attention modules in the event extraction model. The third-class feature vector of the candidate event structure element, i.e., the attention feature vector and the dependency graph, is input into the selected second-level graph attention module, and the candidate event structure element is classified by the second-level graph attention module in combination with the third-class feature vector of the candidate event structure element and the dependency graph, and the third probability vector of the candidate event structure element belonging to each event structure element category is output, i.e., the second output result.

[0087] Each candidate event structure element corresponds to a third probability vector, which includes multiple probability components. The probability components correspond to the event structure element categories one by one and are used to represent the probability that the corresponding candidate event structure element belongs to the corresponding event structure element category.

[0088] Through the second output result, the maximum probability component is selected from the third probability vector, and it is determined whether the maximum probability component is greater than a specified threshold. If it is greater than the specified threshold, the corresponding candidate event structure element is determined to be the target event structure element, and the event structure element category corresponding to the maximum probability component is used as the target category of the target event structure element under the target event type.

[0089] In the embodiment of the present invention, the first feature extraction module and the second feature extraction module in the event extraction model are used to obtain the first feature vector of the noun and the second feature vector of the verb, respectively, so that the feature vector extraction process is simplified and the design cost of the feature extraction module is reduced. In addition, the introduction of the first-level graph attention module and the second-level graph attention module can ensure the accuracy of the target event type acquisition and the accuracy of the target category of the target event structure element under the target event type.

[0090] On the basis of the above embodiment, the script event extraction method provided in the embodiment of the present invention, wherein the first word vector of the noun is input into the first feature extraction module of the event extraction model to obtain the first type of feature vector output by the first feature extraction module, specifically includes:

[0091] Inputting the first word vector into the feature concatenation layer of the first feature extraction module to obtain a concatenation vector output by the feature concatenation layer after concatenating the first word vector with a predetermined event structure element category feature vector;

[0092] Inputting the concatenated vector into the linear transformation layer of the first feature extraction module to obtain a first type of attention weight feature vector output by the linear transformation layer;

[0093] The first-category attention weight feature vector is input into the classification layer, and the classification layer normalizes the first-category attention weight feature vector and performs weighted summation on the first-category attention weight feature vector with the event structure element category feature vector to obtain and output the first-category feature vector.

[0094] Specifically, in the embodiment of the present invention, the first feature extraction module may include a feature concatenation layer, a linear transformation layer, and a classification layer connected in sequence.

[0095] When the first word vector of the noun is input into the first feature extraction module, the first word vector may be first input into the feature concatenation layer, which may concatenate the first word vector with a predetermined event structure element category feature vector to obtain and output a concatenation vector.

[0096] Each event structure element category corresponds to an event structure element category feature vector. The event structure element category feature vector can be obtained by initializing the feature vector of the corresponding event structure element category. The dimension of the event structure element category feature vector can be set as needed. To facilitate subsequent calculations, the dimension of the event structure element category feature vector, the first category feature vector, and the second category feature vector are all the same.

[0097] After that, the splicing vector is input to the linear transformation layer, which performs a linear transformation on the splicing vector. The linear transformation method can be to multiply the splicing vector with the linear transformation matrix, and the product result can be used as the first type of attention weight feature vector. In the linear transformation process, a bias vector can also be introduced, that is, the product result of the splicing vector and the linear transformation matrix is ​​added to the bias vector, and the addition result is used as the first type of attention weight feature vector.

[0098] Thereafter, the first-class attention weight feature vector can be mapped to the classification layer, i.e., the softmax layer, through an activation function, and the classification layer normalizes the first-class attention weight feature vector.

[0099] Among them, the activation function used in the mapping process is the hyperbolic tangent function, and its formula is:

[0100]

[0101] Among them, x represents the value of each element in the first type of attention weight feature vector.

[0102] The classification layer uses the softmax function to normalize the first-class attention weight feature vector. The formula of the softmax function is:

[0103]

[0104] Finally, the normalization result is weightedly summed with the event structure element category feature vector to obtain the first category feature vector.

[0105] In the embodiment of the present invention, the linear transformation layer is used to implement the introduction of the attention mechanism, which can simplify the structure of the first feature extraction module. Moreover, the introduction of the attention mechanism can enrich the information represented by the first type of feature vector.

[0106] On the basis of the above embodiment, the script event extraction method provided in the embodiment of the present invention, the first type of feature vector, the second type of feature vector and the dependency graph are input into the first-level graph attention module of the event extraction model, and then include:

[0107] Inputting the first-category feature vector and the dependency graph into a first attention unit in the first-level graph attention module, a first fusion subunit in the first attention unit fuses the first-category feature vector and the dependency graph, and a first classification subunit in the first attention unit classifies the noun based on a first fusion result, and outputs a first probability vector of whether the noun belongs to each event structure element category;

[0108] The second-category feature vector and the dependency graph are input into the second attention unit in the first-level graph attention module, the second fusion subunit in the second attention unit fuses the second-category feature vector and the dependency graph, and the second classification subunit in the second attention unit classifies the verb based on a second result obtained by the fusion, and outputs a second probability vector that the verb belongs to each event type.

[0109] Specifically, in an embodiment of the present invention, the first-level graph attention module may include a first attention unit and a second attention unit, the first attention unit is used to fuse and classify the first type of feature vector and the dependency graph, and the second attention unit is used to fuse and classify the second type of feature vector and the dependency graph.

[0110] The first type of feature vector and the dependency graph are input into the first attention unit, the first fusion subunit in the first attention unit fuses the first type of feature vector and the dependency graph, and the first classification subunit in the first attention unit classifies the noun based on the first fusion result, and outputs a first probability vector of whether the noun belongs to each event structure element category.

[0111] Here, for any noun in the dependency graph, the fourth-type feature vector of the adjacent words of the noun in the dependency graph can be determined first. If the adjacent words are nouns, the fourth-type feature vector is a first-type feature vector, that is, an attention feature vector; if the adjacent words are verbs, the fourth-type feature vector is a second-type feature vector, that is, a general feature vector.

[0112] Then, the first fusion subunit concatenates the first-category feature vector of any noun with the fourth-category feature vector of the adjacent word, and linearly transforms the concatenated result to obtain the second-category attention weight feature vector.

[0113] Thereafter, the second type of attention weight feature vector can be mapped to the classification layer, i.e., the softmax layer, through an activation function, and the classification layer normalizes the second type of attention weight feature vector.

[0114] Among them, the activation function used in the mapping process is the LeakyReLU function, and its formula is:

[0115]

[0116] Among them, x represents the value of each element in the second type of attention weight feature vector, and a is a constant.

[0117] The classification layer uses the softmax function to normalize the second type of attention weight feature vector. The formula of the softmax function is as described above.

[0118] Finally, a weighted sum is performed on the normalized result and the fourth type of feature vector to obtain a first result, which is a semantic feature vector.

[0119] It can be understood that since the functions of the first fusion subunit and the second fusion subunit are to fuse the feature vector and the dependency graph, when the dimensions of the first type of feature vector and the second type of feature vector are the same, the first fusion subunit and the second fusion subunit can be the same fusion subunit, that is, the first attention unit and the second attention unit share the same fusion subunit.

[0120] In the embodiment of the present invention, the introduction of the attention mechanism is realized by adopting a linear transformation method, so that the first type of feature vector and the dependency graph can be more accurately integrated.

[0121] On the basis of the above embodiment, the script event extraction method provided in the embodiment of the present invention, the third type of feature vector of the candidate event structure element and the dependency graph are input into the second level graph attention module corresponding to the target event type in the event extraction model, and then include:

[0122] The second-level graph attention module classifies the candidate event structure elements based on the third type of feature vectors and the dependency graph, and outputs a third probability vector that the candidate event structure elements belong to each event structure element category.

[0123] Specifically, in an embodiment of the present invention, after the third type of feature vectors and the dependency graph of the alternative event structure elements are input into the second-level graph attention module, the second-level graph attention module can classify the alternative event structure elements based on the third type of feature vectors and the dependency graph, and output a third probability vector that the alternative event structure elements belong to each event structure element category.

[0124] like Figure 3 As shown, based on the above embodiment, an embodiment of the present invention provides a script event extraction device, including:

[0125] An acquisition module 31 is used to acquire the script text to be extracted;

[0126] An analysis module 32 is used to perform dependency analysis on the script text to be extracted, and determine a dependency graph corresponding to the script text to be extracted;

[0127] An extraction module 33 is used to input the dependency graph into an event extraction model to obtain a target category of a target event structure element of the to-be-extracted script text under a target event type output by the event extraction model;

[0128] Among them, the event extraction model is trained based on a sample script text carrying category labels of each sample event structural element under the sample event type. The event extraction model is used to determine the first type of feature vectors of nouns and the second type of feature vectors of verbs in the dependency graph, and based on the first type of feature vectors, the second type of feature vectors and the dependency graph, combined with the graph attention mechanism, determine the target event type of the script text to be extracted and the target category of the target event structural element, and the first type of feature vector is an attention feature vector.

[0129] On the basis of the above-mentioned embodiment, the script event extraction device provided in the embodiment of the present invention, the extraction module is specifically used for:

[0130] Inputting the first word vector of the noun into the first feature extraction module of the event extraction model to obtain the first type of feature vector output by the first feature extraction module;

[0131] Inputting the second word vector of the verb into the second feature extraction module of the event extraction model to obtain the second type of feature vector output by the second feature extraction module;

[0132] Inputting the first-category feature vector, the second-category feature vector, and the dependency graph into a first-level graph attention module of the event extraction model, and determining the target event type and candidate event structure elements in the dependency graph based on a first output result of the first-level graph attention module;

[0133] The third type of feature vector of the alternative event structure element and the dependency graph are input into the second-level graph attention module corresponding to the target event type in the event extraction model, and based on the second output result of the second-level graph attention module, the target category of the target event structure element under the target event type is determined; wherein the third type of feature vector is an attention feature vector.

[0134] On the basis of the above-mentioned embodiment, the script event extraction device provided in the embodiment of the present invention, the extraction module is specifically used for:

[0135] Inputting the first word vector into the feature concatenation layer of the first feature extraction module to obtain a concatenation vector output by the feature concatenation layer after concatenating the first word vector with a predetermined event structure element category feature vector;

[0136] Inputting the concatenated vector into the linear transformation layer of the first feature extraction module to obtain a first type of attention weight feature vector output by the linear transformation layer;

[0137] The first-category attention weight feature vector is input into the classification layer, and the classification layer normalizes the first-category attention weight feature vector and performs weighted summation on the first-category attention weight feature vector with the event structure element category feature vector to obtain and output the first-category feature vector.

[0138] On the basis of the above-mentioned embodiment, in the script event extraction device provided in the embodiment of the present invention, the first output result includes a first probability vector of whether the noun belongs to an event structure element and a second probability vector of whether the target event in the script text to be extracted belongs to each event type; accordingly,

[0139] The extraction module is specifically used for:

[0140] If the probability of belonging to an event structure element in the first probability vector is greater than a preset threshold, taking the noun as the candidate event structure element;

[0141] The event type corresponding to the maximum probability component in the second probability vector is used as the target event type.

[0142] On the basis of the above-mentioned embodiment, the script event extraction device provided in the embodiment of the present invention, the extraction module is specifically used for:

[0143] Inputting the first-category feature vector and the dependency graph into a first attention unit in the first-level graph attention module, a first fusion subunit in the first attention unit fuses the first-category feature vector and the dependency graph, and a first classification subunit in the first attention unit classifies the noun based on a first fusion result, and outputs a first probability vector of whether the noun belongs to each event structure element category;

[0144] The second-category feature vector and the dependency graph are input into the second attention unit in the first-level graph attention module, the second fusion subunit in the second attention unit fuses the second-category feature vector and the dependency graph, and the second classification subunit in the second attention unit classifies the verb based on a second result obtained by the fusion, and outputs a second probability vector that the verb belongs to each event type.

[0145] On the basis of the above-mentioned embodiment, the script event extraction device provided in the embodiment of the present invention, the extraction module is specifically used for:

[0146] Determining a fourth type of feature vector of adjacent words of the noun in the dependency graph;

[0147] The first type of feature vector and the fourth type of feature vector are input into the first fusion subunit, and the first fusion subunit concatenates the first type of feature vector and the fourth type of feature vector, performs linear transformation on the concatenated result to obtain a second type of attention weight feature vector, normalizes the second type of attention weight feature vector, performs weighted summation on the normalized result and the fourth type of feature vector, and obtains and outputs the first result.

[0148] On the basis of the above-mentioned embodiment, the script event extraction device provided in the embodiment of the present invention, the extraction module is specifically used for:

[0149] The second-level graph attention module classifies the candidate event structure elements based on the third type of feature vectors and the dependency graph, and outputs a third probability vector that the candidate event structure elements belong to each event structure element category.

[0150] Specifically, the functions of each module in the script event extraction device provided in the embodiment of the present invention correspond one-to-one to the operating procedures of each step in the above-mentioned method embodiment, and the effects achieved are also consistent. Please refer to the above-mentioned embodiment for details, and no further description will be given in the embodiment of the present invention.

[0151] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4 As shown, the electronic device may include: a processor (Processor) 410, a communication interface (Communications Interface) 420, a memory (Memory) 430 and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 can call the logic instructions in the memory 430 to execute the script event extraction method provided in the above embodiments, which method includes: obtaining the script text to be extracted; performing dependency analysis on the script text to be extracted to determine the dependency graph corresponding to the script text to be extracted; inputting the dependency graph into the event extraction model to obtain the target category of the target event structural element of the script text to be extracted under the target event type output by the event extraction model; wherein the event extraction model is trained based on a sample script text carrying the category label of each sample event structural element under the sample event type, and the event extraction model is used to determine the first type of feature vector of nouns and the second type of feature vector of verbs in the dependency graph, and based on the first type of feature vector, the second type of feature vector and the dependency graph, combined with the graph attention mechanism, determine the target event type of the script text to be extracted and the target category of the target event structural element, and the first type of feature vector is an attention feature vector.

[0152] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.

[0153] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the script event extraction method provided in the above embodiments, and the method includes: obtaining a script text to be extracted; performing a dependency analysis on the script text to be extracted, and determining a dependency graph corresponding to the script text to be extracted; inputting the dependency graph into an event extraction model to obtain a target category of a target event structural element of the script text to be extracted under a target event type output by the event extraction model; wherein the event extraction model is trained based on a sample script text carrying a category label of each sample event structural element under a sample event type, and the event extraction model is used to determine a first-class feature vector of a noun and a second-class feature vector of a verb in the dependency graph, and based on the first-class feature vector, the second-class feature vector and the dependency graph, combined with a graph attention mechanism, determine the target event type of the script text to be extracted and the target category of the target event structural element, and the first-class feature vector is an attention feature vector.

[0154] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the processor executes the script event extraction method provided in the above embodiments, the method comprising: obtaining a script text to be extracted; performing a dependency analysis on the script text to be extracted, and determining a dependency graph corresponding to the script text to be extracted; inputting the dependency graph into an event extraction model, and obtaining a target category of a target event structural element of the script text to be extracted under a target event type output by the event extraction model; wherein the event extraction model is trained based on a sample script text carrying category labels of each sample event structural element under a sample event type, the event extraction model is used to determine a first-class feature vector of a noun and a second-class feature vector of a verb in the dependency graph, and based on the first-class feature vector, the second-class feature vector and the dependency graph, combined with a graph attention mechanism, determines a target event type of the script text to be extracted and a target category of the target event structural element, the first-class feature vector being an attention feature vector.

[0155] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0156] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0157] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A script event extraction method, characterized in that: include: Get the script text to be extracted; Performing dependency analysis on the script text to be extracted to determine a dependency graph corresponding to the script text to be extracted; Inputting the dependency graph into an event extraction model to obtain a target category of a target event structural element of the to-be-extracted script text under a target event type output by the event extraction model; The event extraction model is trained based on a sample script text carrying a category label of each sample event structure element under a sample event type. The event extraction model is used to determine a first-category feature vector of a noun and a second-category feature vector of a verb in the dependency graph, and based on the first-category feature vector, the second-category feature vector and the dependency graph, combined with a graph attention mechanism, determine a target event type of the script text to be extracted and a target category of the target event structure element. The first-category feature vector is an attention feature vector. The step of inputting the dependency graph into the event extraction model to obtain the target category of the target event structure element of the to-be-extracted script text under the target event type output by the event extraction model specifically includes: Inputting the first word vector of the noun into the first feature extraction module of the event extraction model to obtain the first type of feature vector output by the first feature extraction module; Inputting the second word vector of the verb into the second feature extraction module of the event extraction model to obtain the second type of feature vector output by the second feature extraction module; Inputting the first-category feature vector, the second-category feature vector, and the dependency graph into a first-level graph attention module of the event extraction model, and determining the target event type and candidate event structure elements in the dependency graph based on a first output result of the first-level graph attention module; The third type of feature vector of the alternative event structure element and the dependency graph are input into the second-level graph attention module corresponding to the target event type in the event extraction model, and based on the second output result of the second-level graph attention module, the target category of the target event structure element under the target event type is determined; wherein the third type of feature vector is an attention feature vector.

2. The script event extraction method according to claim 1, characterized in that: The step of inputting the first word vector of the noun into the first feature extraction module of the event extraction model to obtain the first type of feature vector output by the first feature extraction module specifically includes: Inputting the first word vector into the feature concatenation layer of the first feature extraction module to obtain a concatenation vector output by the feature concatenation layer after concatenating the first word vector with a predetermined event structure element category feature vector; Inputting the concatenated vector into the linear transformation layer of the first feature extraction module to obtain a first type of attention weight feature vector output by the linear transformation layer; The first-category attention weight feature vector is input into the classification layer, and the classification layer normalizes the first-category attention weight feature vector and performs weighted summation on the first-category attention weight feature vector with the event structure element category feature vector to obtain and output the first-category feature vector.

3. The script event extraction method according to claim 1, characterized in that: The first output result includes a first probability vector of whether the noun belongs to an event structure element and a second probability vector of whether the target event in the script text to be extracted belongs to each event type; accordingly, The determining, based on the first output result of the first-level graph attention module, the target event type and the candidate event structure elements in the dependency graph comprises: If the probability of belonging to an event structure element in the first probability vector is greater than a preset threshold, taking the noun as the candidate event structure element; The event type corresponding to the maximum probability component in the second probability vector is used as the target event type.

4. The script event extraction method according to claim 1, characterized in that: The step of inputting the first type of feature vector, the second type of feature vector, and the dependency graph into a first-level graph attention module of the event extraction model comprises: Inputting the first-category feature vector and the dependency graph into a first attention unit in the first-level graph attention module, a first fusion subunit in the first attention unit fuses the first-category feature vector and the dependency graph, and a first classification subunit in the first attention unit classifies the noun based on a first fusion result, and outputs a first probability vector of whether the noun belongs to each event structure element category; The second-category feature vector and the dependency graph are input into the second attention unit in the first-level graph attention module, the second fusion subunit in the second attention unit fuses the second-category feature vector and the dependency graph, and the second classification subunit in the second attention unit classifies the verb based on a second result obtained by the fusion, and outputs a second probability vector that the verb belongs to each event type.

5. The script event extraction method according to claim 4, characterized in that: The fusing of the first type of feature vector and the dependency graph by the first fusion subunit in the first attention unit specifically includes: Determining a fourth type of feature vector of adjacent words of the noun in the dependency graph; The first type of feature vector and the fourth type of feature vector are input into the first fusion subunit, and the first fusion subunit concatenates the first type of feature vector and the fourth type of feature vector, performs linear transformation on the concatenated result to obtain a second type of attention weight feature vector, normalizes the second type of attention weight feature vector, performs weighted summation on the normalized result and the fourth type of feature vector, and obtains and outputs the first result.

6. The script event extraction method according to any one of claims 1 to 5, characterized in that: The step of inputting the third type feature vector of the candidate event structure element and the dependency graph into the second level graph attention module corresponding to the target event type in the event extraction model comprises: The second-level graph attention module classifies the candidate event structure elements based on the third type of feature vectors and the dependency graph, and outputs a third probability vector that the candidate event structure elements belong to each event structure element category.

7. A script event extraction device, characterized in that: include: An acquisition module is used to obtain the script text to be extracted; An analysis module, used for performing dependency analysis on the script text to be extracted, and determining a dependency graph corresponding to the script text to be extracted; An extraction module, used for inputting the dependency graph into an event extraction model to obtain a target category of a target event structural element of the to-be-extracted script text under a target event type output by the event extraction model; The event extraction model is trained based on a sample script text carrying a category label of each sample event structure element under a sample event type. The event extraction model is used to determine a first-category feature vector of a noun and a second-category feature vector of a verb in the dependency graph, and based on the first-category feature vector, the second-category feature vector and the dependency graph, combined with a graph attention mechanism, determine a target event type of the script text to be extracted and a target category of the target event structure element. The first-category feature vector is an attention feature vector. The step of inputting the dependency graph into the event extraction model to obtain the target category of the target event structure element of the to-be-extracted script text under the target event type output by the event extraction model specifically includes: Inputting the first word vector of the noun into the first feature extraction module of the event extraction model to obtain the first type of feature vector output by the first feature extraction module; Inputting the second word vector of the verb into the second feature extraction module of the event extraction model to obtain the second type of feature vector output by the second feature extraction module; Inputting the first-category feature vector, the second-category feature vector, and the dependency graph into a first-level graph attention module of the event extraction model, and determining the target event type and candidate event structure elements in the dependency graph based on a first output result of the first-level graph attention module; The third type of feature vector of the alternative event structure element and the dependency graph are input into the second-level graph attention module corresponding to the target event type in the event extraction model, and based on the second output result of the second-level graph attention module, the target category of the target event structure element under the target event type is determined; wherein the third type of feature vector is an attention feature vector.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, it implements the script event extraction method as described in any one of claims 1-6.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the script event extraction method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Information classification extraction method and device, computer equipment and storage medium

    CN110765265A

  • Event sequential relation extraction method based on dynamic attention mechanism

    CN114153942A