Event extraction method, device, electronic device and storage medium

By adopting contrast learning technology in the event extraction model, combining recurrent neural networks and convolutional neural networks, the problem of insufficient semantic feature capture in the existing technology is solved, and a more efficient event extraction effect is achieved.

CN113723108BActive Publication Date: 2025-03-04SHENZHEN KINGSPEC ELECTRONICS TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110921072.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-11
Publication Date
2025-03-04
Estimated Expiration
2041-08-11

AI Technical Summary

Technical Problem

The prior art is difficult to fully capture the semantic features of the text context in event extraction, and there is interference from local semantic information, which affects the effect of event extraction.

Method used

An event extraction model based on contrast learning is adopted. This model is composed of recurrent neural networks and convolutional neural networks. It uses contrast loss functions to optimize feature vectors, reduce interference from local semantic information, and improve the accuracy of event extraction.

Benefits of technology

Through comparative learning technology, the model can more effectively capture the contextual semantic features of the text, reduce local semantic interference, and improve the accuracy and classification capabilities of event extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113723108B_ABST
    Figure CN113723108B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses an event extraction method, device, electronic device and storage medium. The method comprises: obtaining a target text, inputting the target text into an event extraction model, and obtaining an event extraction result; the event extraction model is obtained after training by contrastive learning based on the target text and the positive and negative samples corresponding to the target text; the positive sample corresponding to the target text is a first feature vector expressing the contextual semantics of the target text, and the negative sample corresponding to the target text is a second feature vector expressing the local semantics of the target text. The embodiment of the present application extracts text events by using an event extraction model trained by contrastive learning, which can reduce the interference of local semantic information of the text and improve the accuracy of identifying text events.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an event extraction method, device, electronic device and storage medium. Background Art

[0002] Event Extraction (EE) is a classic information extraction task in the field of natural language processing. It extracts event information of interest to users from unstructured text containing event information and presents it in a structured form. It is widely used in intelligence work in fields such as business and military.

[0003] In the prior art, the semantic features of the entire text are usually captured based on the traditional neural network model. However, this network model does not fully capture the semantic features of the text context and cannot capture richer contextual features. There is interference from local semantic information, which affects the final event extraction effect. Summary of the invention

[0004] Since the existing methods have the above-mentioned problems, the embodiments of the present application provide an event extraction method, device, electronic device and storage medium.

[0005] Specifically, the embodiments of the present application provide the following technical solutions:

[0006] In a first aspect, an embodiment of the present application provides an event extraction method, comprising:

[0007] Obtaining a target text, inputting the target text into an event extraction model, and obtaining an event extraction result;

[0008] Among them, the event extraction model is obtained after training through comparative learning based on the target text and the positive and negative samples corresponding to the target text; the positive sample corresponding to the target text is the first feature vector expressing the contextual semantics of the target text, and the negative sample corresponding to the target text is the second feature vector expressing the local semantics of the target text.

[0009] Optionally, the event extraction model consists of a recurrent neural network and a convolutional neural network;

[0010] The recurrent neural network is used to extract a first feature vector of the contextual semantics of the target text, and the convolutional neural network is used to extract a second feature vector of the local semantics of the target text.

[0011] Optionally, the event extraction model is trained based on the following steps, including:

[0012] Step 1: extract words from the target text and map them into word vectors;

[0013] Step 2: Input the word vector into a recurrent neural network and a convolutional neural network to obtain a first feature vector expressing the contextual semantics of the target text and a second feature vector expressing the local semantic features of the target text, respectively;

[0014] Step 3: solving a preset contrast loss function according to the first eigenvector and the second eigenvector, wherein the smaller the contrast loss function is, the closer the first eigenvector is to the second eigenvector;

[0015] Step 4: Optimize the recurrent neural network and the convolutional neural network by continuously optimizing the contrast loss function. When the contrast loss function is less than a preset threshold, the training ends, thereby obtaining a trained event extraction model composed of the recurrent neural network and the convolutional neural network.

[0016] Optionally, the word vector is input into a recurrent neural network to obtain a first feature vector expressing the contextual semantics of the target text, including:

[0017] Inputting the word vector into a recurrent neural network to obtain a previous feature vector of the target text outputted in a forward direction and a following feature vector of the target text outputted in a backward direction;

[0018] The feature vector of the previous text is fused with the feature vector of the following text to obtain a first feature vector expressing the contextual semantics of the target text.

[0019] Optionally, the contrast loss function is:

[0020]

