Event detection method and device based on semantic network word representation and attention map
By using semantic networks and attention graphs, word content, structure, and position feature vectors are generated, feature extraction is optimized, and the problems of polysemy and synonym association in existing technologies are solved, achieving more efficient event detection.
Patent Information
- Application Number
- CN202110806934.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-16
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2041-07-16
AI Technical Summary
Existing event detection methods are inadequate in handling polysemy and synonym association, resulting in low detection accuracy and an inability to effectively identify trigger words and classify events.
We employ a method based on semantic network word representation and attention graphs. We generate word content vectors through a pre-trained language model, combine semantic graphs and positional feature vectors, and optimize features using an attention mechanism to generate more accurate event detection results.
It improves the accuracy of event detection, especially when dealing with polysemy and synonym association, enabling more accurate identification of trigger words and classification of event types.
Smart Images

Figure CN115700583B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of natural language processing, in particular to an event detection method and device based on semantic network word representation and attention map. The method can automatically find events and determine event types from news reports, data files and other text data, and is an event detection method suitable for written text data (different from social text, daily communication text and other spoken language text). The method is applicable to any field of events (such as business, agriculture, finance, entertainment, etc.), and can be applied to public opinion monitoring and event analysis scenarios. BACKGROUND
[0002] Event detection is an important content of knowledge mining. In recent years, with the increasing application of event detection, a large number of methods related to event detection have appeared, which can be mainly divided into two categories: (1) traditional methods, which extract feature rules for classification through text analysis and semantic analysis; (2) methods based on deep neural networks, which capture clues for classification through feature vectors. Some methods have been proposed to address the above problems.
[0003] The traditional methods can be divided into three categories: the first category of methods is based on lexical features, and ingenious filtering rules are generated manually. The second category considers semantic features such as POS tags, and automatically generates filtering rules. The third category is based on statistical information, and filtering rules are generated by establishing logical relationships between words. The rule-based method is simple in principle, but since the amount of information contained in a single rule is small, in order to effectively detect events, intensive manual engineering is often required to design thousands of rules. The traditional method formulates rules for each interpretation of a word, but the event detection rules extracted by human beings only contain language rules that can be directly understood by humans, and it is difficult to mine abstract deep semantic information. Therefore, the amount of information that can be covered by rules in event detection is limited.
[0004] The event detection methods based on deep neural networks mainly include the methods based on CNN and RNN. The event detection model based on CNN regards the event detection problem as a classification problem, and classifies each word into the corresponding trigger category. The typical CNN model includes DMCNN (Chen, Y., Xu, L., Liu, K., et al.: Event extraction via dynamic multi-pooling convolutional neural networks. In: Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing, vol. 1, pp. 167-176 (2015)) and Dual-representation CNN (Extracting Biomedical Events with Parallel Multi-Pooling Convolutional Neural Networks Lishuang Li, Yang Liu, and Meiyue Qin), which both capture the features for classifying words through the method of max-pooling. The existing CNN-based methods fuse the information at the sentence level and the information at the word level, which to some extent increases the amount of information input into the model, but cannot solve the problem of polysemy, nor can they directly establish a correlation for synonyms in the corpus.The event detection model based on RNN solves the event detection problem as a sequence labeling problem, including typical models such as LSTM (Chen, Y., Liu, S., He, S., Kang, L., & Zhao, J.. (2016). Event Extraction via Bidirectional Long Short-Term Memory Tensor Neural Networks. China National Conference on Chinese Computational Linguistics International Symposium on Natural Language Processing Based on Naturally Annotated Big Data. Springer International Publishing.) and dbRNN (Sha, L., *Feng Qian, *Baobao Chang, & Sui, Z.. Jointly Extracting Event Triggers and Arguments by Dependency-Bridge RNN and Tensor-Based Argument Interaction.) etc. Through capturing the connection between the current word and other words in the sentence, the sequence features contained in the context information are learned, and the features are used to generate corresponding event element labels for the words. The method based on learning models such as ELMo (Peters, M., Neumann, M., Iyyer, M., Gardner, M., & Zettlemoyer, L.. (2018). Deep Contextualized Word Representations. Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers).) can solve the polysemy problem, and the model introducing the label attention mechanism can introduce more information helpful to event element labeling for the model, but the existing RNN method cannot directly establish the connection between synonyms. Therefore, it is necessary to improve the polysemy and synonym problems, and design a more accurate event detection method. SUMMARY
[0005] In order to overcome the shortcomings of the existing method in event detection accuracy, the present application provides an event detection method and device based on semantic network word representation and attention map. In the event detection problem, it is necessary to determine whether there is a trigger word in the sentence, and if so, to determine the corresponding event category for the trigger word. The difficulty of completing event detection is that only the information contained in the local context cannot solve the problems of polysemy processing difficulty, synonym association difficulty and insufficient information, and cannot support the correct detection and classification of trigger words. For example, the polysemy problem may cause trigger words containing multiple meanings to be classified as incorrect event types, and not associating synonyms may cause some trigger words expressing events to be ignored. Therefore, the above problems need to be solved to improve the accuracy of event detection.
[0006] The technical solutions adopted by the present application are as follows:
[0007] An event detection method based on semantic network word representation and attention map, the steps of which include:
[0008] 1) Using a pre-trained language model to generate a word content vector CWF for each word in the text data;
[0009] 2) According to the semantic relationship between words in the sample data set, a semantic graph G is constructed, and a word structure vector SF is generated for each word using the semantic graph G, wherein the vertices in the semantic graph G are words, and the edges are semantic relationships between words;
[0010] 3) According to the position of each word in each sentence of the text data, a position feature vector PF is generated for each word;
[0011] 4) Concatenate the word content vector CWF, the word structure vector SF and the position feature vector PF of each word, and generate a feature map for each sentence based on each sentence of the text data and the concatenation result;
[0012] 5) Generate a POS vector for each word in the text data, and perform attention mechanism calculation based on the feature map and the POS vector of each word to generate a new feature map for each sentence;
[0013] 6) Concatenate the sentence-level feature vector P generated based on the new feature map with the word content vector CWF in the sentence, and classify the input vector F obtained by concatenation to obtain the event detection result.
[0014] Further, before generating the word content vector CWF, the word structure vector SF and the position feature vector PF, the text data is preprocessed; the preprocessing includes: word segmentation processing.
[0015] Further, the word structure vector SF for each word in the text data is generated by the following steps:
[0016] 1) Represent the semantic graph G as an adjacency matrix M, and based on the adjacency matrix M, calculate semantic similarity scores for words without direct semantic association, obtain a complete semantic association matrix M G
[0017] 2) Normalize each row in the complete semantic association matrix M G using L2 norm, to obtain a transformation matrix;
[0018] 3) Use principal component analysis to transform the matrix, to generate a word structure vector SF for each word.
[0019] Further, the position feature vector PF is generated by the following steps:
[0020] 1) Traverse each word in the sentence in order, and set the traversed word as a candidate trigger word;
[0021] 2) Obtain the relative distance d of each word in the corresponding sentence to the candidate trigger word;
[0022] 3) According to the relative distance d and the randomly generated embedding matrix, generate a distance vector matrix, wherein the vector represented by the d-th row in the distance vector matrix represents the position vector of the word with a distance of d to the trigger word or argument;
[0023] 4) Through back propagation, randomly initialize and optimize the distance vector matrix to obtain the position feature vector PF of each word.
[0024] Further, the method for generating the POS vector comprises: using the natural language processing tool StanfordCoreNlp.
[0025] Further, the new feature map is generated by the following steps:
[0026] 1) Set each feature map to be a vector of length d k , generate a random vector W Q of length w, and calculate the product of the vector of length d k and the random vector W Q to generate a matrix Q;
[0027] 2) Parallelly splice the POS vectors of each word to generate a POS matrix, generate a random matrix W K of length w and width of the length of the POS vector, and calculate the product of the POS matrix and the random matrix W K to generate a matrix K;
[0028] 3) Generate a random vector W V of length d k , and calculate the product of the random vector W V and the feature map to generate a matrix V;
[0029] 4) using the matrix Q, the matrix K and the matrix V, an attention matrix Z is generated;
[0030] 5) multiplying the attention matrix Z with the feature map respectively, a new feature map is generated.
[0031] Further, the sentence-level feature vector P is generated by the following steps:
[0032] 1) traversing each word in each sentence, and selecting one word as a candidate trigger word each time;
[0033] 2) dividing the new feature map of the sentence by taking the candidate trigger word as a boundary, and obtaining the front half new feature map and the rear half new feature map of each trigger word respectively.
[0034] 3) calculating the values of the front half new feature map and the rear half new feature map, and selecting a front half new feature map with the maximum value and a rear half new feature map with the maximum value respectively;
[0035] 4) splicing the front half new feature map with the maximum value and the rear half new feature map with the maximum value of each sentence together, to obtain the sentence-level feature vector P.
[0036] Further, the event detection result is obtained by the following steps:
[0037] 1) constructing a linear classifier O = W s F + b s , wherein W s is the first parameter of the linear classifier, and b s is the second parameter of the linear classifier;
[0038] 2) inputting the input vector F into the linear classifier O, to obtain the event detection result.
[0039] A storage medium, wherein the storage medium stores a computer program, and the computer program is configured to execute the above method when running.
[0040] An electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the computer program to execute any of the above methods.
[0041] Compared with the prior art, the present application has the following advantages:
[0042] 1) external corpus, semantic network, part of speech and attention map are comprehensively used to complete event detection;
[0043] 2) Using a pre-trained language model to generate word embedding, using this way can learn the characteristics of context word representation, generate different vectors for the same word with different meanings in different contexts to solve the problem of polysemy; and based on the relationship between the synonyms represented by the semantic network, the word embedding is generated by using the network-based vector generation method, thereby expressing the association information between synonyms;
[0044] 3) A new feature optimization step is added between the feature transformation and feature selection steps, according to the sentence structure information and the entity category information of the entity words in the sentence, the weighting of each part of the feature is adjusted, thereby highlighting the part of the feature that needs to be paid more attention, that is, the part corresponding to the trigger word, and then optimizing the feature, thereby more accurately extracting the trigger word, and introducing more information;
[0045] 4) A part-of-speech information-based attention mechanism is designed to optimize the extracted features, making the features related to the trigger word more easily captured. BRIEF DESCRIPTION OF DRAWINGS
[0046] Figure 1 An event detection flowchart. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical scheme and advantages of the present application more clear, the present application is further described in detail below with reference to the drawings.
[0048] The technical scheme of the present application mainly includes:
[0049] After inputting a single sentence text data, first, the preprocessing such as word segmentation is performed. Then, for each word in the sentence, a pre-trained language model is used to generate a corresponding word vector, and a semantic network word vector representation is used to generate a word vector. The position of each word in the sentence is also represented by a vector. The above vectors of each word in the sentence are spliced to generate a sentence representation matrix. The matrix is input into a convolution layer to generate a group of feature maps. POS tags are generated based on the single sentence text data and converted into POS vectors. The POS vectors and the feature maps are input into an attention mechanism to calculate a new feature vector. The new feature vector and the context feature vector at the word level are spliced to generate a total feature vector. The total feature vector is input into a classifier to obtain the trigger and time type, that is, the event detection for the single sentence is completed.
[0050] As shown in Figure 1 The event detection flow of the present application includes the following steps:
[0051] 1. Pre-trained language model generates word content vector CWF:
[0052] Step 1: Select a language model suitable for the target corpus and pre-trained on a large corpus;
[0053] Step two: Fine-tune the pre-trained language model on the target corpus. Using the language model, for a word with multiple meanings, generate a corresponding word content vector for each of its meanings.
[0054] 2. Generate word structure vector SF based on semantic network:
[0055] Step one: Represent semantic network as a semantic graph G, where each word is a vertex, and an edge is established between two words if there is a semantic relation between them.
[0056] Step two: Represent the semantic graph as an adjacency matrix M. When two nodes of G, w i and w j have a direct semantic relation and are associated by an edge, set the matrix element M i,j to 1 (otherwise, set it to 0).
[0057] Step three: Based on the adjacency matrix M, use the cumulative iteration method to construct a similarity matrix to calculate the semantic similarity score for words without direct semantic association, enriching the content of matrix M. The calculation method is as follows:
[0058]
[0059] where I is the identity matrix, and for each transition matrix M n , calculate the association value between nodes i and j with path length n, denoted as G i,j , and α < 1 is a constant used to describe the degree of reduction in lexical similarity represented by longer paths compared to shorter paths.
[0060] Iterate the above process to obtain the complete semantic association matrix M G . M G can be obtained by the following inverse matrix operation.
[0061]
[0062] Step four: Normalize each row in the complete semantic association matrix M G using L2 norm, so that it corresponds to a vector with a score sum of 1, to obtain the transformation matrix,.
[0063] Step five: Use principal component analysis to transform the matrix, reduce the size of the vector, and set the dimension of the encoding semantic space to generate a word representation matrix based on the semantic network.
[0064] 3. Position feature vector PF:
[0065] Step one:
[0066] Traverse each word in the sentence in order, and the traversed word is the candidate trigger word.
[0067] Step two:
[0068] Obtain the relative distance of each word in the sentence to the candidate trigger word, denoted as d
[0069] Step three:
[0070] Randomly generate an embedding matrix, and the vector represented by the dth row of the matrix represents the position vector of the word with a distance of d to the trigger word or argument.
[0071] Step four:
[0072] Randomly initialize and optimize the matrix generating the distance vector through back propagation.
[0073] 4. Convolution generates feature map
[0074] Step one: parallel splicing of CWF, SF, and PF
[0075] Step two: generate n filters to generate a feature map by convolution. The convolution window size is h.
[0076] 5. Attention mechanism calculation process
[0077] Step one: POS matrix generation
[0078] Generate POS tags (part-of-speech tagging) through the natural language processing tool StanfordCoreNlp, and generate a one-hot vector for each POS tag.
[0079] Step two: generate POS tags for the input sentence
[0080] Each word corresponds to a POS tag.
[0081] Step three: generate Q matrix.
[0082] 1) Let each feature map be a vector of length d k ;
[0083] 2) Randomly generate a new random vector W Q of length w.
[0084] 3) Calculate the product of d k and W Q to generate a new matrix Q.
[0085] Step four: generate K matrix
[0086] 1) Parallelly splice the POS vectors of all words in the sentence to generate the POS matrix;
[0087] 2) Randomly generate a random matrix W with length w and width POS vector length K ;
[0088] 3) Multiply the POS matrix with W K matrix to generate matrix K.
[0089] Step five: generate V matrix
[0090] 1) Generate a random vector with length d k , named as W V
[0091] 2) Multiply W V with feature map to generate matrix V.
[0092] Step six: attention mechanism calculation
[0093] Calculate attention using the following formula to generate attention matrix Z
[0094]
[0095] Step seven: new feature map generation
[0096] Multiply Z with the original feature map respectively to generate a new feature map.
[0097] Step eight: training W K , W Q , W V matrix or vector.
[0098] The scoring function is as follows:
[0099]
[0100] All feature maps generated by convolution are calculated, and W K , W Q , W V are updated continuously.
[0101] 6. Dynamic multi-pooling
[0102] Step one: traverse each word in the sentence, and select one word as the candidate trigger word each time
[0103] Step two: divide the new feature map with the candidate trigger word as the boundary, and obtain the new feature map of the first half and the second half of the trigger word respectively.
[0104] Step three: select the maximum value of each feature map, that is, p j,i = max(c j,i). The maximum values are spliced to form a vector, and a sentence-level feature vector P of the sentence is obtained as the output of the dynamic multi-pooling. Wherein, j is the jth sentence, and i is the ith new feature map.
[0105] 7. Classifier classification
[0106] Step one: splice the sentence-level feature vector P and the word-level feature vector CWF to generate an input vector F of the classifier
[0107] Step two: construct a linear classifier O = W s F + b s The type of the output O contains all trigger type labels and a "non-trigger" label, wherein W s , b s are parameters of the linear classifier.
[0108] The event detection experiment of the present application on the widely used ACE2005 benchmark dataset shows that the method is obviously superior to the existing event detection method, and an experimental effect of F1 = 74.9 is obtained in trigger detection. Through performance analysis of the present application, it is considered that the present application is an effective event detection tool.
[0109] The above examples are only used to illustrate the technical solutions of the present application but not to limit it, and the ordinary skilled in the art can modify or equivalently replace the technical solutions of the present application without departing from the spirit and scope of the present application, and the protection scope of the present application should be subject to the description in the claims.
Claims
1. An event detection method based on semantic network word representation and attention map, comprising the steps of: 1) generating a word content vector CWF for each word in the text data using a pre-trained language model; 2) constructing a semantic graph G according to the semantic relationship between words in the sample data set, and generating a word structure vector SF for each word using the semantic graph G, wherein the vertices in the semantic graph G are words, and the edges in the semantic graph G represent the semantic relationship between words, and the word structure vector SF for each word in the text data is generated by the following steps: The semantic graph G is represented as an adjacency matrix M, and based on the adjacency matrix M, a semantic similarity score is calculated for words without direct semantic association, and a complete semantic association matrix M is obtained G ; Each row of the full semantic correlation matrix M G is normalized using the L2 norm to obtain a transformation matrix; using a principal component analysis transformation matrix to generate a word structure vector SF for each word; 3) generating a position feature vector PF for each word according to its position in each sentence of the text data, wherein the position feature vector PF is generated by the following steps: traversing each word in the sentence in order, and setting the traversed word as a candidate trigger word; obtaining the relative distance d of each word in the corresponding sentence to the candidate trigger word; generating a distance vector matrix according to the relative distance d and a randomly generated embedding matrix, wherein the vector represented by the d-th row in the distance vector matrix represents the position vector of the word with a distance of d from the trigger word or argument; randomly initializing and optimizing the distance vector matrix through back propagation to obtain the position feature vector PF for each word; 4) concatenating the word content vector CWF, the word structure vector SF and the position feature vector PF for each word, and generating a feature map for each sentence based on each sentence of the text data and the concatenation result; 5) generating a POS vector for each word in the text data, and performing attention mechanism calculation based on the feature map and the POS vector of each word to generate a new feature map for each sentence, wherein the new feature map is generated by the following steps: Let each feature map be of length d. k Given a vector, generate a random vector W of length w. Q And calculate the length d k vectors and random vectors W Q The product of these elements generates matrix Q; The POS vectors of the words are parallelly spliced to generate a POS matrix, and a random matrix W with a length of w and a width of the length of the POS vector is generated K The product of the POS matrix and the random matrix W K is calculated to generate a matrix K. Generate a length of d k random vector W V And calculate the random vector W V The product of the product with the feature map generates matrix V; generating an attention matrix Z using matrix Q, matrix K and matrix V; multiplying the attention matrix Z and the feature map respectively to generate a new feature map; 6) concatenating the sentence-level feature vector P generated based on the new feature map with the word content vector CWF in the sentence, and classifying the input vector F obtained by concatenation to obtain the event detection result, wherein the sentence-level feature vector P is generated by the following steps: traversing each word in the sentence, and selecting one word as a candidate trigger word each time; dividing the new feature map of the sentence into two parts with the candidate trigger word as the boundary to obtain a front half new feature map and a back half new feature map for each trigger word; calculating the values of the front half new feature map and the back half new feature map, and selecting a front half new feature map with the maximum value and a back half new feature map with the maximum value respectively; concatenating the front half new feature map with the maximum value and the back half new feature map with the maximum value of each sentence to obtain the sentence-level feature vector P.
2. The method of claim 1, wherein, Before generating the word content vector CWF, the word structure vector SF and the position feature vector PF, the text data is preprocessed, and the preprocessing includes tokenization processing.
3. The method of claim 1, wherein, The method for generating the POS vector includes using a natural language processing tool StanfordCoreNlp.
4. The method of claim 1, wherein, The event detection result is obtained by the following steps: 1) Construct linear classifier O = W s F + b s where W s is a first parameter of the linear classifier and b s is a second parameter of the linear classifier; 2) input vector F is input into linear classifier O to obtain event detection result.
5. A storage medium having stored therein a computer program, wherein, The computer program is arranged to perform the method of any one of claims 1-4 when run.
6. An electronic device comprising a memory and a processor, the memory having stored therein a computer program, the processor being arranged to run the computer program to perform the method of any one of claims 1-4.
Citation Information
Patent Citations
Natural language syntactic analysis method
CN110020434A
Event detection method and device based on graph attention neural network, and electronic equipment
CN111461004A