Zero-sample event extraction system and method based on contrastive learning and data enhancement

Through comparative learning and data enhancement technology, the problem of the inability to automatically discover unknown event types in the existing technology is solved, high-quality automatic discovery and classification of unknown event types is achieved, and the accuracy of event extraction is improved.

CN114707483BActive Publication Date: 2024-09-10JIANGSU SECURITIES +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210229733.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-07
Publication Date
2024-09-10
Estimated Expiration
2042-03-07

AI Technical Summary

Technical Problem

Existing zero-sample event extraction systems require predefined event types or can only distinguish between known and unknown events, and cannot automatically discover and classify unknown event types.

Method used

Using methods based on contrastive learning and data enhancement, by comparing similar and heterogeneous samples, using labeled data of known events and unlabeled samples of unknown events, the unknown event description text is rewritten, feature vectors are generated, and the model is updated through the comparison loss function Parameters to realize automatic discovery and classification of unknown event types.

Benefits of technology

It achieves high-quality automatic discovery and classification of unknown event types and improves the accuracy of event extraction, especially the performance on unknown event clustering tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114707483B
    Figure CN114707483B
Patent Text Reader

Abstract

The present invention discloses a zero-sample event extraction system and method based on contrastive learning and data enhancement in the field of natural language processing technology, including: after obtaining a data set, dividing it into known events and unknown events; rewriting the event description text of the unknown event; forming a positive and negative sample pair of the known event, the unknown event and the unknown event rewritten by the event description; inputting the positive and negative sample pairs into an event encoder to generate a corresponding feature vector; after calculating the contrast loss function value based on the feature vector, updating the model parameters in the event encoder through gradient backpropagation; and classifying and clustering based on the feature vector input output by the updated event encoder. The present invention makes full use of the labeled data of known events and the unlabeled samples of unknown events by comparing similar and heterogeneous samples, and realizes the automatic discovery and classification of unknown event types.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a zero-sample event extraction system and method based on contrastive learning and data enhancement, and belongs to the technical field of natural language processing. Background Art

[0002] Natural Language Processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language people use in daily life, so it is closely related to the study of linguistics, but there are important differences. Natural language processing is not a general study of natural language, but the development of computer systems that can effectively realize natural language communication, especially the software systems therein. Therefore, it is part of computer science.

[0003] Existing zero-shot solutions either require predefined event types as heuristic rules or only have the ability to distinguish between known and unknown events and are unable to further classify the discovered unknown events. Summary of the invention

[0004] The purpose of the present invention is to overcome the deficiencies in the prior art and provide a zero-sample event extraction system and method based on contrastive learning and data enhancement. By comparing similar and heterogeneous samples, the labeled data of known events and the unlabeled samples of unknown events are fully utilized to realize the automatic discovery and classification of unknown event types.

[0005] To achieve the above object, the present invention is implemented by adopting the following technical solutions:

[0006] In a first aspect, the present invention provides a zero-sample event extraction method based on contrastive learning and data enhancement, comprising:

[0007] After obtaining the data set, it is divided into known events and unknown events;

[0008] Rewrite the event description text of unknown events;

[0009] The known events, unknown events, and unknown events rewritten with event descriptions are combined into positive and negative sample pairs;

[0010] Input the positive and negative sample pairs into the event encoder to generate the corresponding feature vectors;

[0011] After calculating the contrast loss function value based on the feature vector, the model parameters in the event encoder are updated through gradient backpropagation;

[0012] Classification and clustering are performed based on the feature vector input output by the updated event encoder.

[0013] Furthermore, the data set is divided into known events and unknown events, including: arranging all event categories in the data set in descending order by the number of samples, taking the categories with even numbers in the descending order as known categories, and taking the categories with odd numbers as unknown categories, wherein event categories with sample numbers less than a specified amount are deleted.

[0014] Furthermore, the event description text of the unknown event is rewritten, including: part-of-speech tagging of the unknown event description, random synonym replacement of all non-nouns and verbs, and keeping the event trigger words unchanged.

[0015] Furthermore, the positive and negative sample pairs are input into the event encoder to generate corresponding feature vectors, including:

[0016] Mapped to a low-dimensional word encoding vector E = [e0, e1, ..., e L ];