[0021] Among them, L N is the contrast loss function, f(x) T is the anchor point feature vector, f(x + ) is the first feature vector expressing the contextual semantics of the target text, N is the number of target texts, f(x i ) is the i-th second feature vector expressing the local semantic features of the target text.

[0022] Optionally, the feature fusion of the previous feature vector and the following feature vector is performed to obtain a first feature vector expressing the contextual semantics of the target text, including:

[0023] The feature vector of the previous text and the feature vector of the following text are fused according to the following first formula to obtain a first feature vector expressing the contextual semantics of the target text; the first formula is:

[0024]

[0025] Among them, H t is the first eigenvector, w T is the transposed vector, is the above feature vector, is the following feature vector, b is the bias value, α and β are the weights corresponding to the previous feature vector and the following feature vector respectively.

[0026] Optionally, the word vector is input into a convolutional neural network to obtain a second feature vector expressing a local semantic feature of the target text, including:

[0027] The word vector is input into the convolutional neural network according to the following second formula to obtain a second feature vector expressing the local semantic features of the target text; the second formula is:

[0028] f t =f(k i v t:t+j-1 +b)

[0029] Among them, f t is the second eigenvector, j is the window size of the convolution kernel k, b is the bias value, i is the number of layers of the current convolutional neural network, and k i is the convolution kernel of the i-th layer, k i v t:t+j-1 is the word vector from t to t+j-1.

[0030] In a second aspect, an embodiment of the present application provides an event extraction device, including:

[0031] A processing module, used for acquiring a target text, inputting the target text into an event extraction model, and obtaining an event extraction result;

[0032] Among them, the event extraction model is obtained after training through comparative learning based on the target text and the positive and negative samples corresponding to the target text; the positive sample corresponding to the target text is the first feature vector expressing the contextual semantics of the target text, and the negative sample corresponding to the target text is the second feature vector expressing the local semantics of the target text.

[0033] In a third aspect, an embodiment of the present invention further 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 computer program, the event extraction method as described in the first aspect is implemented.

[0034] In a fourth aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the event extraction method as described in the first aspect.

[0035] It can be seen from the above technical solution that the embodiment of the present application obtains the event extraction result by inputting the target text into the trained event extraction model. Among them, the event extraction model is based on the target text and the positive and negative samples corresponding to the target text, and is obtained after training by contrastive learning; the positive sample corresponding to the target text is the first feature vector expressing the contextual semantics of the target text, and the negative sample corresponding to the target text is the second feature vector expressing the local semantics of the target text. It can be seen that the embodiment of the present application performs contrastive learning between vectors with global overall context features and vectors with local semantic features, thereby reducing the interference of local semantic information in the text and improving the accuracy of event extraction. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 This is one of the step flow charts of the event extraction method provided in the embodiment of the present application;

[0038] Figure 2 This is the second step flow chart of the event extraction method provided in the embodiment of the present application;

[0039] Figure 3 This is one of the flow charts of event extraction model training provided in the embodiment of the present application;

[0040] Figure 4 This is the second flowchart of the event extraction model training provided in the embodiment of the present application;

[0041] Figure 5 This is the third flow chart of the event extraction model training provided in the embodiment of the present application;

[0042] Figure 6 is a schematic diagram of the structure of an event extraction device provided in an embodiment of the present application;

[0043] Figure 7 It is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0044] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0045] Figure 1 This is one of the step flow charts of the event extraction method provided in the embodiment of the present application. Figure 2 This is the second step flow chart of the event extraction method provided in the embodiment of the present application. Figure 1 and Figure 2 The event extraction method provided in the embodiment of the present application is explained and illustrated in detail.

[0046] like Figure 1 As shown, an event extraction method provided in an embodiment of the present application includes:

[0047] Step 101: Obtain a target text, input the target text into an event extraction model, and obtain an event extraction result;

[0048] Among them, the event extraction model is obtained after training through comparative learning based on the target text and the positive and negative samples corresponding to the target text; the positive sample corresponding to the target text is the first feature vector expressing the contextual semantics of the target text, and the negative sample corresponding to the target text is the second feature vector expressing the local semantics of the target text.

