A method and system for extracting event temporal relations based on event knowledge graph
By using pre-trained language models and multi-layer neural networks to extract event temporal relationships, the accuracy problem of implicit temporal relationships in news texts is solved, and the extraction ability and robustness of the model are improved.
Patent Information
- Application Number
- CN202310969505.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-02
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2043-08-02
AI Technical Summary
Existing technologies have difficulty accurately extracting implicit temporal relationships between events in news or narrative texts, resulting in model performance being affected by an imbalance in the number of negative samples and ignoring the importance of implicit temporal relationships.
A pre-trained language model and a multi-layer feedforward neural network are used to encode the context vectors and predict the time of event trigger words. A fully connected neural network and a normalized exponential function are combined to perform relationship probability analysis and build an event temporal relationship extraction system.
It improves the accuracy of extracting implicit event temporal relationships, enhances the robustness and performance of the model, and can better handle complex semantic and grammatical structures.
Smart Images

Figure CN117171229B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a method and system for extracting event temporal relationships based on an event knowledge graph. Background Art
[0002] For news or narrative texts, elements such as characters, time, and location are often used to describe the content. An objective fact involving the interaction of several characters at a specific time and place is called an event. The temporal relationship of events is a key task in natural language processing. Event temporal relationships refer to the temporal order of events, facilitating the understanding of their evolution. The goal of event-to-event temporal relationship extraction is to automatically extract the temporal order of a given pair of events, thereby constructing a temporal relationship between the events in an event graph. For two independent events, A and B, four types of temporal relationships can be categorized based on the temporal relationship between their occurrences: sequential, inclusion, concurrent, and fuzzy. If there is no clear temporal relationship between A and B, the relationship is considered fuzzy.
[0003] However, in real life, only a small number of events in news or other texts have obvious temporal relationships. The vast majority of events only have implicit temporal relationships, making event temporal relationship extraction difficult. Previous work using neural networks to extract event temporal relationships has primarily focused on extracting relationships between events with obvious temporal relationships, while ignoring the fact that the majority of events actually have implicit temporal relationships. As a result, the number of negative samples in event temporal relationship extraction can be significantly higher than expected. This is because previous methods treat events without obvious temporal relationships as negative samples, which can seriously affect model performance. Summary of the Invention
[0004] In view of this, an embodiment of the present invention provides an event time sequence relationship extraction method and system for event knowledge graph, which can accurately realize event time sequence relationship extraction.
[0005] On the one hand, an embodiment of the present invention provides a method for extracting event temporal relationships based on an event knowledge graph, comprising:
[0006] Obtain a text set to be time series recognized; wherein the text set includes text sentences of different events; the text sentences of each event include corresponding event trigger words;
[0007] Using a pre-trained language model, encode the text sentences of each event in the text set to obtain the context vector of the text sentence of each event; the context vector includes the context word vector of the event trigger word;
[0008] Using the relative time prediction module, the time prediction analysis is performed on the upper and lower word vectors of the event trigger words of each event to obtain the time prediction value of each event trigger word; wherein, the relative time prediction module includes a multi-layer feedforward neural network;
[0009] Concatenate the context word vectors and time prediction values of different event trigger words to obtain a concatenated vector;
[0010] The temporal classification module is used to perform relational probability analysis on the splicing vectors to obtain the temporal relationship between different events. The classification module includes a fully connected neural network, an activation function, and a normalized exponential function.
[0011] Optionally, encoding the text sentences of each event in the text set to obtain the context vector of the text sentences of each event includes:
[0012] Perform word segmentation on the text sentence to obtain the word sequence of the text sentence;
[0013] Map each word in the word sequence to the low-order space to obtain the word vector set of the text sentence;
[0014] Perform vector transformation on the word vector set to obtain the context vector of the text sentence;
[0015] The context vector includes the context information, semantic information and position information of the text sentence.
[0016] Optionally, the method further comprises:
[0017] Set up the Bert model and obtain label text data;
[0018] The BERT model is unsupervisedly trained using labeled text data, and based on the training results, the BERT model is adjusted to obtain a pre-trained language model.
[0019] Optionally, the relative time prediction module includes a three-layer feedforward neural network. The relative time prediction module is used to analyze the upper and lower word vectors of the event trigger words of each event to obtain the time prediction value of each event trigger word, including:
[0020] Using the relative time prediction module, the upper and lower word vectors of the event trigger word of each event are processed three times in sequence with full connection and activation to obtain the time prediction value of each event trigger word;
[0021] Among them, the expression for obtaining the time prediction value of the relative time prediction module is:
[0022]
[0023] Where, t iIndicates event trigger word e i The time prediction value of ; tanh represents the activation function, which is used for activation processing; FC represents the fully connected neural network, which is used for fully connected processing; Indicates event trigger word e i The upper and lower word vectors of .
[0024] Optionally, the context word vectors and time prediction values of different event trigger words are concatenated to obtain a concatenated vector, including:
[0025] Concatenate the context word vectors and time prediction values of the event trigger words of two different events to be time-series identified to obtain a concatenated vector;
[0026] Among them, the expression of the splicing vector is:
[0027]
[0028] Where a i, represents the concatenation vector of events i and j, Indicates event trigger word e i The upper and lower word vectors of Indicates event trigger word e j The upper and lower word vectors, t i Indicates event trigger word e i Time prediction value, t j Indicates event trigger word e j The time prediction value.
[0029] Optionally, a time classification module is used to perform relationship probability analysis on the concatenated vectors to obtain the temporal relationship between different events, including:
[0030] Use a fully connected neural network to fully connect the concatenated vector, and then use an activation function to map the fully connected processed vector to a preset interval;
[0031] Based on the mapping values in the preset interval, a probability distribution of the relationship between different events is obtained through a normalized exponential function; wherein the temporal relationship between different events is determined based on the temporal relationship with the highest probability in the relationship probability distribution;
[0032] The expression of relationship probability distribution obtained by the time classification module is:
[0033] P(r|e i ,e j )=softmax(tanh(FC(a i, )))
[0034] Where, P(r|e i ,e j ) represents the probability distribution of the relationship between events i and j, ei The event trigger word representing event i, e j represents the event trigger word of event j; softmax represents the normalized exponential function; tanh represents the activation function; FC represents the fully connected neural network; a i, Represents the concatenation vector of events i and j.
[0035] Optionally, the method further comprises:
[0036] Obtain several text sentences containing time relationship annotations as a training set, train the target network in combination with the loss function, and adjust the target network based on the training results to obtain a trained target network;
[0037] Among them, the target network includes a language model, a time prediction module and a time classification module.
[0038] Optionally, several text sentences containing time relationship annotations are obtained as a training set, including:
[0039] Determine the target dataset based on the target corpus, and obtain several text sentences containing time relationship annotations from the target dataset as a training set;
[0040] The target corpus includes a first corpus containing event and time information in news reports and a second corpus containing a cross-language time recognition and time relationship dataset.
[0041] Optionally, the loss function includes a first loss function for the time prediction module and a second loss function for the time classification module, and training the target network in combination with the loss functions includes:
[0042] The first loss function and the second loss function are added together to construct the total loss function of the target network, and then the target network is trained.
[0043] On the other hand, an embodiment of the present invention provides an event temporal relationship extraction system for an event knowledge graph, comprising:
[0044] The first module is used to obtain a text set to be time series recognized; wherein the text set includes text sentences of different events; the text sentences of each event include corresponding event trigger words;
[0045] The second module is used to encode the text sentences of each event in the text set using the pre-trained language model to obtain the context vector of the text sentence of each event; wherein the context vector includes the context word vector of the event trigger word;
[0046] The third module is used to use the relative time prediction module to perform time prediction analysis on the upper and lower word vectors of the event trigger words of each event to obtain the time prediction value of each event trigger word; wherein the relative time prediction module includes a multi-layer feedforward neural network;
[0047] The fourth module is used to concatenate the context word vectors and time prediction values of different event trigger words to obtain a concatenated vector;
[0048] The fifth module is used to use the time classification module to perform relationship probability analysis on the splicing vectors to obtain the temporal relationship between different events; wherein, the classification module includes a fully connected neural network, an activation function, and a normalized exponential function extraction.
[0049] Optionally, the system further includes:
[0050] The sixth module is used to set up the Bert model and obtain labeled text data; perform unsupervised training on the Bert model through the labeled text data, and adjust the Bert model based on the training results to obtain a pre-trained language model.
[0051] The seventh module is used to obtain several text sentences containing time relationship annotations as a training set, train the target network in combination with the loss function, and adjust the target network based on the training results to obtain a trained target network; wherein, the target network includes a language model, a time prediction module and a time classification module.
[0052] On the other hand, an embodiment of the present invention provides an event temporal relationship extraction system for event knowledge graph, including a processor and a memory;
[0053] The memory is used to store programs;
[0054] The processor executes the program to implement the above method.
[0055] On the other hand, an embodiment of the present invention provides a computer-readable storage medium, wherein the storage medium stores a program, and the program is executed by a processor to implement the above method.
[0056] The present invention also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the above method.
[0057] The embodiment of the present invention first obtains a text set to be time-series recognized; wherein the text set includes text sentences of different events; the text sentences of each event include corresponding event trigger words; using a pre-trained language model, the text sentences of each event in the text set are encoded to obtain the context vector of the text sentence of each event; wherein the context vector includes the context word vector of the event trigger word; using a relative time prediction module, the upper and lower word vectors of the event trigger word of each event are time-predicted and analyzed to obtain the time prediction value of each event trigger word; wherein the relative time prediction module includes a multi-layer feedforward neural network; the context word vectors and time prediction values of the event trigger words of different events are spliced to obtain a spliced vector; using a time classification module, the spliced vector is subjected to relationship probability analysis to obtain the temporal relationship between different events; wherein the classification module includes a fully connected neural network, an activation function and a normalized exponential function. The embodiment of the present invention first encodes the context vector of the text sentence, and then based on the event trigger word, through event time prediction and combined with event temporal relationship probability prediction, fully mines the temporal relationship of the implicit event, and the embodiment of the present invention can accurately realize the event temporal relationship extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. 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 creative work.
[0059] Figure 1 A flow chart of a method for extracting temporal relationships of events based on an event knowledge graph provided by an embodiment of the present invention;
[0060] Figure 2 Schematic diagram of the network framework for extracting event temporal relationships for event knowledge graphs provided by an embodiment of the present invention;
[0061] Figure 3 A diagram showing the overall process of the event temporal relationship extraction method for event knowledge graphs provided by an embodiment of the present invention;
[0062] Figure 4 A schematic diagram of the structure of the event temporal relationship extraction system for event knowledge graph provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0064] On the one hand, referring to Figure 1 , an embodiment of the present invention provides a method for extracting event temporal relationships based on an event knowledge graph, comprising:
[0065] S100, obtaining a text set to be time-series recognized;
[0066] The text set includes text sentences of different events; and the text sentences of each event include corresponding event trigger words.
[0067] S200, using a pre-trained language model, encoding the text sentences of each event in the text set to obtain a context vector of the text sentence of each event;
[0068] Among them, the context vector includes the context word vector of the event trigger word;
[0069] It should be noted that, in some embodiments, step S200 may include: performing word segmentation on the text sentence to obtain a word sequence of the text sentence; mapping each word in the word sequence to a low-bit space to obtain a word vector set of the text sentence; performing vector conversion on the word vector set to obtain a context vector of the text sentence; wherein the context vector includes context information, semantic information and position information of the text sentence.
[0070] The word segmentation process includes but is not limited to the following: ① Mechanical matching: The basic concept is to first establish a vocabulary. For a given Chinese character string to be segmented, a substring is extracted using some method. If the substring successfully matches a dictionary entry, the substring is considered a word, and the remaining parts are segmented. Otherwise, the substring is not a word, and a new substring of the given Chinese character string is extracted for matching. Mechanical matching can be divided into forward matching, reverse matching, and a combination of the two, based on the direction of segmentation. ② Feature lexicon: The basic concept is to first establish a vocabulary containing various words with segmentation characteristics. During word segmentation, the Chinese character string to be segmented is first divided into smaller substrings based on the feature lexicon. Mechanical matching is then used to segment each substring. ③ Constraint matrix: The basic concept is to first establish a grammatical constraint matrix and a semantic constraint matrix, whose elements indicate whether the proximity of words with a certain part of speech to words with another part of speech conforms to grammatical rules, and whether the proximity of words belonging to a certain semantic class to words belonging to another semantic class is logical. These constraints are used to constrain the word segmentation results during mechanical segmentation. ④Grammar analysis method: using Chinese grammatical rules to constrain the results of mechanical word segmentation.
[0071] In some embodiments, the method further includes: setting a Bert model and obtaining labeled text data; performing unsupervised training on the Bert model using the labeled text data, and adjusting the Bert model based on the training results to obtain a pre-trained language model.
[0072] BERT (Bidirectional Encoder Representations from Transformers) is a pre-trained model that represents a major milestone in the field of natural language processing (NLP) and is considered one of the current state-of-the-art models. BERT's design and structure are based on the Transformer model, trained through unsupervised learning, and adaptable to a variety of NLP tasks.
[0073] Pre-training models involves extensive unsupervised training on large amounts of text data to learn rich language representations. BERT's pre-training is performed in two stages: the Masked Language Model (MLM) and the Next Sentence Prediction (NSP). In MLM, portions of the input text are randomly masked, and the model needs to predict these masked words. In NSP, the model needs to determine whether two sentences are consecutive sentences in the original text.
[0074] S300: Using the relative time prediction module, perform time prediction analysis on the upper and lower word vectors of the event trigger words of each event to obtain the time prediction value of each event trigger word;
[0075] Among them, the relative time prediction module includes a multi-layer feedforward neural network;
[0076] It should be noted that the relative time prediction module includes a three-layer feedforward neural network. In some embodiments, step S300 may include: using the relative time prediction module, sequentially performing three full-connection processing and activation processing on the upper and lower word vectors of the event trigger word of each event to obtain the time prediction value of each event trigger word; wherein, the expression for obtaining the time prediction value by the relative time prediction module is:
[0077]
[0078] Where, t i Indicates event trigger word e i The time prediction value of ; tanh represents the activation function, which is used for activation processing; FC represents the fully connected neural network, which is used for fully connected processing; Indicates event trigger word e i The upper and lower word vectors of .
[0079] S400, concatenating the context word vectors and time prediction values of event trigger words of different events to obtain a concatenated vector;
[0080] It should be noted that, in some embodiments, step S400 may include: concatenating the context word vectors and time prediction values of the event trigger words of two different events to be time-series identified to obtain a concatenated vector; wherein the expression of the concatenated vector is:
[0081]
[0082] Where a i, represents the concatenation vector of events i and j, Indicates event trigger word e i The upper and lower word vectors of Indicates event trigger word e j The upper and lower word vectors, t i Indicates event trigger word e i Time prediction value, t j Indicates event trigger word e j The time prediction value.
[0083] S500: Using a time classification module, perform a relationship probability analysis on the spliced vectors to obtain a temporal relationship between different events; wherein the classification module includes a fully connected neural network, an activation function, and a normalized exponential function.
[0084] It should be noted that, in some embodiments, step S500 may include: performing full-connection processing on the concatenated vector using a fully-connected neural network, and then mapping the fully-connected vector to a preset interval using an activation function; obtaining a relationship probability distribution between different events using a normalized exponential function based on the mapping value in the preset interval; wherein the temporal relationship between different events is determined based on the temporal relationship with the highest probability in the relationship probability distribution; and the expression for obtaining the relationship probability distribution by the time classification module is:
[0085] P(r|e i ,e j )=softmax(tanh(FC(a i, )))
[0086] Where, P(r|e i ,e j ) represents the probability distribution of the relationship between events i and j, e i The event trigger word representing event i, e j represents the event trigger word of event j; softmax represents the normalized exponential function; tanh represents the activation function; FC represents the fully connected neural network; a i, Represents the concatenation vector of events i and j.
[0087] It should also be noted that in some embodiments, the method may also include: obtaining several text sentences containing time relationship annotations as a training set, training the target network in combination with the loss function, and adjusting the target network based on the training results to obtain a trained target network; wherein the target network includes a language model, a time prediction module and a time classification module.
[0088] In some embodiments, obtaining a number of text sentences containing time relationship annotations as a training set includes: determining a target data set based on a target corpus, and obtaining a number of text sentences containing time relationship annotations from the target data set as a training set; wherein the target corpus includes a first corpus containing event and time information in news reports and a second corpus containing a cross-language time recognition and time relationship data set.
[0089] In some embodiments, the loss function includes a first loss function for the time prediction module and a second loss function for the time classification module. The target network is trained in combination with the loss function, including: adding the first loss function and the second loss function to construct a total loss function of the target network, and then training the target network.
[0090] To facilitate understanding of the technical solution of the present invention, the method principle of the present invention is described in detail below in conjunction with some specific embodiments. It should be understood that the following is an explanation of the present invention and cannot be regarded as a limitation of the present invention.
[0091] The following takes the training process of the network model as an example to explain in detail the data processing flow at each stage of the method of the present invention:
[0092] (1) The present invention is based on the MATRES dataset, which is a corpus containing time relationship annotations. The MATRES dataset is expanded and improved on the basis of the TimeBank and TempEval corpora, where TimeBank is an English news corpus that contains event and time information in news reports, and TempEval is a cross-language time recognition and time relationship dataset. The MATRES dataset contains most of the documents in TimeBank and TempEval, and annotates the events and time information therein more finely. The MATRES dataset consists of three parts: a training set, a validation set, and a test set, where the training set contains more than 10,000 event temporal relationships. The sentences in the training set are encoded into context vectors, which contain the context information, semantic information, and position information of the text sentences;
[0093] (2) The generated context vector is input into the relative time prediction module, and the relative time prediction value of the event in the sentence is input through a three-layer feedforward neural network;
[0094] (3) The generated context vector and the predicted value calculated in the relative time prediction module are input into the time classification module, which will generate the temporal relationship between events.
[0095] Preferably, in step (1), the specific steps of converting the text sentence into a context vector are:
[0096] A1: If Figure 2 As shown, in the input layer, W={w1,w2,…,w n} is the word sequence of the input text, X={x1,x2,…,x n} is the word vector set of each word in the word sequence. The pre-trained model is used to map each word in the word sequence to the low-order space to obtain the word vector representation of each word in the sentence.
[0097] A2: If Figure 2 As shown, in Bert (Embedding layer), the pre-trained language model Bert is used to convert the word vector set X into the context vector set H of the sentence = {h1,h2,…,h n}, h i is the context vector of each word at position i, which contains its position information; e i Indicates the event trigger word in the sentence, (corresponding to h_(e^I)) represents the context word vector of the event trigger word;
[0098] Preferably, in step (2), Figure 2 As shown in the figure, in the relative time prediction layer, the generated sentence context vector is input into the relative time prediction module, and the relative time prediction value of the event in the sentence is input through a three-layer feedforward neural network. The prediction value is between (-1, 1). That is, given event A and event B, assuming the temporal relationship between them is Before, the prediction value of event A is t A and the predicted value t of event B B The size relationship should be t A <t B , the specific steps are:
[0099] B1: Calculate the relative time prediction value t of the event trigger word i , the specific calculation formula is as follows:
[0100]
[0101] Note: FC represents a fully connected neural network, tanh represents the activation function, Context vector representing the trigger word
[0102] B2: After the time prediction value of the event pair is calculated, the loss function of the relative time prediction stage is calculated using the following formula:
[0103] δ t =R(e i ,e j )=Before]max(0,1-(t j ,-t i ))+R(e i ,e j )=After]max(0,1-(t i ,-t j ))
[0104] +[R(e i ,e j )=Equal]|t i -t j | (2)
[0105] Note: R(e i ,e j ) indicates the trigger word e i and the trigger word e j The relationship between the two, max means taking the maximum value
[0106] Preferably, in step (3), Figure 2 As shown in the figure, in the event temporal relationship recognition layer, the generated context vector and the predicted value calculated in the relative time prediction module are input into the time classification module, and then the temporal relationship of the events contained in the sentence is output. The specific steps are as follows:
[0107] C1: The context vector h_(e^I) generated in the above step (i.e. )、h_(e^j)(i.e. ) and the generated predicted values ti, tj (ie t i , t j ) is concatenated into vector a i, :
[0108]
[0109] C2: vector a generated by C1 i, Through a fully connected neural network, the tanh activation function is used to map it to the range [-1, 1]. Finally, a softmax function is used to obtain the probability distribution of the relationship between events. The relationship with the highest probability in the relationship probability distribution is the relationship between the events. The formula is as follows:
[0110] P(r|e i ,e j )=softmax(tanh(FC(ai,j ))) (4)
[0111] C3: Using the Stack-Propagation neural network structure, the loss functions of the two stages are added together to form the loss function of the entire network. The formula is as follows:
[0112] δ=θδ t -logP(r=r(e i ,e j )|e i ,e j ) (5)
[0113] Note: θ is a hyperparameter, δ t is the relative time prediction module loss value.
[0114] It should be noted that the method of the present invention can also be implemented through the following process: converting the text to be extracted into a context vector, obtaining its semantic relationship features, and generating an attention weight vector based on the input word vector to realize a dynamic attention mechanism; judging whether the event is an implicit time relationship, if so, inputting the obtained context vector into the graph neural network model to extract the implicit temporal relationship, otherwise, performing temporal relationship recognition based on the time elements or conjunctions of the sentence.
[0115] Furthermore, if Figure 3 As shown in the figure, the overall process of extracting event temporal relationships based on the event knowledge graph through the trained network model is as follows:
[0116] 1. Obtain the text of the temporal relationship to be extracted;
[0117] 2. Generate context vectors using a pre-trained language model;
[0118] 3. Calculate the relative time prediction value of events in the text;
[0119] 4. Calculate the temporal relationship based on the context vector and the predicted value;
[0120] 5. Softmax outputs the probability distribution of the temporal relationship and ultimately determines the temporal relationship of events.
[0121] In summary, existing work on extracting temporal relationships between events primarily treats the task as a classification task. Both neural network-based and global structure-based methods achieve excellent results in extracting temporal relationships between events where time appears. However, explicit time appears only in a small fraction of text, while the temporal relationships between events in most texts are implicit. Previous methods treat these implicit temporal relationships between events as fuzzy. This results in fuzzy relationship samples dominating the classification task, while other relationship categories only account for a small fraction. This imbalance in sample size can severely impact model performance and effectiveness.
[0122] To address the problem that only a small fraction of events in a text have explicit temporal relationships, while the vast majority of events have only implicit temporal relationships, this paper proposes a method for event temporal relations based on an event time prediction mechanism. This method extracts sentence features using a pretrained language model and builds an auxiliary module: the relative time prediction module. This module inputs the predicted relative time values of events in a sentence through a three-layer feedforward neural network and embeds them into the event pair context vector, which serves as the input for the classifier in the next module. Compared to previous work, this method innovatively proposes an auxiliary module for event time prediction and uses a multi-task training framework to connect the event time prediction module and the classification module. The multi-task training framework uses a stack-propagation network to connect the auxiliary task module and the classifier, using relative event time features and the context vector as input for temporal relation classification. In this way, event temporal relation classification can benefit from both the context representation of event pairs and the predicted relative event time features, without compromising the distinguishability between the two tasks. Without introducing additional data, the method of the present invention has made significant progress in the accuracy of extracting implicit event temporal relationships. The beneficial effects of the present invention include at least: (1) Proposing a prediction mechanism for relative event time, which can reduce the negative impact of the model on event temporal relationships caused by the imbalance between the number of samples in the data set, thereby improving the performance and effect of the model. (2) By adopting a joint model and relative event time prediction task, it can better handle the complex semantic and grammatical structures in natural language, thereby improving the robustness of the model.
[0123] On the other hand, Figure 4As shown, an embodiment of the present invention provides an event time sequence relationship extraction system 600 for event knowledge graph, including: a first module 610, used to obtain a text set to be time-series identified; wherein the text set includes text sentences of different events; the text sentences of each event include corresponding event trigger words; a second module 620, used to use a pre-trained language model to encode the text sentences of each event in the text set to obtain a context vector of the text sentence of each event; wherein the context vector includes the context word vector of the event trigger word; a third module 630, used to use a relative time prediction module to perform time prediction analysis on the upper and lower word vectors of the event trigger word of each event to obtain a time prediction value of each event trigger word; wherein the relative time prediction module includes a multi-layer feedforward neural network; a fourth module 640, used to splice the context word vectors and time prediction values of the event trigger words of different events to obtain a spliced vector; a fifth module 650, used to use a time classification module to perform relationship probability analysis on the spliced vector to obtain the time sequence relationship between different events; wherein the classification module includes a fully connected neural network, an activation function and a normalized exponential function extraction.
[0124] In some embodiments, the system further comprises:
[0125] The sixth module is used to set up the Bert model and obtain labeled text data; perform unsupervised training on the Bert model through the labeled text data, and adjust the Bert model based on the training results to obtain a pre-trained language model.
[0126] The seventh module is used to obtain several text sentences containing time relationship annotations as a training set, train the target network in combination with the loss function, and adjust the target network based on the training results to obtain a trained target network; wherein, the target network includes a language model, a time prediction module and a time classification module.
[0127] The contents of the method embodiments of the present invention are all applicable to the system embodiments. The functions specifically implemented by the system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.
[0128] Another aspect of the embodiment of the present invention further provides an event temporal relationship extraction system for event knowledge graph, including a processor and a memory;
[0129] The memory is used to store programs;
[0130] The processor executes the program to implement the method described above.
[0131] The contents of the method embodiments of the present invention are all applicable to the system embodiments. The functions specifically implemented by the system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.
[0132] Another aspect of the embodiments of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a program, and the program is executed by a processor to implement the method described above.
[0133] The contents of the method embodiments of the present invention are all applicable to the computer-readable storage medium embodiments. The functions specifically implemented by the computer-readable storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0134] The present invention also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the above method.
[0135] In some optional embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided in an exemplary manner for the purpose of providing a more comprehensive understanding of the technology. The disclosed method is not limited to the operation and logic flow presented herein. Optional embodiments are contemplated in which the order of the various operations is changed and the sub-operations described as a part of a larger operation are performed independently.
[0136] Furthermore, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise indicated, one or more of the functions and / or features described may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in separate physical devices or software modules. It will also be understood that a detailed discussion of the actual implementation of each module is not necessary for understanding the present invention. More specifically, given the properties, functions, and internal relationships of the various functional modules in the devices disclosed herein, the actual implementation of the module will be understood within the ordinary skill of an engineer. Therefore, a person skilled in the art using ordinary skill will be able to implement the present invention set forth in the claims without undue experimentation. It will also be understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.
[0137] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, 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. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute 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.
[0138] The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution apparatus, device, or apparatus (e.g., a computer-based apparatus, a device including a processor, or other apparatus that can fetch instructions from and execute instructions on an instruction execution apparatus, device, or apparatus). For purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, an instruction execution apparatus, device, or apparatus.
[0139] More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk cartridge (magnetic devices), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disc read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering, or processing in another suitable manner as necessary, and then stored in a computer memory.
[0140] It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution device. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0141] Throughout this specification, reference to terms such as "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that a specific feature, structure, material, or characteristic described in conjunction with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
[0142] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to the embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the claims and their equivalents.
[0143] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present invention.
Claims
1. A method for extracting event temporal relations based on event knowledge graph, characterized in that: include: Obtaining a text set to be time-series recognized; wherein the text set includes text sentences of different events; the text sentences of each event include corresponding event trigger words; Using a pre-trained language model, encoding the text sentences of each event in the text set to obtain a context vector of the text sentences of each event; wherein the context vector includes a context word vector of the event trigger word; Using the relative time prediction module, performing time prediction analysis on the upper and lower word vectors of the event trigger word of each event to obtain the time prediction value of each event trigger word; wherein the relative time prediction module includes a multi-layer feedforward neural network; the relative time prediction module includes a three-layer feedforward neural network, using the relative time prediction module to perform time prediction analysis on the upper and lower word vectors of the event trigger word of each event to obtain the time prediction value of each event trigger word, including: Using the relative time prediction module, the upper and lower word vectors of the event trigger word of each event are subjected to three full connection processes and activation processes in sequence to obtain the time prediction value of each event trigger word; The relative time prediction module obtains the time prediction value by the following expression: Where, t i Indicates event trigger word e i The time prediction value of ; tanh represents the activation function, which is used for activation processing; FC represents the fully connected neural network, which is used for fully connected processing; Indicates event trigger word e i The upper and lower word vectors of ; splicing the context word vectors and the time prediction values of the event trigger words of different events to obtain a spliced vector; The step of splicing the context word vectors and the time prediction values of the event trigger words of different events to obtain a spliced vector includes: splicing the context word vectors and the time prediction values of the event trigger words of two different events to be time-series identified to obtain a spliced vector; Wherein, the expression of the splicing vector is: Where a i,j represents the concatenation vector of events i and j, Indicates event trigger word e i The upper and lower word vectors of Indicates event trigger word e j The upper and lower word vectors, t i Indicates event trigger word e i Time prediction value, t j Indicates event trigger word e j The time prediction value of A time classification module is used to perform a relationship probability analysis on the splicing vector to obtain the temporal relationship between different events; wherein the classification module includes a fully connected neural network, an activation function and a normalized exponential function.
2. The method for extracting event temporal relationships based on event knowledge graph according to claim 1 is characterized in that: Encoding the text sentences of each event in the text set to obtain a context vector of the text sentences of each event includes: Performing word segmentation processing on the text sentence to obtain a word sequence of the text sentence; Mapping each word in the word sequence to a low-order space to obtain a word vector set of the text sentence; Performing vector conversion on the word vector set to obtain a context vector of the text sentence; The context vector includes context information, semantic information and position information of the text sentence.
3. The method for extracting event temporal relationships based on event knowledge graph according to claim 2 is characterized in that: The method further comprises: Set up the Bert model and obtain label text data; The BERT model is unsupervisedly trained using the labeled text data, and based on the training results, the BERT model is adjusted to obtain the pre-trained language model.
4. The method for extracting event temporal relationships based on event knowledge graph according to claim 1, characterized in that: The time classification module is used to perform relationship probability analysis on the splicing vector to obtain the temporal relationship between different events, including: Performing full-connection processing on the concatenated vector using the fully-connected neural network, and then mapping the fully-connected processed vector to a preset interval using an activation function; Based on the mapping values in the preset interval, a relationship probability distribution between different events is obtained by the normalized exponential function; wherein the temporal relationship between different events is determined based on the temporal relationship with the highest probability in the relationship probability distribution; The expression for obtaining the relationship probability distribution by the time classification module is: P(r|e i ,e j )=softmax(tanh(FC(a i,j ))) Where, P(r|e i ,e j ) represents the probability distribution of the relationship between events i and j, e i The event trigger word representing event i, e j represents the event trigger word of event j; softmax represents the normalized exponential function; tanh represents the activation function; FC represents the fully connected neural network; a i,j Represents the concatenation vector of events i and j.
5. The method for extracting event temporal relationships based on event knowledge graph according to claim 1, characterized in that: The method further comprises: Obtaining several text sentences containing time relationship annotations as a training set, training a target network in combination with a loss function, and adjusting the target network based on the training results to obtain a trained target network; The target network includes the language model, the time prediction module and the time classification module.
6. The method for extracting event temporal relationships based on event knowledge graph according to claim 5, characterized in that: The step of obtaining a plurality of text sentences containing time relationship annotations as a training set includes: Determine a target dataset based on a target corpus, and obtain a number of text sentences containing time relationship annotations from the target dataset as a training set; The target corpus includes a first corpus containing event and time information in news reports and a second corpus containing a cross-language time recognition and time relationship dataset.
7. The method for extracting event temporal relationships based on event knowledge graph according to claim 5, characterized in that: The loss function includes a first loss function for the time prediction module and a second loss function for the time classification module, and the target network is trained by combining the loss functions, including: The first loss function and the second loss function are added together to construct a total loss function of the target network, and then the target network is trained.
8. An event temporal relationship extraction system for event knowledge graph, characterized by: include: The first module is used to obtain a text set to be time-series recognized; wherein the text set includes text sentences of different events; the text sentences of each event include corresponding event trigger words; The second module is configured to encode the text sentences of each event in the text set using a pre-trained language model to obtain a context vector of the text sentences of each event; wherein the context vector includes a context word vector of the event trigger word; The third module is used to use the relative time prediction module to perform time prediction analysis on the upper and lower word vectors of the event trigger word of each event to obtain the time prediction value of each event trigger word; wherein the relative time prediction module includes a multi-layer feedforward neural network; the relative time prediction module includes a three-layer feedforward neural network, and the use of the relative time prediction module to perform time prediction analysis on the upper and lower word vectors of the event trigger word of each event to obtain the time prediction value of each event trigger word includes: Using the relative time prediction module, the upper and lower word vectors of the event trigger word of each event are subjected to three full connection processes and activation processes in sequence to obtain the time prediction value of each event trigger word; The relative time prediction module obtains the time prediction value by the following expression: Where, t i Indicates event trigger word e i The time prediction value of ; tanh represents the activation function, which is used for activation processing; FC represents the fully connected neural network, which is used for fully connected processing; Indicates event trigger word e i The upper and lower word vectors of ; A fourth module is configured to concatenate the context word vectors and the time prediction values of the event trigger words of different events to obtain a concatenated vector; The step of splicing the context word vectors and the time prediction values of the event trigger words of different events to obtain a spliced vector includes: splicing the context word vectors and the time prediction values of the event trigger words of two different events to be time-series identified to obtain a spliced vector; Wherein, the expression of the splicing vector is: Where a i,j represents the concatenation vector of events i and j, Indicates event trigger word e i The upper and lower word vectors of Indicates event trigger word e j The upper and lower word vectors, t i Indicates event trigger word e i Time prediction value, t j Indicates event trigger word e j The time prediction value of The fifth module is used to use a time classification module to perform relationship probability analysis on the splicing vector to obtain the temporal relationship between different events; wherein the classification module includes a fully connected neural network, an activation function and a normalized exponential function.
Citation Information
Patent Citations
Chinese-Vietnamese news event time sequence relationship identification method based on bidirectional cross attention mechanism
CN110334213A
Relationship analysis method and device based on news events
CN113158672A
Cited By
A method for extracting cross-document temporal relationships based on BiLSTM
CN122549420A