Method and device for constructing event knowledge graph, and computer-readable storage medium

By presetting event types and event elements, using event elements association information and natural language processing model, the event extraction process is optimized, and the problem of difficulty in extracting low-frequency event elements is solved, and the effect of extracting event elements is improved.

CN118569378BActive Publication Date: 2024-12-17HAINA CLOUD IOT TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411035137.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-31
Publication Date
2024-12-17
Estimated Expiration
2044-07-31

AI Technical Summary

Technical Problem

The prior art treats event elements equally during event extraction, resulting in a low frequency of element extraction difficulty, affecting the extraction effect of event elements.

Method used

By presetting event types and event elements, the correlation information between event elements is used for extraction, and combining natural language processing models and graph neural networks, the extraction process of event elements is optimized and the extraction effect of low-frequency event elements is improved.

Benefits of technology

It improves the accuracy and comprehensiveness of event elements extraction, reduces the dependence and difficulty of low-frequency event elements extraction, and enhances the efficiency and accuracy of event extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118569378B_ABST
    Figure CN118569378B_ABST
Patent Text Reader

Abstract

The present application relates to the field of artificial intelligence technology, and discloses a method for constructing an event knowledge graph, including: obtaining a data set of target domain events, a preset event type, and event elements corresponding to the event type; extracting information from the text in the data set according to the preset event type to obtain the target event type; extracting information from the text according to the event element of the target event type to obtain the target event element; wherein, in the event element extraction process, extracting the event element based on the extraction information of the previous event element and the information of the target event type; processing the extracted target event type and the corresponding target event element, and forming an event knowledge graph with the structured data in the data set. When extracting the target event element, this method strengthens the connection between event elements and improves the extraction effect of event elements. The present application also discloses a device for constructing an event knowledge graph and a computer-readable storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, for example, to a method, device and computer-readable storage medium for constructing an event knowledge graph. Background Art

[0002] The knowledge graph itself is a technology that represents knowledge through a graph structure, which organizes entities and their relationships in the form of nodes and edges. The event knowledge graph is an extended form of the knowledge graph, focusing on representing and managing information related to events. The event knowledge graph emphasizes multi-dimensional information such as the time, location, participants, and causal relationships of an event.

[0003] Related technology discloses a method for constructing an event knowledge graph, including: obtaining historical data information in a target space, wherein the historical data information includes data information of at least two modes; extracting events from the historical data information according to a predefined event model to obtain event nodes; instantiating the events corresponding to each event node to obtain event instances corresponding to each event node; determining the association relationship between each event node based on the event occurrence time corresponding to each event instance; and constructing an event knowledge graph corresponding to the target space with the association relationship as the edge between event nodes. Based on data information of at least two modes, the event knowledge graph corresponding to the space is constructed to improve the accuracy of the event knowledge graph.

[0004] In the process of implementing the embodiments of the present disclosure, it is found that there are at least the following problems in the related art:

[0005] In the process of event extraction, related technologies treat event elements equally. In the same event type, if some event elements have a low frequency of occurrence, it will lead to difficulty in extracting such elements, thus affecting the extraction effect of event elements.

[0006] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0007] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical elements or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.

[0008] The embodiments of the present disclosure provide a method, device, and computer-readable storage medium for constructing an event knowledge graph to improve the extraction effect of elements that are difficult to extract.

[0009] In some embodiments, the method includes: obtaining a data set of target domain events, a preset event type, and event elements corresponding to the event type; extracting information from the text in the data set according to the preset event type to obtain the target event type; extracting information from the text according to the event elements of the target event type to obtain the target event elements; wherein, in the event element extraction process, extracting the current event element based on the extraction information of the previous event element and the information of the target event type; processing the extracted target event type and the corresponding target event element, and forming an event knowledge graph with the structured data in the data set.

[0010] In some embodiments, the device includes: a processor and a memory storing program instructions, and the processor is configured to execute the method for constructing an event knowledge graph as described above when running the program instructions.

[0011] In some embodiments, the computer-readable storage medium stores program instructions, and when the program instructions are executed, the computer executes the method for constructing the event knowledge graph as described above.

[0012] The event knowledge graph construction method, device, and computer-readable storage medium provided by the embodiments of the present disclosure can achieve the following technical effects:

[0013] In the disclosed embodiment, the text of the data set is extracted according to the preset event type and the corresponding event element to obtain the target event type and the target event element. Thus, the event knowledge graph is constructed using the target event type, the target event element and the structured data in the data set. Among them, when extracting the target event element, in order to ensure the extraction effect of the elements that are more difficult to extract, the correlation information between the event elements is fully utilized. That is, based on the extraction information of the previous event element and the information of the target event type, the event element is extracted. In this way, the connection between the event elements is strengthened and the extraction effect of the event elements is improved.

[0014] The above general description and the following description are exemplary and explanatory only and are not intended to limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] One or more embodiments are exemplarily described by corresponding drawings, which do not limit the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements, and the drawings do not constitute a scale limitation, and wherein:

[0016] Figure 1 It is a schematic diagram of a method for constructing an event knowledge graph provided by an embodiment of the present disclosure;

[0017] Figure 2is a schematic diagram of an event element extraction method in the method provided by an embodiment of the present disclosure;

[0018] Figure 3 is a schematic diagram of another method for constructing an event knowledge graph provided by an embodiment of the present disclosure;

[0019] Figure 4 is a schematic diagram of another method for constructing an event knowledge graph provided by an embodiment of the present disclosure;

[0020] Figure 5 It is a partial structural diagram of a knowledge graph of gas field events in an embodiment of the present disclosure;

[0021] Figure 6 It is a schematic diagram of a device for constructing an event knowledge graph provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0022] In order to be able to understand the features and technical contents of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present disclosure. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.

[0023] The terms "first", "second", etc. in the specification and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.

[0024] Unless otherwise stated, the term "plurality" means two or more.

[0025] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.

[0026] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.

[0027] The term "correspondence" may refer to an association relationship or a binding relationship. The correspondence between A and B means that there is an association relationship or a binding relationship between A and B.

[0028] Combination Figure 1As shown, the present disclosure embodiment provides a method for constructing an event knowledge graph, including:

[0029] S101, the processor obtains a data set of target domain events, a preset event type, and an event element corresponding to the event type.

[0030] S102: The processor extracts information from the text in the data set according to a preset event type to obtain a target event type.

[0031] S103, the processor extracts the text according to the event element of the target event type to obtain the target event element; wherein, in the event element extraction process, the current target event element is extracted based on the extraction information of the previous target event element and the information of the target event type.

[0032] S104, the processor processes the extracted target event type and the corresponding target event elements, and forms an event knowledge graph with the structured data in the data set.

[0033] Here, event extraction is the process of identifying and extracting event-related information from the unstructured text of the data set. Event extraction is a subfield of information extraction, focusing on information related to time and dynamic changes. The target field refers to the field to which the event knowledge graph to be constructed belongs. For example, if the event knowledge graph in the gas field is constructed, the target field is the gas field. After determining the target field, relevant data of events in the target field are collected to form a data set. Among them, the relevant data includes news reports, public information in the target field (such as gas companies, gas management departments, etc.), and the relevant data includes unstructured text content and structured information (such as structured information composed of event types and event elements). In addition, while determining the target field event, the event type of the target field event and the event element corresponding to the event type are determined. As an example, the target field is the gas field, and the events include gas leaks, gas explosions, etc., and the event types are leaks and explosions respectively; the event elements include event type trigger words (such as gas, leaks), time, location, disposal units, and disposal suggestions. Events can be determined based on event types.

[0034] Then, information is extracted from the text in the data set, i.e., the unstructured text. When extracting event types, in order to capture the semantic relationship and contextual information of the text, natural language processing models (such as bidirectional language models, recurrent neural network models, etc.) are used to extract information and obtain trigger words that represent event types. Based on the obtained trigger words and the deep learning model, the predicted event type, i.e., the target event type, is output. After extracting the target event type, the target event elements are extracted from the corresponding text. Event elements are associated with event types. Therefore, when extracting event elements, the information when extracting event types can be used, such as the text of the extracted event type, the position of the event type trigger word in the text, etc., which is helpful for the extraction of event elements.