[0049] In this step, the event extraction model is first pre-trained using the BERT language model, with the goal of enabling the event extraction model to have the ability to extract text semantics. After the event extraction model is pre-trained, the words in the target text can be extracted and mapped to word vectors. It should be noted that the event extraction model is constructed by a convolutional neural network and a recurrent neural network. Optionally, a BI-GRU recurrent neural network and a CNN convolutional neural network can be used. Among them, the BI-GRU recurrent neural network includes two forward and backward sub-GRU networks, which pass forward and backward the forward propagation formula that each GRU needs to pass through the network. When the word vector is input, the two word networks in the BI-GRU recurrent neural network forwardly output the target text upper feature vector and reversely output the target text lower feature vector. Then the forward and backward feature vectors are fused through the fully connected layer to generate a first feature vector for expressing the contextual semantics of the target text. The CNN convolutional neural network is a feedforward neural network that extracts local features for each word in the target text sentence through the characteristics of the convolutional neural network to form a second feature vector for expressing the local semantics of the target text.

[0050] In this step, since the first feature vector generated by the BI-GRU recurrent neural network has the global overall feature of the target text context, the second feature vector generated by the CNN convolutional neural network has the characteristics of the local information of the target text. Therefore, the two feature vectors are compared and learned to reduce the interference of local semantic information in the target text, enhance the event classification ability of the event extraction model, and ultimately achieve a better event extraction effect. Specifically: the first feature vector generated by the BI-GRU recurrent neural network is used as a positive sample, and the second feature vector generated by the CNN convolutional neural network is used as a negative sample. The positive and negative samples are brought into the preset contrast loss function for optimization calculation. When the contrast loss function is less than the preset threshold, the training ends, thereby obtaining a trained event extraction model composed of a recurrent neural network and a convolutional neural network.

[0051] It can be seen from the above technical solution that the embodiment of the present application obtains the event extraction result by inputting the target text into the trained event extraction model. Among them, the event extraction model is based on the target text and the positive and negative samples corresponding to the target text, and is obtained after training by contrastive learning; the positive sample corresponding to the target text is the first feature vector expressing the contextual semantics of the target text, and the negative sample corresponding to the target text is the second feature vector expressing the local semantics of the target text. It can be seen that the embodiment of the present application performs contrastive learning between vectors with global overall context features and vectors with local semantic features, thereby reducing the interference of local semantic information in the text and improving the accuracy of event extraction.

[0052] Based on the content of the above embodiment, in this embodiment, the event extraction model is composed of a recurrent neural network and a convolutional neural network;

[0053] The recurrent neural network is used to extract a first feature vector of the contextual semantics of the target text, and the convolutional neural network is used to extract a second feature vector of the local semantics of the target text.

[0054] Based on the content of the above embodiment, in this embodiment, the event extraction model is trained based on the following steps, including:

[0055] Step 1: extract words from the target text and map them into word vectors;

[0056] Step 2: Input the word vector into a recurrent neural network and a convolutional neural network to obtain a first feature vector expressing the contextual semantics of the target text and a second feature vector expressing the local semantic features of the target text, respectively;

[0057] Step 3: solving a preset contrast loss function according to the first eigenvector and the second eigenvector, wherein the smaller the contrast loss function is, the closer the first eigenvector is to the second eigenvector;

[0058] Step 4: Optimize the recurrent neural network and the convolutional neural network by continuously optimizing the contrast loss function. When the contrast loss function is less than a preset threshold, the training ends, thereby obtaining a trained event extraction model composed of the recurrent neural network and the convolutional neural network.

[0059] In this embodiment, the BERT model is first used to capture the word-level semantic features in the target text and convert them into high-dimensional dynamic word vectors. Finally, the local semantic information and contextual semantic information of the target text are extracted using the CNN network and the BI-GRU network respectively. Based on the contrastive learning method, by comparing the positive and negative sample pairs, the event extraction model's recognition has more semantic information vectors in the context of the target text, thereby improving the model's classification ability.

[0060] Based on the content of the above embodiment, in this embodiment, the word vector is input into a recurrent neural network to obtain a first feature vector expressing the contextual semantics of the target text, including:

[0061] Inputting the word vector into a recurrent neural network to obtain a previous feature vector of the target text outputted in a forward direction and a following feature vector of the target text outputted in a backward direction;

[0062] The feature vector of the previous text is fused with the feature vector of the following text to obtain a first feature vector expressing the contextual semantics of the target text.

[0063] Based on the content of the above embodiment, in this embodiment, the contrast loss function is:

[0064]

[0065] Among them, L N is the contrast loss function, f(x) T is the anchor point feature vector, f(x + ) is the first feature vector expressing the contextual semantics of the target text, N is the number of target texts, f(x i ) is the i-th second feature vector expressing the local semantic features of the target text.

