A method and apparatus for entity extraction
Patent Information
- Application Number
- CN202310685376.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-09
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2043-06-09
AI Technical Summary
[0003]相关技术中,对事件进行实体抽取的方法很多,但大多为通用领域的实体抽取方法,针对运维领域的方法较少,采用通用领域的实体抽取方法对运维事件的实体进行抽取,不能重复利用运维领域的信息,导致抽取的实体的有效性较低
[0051]上述发明中的一个实施例具有如下优点或有益效果:通过获取多个历史运维文本数据,并对历史运维文本数据进行预处理,并进行实体及实体类型的标注,得到标注结果,然后利用预处理后的历史运维文本数据和标注结果训练得到实体抽取模型,然后采用实体抽取模型对运维文本数据的实体及实体类型进行抽取。其中,预处理包括分词处理、去停用词处理和词性标注,去停用词处理是采用运维停用词库进行得到,充分利用运维领域的特点,提高运维领域中实体抽取的准确性和有效性,并采结合词性标注,使得抽取出的实体有效性更高。
Smart Images

Figure CN116737953B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent operation and maintenance technology, and in particular to a method and apparatus for entity extraction. Background Technology
[0002] Intelligent operations and maintenance (O&M) technology applies artificial intelligence to the O&M field to improve the efficiency and accuracy of intelligent O&M and cope with complex O&M scenarios. In intelligent O&M, entity extraction methods are used to structure O&M events, which facilitates event management.
[0003] In related technologies, there are many methods for entity extraction from events, but most of them are general-domain entity extraction methods, and there are few methods for the operation and maintenance domain. Using general-domain entity extraction methods to extract entities from operation and maintenance events cannot reuse information from the operation and maintenance domain, resulting in low effectiveness of the extracted entities. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method and apparatus for entity extraction, which can make full use of the characteristics of the operation and maintenance field, and make the extracted entities more effective when extracting entities from operation and maintenance events, thereby achieving efficient management of operation and maintenance events.
[0005] To achieve the above objectives, according to one aspect of the present invention, a method for training an entity extraction model is provided, comprising:
[0006] Retrieve multiple historical operation and maintenance text data;
[0007] The historical operation and maintenance text data is preprocessed to obtain preprocessed historical operation and maintenance text data. The preprocessing includes word segmentation, stop word removal, and part-of-speech tagging. The stop word removal is performed using an operation and maintenance stop word library.
[0008] The entities and entity types in the preprocessed historical operation and maintenance text data are labeled to obtain the labeling results;
[0009] Based on the preprocessed historical operation and maintenance text data and the annotation results, an entity extraction model is trained.
[0010] Optionally, the maintenance deselection dictionary is obtained through the following method:
[0011] Retrieve multiple first-level maintenance text data;
[0012] The plurality of first maintenance text data are classified to obtain the category corresponding to each first maintenance text data.
[0013] The first maintenance text data in each category is matched using the log template corresponding to each category to obtain the effective words in the first maintenance text data;
[0014] The maintenance stop word library is determined based on the first maintenance text data and the valid words in the first maintenance text data.
[0015] Optionally, the entities in the preprocessed historical operation and maintenance text data and the entity types corresponding to the entities are labeled to obtain the labeling results, including:
[0016] For the first historical operation and maintenance text data that meets the preset mode after preprocessing, the entities and entity types are extracted from the first historical operation and maintenance text data using the preset mode to obtain the annotation results of the first historical operation and maintenance text data.
[0017] Optionally, after extracting entities and entity types from the first historical operation and maintenance text data using a preset mode, the method further includes:
[0018] Based on the extracted entities and entity types, an n-ary fragment is obtained;
[0019] Based on the frequency of each segment in the n-ary segment, the extracted entities and entity types are denoised.
[0020] Optionally, the entities in the preprocessed historical operation and maintenance text data and the entity types corresponding to the entities are labeled to obtain the labeling results, including:
[0021] For preprocessed second historical operation and maintenance text data that does not meet the preset mode, if there are words in the second historical operation and maintenance text data that are the same as the extracted entities, then the entities and entity types of the second historical operation and maintenance text data are determined according to the extracted entities and entity types to obtain the annotation results of the second historical operation and maintenance text data.
[0022] Optionally, the entities and entity types of the second historical operation and maintenance text data are determined based on the extracted entities and entity types, including:
[0023] The extracted entities are used as entities in the second historical operation and maintenance text data;
[0024] In the case where an entity in the second historical maintenance text data corresponds to multiple entity types, the entity type that appears most frequently among the multiple entity types is taken as the entity type corresponding to the entity in the second historical maintenance text data.
[0025] Optionally, the preprocessed historical operation and maintenance text data includes part-of-speech tagging results; based on the preprocessed historical operation and maintenance text data and the tagging results, an entity extraction model is trained, including:
[0026] Word embedding is performed on the preprocessed historical operation and maintenance text data to obtain word embedding vectors;
[0027] Determine the part-of-speech vectors based on the part-of-speech tagging results;
[0028] The word embedding vector is weighted according to the part-of-speech vector to obtain the weighted result;
[0029] The weighted result is input into the entity recognition network layer to obtain the entity extraction result corresponding to the historical operation and maintenance text. The entity extraction result includes the entity and the probability of the entity type.
[0030] The entity extraction model is obtained by training based on the entity extraction results and the annotation results.
[0031] In another aspect of the present invention, a method for entity extraction is provided, comprising:
[0032] Obtain operation and maintenance text data;
[0033] The operation and maintenance text data is preprocessed to obtain preprocessed operation and maintenance text data. The preprocessing includes word segmentation, stop word removal, and part-of-speech tagging. The stop word removal is performed using an operation and maintenance stop word library.
[0034] The preprocessed operation and maintenance text data is input into the entity extraction model to obtain the entities and entity types corresponding to the operation and maintenance text data.
[0035] The entity extraction model is obtained by the entity extraction model training method according to an embodiment of the present invention.
[0036] In another aspect, the present invention provides a training apparatus for an entity extraction model, comprising:
[0037] The first acquisition module acquires multiple historical operation and maintenance text data;
[0038] The first preprocessing module preprocesses the historical operation and maintenance text data to obtain preprocessed historical operation and maintenance text data. The preprocessing includes word segmentation, stop word removal, and part-of-speech tagging. The stop word removal is performed using an operation and maintenance stop word library.
[0039] The annotation module annotates entities and entity types in the preprocessed historical operation and maintenance text data to obtain annotation results.
[0040] The training module trains an entity extraction model based on the preprocessed historical operation and maintenance text data and the annotation results.
[0041] According to another aspect of the present invention, an apparatus for entity extraction is provided, comprising:
[0042] The second acquisition module acquires operation and maintenance text data;
[0043] The second preprocessing module preprocesses the operation and maintenance text data to obtain preprocessed operation and maintenance text data. The preprocessing includes word segmentation, stop word removal, and part-of-speech tagging. The stop word removal is performed using an operation and maintenance stop word library.
[0044] The determination module inputs the preprocessed operation and maintenance text data into the entity extraction model to obtain the entity and entity type corresponding to the operation and maintenance text data;
[0045] The entity extraction model is obtained using the training method of the entity extraction model in the embodiment of the present invention.
[0046] According to another aspect of the present invention, an electronic device is provided, comprising:
[0047] One or more processors;
[0048] Storage device for storing one or more programs.
[0049] When the one or more programs are executed by the one or more processors, the one or more processors implement the training method or entity extraction method of the entity extraction model provided by the present invention.
[0050] According to another aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements a training method for an entity extraction model or a method for entity extraction provided by the present invention.
[0051] One embodiment of the above invention has the following advantages or beneficial effects: By acquiring multiple historical operation and maintenance text data, preprocessing the historical operation and maintenance text data, and annotating entities and entity types to obtain annotation results, an entity extraction model is trained using the preprocessed historical operation and maintenance text data and the annotation results. The entity extraction model is then used to extract entities and entity types from the operation and maintenance text data. The preprocessing includes word segmentation, stop word removal, and part-of-speech tagging. Stop word removal is performed using an operation and maintenance stop word library, fully utilizing the characteristics of the operation and maintenance domain to improve the accuracy and effectiveness of entity extraction in the operation and maintenance domain. Furthermore, the combination of part-of-speech tagging further enhances the effectiveness of the extracted entities.
[0052] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0053] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:
[0054] Figure 1 This is a schematic diagram of the main flow of a training method for an entity extraction model according to an embodiment of the present invention;
[0055] Figure 2 This is a schematic diagram of the main flow of a training method for another entity extraction model according to an embodiment of the present invention;
[0056] Figure 3 This is a schematic diagram of the main flow of an entity extraction method according to an embodiment of the present invention;
[0057] Figure 4 This is a schematic diagram of the main modules of the training device for the entity extraction model according to an embodiment of the present invention;
[0058] Figure 5 This is a schematic diagram of the main modules of an entity extraction device according to an embodiment of the present invention;
[0059] Figure 6 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;
[0060] Figure 7 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation
[0061] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0062] Figure 1 This is a schematic diagram illustrating the main flow of a training method for an entity extraction model according to an embodiment of the present invention, as shown below. Figure 1 As shown, the method includes the following steps:
[0063] Step S101: Obtain multiple historical operation and maintenance text data;
[0064] Step S102: Preprocess the historical operation and maintenance text data to obtain preprocessed historical operation and maintenance text data. The preprocessing includes word segmentation, stop word removal and part-of-speech tagging. Stop word removal is performed using the operation and maintenance stop word library.
[0065] Step S103: Annotate the entities and entity types in the preprocessed historical operation and maintenance text data to obtain the annotation results;
[0066] Step S104: Train the entity extraction model based on the preprocessed historical operation and maintenance text data and annotation results.
[0067] In this embodiment of the invention, historical operation and maintenance text data refers to text data corresponding to operation and maintenance events in the operation and maintenance scenario. Operation and maintenance events are events that affect the operational stability of the application. Historical operation and maintenance text data can include alarm log data, static relationship data, and issues reported from business operations. Static relationship data can include dependency relationship data and communication relationship data between various applications and components, and can be stored in a CMDB (Configuration Management Database). Issues reported from business operations can be configured alarm data or manually investigated event problem data.
[0068] In this embodiment of the invention, multiple historical operation and maintenance text data can be acquired within a preset time range. After acquiring multiple historical operation and maintenance text data, each historical operation and maintenance text data is preprocessed. Preprocessing includes data cleaning of the historical operation and maintenance text data. Preprocessing includes: word segmentation, stop word removal, and part-of-speech tagging. The word segmentation process includes a first segmentation and a second segmentation. Specifically, a word segmentation tool is used to perform the first segmentation on the historical operation and maintenance text data. Since the historical operation and maintenance text data can be a mixture of Chinese and English, both Chinese and English need to be considered during data cleaning. Therefore, after the first segmentation, data normalization is performed, such as converting uppercase to lowercase and removing special symbols such as semicolons and question marks. Then, the second segmentation is performed, which can be done using the Python (a computer programming language) nltk (Natural Language Toolkit) package for tokenization, resulting in a series of words and phrases. Then, stop word removal is performed, and part-of-speech tagging is performed on the cleaned historical operation and maintenance text data to obtain the part-of-speech of each word, which is achieved using StanfordCorenlp (a natural language analysis tool) in Python.
[0069] In this embodiment of the invention, the stop word removal process is performed using an operations and maintenance (O&M) stop word library. This O&M stop word library is designed for the O&M field and is extracted from massive O&M logs, making entity extraction more specialized. Specifically, the O&M stop word library is obtained through the following method:
[0070] Retrieve multiple first-level maintenance text data;
[0071] Classify multiple first-level operation and maintenance text data to obtain the category corresponding to each first-level operation and maintenance text data;
[0072] By matching the first maintenance text data in each category with the log template corresponding to each category, the effective words in the first maintenance text data are obtained;
[0073] The maintenance stop word library is determined based on the first maintenance text data and the valid words in the first maintenance text data.
[0074] In this embodiment of the invention, when constructing the maintenance deactivation dictionary, multiple first maintenance text data within a preset time range are acquired. These multiple first maintenance text data are then classified using a clustering algorithm to obtain multiple categories and multiple first maintenance text data corresponding to each category. For each category of multiple first maintenance text data, log templates are extracted. Multiple log templates can be extracted from each category, and each log template can be extracted from multiple first maintenance text data, meaning each log template corresponds to multiple first maintenance text data. Then, the log template is matched with each first maintenance text data corresponding to that log template to obtain the first maintenance text data. Valid words are those present in the log template. Then, based on the first maintenance text data and the valid words within it, a maintenance stop word library is determined. Specifically, a portion of the first maintenance text data corresponding to the log template is selected, and words other than valid words in this portion are tagged with part-of-speech tags. Nouns, verbs, and adjectives can then be added to the log template. The validity of these added nouns, verbs, and adjectives can be manually determined. If valid, the remaining words in the portion of the first maintenance text data are marked as stop words, and this process is then expanded to all first maintenance text data to obtain the maintenance stop word library. While obtaining the maintenance stop word library, multiple first maintenance text data sets can be retrieved at preset intervals to update the library.
[0075] In this embodiment of the invention, entities and their corresponding entity types in the preprocessed historical operation and maintenance text data are labeled to obtain the labeling results, including:
[0076] For the preprocessed first historical operation and maintenance text data that meets the preset mode, the entities and entity types are extracted from the first historical operation and maintenance text data using the preset mode to obtain the annotation results of the first historical operation and maintenance text data.
[0077] In this embodiment of the invention, after obtaining the preprocessed historical operation and maintenance text data, it is necessary to determine the annotation result of each historical operation and maintenance text data in order to train an entity extraction model based on the historical operation and maintenance text data and the annotation result. The annotation result is the entity and entity type in the historical operation and maintenance text data. Data annotation of the preprocessed historical operation and maintenance text data is the data annotation of named entities. To reduce annotation costs, an unsupervised annotation method can be used. For the first preprocessed historical operation and maintenance text data that conforms to the preset pattern, its entities and entity types can be annotated using the preset pattern. The preset pattern can be a key-value pair pattern. The first historical operation and maintenance text data records entities and entity types, which can be automatically extracted using the key-value pair pattern. For example, from the text data "Task ID: 155946039962 Application Name: xx-xx-xx-gateway Alarm Dimension: [Unified Log] xx-xx.xx.jsf.gd.error.ClientTimeoutException First Alarm Time: 2022-08-16 16:41:47 Handling Opinion: The ClientTimeoutException exception occurs frequently but is not an urgent exception. After investigating the business timeout setting issue, this exception can be captured and handled separately.", the entity "xx-xx-xx-gateway" and the corresponding entity type "Application Name" can be automatically extracted based on the key-value pair pattern.
[0078] In this embodiment of the invention, when annotating preprocessed historical operation and maintenance text data, multiple preprocessed historical operation and maintenance text data can first be clustered to obtain the category of each preprocessed historical operation and maintenance text data. Then, for each category, multiple log templates are extracted. The log templates are updated based on the extracted log templates and historical operation and maintenance text data for that category to obtain updated log templates. Multiple updated log templates are obtained from each category. The entities and entity types of the updated log templates can be annotated using manual annotation or a preset mode. Then, the entities and entity types of some preprocessed historical operation and maintenance text data corresponding to the updated log template can be obtained. The annotation results are then extended to all preprocessed historical operation and maintenance text data corresponding to the updated log template, and so on, to obtain the annotation results of historical operation and maintenance text data for each category. The extraction of log templates can be implemented using the FT-Tree algorithm.
[0079] In this embodiment of the invention, after extracting entities and entity types from the first historical operation and maintenance text data using a preset mode, the method further includes:
[0080] Based on the extracted entities and entity types, an n-ary fragment is obtained;
[0081] Based on the frequency of each segment in the n-ary segment, the extracted entities and entity types are denoised.
[0082] In this embodiment of the invention, the entities and entity types obtained using a preset mode are susceptible to noise interference, requiring cleaning, i.e., denoising, of the extracted entities and entity types to improve the accuracy of entity extraction. n-ary fragments can be extracted from the extracted entities and entity types, where n is a natural number (1, 2, or 3). Then, the frequency of each fragment is determined, and the fragment with the highest frequency is taken as the entity type corresponding to the entity. For example, in "127.0.0.1 application name: xx-xx-xx-gateway" and "10.0.0.1 application name: xx-xx-xx-gateway", the IP address is noise interference. Therefore, the candidate set of extracted entity names and entity types is further processed to extract n-ary fragments (n ranges from 1 to 3), and the n-ary fragment with the highest frequency K (a manually set parameter) is selected, thereby achieving the purpose of denoising. For example, the data mentioned above can be transformed into a 3-gram fragment ["127.0.0.1", "Application Name", "xx-xx-xx-gateway"]. If the "Application Name" appears most frequently in the candidate set, then that entity and entity type can be retained, thus removing interference from the domain name. When extracting n-gram fragments, the extracted entities and entity types can be matched with the IP address set and the xx-xx-xx-gateway set stored in the CMDB to extract fragments based on the matching results.
[0083] In this embodiment of the invention, the entities and their corresponding entity types in the preprocessed historical operation and maintenance text data are labeled to obtain the labeling results. This may include: for preprocessed second historical operation and maintenance text data that does not meet the preset mode, if there are words in the second historical operation and maintenance text data that are the same as the extracted entities, then the entities and entity types of the second historical operation and maintenance text data are determined according to the extracted entities and entity types to obtain the labeling results of the second historical operation and maintenance text data.
[0084] In this embodiment of the invention, the method of extracting entities and entity types using a preset mode is not applicable to all data, and the data corresponding to this method is relatively special, which is prone to overfitting problems during model training. Therefore, for preprocessed second historical operation and maintenance text data that does not conform to the preset mode, an annotation and expansion method can be used to annotate entities and entity types. Specifically, if there are words or phrases in the second historical operation and maintenance text data that are the same as the extracted entities, that is, if there are words in the second historical operation and maintenance text data that are the same as the entities extracted from the first historical operation and maintenance text data, then the entities and entity types extracted from the first historical operation and maintenance text data can be used to annotate and expand the second historical operation and maintenance text data. In the case where the extracted entities correspond to one entity type, that is, the entity types of the extracted entities are the same in different first historical operation and maintenance text data, the entities and entity types of the first historical operation and maintenance text data can be directly used as the entities and entity types of the second historical operation and maintenance text data, thus obtaining the entities and entity types of the second historical operation and maintenance text data. In other words, if a piece of text data has been labeled as an entity of a certain entity type, then all words or phrases in all text data that contain the same entity extracted from that piece of text data will be labeled as entities and entity types of the same type as that piece of text data. For example, "xx-xx-xx-gateway" in all text data can be labeled as the "application name" entity type.
[0085] In this embodiment of the invention, determining the entities and entity types of the second historical operation and maintenance text data based on the extracted entities and entity types includes: using the extracted entities as entities of the second historical operation and maintenance text data; and, if an entity in the second historical operation and maintenance text data corresponds to multiple entity types, using the entity type with the highest frequency among the multiple entity types as the entity type corresponding to the entity in the second historical operation and maintenance text data, thereby obtaining the annotation result of the second historical operation and maintenance text data. Alternatively, the annotation time of each entity type among the multiple entity types can be obtained, and the entity type with the latest time can be used as the entity type corresponding to the entity in the second historical operation and maintenance text data. The case where an entity in the second historical operation and maintenance text data corresponds to multiple entity types refers to the existence of multiple first historical operation and maintenance text data, which contain the same entities but have different entity types. These multiple first historical operation and maintenance text data can be operation and maintenance text data obtained at different times. In other words, if the same entity in a piece of text data is labeled with different entity types at different times, or the same entity in different text data is labeled with different entity types, then the frequency of each entity type is calculated. That is, the number of times each entity type appears in each first historical maintenance text data is obtained, and then the entity type with the highest frequency is taken as the entity type corresponding to that entity, or the entity type with the most recent time, that is, the entity type closest to the current time, is taken as the entity type of the entity. For example, in historical maintenance text data A, an IP address is labeled as entity type A. This IP address is labeled as entity type B in historical maintenance text data C, and then labeled as entity type A in historical maintenance text data C. Here, historical maintenance text data A, B, and C can be maintenance text data obtained at different times. Then, when the IP address exists in a certain historical maintenance text data, the IP address is labeled as entity type A.
[0086] In embodiments of the present invention, such as Figure 2 As shown, the preprocessed historical operation and maintenance text data includes part-of-speech tagging results; based on the preprocessed historical operation and maintenance text data and the tagging results, an entity extraction model is trained, including:
[0087] Step S201: Perform word embedding on the preprocessed historical operation and maintenance text data to obtain word embedding vectors;
[0088] Step S202: Determine the part-of-speech vectors based on the part-of-speech tagging results;
[0089] Step S203: Weight the word embedding vectors according to the part-of-speech vectors to obtain the weighted result;
[0090] Step S204: Input the weighted result into the entity recognition network layer to obtain the entity extraction result corresponding to the historical operation and maintenance text. The entity extraction result includes the entity and the probability of the entity type.
[0091] Step S205: Train the entity extraction model based on the entity extraction results and annotation results to obtain the entity extraction model.
[0092] In this embodiment of the invention, a BERT (Bidirectional Encoder Representation from Transformers) pre-trained model can be used to embed words into the preprocessed historical operation and maintenance text data to obtain word embedding vectors. Stanford Corenlp annotation is used to obtain part-of-speech tagging results, which include the weight of each part of speech. Based on the weight of each word, a part-of-speech vector is obtained. The word embedding vectors are then weighted using the part-of-speech vectors to obtain a weighted result, which is the input to the model. The weighted result is input into the entity recognition network layer to obtain entity extraction results, which include the probability of the entity and its type. The entity recognition network layer may include a BiLSTM (Bi-directional Long Short-Term Memory) layer + CRF (conditional random field) layer, an LSTM (Long Short-Term Memory) layer + CRF layer, etc. In different scenarios in the field of operation and maintenance, the requirements for entities and entity probabilities are different. Different probability thresholds can be set for different scenarios. The model can be trained based on the probability and probability threshold of entities and entity types in the entity extraction results.
[0093] In this embodiment of the invention, Stanford Corenlp is used to obtain part-of-speech tagging results. The weight of each part of speech can be set by the user or obtained by training a classification model. Different parts of speech correspond to different weights.
[0094] The model is trained based on the entity extraction and labeling results. The entity extraction results are compared with the labeling results, and the loss is calculated based on a loss function such as the cross-entropy loss function. Backpropagation is performed, and the model parameters are optimized through gradient descent to obtain the entity extraction model.
[0095] In this embodiment of the invention, during the training of the entity extraction model, historical operation and maintenance text data can be used to verify the entity extraction model in order to extract entities and entity types from the historical operation and maintenance text data. When the accuracy and recall of the entity extraction model reach a preset threshold, the trained entity extraction model is obtained, and the extracted entities and entity types are added to the log template corresponding to the historical operation and maintenance text data to improve the accuracy of subsequent entity and entity type labeling.
[0096] Another aspect of the embodiments of the present invention, such as Figure 3 As shown, a method for entity extraction is provided, including:
[0097] Step S301: Obtain operation and maintenance text data;
[0098] Step S302: Preprocess the operation and maintenance text data to obtain preprocessed operation and maintenance text data. The preprocessing includes word segmentation, stop word removal and part-of-speech tagging. Stop word removal is performed using the operation and maintenance stop word library.
[0099] Step S303: Input the preprocessed operation and maintenance text data into the entity extraction model to obtain the entities and entity types corresponding to the operation and maintenance text data.
[0100] The entity extraction model is obtained by the training method of the entity extraction model according to an embodiment of the present invention.
[0101] In this embodiment of the invention, when using an entity extraction model for entity extraction, maintenance text data is acquired, preprocessed, and then segmented using a word segmentation tool. The data is then standardized, including converting uppercase English letters to lowercase, removing question marks and other symbols (colons cannot be removed), and then tokenizing the text using the nltk package. Next, a maintenance stop word library is used to remove stop words, which improves the effectiveness of the extracted entities. Finally, the Stanford Corenlp package in Python is used for part-of-speech tagging, resulting in preprocessed maintenance text data. This preprocessed data is then input into the entity extraction model to obtain the corresponding entities and entity types. Specifically, inputting the operation and maintenance text data into the entity extraction model includes: using a BERT pre-trained model to perform word embedding on the operation and maintenance text data to obtain word embedding vectors, using part-of-speech tagging results to obtain part-of-speech vectors, using part-of-speech vectors to weight the word embedding vectors, and inputting the weighted result into a BiLSTM layer + CRF layer to obtain entities and entity types.
[0102] In this embodiment of the invention, before preprocessing the operation and maintenance text data or historical operation and maintenance text data, the operation and maintenance text data can be matched with the set of specific values of application names (such as "xx-xx-xx-gateway") and the set of IP addresses stored in the CMDB. The specific values of application names and IP addresses in the operation and maintenance text data are removed. Then, after the preprocessing is completed, the removed data is restored to the preprocessed operation and maintenance text data to prevent the word segmentation and stop word removal in the preprocessing process from affecting the accuracy and effectiveness of subsequent entity extraction, thereby improving the accuracy and effectiveness of the entity extraction results.
[0103] The entity extraction method of this invention involves acquiring multiple historical operation and maintenance text data, preprocessing the historical operation and maintenance text data, and labeling entities and entity types to obtain labeling results. Then, an entity extraction model is trained using the preprocessed historical operation and maintenance text data and the labeling results. The entity extraction model is then used to extract entities and entity types from the operation and maintenance text data. The preprocessing includes word segmentation, stop word removal, and part-of-speech tagging. Stop word removal is performed using an operation and maintenance stop word library, fully utilizing the characteristics of the operation and maintenance domain to improve the accuracy and effectiveness of entity extraction. The combination of stop word tagging further enhances the effectiveness of the extracted entities. This method employs an unsupervised approach in constructing the stop word library and labeling entities and entity types, improving labeling efficiency and reducing labeling costs. Furthermore, the use of labeling expansion for historical operation and maintenance text data further improves labeling efficiency and accuracy, thereby achieving efficient management of operation and maintenance events.
[0104] In another aspect of the embodiments of the present invention, such as Figure 4 As shown, a training device 400 for an entity extraction model is provided, comprising:
[0105] The first acquisition module 401 acquires multiple historical operation and maintenance text data;
[0106] The first preprocessing module 402 preprocesses the historical operation and maintenance text data to obtain preprocessed historical operation and maintenance text data. The preprocessing includes word segmentation, stop word removal, and part-of-speech tagging. The stop word removal is performed using an operation and maintenance stop word library.
[0107] The annotation module 403 annotates the entities and entity types in the preprocessed historical operation and maintenance text data to obtain annotation results.
[0108] Training module 404 trains an entity extraction model based on preprocessed historical operation and maintenance text data and annotation results.
[0109] In this embodiment of the invention, in the first preprocessing module 402, the maintenance stop word library is obtained by the following method: acquiring multiple first maintenance text data; classifying the multiple first maintenance text data to obtain the category corresponding to each first maintenance text data; matching the first maintenance text data in the category using the log template corresponding to each category to obtain the effective words in the first maintenance text data; and determining the maintenance stop word library based on the first maintenance text data and the effective words in the first maintenance text data.
[0110] In this embodiment of the invention, the annotation module 403 is further configured to: extract entities and entity types from the preprocessed first historical operation and maintenance text data that meet the preset mode, so as to obtain the annotation result of the first historical operation and maintenance text data.
[0111] In this embodiment of the invention, the annotation module 403 is further configured to: after extracting entities and entity types from preprocessed historical operation and maintenance text data using a preset mode, obtain n-ary fragments based on the extracted entities and entity types; and perform noise reduction processing on the extracted entities and entity types based on the frequency of occurrence of each fragment in the n-ary fragments.
[0112] In this embodiment of the invention, the annotation module 403 is further configured to: for preprocessed second historical operation and maintenance text data that does not meet the preset mode, if there are words in the second historical operation and maintenance text data that are the same as the extracted entities, then determine the entities and entity types of the second historical operation and maintenance text data according to the extracted entities and entity types, so as to obtain the annotation results of the second historical operation and maintenance text data.
[0113] In this embodiment of the invention, the annotation module 403 is further configured to: use the extracted entities as entities of the second historical operation and maintenance text data; and when the entities of the second historical operation and maintenance text data correspond to multiple entity types, use the entity type with the highest frequency among the multiple entity types as the entity type corresponding to the entities of the second historical operation and maintenance text data.
[0114] In this embodiment of the invention, the preprocessed historical operation and maintenance text data includes part-of-speech tagging results; the training module 404 is further configured to: perform word embedding on the preprocessed historical operation and maintenance text data to obtain word embedding vectors; determine part-of-speech vectors based on the part-of-speech tagging results; weight the word embedding vectors based on the part-of-speech vectors to obtain weighted results; input the weighted results into the entity recognition network layer to obtain entity extraction results corresponding to the historical operation and maintenance text, wherein the entity extraction results include the entity and the probability of the entity type; and train based on the entity extraction results and the tagging results to obtain an entity extraction model.
[0115] According to another aspect of the embodiments of the present invention, such as Figure 5 As shown, an apparatus 500 for entity extraction is provided, comprising:
[0116] The second acquisition module 501 acquires operation and maintenance text data;
[0117] The second preprocessing module 502 preprocesses the operation and maintenance text data to obtain preprocessed operation and maintenance text data. The preprocessing includes word segmentation, stop word removal, and part-of-speech tagging. The stop word removal is performed using an operation and maintenance stop word library.
[0118] The determination module 503 inputs the preprocessed operation and maintenance text data into the entity extraction model to obtain the entity and entity type corresponding to the operation and maintenance text data;
[0119] The entity extraction model is obtained using the training method of the entity extraction model in this embodiment of the invention.
[0120] According to another aspect of the present invention, an electronic device is provided, comprising: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the training method or entity extraction method of the entity extraction model provided by the present invention.
[0121] According to another aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the training method for the entity extraction model or the entity extraction method provided by the present invention.
[0122] Figure 6 An exemplary system architecture 600 is shown, which can be used to train the entity extraction model of the embodiment of the present invention, or to train the entity extraction model, or to train the entity extraction method or apparatus.
[0123] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, and 603, a network 604, and a server 605. Network 604 serves as the medium for providing communication links between terminal devices 601, 602, and 603 and server 605. Network 604 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.
[0124] Users can use terminal devices 601, 602, and 603 to interact with server 605 via network 604 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 601, 602, and 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0125] Terminal devices 601, 602, and 603 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0126] Server 605 can be a server that provides various services, such as a backend management server that supports shopping websites browsed by users using terminal devices 601, 602, and 603 (for example only). The backend management server can analyze and process data such as received product information query requests, and feed back the processing results (such as target push information, product information - for example only) to the terminal devices.
[0127] It should be noted that the training method or entity extraction method of the entity extraction model provided in the embodiments of the present invention is generally executed by the server 605. Correspondingly, the training device or entity extraction device of the entity extraction model is generally set in the server 605.
[0128] It should be understood that Figure 6 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0129] The following is for reference. Figure 7 It shows a schematic diagram of the structure of a computer system 700 suitable for implementing a terminal device of the present invention. Figure 7 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0130] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 702 or programs loaded from storage section 708 into random access memory (RAM) 703. The RAM 703 also stores various programs and data required for the operation of the system 700. The CPU 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0131] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, mouse, etc.; an output section 707 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 710 as needed so that computer programs read from it can be installed into the storage section 708 as needed.
[0132] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 709, and / or installed from removable medium 711. When the computer program is executed by central processing unit (CPU) 701, it performs the functions defined above in the system of this invention.
[0133] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0134] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0135] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be housed in a processor; for example, a processor can be described as including a first acquisition module, a first preprocessing module, a labeling module, and a training module. The names of these modules do not necessarily limit the module itself; for example, the first acquisition module can also be described as "a module for acquiring multiple historical operation and maintenance text data".
[0136] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include: acquiring multiple historical operation and maintenance text data; preprocessing the historical operation and maintenance text data to obtain preprocessed historical operation and maintenance text data, wherein the preprocessing includes word segmentation, stop word removal, and part-of-speech tagging, and the stop word removal is performed using an operation and maintenance stop word library; tagging entities and entity types in the preprocessed historical operation and maintenance text data to obtain tagging results; and training an entity extraction model based on the preprocessed historical operation and maintenance text data and the tagging results.
[0137] According to the technical solution of this embodiment of the invention, the entity extraction method acquires multiple historical operation and maintenance text data, preprocesses the historical operation and maintenance text data, and annotates entities and entity types to obtain annotation results. Then, it uses the preprocessed historical operation and maintenance text data and annotation results to train an entity extraction model, and then uses the entity extraction model to extract entities and entity types from the operation and maintenance text data. The preprocessing includes word segmentation, stop word removal, and part-of-speech tagging. Stop word removal is performed using an operation and maintenance stop word library, fully utilizing the characteristics of the operation and maintenance domain to improve the accuracy and effectiveness of entity extraction in the operation and maintenance domain. The combination with part-of-speech tagging further enhances the effectiveness of the extracted entities. This method uses an unsupervised approach when constructing the stop word library and annotating entities and entity types, improving annotation efficiency and reducing annotation costs. Furthermore, the annotation expansion method for historical operation and maintenance text data further improves annotation efficiency and accuracy, thereby achieving efficient management of operation and maintenance events.
[0138] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A training method for an entity extraction model, characterized in that, include: Retrieve multiple historical operation and maintenance text data; The historical operation and maintenance text data is preprocessed to obtain preprocessed historical operation and maintenance text data. The preprocessing includes word segmentation, stop word removal, and part-of-speech tagging. The stop word removal is performed using an operation and maintenance stop word library. The entities and entity types in the preprocessed historical operation and maintenance text data are labeled to obtain the labeling results; Based on the preprocessed historical operation and maintenance text data and the annotation results, an entity extraction model is trained. The operation and maintenance stop word library is obtained through the following method: acquiring multiple first operation and maintenance text data; classifying the multiple first operation and maintenance text data to obtain a category corresponding to each first operation and maintenance text data; extracting log templates for the multiple first operation and maintenance text data corresponding to each category; matching the first operation and maintenance text data in the category using the log templates corresponding to each category to obtain the effective words in the first operation and maintenance text data; and determining the operation and maintenance stop word library based on the first operation and maintenance text data and the effective words in the first operation and maintenance text data. The method for determining the operation and maintenance stop word library based on the first operation and maintenance text data and the valid words in the first operation and maintenance text data includes: for each log template, selecting a portion of the first operation and maintenance text data from multiple first operation and maintenance text data corresponding to the log template, performing part-of-speech tagging on the words in the portion of the first operation and maintenance text data other than valid words, adding nouns, verbs, and adjectives to the log template, and marking the words in the portion of the first operation and maintenance text data other than valid words as stop words when the added nouns, verbs, and adjectives are valid words, and expanding them to all first operation and maintenance text data to obtain the operation and maintenance stop word library; The preprocessed historical operation and maintenance text data includes part-of-speech tagging results. Based on the preprocessed historical operation and maintenance text data and the tagging results, an entity extraction model is trained, including: embedding words into the preprocessed historical operation and maintenance text data to obtain word embedding vectors; determining part-of-speech vectors based on the part-of-speech tagging results; weighting the word embedding vectors based on the part-of-speech vectors to obtain a weighted result; inputting the weighted result into an entity recognition network layer to obtain entity extraction results corresponding to the historical operation and maintenance text, the entity extraction results including the probability of the entity and its type; and training based on the entity extraction results and the tagging results to obtain the entity extraction model.
2. The training method according to claim 1, characterized in that, The entities and their corresponding entity types in the preprocessed historical operation and maintenance text data are labeled to obtain the labeling results, including: For the first historical operation and maintenance text data that meets the preset mode after preprocessing, the entities and entity types are extracted from the first historical operation and maintenance text data using the preset mode to obtain the annotation results of the first historical operation and maintenance text data.
3. The training method according to claim 2, characterized in that, After extracting entities and entity types from the first historical operation and maintenance text data using a preset mode, the process also includes: Based on the extracted entities and entity types, an n-ary fragment is obtained; Based on the frequency of each segment in the n-ary segment, the extracted entities and entity types are denoised.
4. The training method according to claim 2, characterized in that, The entities and their corresponding entity types in the preprocessed historical operation and maintenance text data are labeled to obtain the labeling results, including: For preprocessed second historical operation and maintenance text data that does not meet the preset mode, if there are words in the second historical operation and maintenance text data that are the same as the extracted entities, then the entities and entity types of the second historical operation and maintenance text data are determined according to the extracted entities and entity types to obtain the annotation results of the second historical operation and maintenance text data.
5. The training method according to claim 4, characterized in that, Based on the extracted entities and entity types, the entities and entity types of the second historical maintenance text data are determined, including: The extracted entities are used as entities in the second historical operation and maintenance text data; In the case where an entity in the second historical maintenance text data corresponds to multiple entity types, the entity type that appears most frequently among the multiple entity types is taken as the entity type corresponding to the entity in the second historical maintenance text data.
6. A method for entity extraction, characterized in that, include: Obtain operation and maintenance text data; The operation and maintenance text data is preprocessed to obtain preprocessed operation and maintenance text data. The preprocessing includes word segmentation, stop word removal, and part-of-speech tagging. The stop word removal is performed using an operation and maintenance stop word library. The preprocessed operation and maintenance text data is input into the entity extraction model to obtain the entities and entity types corresponding to the operation and maintenance text data. The entity extraction model is obtained by the training method according to any one of claims 1-5.
7. A training device for an entity extraction model, characterized in that, include: The first acquisition module acquires multiple historical operation and maintenance text data; The first preprocessing module preprocesses the historical operation and maintenance text data to obtain preprocessed historical operation and maintenance text data. The preprocessing includes word segmentation, stop word removal, and part-of-speech tagging. The stop word removal is performed using an operation and maintenance stop word library. The annotation module annotates entities and entity types in the preprocessed historical operation and maintenance text data to obtain annotation results. The training module trains an entity extraction model based on the preprocessed historical operation and maintenance text data and the annotation results. In the first preprocessing module, the maintenance stop word library is obtained by the following method: acquiring multiple first maintenance text data; classifying the multiple first maintenance text data to obtain the category corresponding to each first maintenance text data; For each category of multiple first maintenance text data, extract log templates; use the log templates corresponding to each category to match the first maintenance text data in that category to obtain valid words in the first maintenance text data; determine the maintenance stop word library based on the first maintenance text data and the valid words in the first maintenance text data; The first preprocessing module is further configured to: for each log template, select a portion of the first operation and maintenance text data from multiple first operation and maintenance text data corresponding to the log template, perform part-of-speech tagging on the words in the portion of the first operation and maintenance text data other than valid words, add nouns, verbs, and adjectives to the log template, and when the added nouns, verbs, and adjectives are valid words, mark the words in the portion of the first operation and maintenance text data other than valid words as stop words, and expand them to all first operation and maintenance text data to obtain an operation and maintenance stop word library; The preprocessed historical operation and maintenance text data includes part-of-speech tagging results; the training module is further configured to: perform word embedding on the preprocessed historical operation and maintenance text data to obtain word embedding vectors; determine part-of-speech vectors based on the part-of-speech tagging results; weight the word embedding vectors based on the part-of-speech vectors to obtain weighted results; input the weighted results into the entity recognition network layer to obtain entity extraction results corresponding to the historical operation and maintenance text, wherein the entity extraction results include the probability of the entity and the entity type; and train the entity extraction model based on the entity extraction results and the tagging results.
8. An apparatus for extracting physical objects, characterized in that, include: The second acquisition module acquires operation and maintenance text data; The second preprocessing module preprocesses the operation and maintenance text data to obtain preprocessed operation and maintenance text data. The preprocessing includes word segmentation, stop word removal, and part-of-speech tagging. The stop word removal is performed using an operation and maintenance stop word library. The determination module inputs the preprocessed operation and maintenance text data into the entity extraction model to obtain the entity and entity type corresponding to the operation and maintenance text data; The entity extraction model is obtained using the training method described in any one of claims 1-5.
9. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-6.
10. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-6.
Citation Information
Patent Citations
Pre-training model training method and device, text classification method and device and system operation and maintenance method and device
CN115062154A
Entity recognition model training method, entity recognition method and related equipment
CN115828916A