[0035] Furthermore, in order to improve the extraction effect of event elements with low frequency, when extracting event elements, the event type and the information of the event elements extracted last time are integrated to extract the event elements of this time. Among them, there are multiple event elements of the same event type, and there is a certain correlation between the event elements in the context, that is, there is a relationship and effect between the event elements. Therefore, based on the information of the event elements extracted last time, the event elements of this time are extracted, which can strengthen the connection between the event elements. By utilizing the interaction mechanism between historical information (i.e., the information extracted last time) and event elements, the extraction effect of low-frequency event elements is improved. This method not only increases the accuracy and comprehensiveness of event extraction, but also reduces the dependence and difficulty of extracting low-frequency event elements, thereby improving the efficiency and accuracy of event extraction. Finally, the extracted target event type and the corresponding target event element are processed, and an event knowledge graph is formed with the structured data in the data set. The processing of the extracted target event type and the corresponding target event element includes event coreference resolution. Event coreference resolution refers to identifying the same event pointed to by different expressions in the text. Due to the diversity of natural languages, an event may appear in different ways in different contexts, so it is necessary to determine whether the event type refers to the same event. In this way, the knowledge graph is prevented from containing too much redundant or conflicting information.

[0036] In addition, it should be noted that the last target event element extraction information is the extraction information of the last target event element before the current target event element extraction when the target event element extraction is performed for the same target event type. When the first target event element is extracted for a certain target event type, there is no extraction information of the last target event element; only when the second target event element is extracted, the extraction information of the first target event element is combined. In this way, the connection between event elements is strengthened.

[0037] The event knowledge graph construction method provided by the embodiment of the present disclosure is adopted to extract the text of the data set according to the preset event type and the corresponding event element to obtain the target event type and the target event element. Thus, the event knowledge graph is constructed using the target event type, the target event element and the structured data in the data set. Among them, when extracting the target event element, in order to ensure the extraction effect of the elements that are difficult to extract, the association information between the event elements is fully utilized. Strengthen the connection between the event elements and improve the extraction effect of the event elements.

[0038] Optionally, in step S102, the processor extracts text from the data set according to a preset event type to determine a target event type, including:

[0039] The processor analyzes the text of the dataset to obtain the adjacency matrix and word embedding matrix.

[0040] The processor inputs the adjacency matrix and the word vector matrix into the graph neural network model to obtain the target event type corresponding to each word vector in the word vector matrix.

[0041] As mentioned above, the text of the dataset includes unstructured text and structured text. For structured text, the adjacency matrix can represent each piece of information in the graph structure. For unstructured text, the word vector matrix can represent the information in the text sentence. The word vector is used to represent the trigger word of the event type. Therefore, the text of the dataset is analyzed here to obtain the adjacency matrix and the word vector matrix. The adjacency matrix and the word vector matrix are then input into the graph neural network for integration and conversion to output the result. From the output result, the trigger word of the category with the highest probability in each word vector in the word vector matrix is ​​obtained, and the event type represented by the trigger word is the target event type. In this way, the target event type is extracted from the text.

[0042] Optionally, the processor analyzes the text of the dataset to obtain an adjacency matrix and a word vector matrix, including:

[0043] The processor uses dependency parsing to analyze the text and generate a directed graph. The processor builds an adjacency matrix based on the directed graph. The processor uses a language model to analyze the text and obtain a word vector matrix.

[0044] Here, text analysis of a data set refers to the analysis of text sentences. The text sentences are analyzed with the help of language tools and / or language models. Specifically, the text sentences are analyzed using dependency syntax to generate a directed graph. The result of dependency syntax analysis can be represented as a tree-structured graph, where each node represents a word and the edge represents a dependency relationship. A tree-structured graph with a directed edge is a directed graph. Then, an adjacency matrix is ​​constructed based on the directed graph. The rows and columns in the adjacency matrix represent the nodes in the directed graph, and the elements in the matrix represent the edge information. At the same time, the text sentences are analyzed with the help of a language model, and each word in the text sentence is represented by a vector, which is sorted to obtain a word vector matrix. In this way, the grammatical features in the text are fully captured, thereby obtaining the trigger words of the event type.

[0045] As an example, the language model is ord2Vec, GloVe, FastText, or BERT (Bidirectional Encoder Representations from Transformers). The dependency parser is LTP (Language Technology Platform). In detail, for a sentence First, we obtain a directed graph through LTP dependency parsing and use it to construct an adjacency matrix First, in order to capture the semantic relationship and contextual information of the text, the word vector matrix is ​​obtained through the BERT model .