[0066] Based on the content of the above embodiment, in this embodiment, the feature fusion of the previous feature vector and the following feature vector is performed to obtain a first feature vector expressing the contextual semantics of the target text, including:

[0067] The feature vector of the previous text and the feature vector of the following text are fused according to the following first formula to obtain a first feature vector expressing the contextual semantics of the target text; the first formula is:

[0068]

[0069] Among them, H t is the first eigenvector, w T is the transposed vector, is the above feature vector, is the following feature vector, b is the bias value, α and β are the weights corresponding to the previous feature vector and the following feature vector respectively.

[0070] Based on the content of the above embodiment, in this embodiment, the word vector is input into a convolutional neural network to obtain a second feature vector expressing the local semantic features of the target text, including:

[0071] According to the second formula below, the word vector is input into the convolutional neural network to obtain a second feature vector expressing the local semantic features of the target text.

[0072] f t =f(k i v t:t+j-1 +b)

[0073] Among them, f t is the second eigenvector, j is the window size of the convolution kernel k, b is the bias value, i is the number of layers of the current convolutional neural network, and k i is the convolution kernel of the i-th layer, k i v t:t+j-1 is the word vector from t to t+j-1.

[0074] The following is described by specific examples:

[0075] Embodiment 1:

[0076] In this embodiment, the BERT network is first used for modeling and training. Specifically, in the BERT layer, in the Embedding process, a given Chinese sentence consisting of n words S = {w1, w2, w3, w4, ..., w n Each word w i Transformed into a word vector e with a dimension of 640x1 i That is, E={e1,e2,e3,e4,…,e n}.

[0077] In this embodiment, if Figure 3As shown in the figure, in the BI-GRU network, since the BI-GRU network contains two sub-GRU networks, forward and backward, each GRU needs to pass through the network's forward propagation formula to pass forward and backward, respectively, where h t is the input at this moment, h t-1 is the memory output of the previous moment, Wr, Wz, Wh, Wo are the parameters of the model respectively. The forward propagation formula of the network is:

[0078] Z t =σ(w t ×[h t-1 , x t ])

[0079] r t =σ(w t ×[h t-1 , x t ]

[0080]

[0081]

[0082] In this embodiment, after the word vector is input into the BI-GRU network, the feature vector of the forward output is The feature vector of the backward output is The forward and backward feature vectors are fused and reduced in dimension through the fully connected layer. In order to reduce the loss of key semantic features when the forward and backward feature vectors are fused, weights α and β are introduced. The optimized formula is:

[0083]

[0084] In this embodiment, if Figure 4 As shown in the figure, after the word vector is input into the CNN convolutional neural network, the word vector mapping matrix is ​​convolved using the characteristics of the convolutional neural network to obtain the semantic mapping matrix of the target text, and then the semantic mapping matrix of the target text is reduced in dimension using the pooling algorithm to obtain the local semantic feature vector of the target text. Among them, convolution is equivalent to a process of sliding the convolution kernel on the input matrix to perform product summation. The target word vector can form a local feature vector f t Its expression is:

[0085] f t =f(k i v t:t+j-1 +b)

[0086] where v t is the input word vector matrix, j is the window size of the convolution kernel k, b is the bias value, and is the ReLU activation function.

[0087] In this embodiment, since the feature vector generated by the BI-GRU network has the global overall characteristics of the context, and the feature vector generated by the CNN network mainly contains local information, comparative learning of the two feature vectors can reduce the interference of local semantic information, enhance the model's event classification ability, and ultimately achieve better event extraction effects.

[0088] like Figure 5 As shown, in the embodiment of the present application, the feature vector generated by the BI-GRU network is used as a positive sample, and the feature vector generated by the CNN network is used as a negative sample. The weight variable θ∈(0,1) is introduced in the calculation to balance the loss function. The optimized loss function is:

[0089]

[0090] It can be seen that the embodiment of the present application first uses the BERT model to capture the semantic features of the word level and converts it into a high-dimensional dynamic word vector. Then, the BI-GRU network and the CNN network are used to capture features in two time steps from front to back and from back to front, respectively, to obtain the contextual semantics of the target text, thereby capturing richer contextual features and improving the classification accuracy. Finally, the two feature vectors are compared and learned to reduce the interference of local semantic information, enhance the model event classification ability, and finally eliminate irrelevant semantic influences as much as possible to achieve better event extraction effects.

[0091] Based on the same inventive concept, another embodiment of the present invention provides an event extraction device, such as Figure 6 As shown, an event extraction device provided in an embodiment of the present application includes:

[0092] A processing module, used for acquiring a target text, inputting the target text into an event extraction model, and obtaining an event extraction result;

[0093] Among them, the event extraction model is obtained after training through comparative learning based on the target text and the positive and negative samples corresponding to the target text; the positive sample corresponding to the target text is the first feature vector expressing the contextual semantics of the target text, and the negative sample corresponding to the target text is the second feature vector expressing the local semantics of the target text.

[0094] In this embodiment, the event extraction model is first pre-trained using the BERT language model, with the goal of enabling the event extraction model to have the ability to extract text semantics. After the event extraction model is pre-trained, the words in the target text can be extracted and mapped to word vectors. It should be noted that the event extraction model is constructed by a convolutional neural network and a recurrent neural network. Optionally, a BI-GRU recurrent neural network and a CNN convolutional neural network can be used. Among them, the BI-GRU recurrent neural network includes two forward and backward sub-GRU networks, which pass forward and backward the forward propagation formula that each GRU needs to pass through the network. When the word vector is input, the two word networks in the BI-GRU recurrent neural network forwardly output the target text upper feature vector and reversely output the target text lower feature vector. Then the forward and backward feature vectors are fused through the fully connected layer to generate a first feature vector for expressing the contextual semantics of the target text. The CNN convolutional neural network is a feedforward neural network that extracts local features from each word in the target text sentence through the characteristics of the convolutional neural network to form a second feature vector for expressing the local semantics of the target text.

[0095] In this embodiment, since the first feature vector generated by the BI-GRU recurrent neural network has the global overall feature of the target text context, the second feature vector generated by the CNN convolutional neural network has the characteristics of the local information of the target text. Therefore, the two feature vectors are compared and learned to reduce the interference of local semantic information in the target text, enhance the event classification ability of the event extraction model, and ultimately achieve a better event extraction effect. Specifically: the first feature vector generated by the BI-GRU recurrent neural network is used as a positive sample, and the second feature vector generated by the CNN convolutional neural network is used as a negative sample. The positive and negative samples are brought into the preset contrast loss function for optimization calculation. When the contrast loss function is less than the preset threshold, the training ends, thereby obtaining a trained event extraction model composed of a recurrent neural network and a convolutional neural network.

[0096] It can be seen from the above technical solution that the embodiment of the present application obtains the event extraction result by inputting the target text into the trained event extraction model. Among them, the event extraction model is based on the target text and the positive and negative samples corresponding to the target text, and is obtained after training by contrastive learning; the positive sample corresponding to the target text is the first feature vector expressing the contextual semantics of the target text, and the negative sample corresponding to the target text is the second feature vector expressing the local semantics of the target text. It can be seen that the embodiment of the present application performs contrastive learning between vectors with global overall context features and vectors with local semantic features, thereby reducing the interference of local semantic information in the text and improving the accuracy of event extraction.

[0097] Based on the same inventive concept, another embodiment of the present invention provides an electronic device, see Figure 7 The structural diagram of the electronic device specifically includes the following contents: a processor 701, a memory 702, a communication interface 703 and a communication bus 704;

[0098] The processor 701, the memory 702, and the communication interface 703 communicate with each other through the communication bus 704; the communication interface 703 is used to realize information transmission between various devices;

[0099] The processor 701 is used to call the computer program in the memory 702. When the processor executes the computer program, it implements all the steps of the above-mentioned event extraction method, for example, obtaining the target text, inputting the target text into the event extraction model, and obtaining the event extraction result; wherein the event extraction model is based on the target text and the positive and negative samples corresponding to the target text, and is obtained after training by comparative learning; the positive sample corresponding to the target text is the first feature vector expressing the contextual semantics of the target text, and the negative sample corresponding to the target text is the second feature vector expressing the local semantics of the target text.

[0100] Based on the same inventive concept, another embodiment of the present invention provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, all the steps of the above-mentioned event extraction method are implemented, for example, obtaining a target text, inputting the target text into an event extraction model, and obtaining an event extraction result; wherein the event extraction model is based on the target text and the positive and negative samples corresponding to the target text, and is obtained after training by comparative learning; the positive sample corresponding to the target text is a first feature vector expressing the contextual semantics of the target text, and the negative sample corresponding to the target text is a second feature vector expressing the local semantics of the target text.

[0101] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, 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, which is stored in a storage medium and includes several 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: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0102] 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 embodiments of the present invention. Those of ordinary skill in the art may understand and implement them without creative effort.

[0103] 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 event extraction method described in each embodiment or some parts of the embodiment.

[0104] 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. An event extraction method, characterized in that: include: Obtaining a target text, and inputting the target text into an event extraction model to obtain an event extraction result; Among them, the event extraction model is obtained after training through contrastive learning based on the target text and the positive and negative samples corresponding to the target text; the positive sample corresponding to the target text is a first feature vector expressing the contextual semantics of the target text, and the negative sample corresponding to the target text is a second feature vector expressing the local semantics of the target text; the contrastive learning includes substituting the positive sample and the negative sample into a preset contrast loss function, and optimizing the contrast loss function until the contrast loss function is less than a preset threshold.

2. The event extraction method according to claim 1, characterized in that: The event extraction model consists of a recurrent neural network and a convolutional neural network; The recurrent neural network is used to extract a first feature vector of the contextual semantics of the target text, and the convolutional neural network is used to extract a second feature vector of the local semantics of the target text.

3. The event extraction method according to claim 2, characterized in that: The event extraction model is trained based on the following steps, including: Step 1: extract words from the target text and map them into word vectors; Step 2: Input the word vector into a recurrent neural network and a convolutional neural network to obtain a first feature vector expressing the contextual semantics of the target text and a second feature vector expressing the local semantic features of the target text, respectively; Step 3: solving the preset contrast loss function according to the first eigenvector and the second eigenvector, wherein the smaller the contrast loss function is, the closer the first eigenvector is to the second eigenvector; Step 4: Optimize the recurrent neural network and the convolutional neural network by continuously optimizing the contrast loss function. When the contrast loss function is less than the preset threshold, the training ends, thereby obtaining a trained event extraction model composed of the recurrent neural network and the convolutional neural network.

4. The event extraction method according to claim 3, characterized in that: The word vector is input into a recurrent neural network to obtain a first feature vector expressing the contextual semantics of the target text, including: Inputting the word vector into a recurrent neural network to obtain a previous feature vector of the target text outputted in a forward direction and a following feature vector of the target text outputted in a backward direction; The feature vector of the previous text is fused with the feature vector of the following text to obtain a first feature vector expressing the contextual semantics of the target text.

5. The event extraction method according to claim 3, characterized in that: The contrast loss function is: Among them, L N is the contrast loss function, f(x) T is the anchor point feature vector, f(x + ) is the first feature vector expressing the contextual semantics of the target text, N is the number of target texts, f(x i ) is the i-th second feature vector expressing the local semantic features of the target text.

6. The event extraction method according to claim 4, characterized in that: The feature fusion of the previous feature vector and the following feature vector is performed to obtain a first feature vector expressing the contextual semantics of the target text, including: The feature vector of the previous text and the feature vector of the following text are fused according to the following first formula to obtain a first feature vector expressing the contextual semantics of the target text; the first formula is: Among them, H t is the first eigenvector, w T is the transposed vector, is the above feature vector, is the following feature vector, b is the bias value, α and β are the weights corresponding to the previous feature vector and the following feature vector respectively.

7. The event extraction method according to claim 3, characterized in that: The word vector is input into a convolutional neural network to obtain a second feature vector expressing the local semantic features of the target text, including: The word vector is input into the convolutional neural network according to the following second formula to obtain a second feature vector expressing the local semantic features of the target text; the second formula is: f t =f(k i n t:t+j-1 +b) Among them, f t is the second eigenvector, j is the window size of the convolution kernel k, b is the bias value, i is the number of layers of the current convolutional neural network, and k i is the convolution kernel of the i-th layer, k i v t:t+j-1 is the word vector from t to t+j-1.

8. An event extraction device, characterized in that: include: A processing module, used for acquiring a target text, inputting the target text into an event extraction model, and obtaining an event extraction result; Among them, the event extraction model is obtained after training through contrastive learning based on the target text and the positive and negative samples corresponding to the target text; the positive sample corresponding to the target text is a first feature vector expressing the contextual semantics of the target text, and the negative sample corresponding to the target text is a second feature vector expressing the local semantics of the target text; the contrastive learning includes substituting the positive sample and the negative sample into a preset contrast loss function, and optimizing the contrast loss function until the contrast loss function is less than a preset threshold.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the event extraction method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the event extraction method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Text classification method and system

    CN109871444A

  • Text statement processing method and device, computer equipment and storage medium

    CN111950269A