Log text processing method and device, equipment and storage medium
By using the target joint model for co-referential digestion and entity recognition in log text processing, the noise and redundancy problems when building knowledge graphs in log text are solved, and the accuracy and efficiency of entity links are improved.
Patent Information
- Application Number
- CN202411996508.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-18
AI Technical Summary
When using log files to build knowledge graphs, the prior art is prone to introduce noisy data and redundant information, which leads to difficulty in linking entities, especially in terms of deficiencies in co-referential digestion.
By obtaining the vector of the pending log text, using the co-reference digestion model in the target joint model for the co-reference digestion operation, and adjusting the log text, then obtaining the vector of the adjusted text, using the entity recognition model for entity recognition and relationship extraction, and building a knowledge graph.
Effectively process log text, reduce noise and redundancy, improve the accuracy and efficiency of entity links, avoid entity recognition errors propagating to the common-reference digestion stage, and improve the overall processing effect.
Smart Images

Figure CN119849486A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a log text processing method, device, equipment and storage medium. Background Art
[0002] Since the generation rules of log files are different, the description forms of the same event or entity in different log files may be different. Directly using these log files to build a knowledge graph often introduces a lot of noise data and redundant information, making it difficult for users to obtain query results. In the current knowledge fusion research, entity linking is considered to be one of the main difficulties, which mainly includes two subtasks: entity disambiguation and coreference resolution. These tasks aim to determine whether entities with the same name in the knowledge base refer to the same concept, or whether entities with different names can convey the same meaning. At present, there are several shortcomings in the coreference resolution method: first, many traditional coreference resolution models mainly rely on the grammatical rules, syntactic structure or classification and clustering techniques of sentences, but do not fully explore the deep semantics in log descriptions; second, traditional methods often ignore the contextual information and global features in the complete log file, which may lead to a one-sided understanding of the information.
[0003] It can be seen that how to effectively process log text is a problem that technical personnel in this field need to solve. Summary of the invention
[0004] The purpose of the embodiments of the present invention is to provide a log text processing method, device, equipment and storage medium, which can solve the problem that the processing effect of the log text cannot meet the actual needs.
[0005] In order to solve the above technical problems, in a first aspect, the present application and the embodiment of the present invention provide a log text processing method, comprising:
[0006] Get the first vector corresponding to the log text to be processed;
[0007] Using the coreference resolution model in the target joint model to perform a coreference resolution operation on the first vector, and adjusting the log text to be processed based on the corresponding operation result to obtain an adjusted log text;
[0008] Get the second vector corresponding to the adjusted log text;
[0009] The entity recognition model in the target joint model is used to perform entity recognition operations on the second vector, and the relationship between the entities is extracted to obtain the corresponding triple data, so as to use the triple data to construct a knowledge graph corresponding to the log text to be processed.
[0010] Optionally, obtaining a first vector corresponding to the log text to be processed includes:
[0011] Processing the log text to be processed by using a preset universal text embedding model to obtain a corresponding first vector;
[0012] Accordingly, the second vector corresponding to the adjusted log text is obtained, including:
[0013] The adjusted log text is processed using a preset universal text embedding model to obtain a corresponding second vector.
[0014] Optionally, a preset universal text embedding model is located in the target joint model and used as a shared embedding layer for the coreference resolution model and the entity recognition model.
[0015] Optionally, performing a coreference resolution operation on the first vector includes:
[0016] Selecting a number of candidate references from each candidate span corresponding to the first vector by using a preset candidate reference scoring function, and assigning a unique predecessor to each candidate reference by using a preset co-reference scorer based on coarse granularity and fine granularity, so as to construct a corresponding co-reference matrix;
[0017] A coreference elimination operation is performed on the vector according to the coreference matrix to obtain a corresponding operation result containing several coreference clusters.
[0018] Optionally, the log text to be processed is adjusted based on the corresponding operation result to obtain the adjusted log text, including:
[0019] Based on the coreference clusters, the expressions pointing to the same entity in the log text to be processed are adjusted to the same term to obtain the adjusted log text.
[0020] Optionally, an entity recognition operation is performed on the second vector, including:
[0021] Extract features of each word sequence in the second vector through a bidirectional long short-term memory network to obtain prediction results of related entities;
[0022] The prediction results are corrected using conditional random fields to obtain the recognition results of the related entities of the second vector.
[0023] Optionally, feature extraction is performed on each word sequence in the second vector through a bidirectional long short-term memory network to obtain prediction results of related entities, including:
[0024] Using a forward long short-term memory network, the context representation of each word sequence in the second vector is calculated to obtain a corresponding forward representation;
[0025] The context representation of each word sequence in the second vector is calculated using a reverse long short-term memory network to obtain a corresponding reverse representation;
[0026] The context information of the forward representation and the reverse representation are concatenated to obtain the prediction results of each entity in the adjusted log text.
[0027] Optionally, the relationship between entities is extracted to obtain corresponding triple data, including:
[0028] Extract the relationship between entities through the self-help method to obtain the corresponding relationship data;
[0029] The relational data is stored in triple form to obtain triple data corresponding to the log text to be processed.
[0030] Optionally, the knowledge graph corresponding to the log text to be processed is constructed using triple data, including:
[0031] The triple data is visualized using a graph database to construct a knowledge graph corresponding to the log text to be processed.
[0032] Optionally, the method of the present application further includes:
[0033] Determine a first loss function of a coreference resolution model and a second loss function of an entity recognition model;
[0034] Corresponding weight parameters are configured for the first loss function and the second loss function to construct a fusion loss function of the target joint model, so as to complete the training of the target joint model based on the fusion loss function.
[0035] Optionally, the method of the present application further includes:
[0036] During the training process of the target joint model, the weight parameters corresponding to the first loss function and the second loss function are updated respectively through the back propagation algorithm.
[0037] Optionally, the method of the present application further includes:
[0038] During the training process of the target joint model, the bidirectional long short-term memory network and conditional random field in the entity recognition model are trained based on the principle of minimizing the second loss function.
[0039] In a second aspect, the present application provides a log text processing device, comprising:
[0040] A first vector acquisition module, used to acquire a first vector corresponding to the log text to be processed;
[0041] A coreference resolution module, used for performing a coreference resolution operation on the first vector by using a coreference resolution model in a target joint model, and adjusting the log text to be processed based on the corresponding operation result to obtain an adjusted log text;
[0042] A second vector acquisition module, used to acquire a second vector corresponding to the adjusted log text;
[0043] The entity recognition module is used to perform entity recognition operations on the second vector using the entity recognition model in the target joint model, and extract the relationship between each entity to obtain corresponding triple data, so as to use the triple data to construct a knowledge graph corresponding to the log text to be processed.
[0044] In a third aspect, the present application provides an electronic device, including:
[0045] Memory for storing computer programs;
[0046] The processor is used to execute a computer program to implement the steps of the log text processing method as described above.
[0047] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the log text processing method as described above are implemented.
[0048] It can be seen from the above technical solution that the present application first obtains the first vector corresponding to the log text to be processed; then uses the coreference resolution model in the target joint model to perform a coreference resolution operation on the first vector, and adjusts the log text to be processed based on the corresponding operation results to obtain the adjusted log text; then obtains the second vector corresponding to the adjusted log text; then uses the entity recognition model in the target joint model to perform an entity recognition operation on the second vector, and extracts the relationship between each entity to obtain the corresponding triple data, so as to use the triple data to construct the knowledge graph corresponding to the log text to be processed. In this way, the present application first performs a coreference resolution operation on the log text to be analyzed, and then performs an entity recognition operation, which can avoid the propagation of errors in the entity recognition stage to the coreference resolution stage and improve the processing effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in 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 paying creative work.
[0050] Figure 1 A flow chart of a log text processing method disclosed in this application;
[0051] Figure 2 A flowchart of an existing entity merger disclosed in this application;
[0052] Figure 3 A model training flow chart disclosed in this application;
[0053] Figure 4 A flow chart of a specific log text processing method disclosed in this application;
[0054] Figure 5 This is a structural schematic diagram of a log text processing device disclosed in this application;
[0055] Figure 6 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0056] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0057] The terms "including" and "having" in the specification of the present invention and the above-mentioned drawings, as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may include steps or units that are not listed.
[0058] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0059] like Figure 1 As shown, the embodiment of the present application discloses a log text processing method, including:
[0060] Step S11: Obtain a first vector corresponding to the log text to be processed.
[0061] In the embodiment of the present application, in order to facilitate the subsequent coreference resolution operation and entity recognition operation, it is necessary to obtain the first vector corresponding to the log text to be processed; after vectorization processing, deep semantic features can be mined, thereby improving the accuracy of subsequent coreference resolution and entity recognition.
[0062] In a specific embodiment, obtaining the first vector corresponding to the log text to be processed may include: processing the log text to be processed using a preset general text embedding model to obtain a corresponding first vector. Specifically, the log text to be processed may be vectorized using a pre-trained general text embedding model to obtain a corresponding first vector. It should be noted that the preset general text embedding model (General Text Embeddings, GTE) is located in the target joint model and is used as a shared embedding layer for the coreference resolution model and the entity recognition model. That is, the log text to be processed is first vectorized using a preset general text embedding model to obtain a corresponding first vector, and the first vector of the log text to be processed may be used to perform related coreference resolution operations or entity recognition operations.
[0063] Step S12: perform a coreference resolution operation on the first vector using the coreference resolution model in the target joint model, and adjust the log text to be processed based on the corresponding operation result to obtain an adjusted log text.
[0064] In the present application, a coreference resolution operation is first performed, and a coreference resolution operation is performed on the first vector of the log text to be processed obtained in the above step using a coreference resolution model in a pre-trained target joint model; the relationship between the various references in the log text to be processed can be obtained through the coreference resolution operation; further, based on the operation result of the coreference resolution operation, different references in the log text to be processed can be adjusted to obtain the corresponding adjusted text.
[0065] In a specific embodiment, performing a coreference resolution operation on the first vector may include: selecting a number of candidate references from each candidate span corresponding to the first vector through a preset candidate reference scoring function, and using a preset coreference scorer based on coarse-grained and fine-grained to assign a unique predecessor to each candidate reference, so as to construct a corresponding coreference matrix; performing a coreference resolution operation on the vector according to the coreference matrix to obtain a corresponding operation result containing a number of coreference clusters. Specifically, the coreference resolution model in the target joint model may be composed of a reference extraction layer and a reference connection layer, firstly, a number of candidate references are selected from all candidate spans through a preset candidate reference scoring function, and a unique predecessor is assigned to each candidate reference using coarse-grained and fine-grained coreference scoring, so as to construct a corresponding coreference matrix; further, all coreference clusters can be identified through the coreference matrix to obtain the corresponding operation result of the coreference resolution operation.
[0066] In a specific embodiment, adjusting the log text to be processed based on the corresponding operation results to obtain the adjusted log text may include: adjusting the expressions pointing to the same entity in the log text to be processed to the same term based on the co-reference clusters to obtain the adjusted log text. Specifically, in the process of adjusting the log text to be processed according to the operation results obtained by the co-reference resolution operation, the expressions pointing to the same entity in the log text to be processed may be uniformly adjusted to the same term based on the co-reference clusters obtained by identifying the co-reference matrix to obtain the adjusted log text; it can be understood that the log text processed in this way can reduce the task complexity of entity recognition and improve processing efficiency. Figure 2 The figure shows the entity merging flow chart in the existing commonly used methods. After entity A and entity B are divided by the dictionary, the corresponding word frequency vector representation can be obtained. The similarity between entities A and B is calculated based on the cosine similarity to see if it is greater than the threshold. If so, the two entities can be merged. The present application can provide rich semantic features for coreference resolution and entity recognition through a universal text embedding model. The GTE model uses static word vectors, which are generated relatively quickly and require relatively few resources in the training and reasoning stages. In scenarios that require fast processing and real-time applications, the lightweight nature of GTE can effectively reduce execution time and operating costs. In comparison, BERT's transformer architecture has a higher demand for computing resources, especially when processing longer sequences, which may cause significant delays. At the same time, GTE's demand for training data is usually lower than BERT, which requires a large-scale data set for effective pre-training and fine-tuning. In the case of scarce labeled data, GTE can still maintain reasonable performance. When the GTE model is used as a shared embedding layer for coreference resolution and entity recognition tasks, it can help the coreference resolution model and named entity recognition model better understand the context of entities and referents, thereby improving the accuracy of coreference resolution and entity recognition.
[0067] Step S13: Obtain a second vector corresponding to the adjusted log text.
[0068] In an embodiment of the present application, after obtaining the adjusted log text through the above steps, the adjusted log text can be input into a preset universal text embedding model. The second vector obtained at this time is a unified high-dimensional vector of entities after eliminating co-reference. That is, obtaining the second vector corresponding to the adjusted log text can include: processing the adjusted log text using a preset universal text embedding model to obtain a corresponding second vector. Subsequent entity recognition operations based on the second vector corresponding to the adjusted log text can reduce complexity.
[0069] Step S14: Use the entity recognition model in the target joint model to perform entity recognition operation on the second vector, and extract the relationship between the entities to obtain corresponding triple data, so as to use the triple data to construct a knowledge graph corresponding to the log text to be processed.
[0070] Furthermore, in the entity recognition process, the entity recognition model in the target joint model is used to perform entity recognition operations on the second vector obtained in the above steps, and structured data can be obtained; and the relationship between each entity can be extracted to obtain the corresponding triple data; subsequently, the knowledge graph corresponding to the log text to be processed can be constructed based on the triple data, and the coreference resolution and entity recognition operations of the log text can be completed. In a specific embodiment, the second vector corresponding to the adjusted log text after coreference resolution can be obtained through the above steps, and then the second vector can be processed by the entity recognition model to obtain the entity recognition result corresponding to the log text to be processed; further, the relationship between each entity can be stored in the form of triple data, and the relevant triple data can be used to perform downstream fault analysis tasks later; it can be understood that with the help of the information mining ability of the joint model for the log text, the triple data finally obtained can present more detailed and accurate entity relationships, which can be effective in the execution of downstream fault analysis tasks.
[0071] In a specific embodiment, performing entity recognition operation on the second vector may include: extracting features from each word sequence in the second vector through a bidirectional long short-term memory network to obtain prediction results of related entities; and correcting the prediction results using a conditional random field to obtain recognition results of related entities of the second vector. Specifically, feature extraction can be performed on each word sequence in the second vector through a bidirectional long short-term memory network (Bidirectional Encoder Representations from Transformers, BERT), and recognition prediction can be performed on the entity to obtain corresponding prediction results; and the prediction results output by the bidirectional long short-term memory network can be provided to a pre-set conditional random field (Conditional Random Field, CRF, a probability model for labeling and segmenting sequence data), and the prediction results can be constrained and corrected through the conditional random field to achieve accurate classification of the label data, and finally the recognition results of the related entities of the second vector can be obtained.
[0072] Further, in a specific embodiment, feature extraction of each word sequence in the second vector is performed through a bidirectional long short-term memory network to obtain prediction results of related entities, which may include: using a forward long short-term memory network to calculate the context representation of each word sequence in the second vector to obtain a corresponding forward representation; using a reverse long short-term memory network to calculate the context representation of each word sequence in the second vector to obtain a corresponding reverse representation; connecting the context information of the forward representation and the reverse representation to obtain the prediction results of each entity in the adjusted log text. Specifically, in the process of predicting entities through a bidirectional long short-term memory network, the forward long short-term memory network can calculate the previous context representation of any word, that is, to obtain a forward representation; the reverse long short-term memory network can calculate the subsequent context representation of the word to obtain a corresponding reverse representation; thereafter, by connecting the forward and reverse context information, the final word representation contains the context information, and the prediction results of each entity in the adjusted system text are obtained.
[0073] In a specific embodiment, extracting the relationship between entities to obtain corresponding triple data may include: extracting the relationship between entities by a bootstrap method to obtain corresponding relationship data; storing the relationship data in the form of triples to obtain triple data corresponding to the log text to be processed. Specifically, when constructing triples, the relationship between entities is extracted by Bootstrap (self-service method) and stored in the form of triples to obtain triple data corresponding to the log text to be processed. Further, in another specific embodiment, using triple data to construct a knowledge graph corresponding to the log text to be processed may include: using a graph database to visualize the triple data to construct a knowledge graph corresponding to the log text to be processed. Specifically, after obtaining the triple data, Neo4j (a graph database) can be used to visualize the knowledge graph.
[0074] In another specific embodiment, it also includes: determining a first loss function of a coreference resolution model and a second loss function of an entity recognition model; configuring corresponding weight parameters for the first loss function and the second loss function, constructing a fusion loss function of a target joint model, so as to complete the training of the target joint model based on the fusion loss function. Specifically, the target joint model in the present application includes a coreference resolution model and an entity recognition model, where the first loss function corresponding to the coreference resolution model and the second loss function corresponding to the entity recognition model can be jointly optimized by configuring weight parameters, and a fusion loss function can be constructed after configuring the weight parameters, so as to form a training process for the target joint model based on the fusion loss function.
[0075] Furthermore, it may also include: in the training process of the target joint model, respectively updating the weight parameters corresponding to the first loss function and the second loss function through the back propagation algorithm. Specifically, in order to enable the coreference resolution model and the entity recognition model in the target joint model to learn to independently perform their respective tasks and collaborate to improve the model performance, the weight parameters corresponding to the first loss function and the second loss function may be updated and iterated in reverse through the back propagation algorithm to finally obtain a suitable fusion loss function.
[0076] Correspondingly, it may also include: in the training process of the target joint model, based on the principle of minimizing the second loss function, training the bidirectional long short-term memory network and the conditional random field in the entity recognition model. Specifically, for the entity recognition model in the target joint model, the model includes a bidirectional long short-term memory network and a conditional random field. In the training process of the entity recognition model, it is possible to choose to train the bidirectional long short-term memory network and the conditional random field based on the principle of minimizing the second loss function, so that the probability of the real label sequence predicted by the entity recognition model is maximized, while minimizing the probability of other non-real label sequences.
[0077] It can be seen that this application first performs a coreference resolution operation on the log text that needs to be analyzed, and then performs an entity recognition operation, which can prevent the errors in the entity recognition stage from being propagated to the coreference resolution stage and improve the processing effect. In addition, the target joint model based on the coreference resolution model and the entity recognition model performs better and has lower training costs than the currently commonly used "entity recognition + coreference resolution" pipeline process, and jointly optimizes the knowledge fusion and knowledge extraction in the process of knowledge graph construction, making the knowledge graph construction result more accurate and concise.
[0078] like Figure 3 As shown, this application will introduce in detail the process of training a general text embedding model, a coreference resolution model, and an entity recognition model, including:
[0079] It can be understood that the universal text embedding model, as a shared embedding layer of the coreference resolution model and the entity recognition model, can capture the deep semantic information of the text and convert the input text into a high-dimensional vector representation. The universal text embedding model, the end-to-end coreference resolution model, and the entity recognition model are trained using the training set; and in order to jointly optimize coreference resolution and entity recognition and improve the training efficiency of the two models, a fusion loss function can be configured based on the weight parameters and trained. Among them, the fusion loss function with the weight parameters configured is as follows:
[0080] ;
[0081] Among them, L CR and L NERThey are the loss function of the coreference resolution model and the loss function of the entity recognition model respectively; α and β are weight parameters used to balance the importance of the two loss functions in the training process, and their sum is 1. The initial values can be set to 0.5. By adjusting the hyperparameters α and β, the emphasis of the model on different loss functions can be flexibly controlled. It can be understood that the use of the fusion loss function to jointly train the coreference resolution model and the entity recognition model not only improves the generalization ability of the joint model, but also enhances the robustness of the model in dealing with complex language phenomena. During the training process, the parameters of the two models will be updated simultaneously through the back-propagation algorithm. In this way, the coreference resolution model and the entity recognition model can not only learn how to perform their respective tasks independently, but also learn how to collaborate with each other to improve the overall performance.
[0082] Furthermore, L CR is the loss function of the coreference resolution model, usually a negative log marginal likelihood function:
[0083] ;
[0084] where N is the set of top-scoring spans of extracted candidate coreferences (i.e., unpruned spans), GOLD(i) contains the set of spans in the gold standard coreference cluster of span i, and if span i does not belong to any coreference chain, or all gold standard antecedents have been pruned, then is a virtual antecedent, indicating that span i is not an entity mention or has no antecedent. For each span i, with respect to the antecedent The coreference probability of .
[0085] Correspondingly, L NER is the loss function for the entity recognition task, usually a log-likelihood function:
[0086] ;
[0087] Among them, y* is the observation sequence (i.e., the true label sequence), Y is the set of all possible label sequences, f(y) is the score calculated for the label sequence y, which usually includes the emission score (provided by the BiLSTM layer) and the transfer score (provided by the CRF layer), e f(y) Is the probability assigned by the model to the label sequence y. During the training process, the BiLSTM-CRF model is trained by minimizing this loss function, so that the probability of the real label sequence predicted by the model is maximized, while the probability of other non-real label sequences is minimized.
[0088] In a specific embodiment, during the process of processing the log text to be analyzed, Figure 4As shown in the figure, the log text to be analyzed is input into the trained coreference resolution-entity recognition joint model, and after being embedded in the GTE embedding layer, it is input into the coreference resolution model in the form of a high-dimensional vector. The end-to-end coreference resolution model is used here, which can automatically handle the coreference problem in the text without using a syntactic parser or a manually designed mention detector. The coreference resolution model is mainly composed of a reference extraction layer and a reference connection layer. First, the candidate reference scoring function is used to select the Top-k candidate references from all candidate spans, and the coarse-grained and fine-grained coreference scorers are used to assign a unique pre-reference to each candidate reference, thereby constructing a coreference matrix. Finally, all coreference clusters are identified through the coreference matrix. Furthermore, according to the coreference clusters given by coreference resolution, the actual coreference resolution operation can be performed on the log text to be processed. Specifically, all expressions pointing to the same entity are unified into the same term. After the replacement is completed, the text is embedded again through the GTE model. The result is a unified high-dimensional vector of the entity after coreference resolution. Using the vector obtained at this time as the input of the entity recognition model, the entity recognition model can focus more on identifying the type and boundary of the entity, reduce the complexity of the task, and thus improve the overall processing efficiency. The entity recognition model is a BiLSTM-CRF model. BiLSTM is designed to learn the contextual relationship in a sentence, while CRF is used to process the dependency relationship between entity types. After the coreference-resolved text is converted into word vectorization through the shared embedding layer, the initial value will be input into the LSTM network layer. For any word t, the LSTM model can be used to calculate its previous context representation h Similarly, the reverse LSTM model also calculates the context representation h of the word. . By connecting the forward and backward context information, the final word representation will contain context information. This model training method is particularly effective for entity recognition problems and can efficiently and accurately identify entities in text. The basic features of the input word sequence are extracted with the help of the bidirectional LSTM layer, and the prediction results are normalized and output to provide to the final CRF layer. Through the constraints and corrections of the CRF layer, accurate classification of label data is achieved; then the relationship between entities can be extracted through the self-service method and stored in the form of triples, and finally the knowledge graph can be visualized with the help of a graph database.
[0089] It can be seen that in this embodiment, end-to-end coreference resolution can be used as a pre-task for named entity recognition. The results of the coreference resolution stage can help the entity recognition model to more accurately identify entities and simplify the complexity of entity recognition. At the same time, a general text embedding model is introduced as a shared embedding layer for coreference resolution and entity recognition tasks. The model is pre-trained on large-scale text and can cover a variety of fields and scenarios, which makes it advantageous when processing various types of texts. It has low requirements on the scale of training data and can provide rich semantic features for the joint model of coreference resolution and entity recognition, thereby improving the performance of the model. In addition, this embodiment designs a fusion loss function for the joint model, jointly optimizes the coreference resolution and entity recognition tasks during the training process, and improves the training efficiency of the two subtask models. Compared with the currently commonly used "entity recognition + coreference resolution" pipeline process, the joint model has better performance and lower training cost. It jointly optimizes the knowledge fusion and knowledge extraction in the process of knowledge graph construction, making the construction result of the knowledge graph more accurate and concise.
[0090] like Figure 5 As shown, the embodiment of the present application discloses a log text processing device, including:
[0091] A first vector acquisition module 11 is used to acquire a first vector corresponding to the log text to be processed;
[0092] A coreference resolution module 12 is used to perform a coreference resolution operation on the first vector using a coreference resolution model in a target joint model, and adjust the log text to be processed based on the corresponding operation result to obtain an adjusted log text;
[0093] A second vector acquisition module 13, used to acquire a second vector corresponding to the adjusted log text;
[0094] The entity recognition module 14 is used to perform entity recognition operation on the second vector using the entity recognition model in the target joint model, and extract the relationship between each entity to obtain corresponding triple data, so as to use the triple data to construct a knowledge graph corresponding to the log text to be processed.
[0095] It can be seen that the present application first performs a coreference resolution operation on the log text to be analyzed, and then performs an entity recognition operation, which can avoid the propagation of errors in the entity recognition stage to the coreference resolution stage and improve the processing effect.
[0096] In a specific embodiment, the first vector acquisition module 11 may include:
[0097] A first processing unit, configured to process the log text to be processed by using a preset universal text embedding model to obtain a corresponding first vector;
[0098] Accordingly, the second vector acquisition module 13 may include:
[0099] The second processing unit is used to process the adjusted log text by using a preset universal text embedding model to obtain a corresponding second vector.
[0100] In a specific embodiment, the coreference resolution module 12 may include:
[0101] A coreference matrix construction unit, used for selecting a number of candidate references from each candidate span corresponding to the first vector by using a preset candidate reference scoring function, and assigning a unique pre-reference to each candidate reference by using a preset coarse-grained and fine-grained coreference scorer to construct a corresponding coreference matrix;
[0102] The coreference resolution unit is used to perform a coreference resolution operation on the vector according to the coreference matrix to obtain a corresponding operation result containing a number of coreference clusters.
[0103] In a specific embodiment, the coreference resolution module 12 may include:
[0104] The text adjustment unit is used to adjust the expressions pointing to the same entity in the log text to be processed into the same term based on the coreference cluster to obtain the adjusted log text.
[0105] In a specific embodiment, the entity identification module 14 may include:
[0106] An entity prediction submodule, used for extracting features of each word sequence in the second vector through a bidirectional long short-term memory network to obtain prediction results of related entities;
[0107] The correction unit is used to correct the prediction result by using the conditional random field to obtain the recognition result of the related entity of the second vector.
[0108] In another specific embodiment, the entity prediction submodule may include:
[0109] A first computing unit is used to compute the context representation of each word sequence in the second vector using a forward long short-term memory network to obtain a corresponding forward representation;
[0110] A second computing unit is used to compute the context representation of each word sequence in the second vector by using a reverse long short-term memory network to obtain a corresponding reverse representation;
[0111] The context information connection unit is used to connect the context information of the forward representation and the reverse representation to obtain the prediction results of each entity in the adjusted log text.
[0112] In a specific embodiment, the entity identification module 14 may include:
[0113] An entity relationship extraction unit, used to extract the relationship between entities through a self-help method to obtain corresponding relationship data;
[0114] The relational data storage unit is used to store relational data based on triples to obtain triples of data corresponding to the log text to be processed.
[0115] In a specific embodiment, the entity identification module 14 may include:
[0116] The visualization processing unit is used to perform visualization processing on the triple data using a graph database to construct a knowledge graph corresponding to the log text to be processed.
[0117] In a specific embodiment, the device of the present application may further include:
[0118] A loss function determination module, used to determine a first loss function of a coreference resolution model and a second loss function of an entity recognition model;
[0119] The weight parameter configuration module is used to configure corresponding weight parameters for the first loss function and the second loss function, construct a fusion loss function of the target joint model, and complete the training of the target joint model based on the fusion loss function.
[0120] In another specific embodiment, the method may further include:
[0121] The weight parameter updating module is used to update the weight parameters corresponding to the first loss function and the second loss function respectively through the back propagation algorithm during the training process of the target joint model.
[0122] In another specific embodiment, the method may further include:
[0123] The training module is used to train the bidirectional long short-term memory network and conditional random field in the entity recognition model based on the principle of minimizing the second loss function during the training process of the target joint model.
[0124] Furthermore, the present application also discloses an electronic device. Figure 6It is a structural diagram of an electronic device according to an exemplary embodiment, and the content in the figure cannot be regarded as any limitation on the scope of use of this application. The electronic device may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input and output interface 25 and a communication bus 26. Among them, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the log text processing method disclosed in any of the aforementioned embodiments. In addition, the electronic device in this embodiment may specifically be an electronic computer.
[0125] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0126] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0127] The operating system 221 is used to manage and control various hardware devices on the electronic device and the computer program 222, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the log text processing method performed by the electronic device disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0128] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned disclosed log text processing method. The specific steps of the method can refer to the corresponding contents disclosed in the aforementioned embodiments, and will not be repeated here.
[0129] Furthermore, the present application also discloses a computer program product, including a computer program / instruction, which implements the aforementioned disclosed log text processing method when executed by a processor.
[0130] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0131] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0132] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0133] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0134] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A log text processing method, characterized in that: include: Get the first vector corresponding to the log text to be processed; Using a coreference resolution model in a target joint model to perform a coreference resolution operation on the first vector, and adjusting the log text to be processed based on the corresponding operation result to obtain an adjusted log text; Obtaining a second vector corresponding to the adjusted log text; The entity recognition model in the target joint model is used to perform entity recognition operation on the second vector, and the relationship between the entities is extracted to obtain corresponding triple data, so as to use the triple data to construct a knowledge graph corresponding to the log text to be processed.
2. The log text processing method according to claim 1, characterized in that: The step of obtaining a first vector corresponding to the log text to be processed includes: Processing the log text to be processed by using a preset universal text embedding model to obtain a corresponding first vector; Correspondingly, obtaining the second vector corresponding to the adjusted log text includes: The adjusted log text is processed using the preset universal text embedding model to obtain a corresponding second vector.
3. The log text processing method according to claim 2, characterized in that: The preset universal text embedding model is located in the target joint model and serves as a shared embedding layer for the coreference resolution model and the entity recognition model.
4. The log text processing method according to claim 1, characterized in that: The performing a coreference elimination operation on the first vector includes: Selecting a number of candidate references from each candidate span corresponding to the first vector by using a preset candidate reference scoring function, and assigning a unique predecessor to each of the candidate references by using a preset co-reference scorer based on coarse granularity and fine granularity, so as to construct a corresponding co-reference matrix; A coreference elimination operation is performed on the vector according to the coreference matrix to obtain a corresponding operation result including a plurality of coreference clusters.
5. The log text processing method according to claim 4, characterized in that: The step of adjusting the log text to be processed based on the corresponding operation result to obtain the adjusted log text includes: Based on the coreference cluster, expressions pointing to the same entity in the log text to be processed are all adjusted to the same term to obtain an adjusted log text.
6. The log text processing method according to claim 1, characterized in that: The performing an entity recognition operation on the second vector includes: Extracting features of each word sequence in the second vector by using a bidirectional long short-term memory network to obtain prediction results of related entities; The prediction result is corrected using a conditional random field to obtain a recognition result of an entity related to the second vector.
7. The log text processing method according to claim 6, characterized in that: The extracting features of each word sequence in the second vector by using a bidirectional long short-term memory network to obtain a prediction result of a related entity includes: Using a forward long short-term memory network, calculating the context representation of each word sequence in the second vector to obtain a corresponding forward representation; Using a reverse long short-term memory network, calculating the context representation of each word sequence in the second vector to obtain a corresponding reverse representation; The context information of the forward representation and the reverse representation are connected to obtain prediction results of each entity in the adjusted log text.
8. The log text processing method according to claim 1, characterized in that: The extraction of the relationship between the entities to obtain the corresponding triple data includes: Extract the relationship between entities through the self-help method to obtain the corresponding relationship data; The relational data is stored in a triple form to obtain triple data corresponding to the log text to be processed.
9. The log text processing method according to claim 1, characterized in that: The step of constructing a knowledge graph corresponding to the log text to be processed by using the triple data includes: The triple data is visualized using a graph database to construct a knowledge graph corresponding to the log text to be processed.
10. The log text processing method according to any one of claims 1 to 9, characterized in that: Also includes: Determining a first loss function of the coreference resolution model and a second loss function of the entity recognition model; Corresponding weight parameters are configured for the first loss function and the second loss function to construct a fusion loss function of the target joint model, so as to complete the training of the target joint model based on the fusion loss function.
11. The log text processing method according to claim 10, characterized in that: Also includes: During the training process of the target joint model, the weight parameters corresponding to the first loss function and the second loss function are updated respectively through the back propagation algorithm.
12. The log text processing method according to claim 10, characterized in that: Also includes: During the training process of the target joint model, based on the principle of minimizing the second loss function, the bidirectional long short-term memory network and conditional random field in the entity recognition model are trained.
13. A log text processing device, characterized in that: include: A first vector acquisition module, used to acquire a first vector corresponding to the log text to be processed; A coreference resolution module, configured to perform a coreference resolution operation on the first vector using a coreference resolution model in a target joint model, and adjust the log text to be processed based on a corresponding operation result to obtain an adjusted log text; A second vector acquisition module, used to acquire a second vector corresponding to the adjusted log text; An entity recognition module is used to perform entity recognition operations on the second vector using the entity recognition model in the target joint model, and extract the relationship between each entity to obtain corresponding triple data, so as to use the triple data to construct a knowledge graph corresponding to the log text to be processed.
14. An electronic device, characterized in that: include: Memory for storing computer programs; A processor is used to execute the computer program to implement the steps of the log text processing method according to any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the log text processing method according to any one of claims 1 to 12 are implemented.