[0046] H=BERT ( S ) (1)

[0047] The adjacency matrix And the word vector matrix H Input to Graph Neural Network GCN , thereby capturing its syntactic features.

[0048] G= GCN ( H,A )(2)

[0049] Finally, it passes through the fully connected layer and softmax Layer, from each word vector classified as the category with the highest probability, obtain the trigger word result in the sentence.

[0050] O i =softmax ( W*Gi+b )(3)

[0051] in, SoftmaxThe function converts the vector into a probability distribution, and the adjacency matrix and word vector matrix are passed through the fully connected layer and softmax After layer processing, the trigger word result matrix of the i-th sentence is obtained O i . W is the weight matrix, b is the bias matrix, and both are the basic parameters of the model.

[0052] Optionally, in step S103, the processor extracts the text according to the event element of the target event type to obtain the target event element, including:

[0053] S131, the processor determines the importance of the event element corresponding to the target event type; the target event type includes multiple event elements.

[0054] S132, the processor fuses the position information of the target event type into the word vector matrix corresponding to the text, and uses the fused word vector matrix to extract information from the text in order according to the importance of the event elements to obtain the target event elements.

[0055] When extracting the i+1th event element, the key information of the ith event element is obtained, and the text is extracted based on the key information and the fused word vector matrix.

[0056] Here, the target event type includes multiple event elements, and the importance of multiple event elements is determined. As an example, the importance of event elements can be confirmed by the frequency of their occurrence in the event. The higher the frequency of occurrence, the more important the event element. Then, the position information of the target event type is fused into the word vector matrix corresponding to the text sentence. Among them, the word vector matrix refers to the matrix of the text sentence of the target event type. When extracting event elements, the text is extracted based on the fused word vector matrix, and the event elements are extracted in sequence according to their importance. That is, the most important event elements are extracted first, and the event elements with the lowest importance are extracted last. At the same time, when extracting non-most important event elements, the key information of the previous event element (such as the keywords of the extracted information) and the fused word vector matrix are fused again to extract the event elements of this time. In this way, low-frequency event elements are extracted based on the previous higher-frequency event elements, which not only solves the problem of difficulty in extracting low-frequency event elements, but also improves the extraction effect of event elements through the association between event elements.

[0057] Optionally, in step S131, the processor determines the importance of the event element corresponding to the target event type, including:

[0058] The processor obtains a first frequency of each event element appearing in the target event.

[0059] The processor obtains a second frequency of the target event type including the event element in all target events.

[0060] The processor determines a weight of each event element according to the first frequency and the second frequency.

[0061] Among them, the larger the weight value, the more important the corresponding event element.

[0062] Here, a weighted approach is used to determine the importance of each time element. Specifically, the first frequency of each event element appearing in the target event is calculated. At the same time, the second frequency of each event element contained in the target event and the target event type containing the event element in all target events is calculated. Then, based on the first frequency and the second frequency, the weight of each event element is determined. For example, the product of the first frequency and the second frequency is used as the weight of each event element. Among them, the larger the weight value, the more important the corresponding event element. As an example, the TF-IDF (Term Frequency-Inverse Document Frequency) technology is used to calculate the importance of event elements.

[0063] (4)

[0064] (5)

[0065] (6)

[0066] in, TF(r,e) is the first frequency, IDF(r) is the second frequency, r is an event element of an event, Represents event elements r The number of occurrences in event e. R It is an event e A collection of all event elements. All event types contain r The number of event types, E is the set of all events. k,y It is also an element of a certain event. In formula 4, the ratio of the number of occurrences of a certain event element in event e to the sum of the number of occurrences of each event element in event e is used as the first frequency. In this way, the first frequency can reflect the frequency of occurrence of a certain event element in the corresponding event. In formula 5, the ratio of the number of event types containing event element r in the event set to all event types is used as the second frequency. The second frequency reflects the number of event types containing event element r. rThe inverse ratio of the number of event types to all events. In Formula 6, the ratio of the product of the first frequency and the second frequency of an element of an event to the sum of the products of the first frequency and the second frequency of all elements of all events is used as the weight of the event element. In this way, the importance of the event element can be accurately reflected by the weight calculated by the first frequency and the second frequency.