[0017] The word encoding vector E is input into the pre-trained BERT encoder to obtain the context vector C containing text information = BERT (E) = [c0, c1, ..., c L ], use the output vector c0 corresponding to the classification tag CLS in the BERT model as the output vector of the entire event description text;

[0018] The output vector c0 is reduced in dimension through a fully connected layer and an activation function to become the output latent vector h = σ(W h c0+b h ), where w h and b h is the fully connected layer parameter, and σ is the nonlinear activation function sigmoid.

[0019] Furthermore, the contrast loss function is:

[0020]

[0021] Among them, N is the number of samples, y is the category label, d is the Euclidean distance between the latent vectors h1 and h2 of x1 and x2, and margin is a hyperparameter that represents the distance between samples of different classes.

[0022] Furthermore, classification and clustering are performed based on the feature vector input output by the updated event encoder, including: inputting the output feature vector into a classifier to determine the type of known events, and inputting the output feature vector into a clusterer to complete the clustering task of unknown events.

[0023] Furthermore, after the feature vector is input into the classifier, the K nearest neighbor algorithm is used to classify the known events, and after the feature vector is input into the clusterer, the K means algorithm is used to cluster the unknown events.

[0024] In a second aspect, the present invention provides a zero-sample event extraction system based on contrastive learning and data enhancement, comprising:

[0025] Division module: used to divide the acquired data set into known events and unknown events;

[0026] Rewrite module: used to rewrite the event description text of unknown events;

[0027] Pairing module: used to form positive and negative sample pairs from known events, unknown events, and unknown events rewritten with event descriptions;

[0028] Event encoding module: used to input positive and negative sample pairs into the event encoder to generate corresponding feature vectors;

[0029] Model update module: used to update the model parameters in the event encoder through gradient backpropagation after calculating the contrast loss function value based on the feature vector;

[0030] Classification and clustering module: used for classification and clustering based on the feature vector input output by the updated event encoder.

[0031] In a third aspect, the present invention provides a zero-sample event extraction device based on contrastive learning and data enhancement, including a processor and a storage medium;

[0032] The storage medium is used to store instructions;

[0033] The processor is used to operate according to the instructions to execute the steps of any of the methods described above.

[0034] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of any of the above methods when executed by a processor.

[0035] Compared with the prior art, the present invention has the following beneficial effects:

[0036] The present invention proposes a zero-shot event extraction model based on contrastive learning. By comparing similar and heterogeneous samples, the labeled data of known events and the unlabeled samples of unknown events are fully utilized to realize the automatic discovery and classification of unknown event types; similar samples are provided for unlabeled unknown events in the contrastive learning process through data enhancement; when rewriting event descriptions, features such as part of speech are introduced to find semantically similar words to replace and rewrite while maintaining the overall semantic similarity of the text; when encoding event descriptions, a contrastive learning loss function is introduced to learn the spatial distance information between text vector representations, and finally a high-quality text vector representation is obtained. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a general architecture diagram of the event extraction model provided in the first embodiment of the present invention;

[0038] Figure 2 This is an architecture diagram of the event encoder provided in the first embodiment of the present invention. DETAILED DESCRIPTION

[0039] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.

[0040] Embodiment 1:

[0041] Zero-shot event extraction method based on contrastive learning and data enhancement. During model training, known events, unknown events, and unknown events rewritten by event descriptions together form positive and negative sample pairs. A positive sample pair contains two samples of the same event type, and a negative sample pair contains two samples of different event types. These samples are input into the event encoder to generate corresponding feature vectors. The latter is used to calculate the contrast loss function value, and then update the model parameters in the event encoder through gradient backpropagation. During model inference, the output feature vector will be input into the classifier or clusterer to distinguish the type of known events or complete the clustering task of unknown events. This method is implemented by the Zero-Shot Event Extraction Based on Contrastive Learning (ZECL) system based on contrastive learning and data enhancement, which provides better accuracy in the field of zero-shot event extraction. The system structure mainly includes: S1 dataset input module, S2 event description rewriter, S3 event encoder, S4 classifier and clusterer. The specific scheme is as follows:

[0042] Given an event set I = {S ∪ U}, where I is composed of the known event set and unknown event set Each event x iInclude event description textm i and type t i The types of all events in the known event set S are known and visible to the model, while the types of all events in the unknown event set U are unknown and invisible to the model. The model needs to learn the known and unknown event samples in the training data set to automatically discover and classify the types of unknown events.

[0043] For known event samples in the test dataset , the model should be described according to the input event Output the predicted event category for unknown event samples in the test dataset , the model should be described according to the input event , clustering is completed according to the type of new events. The system architecture is as follows Figure 1 shown.

[0044] S1 dataset input module

[0045] In order to meet the problem definition of zero-sample event extraction, the data set input module needs to divide the event categories in the data set into two categories: known and unknown. In order to ensure that the number of samples in the unknown category is close to the number of samples in the known category, the present invention adopts an alternating division method:

[0046] S101 sorts all event categories in descending order of sample number;

[0047] S102 takes the categories of even-numbered digits in the descending order as known categories, and takes the categories of odd-numbered digits as unknown categories;

[0048] In order to ensure that there are sufficient samples for training, S103 deletes event categories with less than 50 samples.

[0049] S2 event description rewriter

[0050] The goal of the event description rewriter is to rewrite the event description text of unknown events, modify the words in the text without changing the event type reflected by the event description text, and form a new description text. To ensure that the event type reflected by the rewritten event description remains unchanged, the most important thing is to keep the event trigger words unchanged, while other auxiliary information in the text, even the event components, can be replaced.

[0051] S201 first performs part-of-speech tagging on the input event description.

[0052] S202 then performs random synonym replacement on all non-nouns (NOUN) and verbs (VERB).

[0053] S3 Event Encoder

[0054] The goal of the event encoder is to extract a low-dimensional dense feature vector from the input event description text. This model will use the pre-trained BERT encoder to first encode the event text into a context vector. Given an event description text m i ={w0, w1, w2, ..., w L}, where w i is the i-th word in the text, w0 is the BERT classification tag CLS, L is the length of the word sequence of the event description text, and the event encoder architecture is as follows Figure 2 shown.

[0055] S301 event encoder first maps the word encoding into a low-dimensional word encoding vector E = [e0, e1, ..., e L ].