[0067] In addition, based on the importance of the above event elements, the event elements are extracted in sequence. Specifically, the position information of the trigger word of the event type corresponding to the event element is integrated into the word vector matrix to obtain the word vector matrix of the event element. Each time an event element is extracted, the matrix of the event element is l i Put it into the event tracker. When the next event element is extracted, the key information of the previous event element can be obtained from the historical information of the tracker, and then the key information can be combined with the matrix of the current event element. l i+1 The fusion is used to extract new elements, thus extracting all event elements.

[0068] Optionally, when the processor extracts the i+1th event element, key information of the ith event element is obtained, including:

[0069] The processor determines the influence factor of the ith event element; and uses the product of the influence factor of the ith event element and the extracted information as key information.

[0070] Here, the impact factor of the i-th event element in the event is determined, and the key information of the i-th event element is determined based on the impact factor. Specifically, the impact factor ;Key Information , the matrix of the elements of this event l i+1 After integrating with key information, . Where i is the i-th event element, e j is the jth event. In this way, the key information of the previous event element can be reasonably obtained based on the impact factor. As an example, when extracting event elements, the event tracker is used to obtain the key information of the i-th event element. The matrix of event elements L i The event tracker is input, and the key information of the i-th event element can be obtained from the event tracker when the i+1-th event element is extracted.

[0071] Optionally, the processor extracts text based on the key information and the fused word vector matrix, including:

[0072] The processor determines the starting position for extracting the i+1th event element based on the key information and the fused word vector matrix.

[0073] The processor extracts the i+1th event element within the starting position range.

[0074] Here, because the information of the previous event element is integrated when extracting the event element, this will cause the text content to increase when extracting the event element this time. In order to reduce the length of the extracted text, the start and end positions of the event element extraction are determined based on the key information and the fused word vector matrix. Specifically, the sigmoid function in the graph neural network model is used for determination.

[0075] (7)

[0076] (8)

[0077] in, are the starting position and the ending position respectively. W s , W e is the weight matrix, b s , b e is the bias matrix. When is the starting position. Similarly, When is the end position. is the preset threshold.

[0078] Optionally, in the event extraction process, the graph neural network, BERT model and event tracker constitute an event extraction model, and when the first loss function reaches a stable state, the trained event extraction model is obtained. The first loss function loss is:

[0079]

[0080] in, c is the event type, C is a collection of event types, x 1 is the trigger word of event type; x 2 is the event element, arg s For the previous , arg e For the previous .

[0081] Combination Figure 3As shown, the embodiment of the present disclosure provides another method for constructing an event knowledge graph, including:

[0082] S101, the processor obtains a data set of target domain events, a preset event type, and an event element corresponding to the event type.

[0083] S102: The processor extracts text in the data set according to a preset event type to obtain a target event type.

[0084] S103, the processor extracts the text according to the event element of the target event type to obtain the target event element; wherein, in the event element extraction process, the current event element is extracted based on the extraction information of the previous event element and the information of the target event type.

[0085] S141, jointly encode the extracted target event and the text corresponding to the existing event according to a preset format to obtain a corresponding first embedding vector; the target event is determined based on the target event type.

[0086] S142: The processor obtains a second embedding vector according to information corresponding to the target event type and the event type of the existing event.

[0087] S143: The processor merges the first embedding vector and the second embedding vector and inputs the merged vector into a pre-trained language model to obtain a probability vector.

[0088] S144: The processor determines whether the target event is an existing event according to the value of the probability vector.

[0089] S145, when the processor determines that the target event is a new event, it forms an event knowledge graph with the structured data in the data set.

[0090] In order to solve the problem of redundant and conflicting information caused by only considering the alignment at the entity (i.e., event element) level, the embodiment of the present disclosure performs granular correspondence from the event level. Specifically, the extracted target event and the existing events (existing events refer to events that already exist and are non-repetitive in the knowledge graph database) are compared one by one to determine whether the extracted target event is the same event as the existing event. For example, if 5 non-repetitive existing events have been identified, the target event needs to be compared with these 5 existing events one by one. Among them, analysis is performed from the two aspects of the text sentence where the event is located and the event type and event elements of the event; these two aspects of features are input into a pre-trained language model (such as a SpanBERT model) to output the probability of inference. Thus, it is determined by probability whether the target event is an existing event.

[0091] In detail, the extracted target event and the text corresponding to the existing event are jointly encoded according to a preset format to obtain the corresponding first embedding vector. The encoder is used to encode the text sentences corresponding to the two events (the target event and an existing event) in a preset format. As an example, the preset encoding format is [CLS] sentence A [SEP] sentence B [SEP]; sentence A is the text sentence of the target event, and sentence B is the text sentence of an existing event. [CLS] is a start tag, and [SEP] is used to separate two sentences or mark the end of a sentence. Then, the encoded text content is input into the pre-trained language model to obtain the first embedding vector.

[0092] (9)

[0093] in, F sentesce ( A,B ) is the first embedding vector, f cls is the encoded text; W 1 、W 2 、b 1 、b 2 is the parameter of the model.

[0094] The second embedding vector is obtained based on the information of the event type, wherein the information of the event type includes the keyword information of the event type and the event element information of the event type. The second embedding vector is obtained by fusing the event type information of the target event and the existing event. Finally, the two vectors are input into the pre-trained language model to output the probability of reasoning. Through global information perception (i.e., text sentence level) and event level alignment, the duplicate information and contradictions in the knowledge graph can be reduced, and the consistency and integrity of the knowledge graph can be enhanced. This helps to improve the quality and application effect of the knowledge graph, and can also simplify the complexity of knowledge management and maintenance.

[0095] Optionally, when encoding together according to a preset format, add a special tag before / after the trigger word of each text sentence. Through special editing, the pre-trained language model pays more attention to event structure information. As an example, the tag [unusedx] is used as a special tag, where x is a number, such as 0, 3, etc.

[0096] Optionally, in step S142, the processor obtains a second embedding vector according to information of a target event element corresponding to the target event type and information of an event element corresponding to the event type of an existing event, including:

[0097] The processor obtains the trigger word vector matrix and event element vector matrix of the target event type and the existing event type respectively.

[0098] The processor fuses the trigger word vector matrix and the event element vector matrix of the target event type and the existing event type to obtain a second embedding vector.

[0099] The event element vector matrix is ​​obtained by weighted summing the event element weight and the event element trigger word vector matrix.

[0100] When extracting event types, information is extracted through the trigger word vector matrix; and the trigger word vector matrix is ​​obtained through the BERT model. Similarly, for event elements, the event element trigger word vector matrix can be obtained through the BERT model. Then, based on the weights of the previous event elements, the event elements are weighted and summed to obtain the event element vector matrix. The event element vector matrix and the trigger word vector matrix of the target event and the existing event are merged to obtain the second embedding vector of the target event and the known event.

[0101] (10)

[0102] (11)

[0103] (12)

[0104] in, h role is the event element vector matrix, h trigger is the trigger word vector matrix of the event type, S r is the text statement corresponding to the event element, S trigger is the text sentence corresponding to the trigger word; W 3 、b 3 is the parameter of the model. Formulas 10 and 11 are used to obtain the information of the target event and the existing event respectively, and then the information of the two is merged. Formula 12 is used for fusion; the ";" in formula 12 represents the concatenation operation; "." represents the multiplication of two vectors. In this way, the second embedding vector for representing event-level information is obtained. Fevent ( A,B ).

[0105] Optionally, in step S143, the processor fuses the first embedding vector and the second embedding vector and inputs the merged vector into a pre-trained language model to obtain a probability vector, including:

[0106] The processor fuses the first embedding vector and the second embedding vector into the pre-trained language model, and outputs the probability vector through the fully connected layer of the pre-trained model. P .

[0107] (13)

[0108] (14)

[0109] After obtaining the probability vector P, based on the maximum value Determine whether the target event and the existing event are the same event. As an example, when the maximum value approaches 1, the target event and the existing event are determined to be the same event; when the maximum value approaches 0, the target event and the known event are determined to be different events. In this way, each time the target event is extracted, it is compared with the existing events in the database one by one to determine whether it is a non-repeated event. After determining that it is a non-repeated event, the relevant information of the target event is stored in the database.