[0056] S302 Next, the word encoding vector E is input into the pre-trained BERT to obtain the context vector C containing text information = BERT (E) = [c0, c1, ..., c L In order to avoid the cumulative error caused by filtering trigger words, the output vector c0 corresponding to the classification tag CLS in the BERT model is used as the output vector of the entire event description text.

[0057] S303 Finally, the output vector c0 is reduced in dimension through a fully connected layer and an activation function to become the output latent vector h = σ(W h c0+b h ). h and b h is the fully connected layer parameter, and σ is the nonlinear activation function sigmoid.

[0058] In order to distinguish different event types of known events and discover new types of unknown events, the event encoder needs to extract key features from the event description text, map samples of the same event type to positions with close distances in the latent vector space, and map different event types to positions with far distances in the latent vector space. For this purpose, the contrast loss function of this module is designed as follows:

[0059]

[0060] Where N is the number of samples, y is the category label (when two events are of the same type, y = 1; otherwise y = 0), d is the Euclidean distance (L2 norm) between the latent vectors h1 and h2 of x1 and x2, and margin is a hyperparameter, which indicates the distance between samples of different classes.

[0061] S4 Classification and Clustering

[0062] With the help of the event encoder, the classification of known events and the clustering of unknown events are transformed into the classification and clustering of latent vectors, and samples of the same event type are close in distance in the latent vector space. To this end, the present invention adopts the K-nearest Neighbors algorithm to classify known events and the K-means Clustering algorithm to cluster unknown events.

[0063] Evaluation indicators

[0064] The performance of the present invention is evaluated based on the following indicators.

[0065] (1) Accuracy: The percentage of actual positive examples among the identified positive examples

[0066] TP is a positive example that is correctly identified as a positive example, FP is a negative example that is incorrectly identified as a positive example, and FN is a positive example that is incorrectly identified as a negative example. The definitions are as follows:

[0067]

[0068] (2) Recall: The percentage of correctly predicted positive examples to all actual positive examples

[0069]

[0070] (3) F1 score

[0071]

[0072] (4) Normalized mutual information: This is the normalization of the mutual information score, scaling it to a value between 0 and 1

[0073]

[0074] Where Y is the true type of the sample, C is the clustering type of the sample, H is the information entropy calculation function, and I is the mutual information between Y and C.

[0075] (5) Fowlkes-Mallows index: used to evaluate the similarity between cluster labels and the true labels of the data

[0076]

[0077] (6) Completeness: used to measure whether samples belonging to the same category are classified into the same cluster.

[0078]

[0079] Where H(C|Y) is the conditional entropy of cluster category C under the true category Y.

[0080] (7) Homogeneity: used to measure whether the true categories of samples in the same cluster are the same.

[0081]

[0082] Performance Evaluation

[0083] The classical model of current event extraction is used as the baseline to evaluate the performance of the present invention on the FewShotED dataset. The selected baseline is as follows:

[0084] –SemiSup: A semi-supervised zero-shot event extraction method that can distinguish known from unknown events through a specially designed loss function.

[0085] –SemiSup-CL: Based on SemiSup, the contrastive learning module proposed in this invention is added.

[0086] –ZECL-NoRe: The ZECL model lacks the event description rewriting module, which can be used as an ablation experiment to verify the improvement of model effect by data augmentation.

[0087]

[0088] The experimental results are shown in the table above, where the bold font represents the optimal data under this indicator. The model proposed in the present invention has achieved significant improvements in the unknown event discovery and clustering tasks while ensuring a high recognition rate for known events. In addition, it can be found that although the semi-supervised model SemiSup can achieve good performance in the known event classification task, it performs poorly in the clustering task on unknown categories, indicating that its design can only distinguish unknown category events from known events, but lacks the ability to distinguish between unknown events. After adding the contrastive learning module, SemiSup-CL can achieve some improvements in the clustering task of unknown events. Unsupervised learning techniques represented by contrastive learning can better cope with unlabeled data samples and help the model extract key features in event description texts. ZECL-NoRe, the method used as the comparison object of the ablation experiment, did not perform as well as ZECL, and had similar problems to SemiSup: it could only distinguish between known and unknown events, but could not further learn the differences between unknown events. Considering that the model can only receive negative sample pairs based on known events and unknown events, but lacks positive sample pairs of unknown events provided by the event rewriting module, this result proves that data enhancement is an important reason why the model ZECL proposed in the present invention can realize the recognition of unknown event categories.

[0089] Embodiment 2:

[0090] The zero-sample event extraction system based on contrastive learning and data enhancement can implement the zero-sample event extraction method based on contrastive learning and data enhancement described in Embodiment 1, including:

[0091] Division module: used to divide the acquired data set into known events and unknown events;

[0092] Rewrite module: used to rewrite the event description text of unknown events;

[0093] Pairing module: used to form positive and negative sample pairs from known events, unknown events, and unknown events rewritten with event descriptions;

[0094] Event encoding module: used to input positive and negative sample pairs into the event encoder to generate corresponding feature vectors;

[0095] Model update module: used to update the model parameters in the event encoder through gradient backpropagation after calculating the contrast loss function value based on the feature vector;

[0096] Classification and clustering module: used for classification and clustering based on the feature vector input output by the updated event encoder.

[0097] Embodiment three:

[0098] The embodiment of the present invention further provides a zero-sample event extraction device based on contrastive learning and data enhancement, which can implement the zero-sample event extraction method based on contrastive learning and data enhancement described in the first embodiment, including a processor and a storage medium;

[0099] The storage medium is used to store instructions;

[0100] The processor is used to operate according to the instructions to perform the steps of the following method:

[0101] After obtaining the data set, it is divided into known events and unknown events;

[0102] Rewrite the event description text of unknown events;

[0103] The known events, unknown events, and unknown events rewritten with event descriptions are combined into positive and negative sample pairs;

[0104] Input the positive and negative sample pairs into the event encoder to generate the corresponding feature vectors;

[0105] After calculating the contrast loss function value based on the feature vector, the model parameters in the event encoder are updated through gradient backpropagation;

[0106] Classification and clustering are performed based on the feature vector input output by the updated event encoder.

[0107] Embodiment 4:

[0108] The embodiment of the present invention further provides a computer-readable storage medium, which can implement the zero-sample event extraction method based on contrastive learning and data enhancement described in Embodiment 1, and stores a computer program thereon, which implements the steps of the following method when the program is executed by a processor:

[0109] After obtaining the data set, it is divided into known events and unknown events;

[0110] Rewrite the event description text of unknown events;

[0111] The known events, unknown events, and unknown events rewritten with event descriptions are combined into positive and negative sample pairs;

[0112] Input the positive and negative sample pairs into the event encoder to generate the corresponding feature vectors;

[0113] After calculating the contrast loss function value based on the feature vector, the model parameters in the event encoder are updated through gradient backpropagation;

[0114] Classification and clustering are performed based on the feature vector input output by the updated event encoder.

[0115] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0116] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0117] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0118] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0119] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A zero-shot event extraction method based on contrastive learning and data enhancement, characterized by: include: After obtaining the data set, it is divided into known events and unknown events; Rewrite the event description text of unknown events; The known events, unknown events, and unknown events rewritten with event descriptions are combined into positive and negative sample pairs; The positive and negative sample pairs are input into the event encoder to generate the corresponding feature vector, including: mapping the word encoding into a low-dimensional word encoding vector E = [e0, e1, ..., e L ]; The word encoding vector E is input into the pre-trained BERT encoder to obtain the context vector C containing text information = BERT (E) = [c0, c1, ..., c L ], use the output vector c0 corresponding to the classification tag CLS in the BERT model as the output vector of the entire event description text; The output vector c0 is reduced in dimension through a fully connected layer and an activation function to become the output latent vector h = σ(W h c0+b h ), where w h and b h is the fully connected layer parameter, σ is the nonlinear activation function sigmoid; After calculating the contrast loss function value based on the feature vector, the model parameters in the event encoder are updated by gradient backpropagation. The contrast loss function is: Where N is the number of samples, y is the category label, d is the Euclidean distance between the latent vectors h1 and h2 of x1 and x2, and margin represents the hyperparameter that distances samples of different classes. Classification and clustering are performed based on the feature vector output by the updated event encoder, including: inputting the output feature vector into the classifier to determine the type of known events, and inputting the output feature vector into the clusterer to complete the clustering task of unknown events. After the feature vector is input into the classifier, the known events are classified through the K nearest neighbor algorithm, and after the feature vector is input into the clusterer, the unknown events are clustered through the K mean algorithm.