[0110] Optionally, during the training process of the pre-trained language model in step S143, when the second loss function reaches a stable state, a pre-trained language model is obtained after training to be used for coreference resolution of events; wherein the second loss function L is:

[0111] (15)

[0112] The model used in step S143 is a pre-trained language model after training.

[0113] Combination Figure 4 As shown, the embodiment of the present disclosure provides another method for constructing an event knowledge graph, including:

[0114] S101, the processor obtains a data set of target domain events, a preset event type, and an event element corresponding to the event type.

[0115] S102: The processor extracts text from the data set according to a preset event type to determine a target event type.

[0116] S103, the processor extracts the text according to the event element of the target event type to obtain the target event element; wherein, in the event element extraction process, the current event element is extracted based on the extraction information of the previous event element and the information of the target event type.

[0117] S141, the processor jointly encodes the extracted target event and the text corresponding to the existing event according to a preset format to obtain a corresponding first embedding vector; the target event is determined based on the target event type.

[0118] S142: The processor obtains a second embedding vector according to information of a target event element corresponding to the target event type and information of an event element corresponding to the event type of an existing event.

[0119] S143: The processor merges the first embedding vector and the second embedding vector and inputs the merged vector into a pre-trained language model to obtain a probability vector.

[0120] S144: The processor determines whether the target event is an existing event according to the value of the probability vector.

[0121] S206: When determining that the target event is a new event, the processor uses the trained pre-trained language model to determine the similarity between the target event element of the target event type and the event element of the known event.

[0122] S207: When the similarity is greater than a similarity threshold, the processor determines that the current target event element and the known event element are the same event element.

[0123] S145, the processor forms an event knowledge graph with the new events, new event elements and structured data in the data set.

[0124] Here, when it is determined that the target event is a new event, it is further determined whether the target event element in the target event type is the same as the event element already in the database. Specifically, the trained pre-trained language model is used to determine the similarity between the target event element and the event element of a known event. When the similarity is greater than the similarity threshold, it is determined that the current target event element and the known event element are the same event element. In addition, if the target event is determined to be an existing event, steps S205 and S206 do not need to be executed. In this way, when resolving event coreferences, the alignment of the event element level and the event level is considered to achieve consistency and integrity of the knowledge graph.

[0125] Figure 5 Some examples of event knowledge graphs in the gas field are shown. Among them, events include gas explosion and gas leakage; the event type of gas explosion is explosion, and the event elements include time, location and disposal company; the event type of gas leakage is leakage, and the event elements include time, location and disposal company.

[0126] Combination Figure 6 As shown, the embodiment of the present disclosure provides a device 200 for constructing an event knowledge graph, including a processor 100 and a memory 101. Optionally, the device 200 may also include a communication interface 102 and a bus 103. Among them, the processor 100, the communication interface 102, and the memory 101 can communicate with each other through the bus 103. The communication interface 102 can be used for information transmission. The processor 100 can call the logic instructions in the memory 101 to execute the method for constructing the event knowledge graph of the above embodiment.

[0127] In addition, the logic instructions in the memory 101 described above may be implemented in the form of software functional units and when sold or used as independent products, may be stored in a computer-readable storage medium.

[0128] The memory 101 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor 100 executes the function application and data processing by running the program instructions / modules stored in the memory 101, that is, the method for constructing the event knowledge graph in the above embodiment is realized.

[0129] The memory 101 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 101 may include a high-speed random access memory and may also include a non-volatile memory.

[0130] The disclosed embodiment provides a gas monitoring system, including: a system body, and the above-mentioned event knowledge graph construction device 200. The event knowledge graph construction device 200 is installed in the system body. The installation relationship described here is not limited to placement inside the product body, but also includes installation connections with other components of the system, including but not limited to physical connections, electrical connections, or signal transmission connections. It can be understood by those skilled in the art that the event knowledge graph construction device 200 can be adapted to a feasible system body, thereby realizing other feasible embodiments.

[0131] An embodiment of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured to execute the method for constructing the event knowledge graph.

[0132] The technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the embodiment of the present disclosure. The aforementioned storage medium may be a non-transient storage medium, such as: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes.

[0133] The above description and the accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent only possible changes. Unless explicitly required, separate components and functions are optional, and the order of operations may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and the claims, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of one or more associated listings. In addition, when used in this application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof. In the absence of further restrictions, an element defined by the text "comprising a..." does not exclude the presence of other identical elements in the process, method or device including the element. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.

[0134] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. The technicians may use different methods for each specific application to implement the described functions, but such implementations should not be considered to exceed the scope of the embodiments of the present disclosure. The technicians may clearly understand that, for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above may refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.

[0135] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.

[0136] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.

Claims

1. A method for constructing an event knowledge graph, characterized in that: include: Obtain a data set of target domain events, preset event types, and event elements corresponding to the event types; Extract information from the text in the data set according to the preset event type to obtain the target event type; According to the event elements of the target event type, information is extracted from the text to obtain the target event elements; wherein, in the event element extraction process, the event elements are extracted in order from the event elements with the highest importance according to their importance; and based on the extraction information of the previous event element and the information of the target event type, the event element of this time is extracted; The extracted target event types and corresponding target event elements are processed and combined with the structured data in the dataset to form an event knowledge graph.

2. The method according to claim 1, characterized in that Extract the text of the dataset according to the preset event type to obtain the target event type, including: Analyze the text of the dataset to obtain the adjacency matrix and word embedding matrix; The adjacency matrix and word vector matrix are input into the graph neural network model to obtain the target event type corresponding to each word vector in the word vector matrix.

3. The method according to claim 2, characterized in that Analyze the text of the dataset to obtain the adjacency matrix and word vector matrix, including: Analyze the text using dependency parsing to generate a directed graph; According to the directed graph, construct the adjacency matrix; Use the language model to analyze the text and obtain the word vector matrix.

4. The method according to claim 1, characterized in that: According to the event element of the target event type, information extraction is performed on the text to obtain the target event element, including: Determine the importance of the event element corresponding to the target event type; the target event type includes multiple event elements; The position information of the target event type is integrated into the word vector matrix corresponding to the text, and the integrated word vector matrix is ​​used to extract information from the text in order according to the importance of the event elements to obtain the target event elements; When extracting the i+1th event element, the extraction information of the ith event element is obtained, and information is extracted from the text based on the extraction information and the fused word vector matrix.

5. The method according to claim 4, characterized in that Determine the importance of the event elements corresponding to the target event type, including: Get the first frequency of each event element appearing in the target event; Obtain a second frequency of the target event type including the event element in all target events; Determining a weight of the event element according to the first frequency and the second frequency; Among them, the larger the weight value, the more important the corresponding event element.

6. The method according to any one of claims 1 to 5, characterized in that: Process the extracted target event type and the corresponding target event element, including: The extracted target event and the text corresponding to the existing event are jointly encoded according to a preset format to obtain a corresponding first embedding vector; the target event is determined based on the target event type; Obtaining a second embedding vector according to information of a target event element corresponding to the target event type and information of an event element corresponding to the event type of an existing event; The first embedding vector and the second embedding vector are fused and input into the pre-trained language model to obtain a probability vector; According to the value of the probability vector, determine whether the target event is an existing event.

7. The method according to claim 6, characterized in that Obtaining a second embedding vector according to information of a target event element corresponding to the target event type and information of an event element corresponding to the event type of an existing event, including: Obtain the trigger word vector matrix and event element vector matrix of the target event type and the existing event type respectively; The trigger word vector matrix and event element vector matrix of the target event type and the existing event type are merged to obtain a second embedding vector; The event element vector matrix is ​​obtained by weighted summing the event element weights and the event element trigger word vectors.

8. The method according to claim 6, characterized in that After determining that the target event is a new event, it also includes: Using the trained pre-trained language model, determine the similarity between the target event element and the known event element of the target event type; When the similarity is greater than the similarity threshold, it is determined that the current target event element and the known event element are the same event element.

9. A device for constructing an event knowledge graph, comprising a processor and a memory storing program instructions, characterized in that: The processor is configured to execute the method for constructing an event knowledge graph as described in any one of claims 1 to 8 when running the program instructions.

10. A computer-readable storage medium storing program instructions, characterized in that: When the program instructions are executed, the computer is used to execute the method for constructing an event knowledge graph as described in any one of claims 1 to 8.