2. The zero-sample event extraction method based on contrastive learning and data enhancement according to claim 1, characterized in that: The data set is divided into known events and unknown events, including: arranging all event categories in the data set in descending order according to the number of samples, taking the categories with even numbers in the descending order as known categories, and taking the categories with odd numbers as unknown categories, wherein event categories with sample numbers less than a specified amount are deleted.

3. A zero-shot event extraction system based on contrastive learning and data enhancement, characterized by: include: Division module: used to divide the acquired data set into known events and unknown events; Rewrite module: used to rewrite the event description text of unknown events; Pairing module: used to form positive and negative sample pairs from known events, unknown events, and unknown events rewritten with event descriptions; Event encoding module: used to input positive and negative sample pairs into the event encoder to generate corresponding feature vectors, including: mapping the word encoding into a low-dimensional word encoding vector E = [e0, e1, ..., e L ]; The word encoding vector E is input into the pre-trained BERT encoder to obtain the context vector C containing text information = BERT (E) = [c0, c1, ..., c L ], use the output vector c0 corresponding to the classification tag CLS in the BERT model as the output vector of the entire event description text; The output vector c0 is reduced in dimension through a fully connected layer and an activation function to become the output latent vector h = σ(W h c0+b h ), where w h and b h is the fully connected layer parameter, σ is the nonlinear activation function sigmoid; Model update module: used to update the model parameters in the event encoder through gradient backpropagation after calculating the contrast loss function value based on the feature vector. The contrast loss function is: Where N is the number of samples, y is the category label, d is the Euclidean distance between the latent vectors h1 and h2 of x1 and x2, and margin represents the hyperparameter that distances samples of different classes. Classification and clustering module: used for classification and clustering based on the feature vector output by the updated event encoder, including: inputting the output feature vector into the classifier to determine the type of known events, and inputting the output feature vector into the clusterer to complete the clustering task of unknown events. After the feature vector is input into the classifier, the known events are classified through the K nearest neighbor algorithm, and after the feature vector is input into the clusterer, the unknown events are clustered through the K mean algorithm.

4. A zero-sample event extraction device based on contrastive learning and data enhancement, characterized in that: including processor and storage medium; The storage medium is used to store instructions; The processor is used to operate according to the instructions to execute the steps of the method according to any one of claims 1 to 2.

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