Method and device for constructing power utilization safety knowledge graph
The R-BERT-CNN model integrates and fuses electricity safety knowledge data to build an electricity safety knowledge graph in the electric power field, which solves the data integration and fusion problems in the construction of knowledge graphs in the electric power field and improves the efficiency and accuracy of electricity safety diagnosis. and support intelligent management of the power grid.
Patent Information
- Application Number
- CN202410655598.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2024-09-24
AI Technical Summary
Existing knowledge graph construction methods in the electric power field have problems such as data sparseness, noise interference, poor domain adaptability, and limited extraction and linking accuracy. Especially when dealing with potential safety hazards in electricity, it is difficult to integrate and fuse structured and unstructured data. large, resulting in low diagnostic efficiency and high cost.
The method based on the R-BERT-CNN model is used to integrate and extract knowledge about electricity safety knowledge, form a preliminary knowledge representation through entity extraction and relationship extraction, and generate a standard knowledge representation through knowledge fusion and disambiguation processing, and finally construct an electricity safety knowledge representation. The security knowledge graph is stored in RDF triples or graph databases.
It improves the integration and query efficiency of electricity safety knowledge, enhances the ability to troubleshoot hidden faults and assist decision-making, improves the intelligence level of the power grid, and reduces labor costs and time costs.
Smart Images

Figure CN118690841A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of microgrid optimization, and specifically relates to a method and device for constructing an electricity safety knowledge graph. Background Art
[0002] In the research of knowledge graph, in today's big data era, professional knowledge and related data have gradually become a valuable resource. However, these knowledge and data are often scattered in various data sources such as various documents, databases, websites, etc., and are difficult to be effectively organized, integrated and utilized. In order to solve this problem, knowledge graph, as an emerging technology, aims to represent and store professional knowledge and data in a structured and semantic way. The construction technology of knowledge graph mainly includes subtasks such as entity extraction, relationship extraction, attribute extraction, and entity linking. At present, these tasks mainly rely on rule-based, statistical machine learning-based or deep neural network-based methods. There are also some methods that use multimodal information (such as images, videos, etc.) or external knowledge (such as ontologies, rules, etc.) to assist the extraction and linking process. At present, this technology still faces problems such as data sparsity, noise interference, and domain adaptation, resulting in limited accuracy and recall of extraction and linking.
[0003] In terms of knowledge graph research in the power sector, knowledge graph technology is still in the initial exploration stage in the power sector. Existing research mainly focuses on power knowledge graph construction methods, power grid data fusion and management, simple query reasoning and knowledge question and answer. Some literature proposes a "neighborhood knowledge" model for power grid dispatching and a method for online discovery of fine operation rules, but the content of the knowledge graph is limited to sections and their quantitative relationships; some literature proposes a "one-graph for power grid" construction method to achieve comprehensive integration of power grid data, but does not consider the association with business scenario knowledge. In addition, some literature integrates existing power grid multi-source data to construct power equipment knowledge graphs to achieve intelligent search and visualization, mainly focusing on the comprehensive management of equipment under non-power grid fault conditions. Some other literature constructs a knowledge graph of power grid physical equipment and uses graph search and inconsistency testing to achieve automatic retrieval of power equipment defect records. However, the current research work is mainly based on the conceptual framework, with few specific implementation applications; it is mostly limited to partial graph construction and single function realization, and the comprehensive scenario is not considered enough; there is a lack of convenient human-computer interaction, the algorithm ignores the leading role of the control personnel, and does not break the technical barriers between power grid control personnel and knowledge graphs, and data management and updating are relatively complex.
[0004] At present, the patents in the field of power knowledge graph research include:
[0005] The patent with application number 202110799954.3 discloses an intelligent diagnosis method for power safety hazards based on knowledge graph, including the following steps: 1) Building a decision tree model based on knowledge graph and expert knowledge base; 2) Collecting and transmitting parameter information of each monitored object through online monitoring equipment and communication technology, and judging parameter abnormalities through data processing platform; 3) Grouping the alarm information within 10 acquisition cycles according to attributes such as monitored object, alarm time, electricity type, parameter item, alarm type, etc.; 4) Inputting the grouped alarm information into the decision tree model to obtain a hidden danger set output; 5) Expanding the knowledge graph and improving the decision tree model through manual supervision. However, the current description of power safety hazards contains a large amount of structured and unstructured data, such as safety hazard inspection records, etc. The patent only targets structured data, which affects the comprehensiveness of safety hazard diagnosis. In addition, relying on manual supervision to expand the knowledge graph and improve the decision tree model, it is impossible to expand large-scale new data into the model in a timely manner, which limits the practicality of the invention, increases labor costs and time costs, and reduces the efficiency of power safety hazard diagnosis.
[0006] The patent with application number 201911069823.9 discloses a method for automatically constructing an information security knowledge graph based on deep learning, including the following steps: step 1, constructing an ontology library of the information security knowledge graph; step 2, labeling the collected data based on heuristic rules to obtain a training set for entity recognition, and designing a model structure based on Bi-LSTM for learning as a model for entity recognition, thereby extracting entity words from the text; step 3, automatically labeling based on triple knowledge to obtain a training set for relationship extraction, and designing an LSTM structure based on an attention mechanism as a model for relationship extraction, thereby extracting triples from the text. The patent uses heuristic rules to label the collected data, which may limit the accuracy and comprehensiveness of the labeling, and cannot cover entities and relationship types with different characteristics, thereby causing deviations in model learning; the patent does not provide strategies or methods for knowledge fusion, which may lead to biased, redundant or even erroneous information in the knowledge graph, reducing the quality of the constructed knowledge graph and affecting the reliability of its hidden danger detection. Summary of the invention
[0007] In order to overcome the problems existing in the above-mentioned related technologies, the present application provides a method and device for constructing an electricity safety knowledge graph.
[0008] According to a first aspect of an embodiment of the present application, a method for constructing an electricity safety knowledge graph is provided, comprising:
[0009] Collect electricity safety knowledge data;
[0010] Based on the data type of the power safety knowledge data, integrating and extracting knowledge from the power safety knowledge data to obtain a preliminary knowledge representation of the power safety knowledge data;
[0011] Performing knowledge fusion on the preliminary knowledge representation to obtain a standard knowledge representation of the electricity safety knowledge data;
[0012] The standard knowledge representation is stored to obtain an electricity safety knowledge graph.
[0013] Preferably, the data types of the electricity safety knowledge data include: structured data, semi-structured data and unstructured data.
[0014] Preferably, the integrating and extracting the electricity safety knowledge data based on the data type of the electricity safety knowledge data includes:
[0015] Based on preset node tables of various types, the field information in the structured data and semi-structured data in the power safety knowledge data is integrated to form a structured graph node table;
[0016] Performing entity extraction on the unstructured data in the power safety knowledge data to obtain entities of the power safety knowledge data;
[0017] Based on the pre-established R-BERT-CNN model, performing relationship extraction on the unstructured data in the power safety knowledge data to obtain the relationship between entities of the power safety knowledge data;
[0018] The structured graph node table, the entities of the electricity safety knowledge data, and the relationships between the entities of the electricity safety knowledge data are the preliminary knowledge representation.
[0019] Preferably, the entity extraction of the unstructured data in the electricity safety knowledge data includes:
[0020] Based on a dictionary method, entity extraction is performed on the unstructured data in the electricity safety knowledge data to obtain a first entity set;
[0021] Based on a rule-based method, entity extraction is performed on the unstructured data in the electricity safety knowledge data to obtain a second entity set;
[0022] The first entity set and the second entity set are deduplicated and a union is taken to obtain entities of the electricity safety knowledge data.
[0023] Preferably, the dictionary-based method extracts entities from the unstructured data in the power safety knowledge data, including:
[0024] Based on a pre-established entity dictionary in the field of power safety, a forward maximum matching algorithm is used to identify entities of unstructured data in the power safety knowledge data to obtain a first entity set.
[0025] Preferably, the rule-based method extracts entities from the unstructured data in the power safety knowledge data, including:
[0026] An entity recognition method based on word-forming characteristic character rules is used to extract entities from the unstructured data in the power safety knowledge data to obtain a third entity set;
[0027] An entity recognition method based on part-of-speech combination rules is used to extract entities from the unstructured data in the power safety knowledge data to obtain a fourth entity set;
[0028] The third entity set and the fourth entity set are deduplicated and a union is taken to obtain the second entity set.
[0029] Preferably, the process of establishing the entity dictionary in the field of power safety includes:
[0030] Perform natural language text preprocessing on the power knowledge text to obtain a raw corpus;
[0031] Using the LAC word segmentation tool to segment the raw corpus to obtain a familiar corpus;
[0032] Based on preset entity names and their corresponding label codes, the words in the familiar corpus are annotated to obtain preset entity names and label codes corresponding to the words in the familiar corpus;
[0033] The entity dictionary in the field of power safety is constructed by using the words in the familiar corpus and their corresponding entity names and label codes.
[0034] Preferably, the entity recognition method based on word-forming characteristic character rules extracts entities from the unstructured data in the power safety knowledge data, including:
[0035] Perform natural language text preprocessing on the power knowledge text to obtain a raw corpus;
[0036] Using the LAC word segmentation tool to segment the raw corpus to obtain a familiar corpus;
[0037] The words in the familiar corpus corresponding to each preset entity name are annotated using the BIOES mode annotation rule, and irrelevant characters in the words in the familiar corpus are annotated as O, and single characters in the words in the familiar corpus are annotated as S, so as to obtain a word-forming feature character set corresponding to each preset entity name;
[0038] Based on the word-forming feature character sets corresponding to the preset entity names, regular expression matching technology is used to perform entity extraction on the unstructured data in the electricity safety knowledge data to obtain a third entity set.
[0039] Preferably, the entity recognition method based on part-of-speech combination rules extracts entities from the unstructured data in the power safety knowledge data, including:
[0040] Perform natural language text preprocessing on the power knowledge text to obtain a raw corpus;
[0041] Using the LAC word segmentation tool to segment the raw corpus to obtain a familiar corpus;
[0042] Using a part-of-speech segmentation tool to perform part-of-speech tagging on the words in the familiar corpus to obtain a part-of-speech tagging sequence, and fusing the part-of-speech tagging sequence with a set of word-forming feature characters corresponding to each preset entity name to obtain a fused part-of-speech tagging sequence;
[0043] Based on the fused part-of-speech tagging sequence, regular expression matching technology is used to perform entity extraction on the unstructured data in the electricity safety knowledge data to obtain a fourth entity set.
[0044] Preferably, the process of establishing the pre-established R-BERT-CNN model includes:
[0045] Perform natural language text preprocessing on the power knowledge text to obtain a raw corpus;
[0046] Using the LAC word segmentation tool to segment the raw corpus to obtain a familiar corpus;
[0047] Performing entity annotation on the words in the familiar corpus to obtain entity names, entity annotations, and relationships between entities corresponding to the words in the familiar corpus;
[0048] Constructing a data set using words in the familiar corpus and their corresponding entity names, entity annotations, and relationships between entities;
[0049] The R-BERT-CNN model is trained and verified using the data set to obtain the pre-established R-BERT-CNN model.
[0050] Preferably, the using the data set to train and verify the R-BERT-CNN model includes:
[0051] Dividing the data set into a training set and a validation set;
[0052] The words in the training set and their corresponding entity names and entity annotations are used as input layer training samples of the R-BERT-CNN model, and the relationships between entities corresponding to the words in the training set are used as output layer training samples of the R-BERT-CNN model, and the R-BERT-CNN model is trained to obtain a trained R-BERT-CNN model;
[0053] The trained R-BERT-CNN model is verified using the verification set to obtain a verification result. If the accuracy of the verification result is greater than or equal to the accuracy threshold, the verification is successful, and the trained R-BERT-CNN model is the pre-established R-BERT-CNN model. If the verification result is less than the accuracy threshold, the data set is re-acquired to train the R-BERT-CNN model until the verification is successful.
[0054] Preferably, the performing knowledge fusion on the preliminary knowledge representation to obtain the standard knowledge representation of the electricity safety knowledge data includes:
[0055] Preprocessing the preliminary knowledge representation to obtain a preprocessed preliminary knowledge representation;
[0056] Based on a hash function, entities of the electricity safety knowledge data in the preprocessed preliminary knowledge representation are divided into blocks;
[0057] Using Map-Reduce operation to perform load balancing operation on entities of the electricity safety knowledge data after block division in the preprocessed preliminary knowledge representation;
[0058] Entity disambiguation and coreference resolution are performed on entities of the power safety knowledge data after the load balancing operation to obtain the standard knowledge representation.
[0059] Preferably, the preprocessing of the preliminary knowledge representation includes:
[0060] Extracting field information corresponding to the entity of the power safety knowledge data from the structured graph node table, and adding the field information corresponding to the entity of the power safety knowledge data to the text sequence of the entity of the power safety knowledge data, to obtain an updated entity of the power safety knowledge data;
[0061] The structured graph node table, the entities of the updated power safety knowledge data, and the relationships between the entities of the power safety knowledge data are the preliminary knowledge representation after preprocessing.
[0062] Preferably, the performing entity disambiguation and coreference resolution on the entities of the power safety knowledge data after the load balancing operation includes:
[0063] Based on the EDAG edit distance method, the attribute similarity between entities of the power safety knowledge data after load balancing is calculated, and the attribute similarity vector is obtained by combining the similarities of individual attributes.
[0064] Based on the attribute similarity between entities of the power safety knowledge data after the load balancing operation, the attribute similarity vectors are clustered to obtain entity similarity scores between entities of the power safety knowledge data after the load balancing operation;
[0065] Based on the entity similarity scores, entity disambiguation and coreference resolution are performed on the entities of the power safety knowledge data after the load balancing operation to obtain the final entities of the power safety knowledge data;
[0066] The entities of the final electricity safety knowledge data and the relationship between the entities of the final electricity safety knowledge data are represented by the standard knowledge.
[0067] Preferably, the performing entity disambiguation and coreference resolution on the entities of the power safety knowledge data after the load balancing operation based on the entity similarity score includes:
[0068] According to the entity similarity scores, the entities of the power safety knowledge data after the load balancing operation are ranked in descending order, and the first-ranked entity of the power safety knowledge data after the load balancing operation is disambiguated to obtain the disambiguated entity of the power safety knowledge data;
[0069] Based on the entity similarity score, different expressions corresponding to the same entity in the entity of the power safety knowledge data after disambiguation are identified, and the different expressions corresponding to the same entity are merged to obtain the final entity of the power safety knowledge data.
[0070] Preferably, storing the standard knowledge representation includes:
[0071] The standard knowledge representation is stored using RDF triple text or graph database to obtain the electricity safety knowledge graph.
[0072] According to a second aspect of an embodiment of the present application, a device for constructing an electricity safety knowledge graph is provided, including:
[0073] A collection unit, used for collecting electricity safety knowledge data;
[0074] an acquisition unit, configured to integrate and extract knowledge from the power safety knowledge data based on the data type of the power safety knowledge data, and obtain a preliminary knowledge representation of the power safety knowledge data;
[0075] A fusion unit, used for performing knowledge fusion on the preliminary knowledge representation to obtain a standard knowledge representation of the electricity safety knowledge data;
[0076] A storage unit is used to store the standard knowledge representation to obtain an electricity safety knowledge graph.
[0077] According to a third aspect of an embodiment of the present application, there is provided a computer device, including: one or more processors;
[0078] The processor is used to store one or more programs;
[0079] When the one or more programs are executed by the one or more processors, the method for constructing the electricity safety knowledge graph is implemented.
[0080] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed, the method for constructing the electricity safety knowledge graph is implemented.
[0081] The technical solution provided by the present invention has the following beneficial effects:
[0082] The present invention provides a method and device for constructing an electricity safety knowledge graph. The method collects electricity safety knowledge data, integrates the electricity safety knowledge data and extracts knowledge based on the data type of the electricity safety knowledge data to obtain a preliminary knowledge representation of the electricity safety knowledge data. The method fuses the preliminary knowledge representation to obtain a standard knowledge representation of the electricity safety knowledge data. The method stores the standard knowledge representation to obtain an electricity safety knowledge graph. The method can help power grid companies to tap the value of massive data, integrate electricity knowledge, and facilitate staff to query and obtain electricity information, thereby improving the work efficiency of the power industry. The method also has the capabilities of troubleshooting potential fault hazards and assisting decision-making, which is of great significance to the intelligence of power grids. BRIEF DESCRIPTION OF THE DRAWINGS
[0083] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. 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.
[0084] Figure 1 It is a flowchart of a method for constructing an electricity safety knowledge graph provided by an embodiment of the present invention;
[0085] Figure 2 is a flowchart of relationship extraction based on the R-BERT-CNN model provided by an embodiment of the present invention;
[0086] Figure 3 It is a flowchart of a method for constructing an electricity safety knowledge graph provided by an embodiment of the present invention;
[0087] Figure 4 It is a schematic diagram of the electricity safety knowledge graph storage process provided by an embodiment of the present invention;
[0088] Figure 5 is a schematic diagram of the overall situation of the atlas provided by the embodiment of the present invention;
[0089] Figure 6 It is a schematic diagram of the steel industry map and main production process node information provided by an embodiment of the present invention;
[0090] Figure 7 It is a schematic diagram of the steel industry map and key equipment node information provided by an embodiment of the present invention;
[0091] Figure 8 It is a schematic diagram showing the industry map and load types provided by an embodiment of the present invention;
[0092] Fig. 9 is a schematic diagram of security load query results and device node information provided by an embodiment of the present invention;
[0093] Fig.10 It is a structural block diagram of a device for constructing an electricity safety knowledge graph provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0094] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the following embodiments are part of the embodiments of the present invention, rather than 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.
[0095] Embodiment 1
[0096] In order to solve the problems of data loss and waste in the power sector, redundant and inaccurate power-related entities, and the inadequate efficiency and reliability of the current safety hazard identification system, and the lack of reasonable application of unstructured data on power safety, the present invention provides a method for constructing a power safety knowledge graph, such as Figure 1 As shown, the following steps are included:
[0097] Step 11: Collect electricity safety knowledge data;
[0098] Step 12: Based on the data type of the electricity safety knowledge data, integrate the electricity safety knowledge data and extract knowledge to obtain a preliminary knowledge representation of the electricity safety knowledge data;
[0099] Step 13: Perform knowledge fusion on the preliminary knowledge representation to obtain the standard knowledge representation of power safety knowledge data;
[0100] Step 14: Store the standard knowledge representation to obtain the electricity safety knowledge graph.
[0101] Furthermore, the data types of electricity safety knowledge data include: structured data, semi-structured data and unstructured data.
[0102] In some embodiments, the power safety knowledge data can be obtained by, but is not limited to, collecting texts such as power standards and specifications, equipment operating procedures, and expert field knowledge in the field of power safety, and converting them into structured, semi-structured, and unstructured data through simple manual induction and screening. Among them, the structured data mainly includes the industry classification of power equipment, load classification, load safety characteristic parameters (load type, whether it is a safety load, voltage level), etc.
[0103] Further, step 12 includes:
[0104] Step 121: Based on preset node tables of various types, the field information in the structured data and the semi-structured data in the power safety knowledge data are integrated to form a structured graph node table;
[0105] Step 122: extracting entities from the unstructured data in the electricity safety knowledge data to obtain entities of the electricity safety knowledge data;
[0106] Step 123: Based on the pre-established R-BERT-CNN model, perform relationship extraction on the unstructured data in the power safety knowledge data to obtain the relationship between entities of the power safety knowledge data;
[0107] Step 124: The structured graph node table, entities of the electricity safety knowledge data, and the relationships between entities of the electricity safety knowledge data are represented as preliminary knowledge.
[0108] Specifically, step 123 includes: inputting the unstructured data in the electricity safety knowledge data into a pre-established R-BERT-CNN model, and outputting the relationship between entities of the electricity safety knowledge data.
[0109] It is understandable that the “R-BERT-CNN model” involved in the present invention is well known to those skilled in the art, and therefore, its specific implementation will not be described in detail.
[0110] For example, Figure 2 As shown in the figure, the relation extraction process based on the pre-established R-BERT-CNN model includes:
[0111] 1) Preprocess the electric power knowledge text data and add [CLS], [SEP] tags and some special standard characters to the data.
[0112] 2) Output the processed data to the BERT model for pre-training. The essence of the BERT model is to learn a good feature representation for words by running a self-supervised learning method based on a massive corpus. The pre-training stage of BERT includes two tasks: one is the Masked Language Model (MLM); the other is the Next Sentence Prediction (NSP). Simply described as masking a few words in a sentence and then predicting the masked words and judging whether the two sentences are in a contextual relationship, and these two training tasks are performed simultaneously. MLM enables BERT to learn bidirectionally from text, that is, this method allows the model to learn the contextual relationship of a word from the words before and after it. As long as the corresponding label is input into BERT, each layer of the Transformer layer outputs the corresponding number of hidden vectors, and this is passed down layer by layer until the final output.
[0113] 3) After BERT pre-training is completed, the entity vectors are averaged and activated, and then CNN and fully connected neural networks are used to extract semantic information from sentences and two target entities. CNN learns a large number of mapping relationships between inputs and outputs through data input layer, convolution calculation layer, pooling layer, and fully connected layer.
[0114] 4) Fully connect the extracted label semantics, sentence semantics and entity semantic information.
[0115] 5) Extract entity relationships through the Softmax classifier and output the relationship between the two target entities.
[0116] Furthermore, the process of building the pre-built R-BERT-CNN model includes:
[0117] Perform natural language text preprocessing on the power knowledge text to obtain a raw corpus;
[0118] Use LAC word segmentation tool to segment the raw corpus to obtain the familiar corpus;
[0119] Perform entity annotation on the words in the familiar corpus to obtain the entity names, entity annotations and relationships between the entities corresponding to the words in the familiar corpus;
[0120] Construct a dataset using words in the familiar corpus and their corresponding entity names, entity annotations, and the relationships between entities;
[0121] The R-BERT-CNN model is trained and validated using the dataset to obtain the pre-built R-BERT-CNN model.
[0122] Furthermore, the R-BERT-CNN model is trained and verified using the dataset, including:
[0123] Divide the dataset into training and validation sets;
[0124] The words in the training set and their corresponding entity names and entity annotations are used as input layer training samples of the R-BERT-CNN model, and the relationships between entities corresponding to the words in the training set are used as output layer training samples of the R-BERT-CNN model. The R-BERT-CNN model is trained to obtain a trained R-BERT-CNN model.
[0125] The trained R-BERT-CNN model is verified using the verification set to obtain a verification result. If the accuracy of the verification result is greater than or equal to the accuracy threshold, the verification is successful, and the trained R-BERT-CNN model is the pre-established R-BERT-CNN model; if the verification result is less than the accuracy threshold, the data set is re-acquired to train the R-BERT-CNN model until the verification is successful.
[0126] For example, the training process of the R-BERT-CNN model includes the following steps:
[0127] 1) Dataset preparation: Construct a training text dataset (electricity entities and their accurate relationships). Each sample in the dataset includes the entity name, entity annotation, and the accurate relationship type between entities;
[0128] 2) Entity tagging enhancement: Special tagging of target entities in the text (for example, by adding special tags such as [CLS], [SEP] to mark entities), which helps the model better recognize and focus on these entities;
[0129] 3) Use BERT for word embedding: Use the BERT model to convert each word in the text into a vector in a high-dimensional space;
[0130] 4) Convolution operation: The word vector output by BERT is input into the convolutional neural network. The convolution layer captures the local features of the text through different convolution kernels. These local features include the semantic information of the entity and its context.
[0131] 5) Pooling layer: Using pooling layers (such as max pooling) to reduce the dimensionality of features while retaining the most important information helps reduce the complexity of subsequent calculations and prevent overfitting;
[0132] 6) Fully connected layer: The output of CNN is passed through one or more fully connected layers (Dense Layer) for feature fusion, so as to convert the extracted features into the final relationship category;
[0133] 7) Classification: Use Softmax or other classifiers to classify the relationships between entities based on the extracted features and output the probability distribution of each relationship;
[0134] 8) Training and evaluation: Train the model on the prepared training set and use the cross entropy loss function to optimize the model parameters; evaluate the model performance on the validation set or test set. Common evaluation indicators include accuracy, recall rate, and F1 score.
[0135] 9) Fine-tuning and deployment: Further fine-tune the model based on the entity and relationship characteristics in the field of power safety to improve its performance in relationship extraction tasks.
[0136] The structured data is further integrated to form a structured graph node table for easy entry into the graph database. In some embodiments, five types of node tables are mainly formed, namely, information node table, equipment information node table, production process node table, fault potential information node table, and regional information node table. Therefore, further, the preset node tables of various types may include, but are not limited to: industry information node table, equipment information node table, production process node table, fault potential information node table, and regional information node table;
[0137] The industry information node table may include, but is not limited to: industry name and device name;
[0138] The equipment information node table may include, but is not limited to: equipment name, load level, load type, shutdown consequence description, power supply continuity requirements, normal operating voltage and normal operating current;
[0139] The production process node table may include, but is not limited to: main production process, work preconditions, work postconditions and production process;
[0140] The fault potential information node table may include, but is not limited to: the name of the fault potential information, the equipment involved in the fault potential, and the type of the fault potential;
[0141] The regional information node table may include, but is not limited to: region name, indoor / outdoor, floor, area, regional voltage, adjustable capacity, equipment capacity, fire protection level and industry.
[0142] The present invention can improve the ability of troubleshooting and assisting decision-making by integrating equipment information, load classification, production process and other information into the knowledge graph.
[0143] The rule-based and dictionary-based power entity recognition requires the design of specific entity extraction rules to complete the extraction after observing the specific field text and the grammatical structure and pattern of the entity. It is mainly divided into two methods: first, the entity recognition based on the entity dictionary in the power safety field adopts the forward maximum matching algorithm to obtain the recognized entities from the text using the dictionary, and then the matching recognition based on the rule template uses the established entity recognition rule library to obtain another part of the entity recognition results, and finally the entity results recognized by the two methods are deduplicated and the union is taken to obtain the final recognition result. Further, step 122 includes:
[0144] Step 122a: extracting entities from the unstructured data in the electricity safety knowledge data based on a dictionary method to obtain a first entity set;
[0145] Step 122b: extracting entities from the unstructured data in the electricity safety knowledge data based on a rule-based method to obtain a second entity set;
[0146] Step 122c: remove duplicates and take the union of the first entity set and the second entity set to obtain entities of the electricity safety knowledge data.
[0147] Further, step 122a includes:
[0148] Based on a pre-established entity dictionary in the field of power safety, a forward maximum matching algorithm is used to identify entities of unstructured data in power safety knowledge data to obtain a first entity set.
[0149] Specifically, the process of establishing the entity dictionary in the field of electrical safety includes:
[0150] Perform natural language text preprocessing on the power knowledge text to obtain a raw corpus;
[0151] Use LAC word segmentation tool to segment the raw corpus to obtain the familiar corpus;
[0152] Based on the preset entity names and their corresponding label codes, the words in the familiar corpus are annotated to obtain the preset entity names and label codes corresponding to the words in the familiar corpus;
[0153] An entity dictionary in the field of power safety is constructed by using the words in the familiar corpus and their corresponding entity names and label codes.
[0154] It should be noted that the present invention does not limit the "preset entity names and their corresponding label codes", which can be set by those skilled in the art according to engineering needs or experimental data. It is understandable that based on entity recognition in the entity dictionary of the power safety field, the power entities in the text can be extracted and their categories can be marked. In some embodiments, as shown in Table 1, six main entity names and label codes in the power safety field are included.
[0155] Table 1 Classification and label of special names for electricity safety
[0156] Tag Code name Tag Code name PLA Power plant name UN Power Unit EQ Power equipment name VAL Power Value TRB Power safety failure ADV Electricity safety advice
[0157] For example, each line in the dictionary represents an entity in the field of power safety and its category label, separated by ' / '. In the text recognition process, the entities in the dictionary are no longer split, but directly identified and labeled. After the entity dictionary in the field of power safety is constructed, the forward maximum matching algorithm is used to identify entities in the text. The algorithm flow is shown in Table 2.
[0158] Table 2 Dictionary-based forward maximum matching algorithm
[0159]
[0160] Matching recognition based on rule templates requires analyzing the word formation rules of entity words or attribute values and formulating rule templates, which mainly include recognition based on character word formation rules and recognition based on part-of-speech combination rules. Among them, recognition based on character word formation rules uses regular expressions for extraction; recognition based on part-of-speech combination rules requires segmenting and part-of-speech tagging of the text and then extracting it using a combination matching method. Finally, the entity sets obtained by the two methods are deduplicated and unioned to obtain a higher quality entity extraction result set. Further, step 122b includes:
[0161] 122b1: Based on the entity recognition method of word formation feature character rules, the unstructured data in the power safety knowledge data is extracted to obtain the third entity set;
[0162] 122b2: Based on the entity recognition method of part-of-speech combination rules, entity extraction is performed on the unstructured data in the power safety knowledge data to obtain a fourth entity set;
[0163] 122b3: Remove duplicates and take the union of the third entity set and the fourth entity set to obtain a second entity set.
[0164] Further, 122b1, including:
[0165] Perform natural language text preprocessing on the power knowledge text to obtain a raw corpus;
[0166] Use LAC word segmentation tool to segment the raw corpus to obtain the familiar corpus;
[0167] The words in the familiar corpus corresponding to each preset entity name are annotated using the BIOES mode annotation rule, and irrelevant characters in the words in the familiar corpus are annotated as O, and single characters in the words in the familiar corpus are annotated as S, so as to obtain a set of word-forming feature characters corresponding to each preset entity name;
[0168] Based on the word-forming feature character sets corresponding to the preset entity names, regular expression matching technology is used to extract entities from the unstructured data in the power safety knowledge data to obtain a third entity set.
[0169] For example, according to the BIOES mode labeling rules (BX, IX, EX), and combined with the six types of entity category labels in the power safety field defined above (PLA, EQ, UN, VAL, TRB, ADV), the character label set is constructed as follows: LabelSet = {B-PLA, B-EQ, B-UN, B-VAL, B-TRB, B-ADV, E-PLA, E-TRB, E-EQ, E-ADV, E-UN, E-VAL, S, O};
[0170] In the electric power knowledge text training corpus, common entities in the field of electric power safety are annotated according to the BIOES mode serialization tags, and irrelevant characters in the text are annotated as O (Outside), and single-character entities are annotated as S (Single); after the annotation is completed, the entity word formation features are stored in the sets corresponding to the element labels; for example, the prefixes of common electric power venue entities are stored in the begin_pla[] array, the suffixes of common electric power equipment are stored in the end_eq[] array, and the characters unrelated to electricity are stored in the outside[] array. Similarly, the remaining types of prefix and suffix character features are stored in the corresponding arrays to realize the recognition of unregistered entities;
[0171] After storing the common entity word-forming feature characters in the prefix and suffix arrays, the character-based sequence annotation matching rule algorithm is used to identify the unregistered entities in the text. The algorithm flow is shown in Table 3.
[0172] Table 3 Character-based sequence labeling matching rule algorithm
[0173]
[0174] Further, 122b2, including:
[0175] Perform natural language text preprocessing on the power knowledge text to obtain a raw corpus;
[0176] Use LAC word segmentation tool to segment the raw corpus to obtain the familiar corpus;
[0177] Using a part-of-speech segmentation tool to perform part-of-speech tagging on words in the familiar corpus to obtain a part-of-speech tagging sequence, and merging the part-of-speech tagging sequence with a set of word-forming feature characters corresponding to each preset entity name to obtain a fused part-of-speech tagging sequence;
[0178] Based on the fusion of part-of-speech tagging sequences and through regular expression matching technology, entity extraction is performed on the unstructured data in the power safety knowledge data to obtain the fourth entity set.
[0179] For example, based on the use of general part-of-speech segmentation tools (such as LAC, jieba word segmentation, etc.), the part-of-speech tagging of the text to be identified is performed, and the word-forming feature character prefix and suffix arrays (begin_xx[], end_xx[]) defined in the previous article are combined to study the part-of-speech combination characteristics. Combining the two tagging methods, on the basis of part-of-speech tagging, the key field characters are supplemented with tags to form a part-of-speech tagging sequence that highlights professional vocabulary. Subsequently, the regular expression matching technology (regular expression is an effective means of string matching, using some pre-defined specific characters and the combination of these specific characters to form a "regular string", which is used to express a filtering logic for the string, so as to check whether a string contains a certain substring, replace the matched substring, and other character processing tasks) is used to identify the power entity. The algorithm flow is shown in Table 4.
[0180] Table 4 Matching algorithm based on part-of-speech combination rules
[0181]
[0182] Knowledge fusion refers to the fusion of descriptive information about the same entity or concept from multiple sources. For example, if a certain equipment name is included in a certain power standard text, and the equipment name is also included in the operation guide text, the entities related to the equipment need to be identified and put together, and then merged into one entity. Therefore, further, step 13 includes:
[0183] Step 131: preprocessing the preliminary knowledge representation to obtain a preprocessed preliminary knowledge representation;
[0184] Step 132: Based on the Hash function, the entities of the power safety knowledge data in the preprocessed preliminary knowledge representation are divided into blocks;
[0185] Step 133: using Map-Reduce operations to perform load balancing operations on entities of the electricity safety knowledge data that have been divided into blocks in the preprocessed preliminary knowledge representation;
[0186] Step 134: Perform entity disambiguation and coreference resolution on the entities of the power safety knowledge data after the load balancing operation to obtain a standard knowledge representation.
[0187] Further, step 131 includes:
[0188] Step 131a: extracting field information corresponding to the entity of the power safety knowledge data from the structured graph node table, and adding the field information corresponding to the entity of the power safety knowledge data to the text sequence of the entity of the power safety knowledge data, to obtain an updated entity of the power safety knowledge data;
[0189] Step 131b: The structured graph node table, the entities of the updated electricity safety knowledge data, and the relationships between the entities of the electricity safety knowledge data are the preliminary knowledge representation after preprocessing.
[0190] Further, step 134 includes:
[0191] Step 134a: Based on the EDAG edit distance method, the attribute similarity between entities of the power safety knowledge data after the load balancing operation is calculated, and the attribute similarity vector is obtained by combining the single attribute similarities;
[0192] Step 134b: clustering attribute similarity vectors based on the attribute similarity between entities of the power safety knowledge data after the load balancing operation is performed, and obtaining entity similarity scores between entities of the power safety knowledge data after the load balancing operation is performed;
[0193] Step 134c: Based on the entity similarity scores, entity disambiguation and coreference resolution are performed on the entities of the power safety knowledge data after the load balancing operation, to obtain the final entities of the power safety knowledge data;
[0194] Step 134d: The entities of the final electricity safety knowledge data and the relationships between the entities of the final electricity safety knowledge data are represented as standard knowledge.
[0195] Further, step 134c includes:
[0196] According to the entity similarity scores, the entities of the power safety knowledge data after the load balancing operation are ranked in descending order, and the first-ranked entity of the power safety knowledge data after the load balancing operation is disambiguated to obtain the entity of the power safety knowledge data after disambiguation;
[0197] Based on the entity similarity score, different expressions corresponding to the same entity in the entities of the power safety knowledge data after disambiguation are identified, and the different expressions corresponding to the same entity are merged to obtain the final entity of the power safety knowledge data.
[0198] The present invention provides a specific example to illustrate the knowledge fusion of the preliminary knowledge representation, such as Figure 3 As shown, the following steps are included:
[0199] (1) Data preprocessing
[0200] Syntax regularization: Syntax matching, such as the representation method of power load; comprehensive attributes, such as the expression method of electrical quantity of equipment.
[0201] Data normalization: remove spaces, "", "", - and other symbols; input error-class topological errors; replace nicknames and abbreviations with formal names, etc.
[0202] Adding structured data entities: For the tabular data obtained by processing the structured data, the field information of the candidate entity (i.e., the entity of the power safety knowledge data in the preliminary knowledge representation) is obtained and added to the corresponding text sequence of the entity as a supplement.
[0203] (2) Block
[0204] Among all entity pairs in a given knowledge base, potential matching record pairs are selected as candidates, and the size of the candidates is reduced as much as possible. The present invention is based on the block division of the Hash function: for a record x, if hash(x)=hi, then x is mapped to the block Ci bound to the keyword hi. The Hash functions used are: the first n words of the string; n-grams; combining multiple simple hash functions, etc.
[0205] (3) Load Balancing
[0206] Multiple Map-Reduce operations ensure that the number of entities in all blocks is equal, thereby ensuring the degree of performance improvement achieved by block partitioning.
[0207] (4) Record Link
[0208] Assume that there are two entity records x and y, and the values of x and y on the i-th attribute are xi, yi, then the records are linked in the following two steps:
[0209] 1) Attribute similarity: For the attribute sequence values (x1, x2, …, xN) and (y1, y2, …, yN) of the two entities to be linked, the edit distance based on Edit Distance with Afine Gaps (EDAG) is used to calculate the attribute similarity. When calculating string similarity, EDAG replaces the insertion, deletion and replacement operations with gap opening and gap extension. The cost of gap opening is s, the cost of gap extension is e, and the length of the gap is l. When calculating, first align the two strings head to tail, regard the corresponding missing parts as gaps, and then calculate the total cost of gap opening and gap extension.
[0210] For example, when calculating the similarity between "Levenshtein" and "Lvensshtain", first align the two words head to tail and regard the corresponding missing parts as gaps. The first e and the third to last e are missing from the word above and below, which are two gaps. The word below is missing an s and an a from the word above, which are two gaps. There are a total of 4 gaps, each with a length of 1. Based on the costs of these gap openings and gap extensions, the similarity between the two words can be calculated. Combining the similarities of individual attributes, the similarity scores calculated for each attribute are combined to form a vector. Assuming there are n attributes, the attribute similarity vector between each pair of entities or data points will be an n-dimensional vector, where each dimension corresponds to the similarity score of an attribute, and the attribute similarity vector is finally obtained: sim(x1,y1),sim(x2,y2),…,sim(xN,yN)].
[0211] 2) Entity similarity: Based on the calculated attribute similarity of two entities, the attribute similarity vectors [sim(x1,y1),sim(x2,y2),…,sim(xN,yN)] are clustered to obtain the similarity score of the two entities.
[0212] 3) Entity disambiguation: Using the calculated entity similarity score and attribute similarity vector, calculate the similarity score between entities and compare it with the threshold, rank the candidate entities according to the similarity score, and use the entity with the highest score as the result of disambiguation. Then check the consistency of the relationship between entities. Continuous improvement can be made by manually reviewing the disambiguation results and adjusting the model parameters.
[0213] 4) Co-reference resolution: Aims to determine which words refer to the same entity. Using the calculated similarity scores of the candidate entities, different expressions in the candidate text that refer to the same entity are identified, and these expressions are merged into a single representation and assigned the same label.
[0214] Further, step 14 includes:
[0215] The standard knowledge representation is stored using RDF triple text or graph database to obtain a knowledge graph of electricity safety.
[0216] In some embodiments, the knowledge graph storage can be completed by writing corresponding scripts using Py2neo but is not limited to it.
[0217] It should be noted that there are two storage methods for the electricity safety knowledge graph, one of which is to use RDF triples (entity-relationship-entity structure) text for storage; the other is to use an existing graph database for storage. Figure 4 As shown in the figure, the storage process of the electricity safety knowledge graph includes the following steps:
[0218] According to the knowledge graph model layer of power safety equipment failure, the reading and saving of the standard knowledge representation obtained above is mainly divided into the following two steps: (1) reading data including entities, relationships, and attributes; (2) creating entity nodes, storing attribute values, and creating relationship edges between entities.
[0219] An automated data reading and storage method is used for the graph database. Py2neo, the Python driver for the Neo4j graph database, is used as a client library and comprehensive toolkit for processing Neo4j from within Python applications and the command line. You can, but are not limited to, use Py2neo to write corresponding scripts to complete the storage of the knowledge graph. Different scripts are designed for different data storage formats to read relevant node information and relationship information, and store them in the graph database in the form of triples. Experiments have shown that the current version of the graph contains 10 types of industry knowledge, such as steel and data centers, and more than 2,000 knowledge entities. It supports queries such as security load, production process, priority, etc., with a query accuracy of over 90%. Figure 5-Figure 9 This is a partial screenshot of the current map, including industry nodes, equipment nodes, production process nodes, load level attributes, etc.
[0220] The method for constructing the electricity safety knowledge graph provided by the present invention can help power grid companies tap into the value of massive data, realize the integration of electricity knowledge, facilitate staff to query and obtain electricity information, and improve the work efficiency of the power industry. At the same time, the graph, which integrates technologies such as big data and artificial intelligence, also has the capabilities of fault hidden danger troubleshooting and decision-making assistance, which is of great significance to the intelligentization of power grids.
[0221] The method for constructing an electricity safety knowledge graph provided by the present invention can make full use of unstructured data to accurately identify electricity safety entities. The entity recognition method of the present invention is compared with a single domain entity dictionary, feature character rule matching, and part-of-speech combination rule matching method. Experimental results show that the method of the present invention has higher accuracy, recall rate, and F1 score, effectively improving the accuracy of entity recognition.
[0222] The method for constructing the electricity safety knowledge graph provided by the present invention and the relationship extraction model R-BERT-CNN based on the deep learning method can improve the comprehensiveness of the recognition of electricity safety entity relationships and cover relationship types with different characteristics.
[0223] Embodiment 2
[0224] The present invention provides a device for constructing an electricity safety knowledge graph, such as Fig.10 As shown, including:
[0225] A collection unit, used for collecting electricity safety knowledge data;
[0226] An acquisition unit, used for integrating and extracting the power safety knowledge data based on the data type of the power safety knowledge data, and obtaining a preliminary knowledge representation of the power safety knowledge data;
[0227] A fusion unit is used to fuse the preliminary knowledge representation to obtain a standard knowledge representation of power safety knowledge data;
[0228] The storage unit is used to store the standard knowledge representation to obtain the electricity safety knowledge graph.
[0229] Furthermore, the data types of electricity safety knowledge data include: structured data, semi-structured data and unstructured data.
[0230] Furthermore, the acquisition unit includes:
[0231] An integration subunit is used to integrate the field information in the structured data and semi-structured data in the power safety knowledge data based on preset node tables of various types to form a structured graph node table;
[0232] An extraction subunit is used to extract entities from unstructured data in the power safety knowledge data to obtain entities of the power safety knowledge data;
[0233] The first acquisition subunit is used to extract the relationship between the unstructured data in the power safety knowledge data based on the pre-established R-BERT-CNN model, and obtain the relationship between the entities of the power safety knowledge data;
[0234] Determine subunits for structuring graph node tables, entities of power safety knowledge data, and relationships between entities of power safety knowledge data as preliminary knowledge representation.
[0235] Further, sub-units are extracted, including:
[0236] A first acquisition module is used to extract entities from unstructured data in the power safety knowledge data based on a dictionary method to obtain a first entity set;
[0237] A second acquisition module is used to extract entities from unstructured data in the power safety knowledge data based on a rule-based method to obtain a second entity set;
[0238] The third acquisition module is used to remove duplicates and take the union of the first entity set and the second entity set to obtain entities of the electricity safety knowledge data.
[0239] Furthermore, the first acquisition module is specifically used for:
[0240] Based on a pre-established entity dictionary in the field of power safety, a forward maximum matching algorithm is used to identify entities of unstructured data in power safety knowledge data to obtain a first entity set.
[0241] Furthermore, the second acquisition module includes:
[0242] The first acquisition submodule is used to extract entities from the unstructured data in the power safety knowledge data by using an entity recognition method based on word formation characteristic character rules to obtain a third entity set;
[0243] A second acquisition submodule is used to extract entities from unstructured data in the power safety knowledge data using an entity recognition method based on part-of-speech combination rules to obtain a fourth entity set;
[0244] The third entity set and the fourth entity set are deduplicated and a union is taken to obtain a second entity set.
[0245] Furthermore, the device further includes: a first establishing unit, used to establish an entity dictionary in the field of power safety; the first establishing unit is specifically used to:
[0246] Perform natural language text preprocessing on the power knowledge text to obtain a raw corpus;
[0247] Use LAC word segmentation tool to segment the raw corpus to obtain the familiar corpus;
[0248] Based on the preset entity names and their corresponding label codes, the words in the familiar corpus are annotated to obtain the preset entity names and label codes corresponding to the words in the familiar corpus;
[0249] An entity dictionary in the field of power safety is constructed by using the words in the familiar corpus and their corresponding entity names and label codes.
[0250] Furthermore, the first acquisition submodule is specifically used for:
[0251] Perform natural language text preprocessing on the power knowledge text to obtain a raw corpus;
[0252] Use LAC word segmentation tool to segment the raw corpus to obtain the familiar corpus;
[0253] The words in the familiar corpus corresponding to each preset entity name are annotated using the BIOES mode annotation rule, and irrelevant characters in the words in the familiar corpus are annotated as O, and single characters in the words in the familiar corpus are annotated as S, so as to obtain a set of word-forming feature characters corresponding to each preset entity name;
[0254] Based on the word-forming feature character sets corresponding to the preset entity names, regular expression matching technology is used to extract entities from the unstructured data in the power safety knowledge data to obtain a third entity set.
[0255] Furthermore, the second acquisition submodule is specifically used for:
[0256] Perform natural language text preprocessing on the power knowledge text to obtain a raw corpus;
[0257] Use LAC word segmentation tool to segment the raw corpus to obtain the familiar corpus;
[0258] Using a part-of-speech segmentation tool to perform part-of-speech tagging on words in the familiar corpus to obtain a part-of-speech tagging sequence, and merging the part-of-speech tagging sequence with a set of word-forming feature characters corresponding to each preset entity name to obtain a fused part-of-speech tagging sequence;
[0259] Based on the fusion of part-of-speech tagging sequences and through regular expression matching technology, entity extraction is performed on the unstructured data in the power safety knowledge data to obtain the fourth entity set.
[0260] Furthermore, the device also includes: a second establishment unit, used to establish an R-BERT-CNN model; the second establishment unit includes:
[0261] The first preprocessing subunit is used to perform natural language text preprocessing on the electric power knowledge text to obtain a raw corpus;
[0262] The word segmentation subunit is used to segment the raw corpus using the LAC word segmentation tool to obtain the familiar corpus;
[0263] The annotation subunit is used to perform entity annotation on the words in the familiar corpus, and obtain the entity names, entity annotations and relationships between the entities corresponding to the words in the familiar corpus;
[0264] A construction subunit is used to construct a data set using words in the familiar corpus and their corresponding entity names, entity annotations, and the relationships between entities;
[0265] The second acquisition subunit is used to train and verify the R-BERT-CNN model using the data set to obtain a pre-established R-BERT-CNN model.
[0266] Furthermore, the second acquisition subunit is specifically used for:
[0267] Divide the dataset into training and validation sets;
[0268] The words in the training set and their corresponding entity names and entity annotations are used as input layer training samples of the R-BERT-CNN model, and the relationships between entities corresponding to the words in the training set are used as output layer training samples of the R-BERT-CNN model. The R-BERT-CNN model is trained to obtain a trained R-BERT-CNN model.
[0269] The trained R-BERT-CNN model is verified using the verification set to obtain a verification result. If the accuracy of the verification result is greater than or equal to the accuracy threshold, the verification is successful, and the trained R-BERT-CNN model is the pre-established R-BERT-CNN model; if the verification result is less than the accuracy threshold, the data set is re-acquired to train the R-BERT-CNN model until the verification is successful.
[0270] Furthermore, the fusion unit comprises:
[0271] A second preprocessing subunit is used to preprocess the preliminary knowledge representation to obtain a preprocessed preliminary knowledge representation;
[0272] A block subunit is used to block entities of the power safety knowledge data in the preprocessed preliminary knowledge representation based on a hash function;
[0273] A load balancing subunit is used to perform a load balancing operation on the entities of the electricity safety knowledge data that are divided into blocks in the preprocessed preliminary knowledge representation by using a Map-Reduce operation;
[0274] The third acquisition subunit is used to perform entity disambiguation and coreference resolution on the entities of the power safety knowledge data after the load balancing operation to obtain a standard knowledge representation.
[0275] Furthermore, the second preprocessing subunit is specifically used for:
[0276] Extracting field information corresponding to the entity of the power safety knowledge data from the structured graph node table, and adding the field information corresponding to the entity of the power safety knowledge data to the text sequence of the entity of the power safety knowledge data, to obtain an updated entity of the power safety knowledge data;
[0277] The structured graph node table, the entities of the updated power safety knowledge data, and the relationships between the entities of the power safety knowledge data are the preliminary knowledge representation after preprocessing.
[0278] Furthermore, the third acquisition subunit includes:
[0279] A calculation module, for calculating the attribute similarity between entities of the power safety knowledge data after the load balancing operation based on the EDAG edit distance method, and obtaining an attribute similarity vector by combining the similarities of individual attributes;
[0280] A clustering module, for clustering attribute similarity vectors based on attribute similarity between entities of the power safety knowledge data after the load balancing operation is performed, to obtain entity similarity scores between entities of the power safety knowledge data after the load balancing operation is performed;
[0281] A fourth acquisition module is used to perform entity disambiguation and coreference resolution on the entities of the power safety knowledge data after the load balancing operation based on the entity similarity score to obtain the final entities of the power safety knowledge data;
[0282] A determination module is provided for entities of final power safety knowledge data and relationships between entities of final power safety knowledge data as standard knowledge representation.
[0283] Furthermore, the fourth acquisition module is specifically used for:
[0284] According to the entity similarity scores, the entities of the power safety knowledge data after the load balancing operation are ranked in descending order, and the first-ranked entity of the power safety knowledge data after the load balancing operation is disambiguated to obtain the entity of the power safety knowledge data after disambiguation;
[0285] Based on the entity similarity score, different expressions corresponding to the same entity in the entities of the power safety knowledge data after disambiguation are identified, and the different expressions corresponding to the same entity are merged to obtain the final entity of the power safety knowledge data.
[0286] Furthermore, the storage unit is specifically used for:
[0287] The standard knowledge representation is stored using RDF triple text or graph database to obtain a knowledge graph of electricity safety.
[0288] It can be understood that the device embodiment provided above corresponds to the method embodiment described above, and the corresponding specific contents can be referenced to each other and will not be repeated here.
[0289] It can be understood that the same or similar parts of the above embodiments can be referenced to each other, and the contents not described in detail in some embodiments can refer to the same or similar contents in other embodiments.
[0290] Embodiment 3
[0291] Based on the same inventive concept, the present invention also provides a computer device, which includes a processor and a memory, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions in a computer storage medium to implement the corresponding method flow or corresponding function, so as to implement the steps of a method for constructing a power safety knowledge graph in the above embodiment.
[0292] Embodiment 4
[0293] Based on the same inventive concept, the present invention also provides a storage medium, specifically a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It can be understood that the computer-readable storage medium here can include both built-in storage media in a computer device and, of course, extended storage media supported by the computer device. The computer-readable storage medium provides a storage space that stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by a processor are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The processor can load and execute one or more instructions stored in the computer-readable storage medium to implement the steps of a method for constructing a power safety knowledge graph in the above embodiment.
[0294] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0295] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0296] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1A function specified in one or more boxes.
[0297] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0298] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A method for constructing an electricity safety knowledge graph, characterized in that: include: Collect electricity safety knowledge data; Based on the data type of the power safety knowledge data, integrating and extracting knowledge from the power safety knowledge data to obtain a preliminary knowledge representation of the power safety knowledge data; Performing knowledge fusion on the preliminary knowledge representation to obtain a standard knowledge representation of the electricity safety knowledge data; The standard knowledge representation is stored to obtain an electricity safety knowledge graph.
2. The method according to claim 1, characterized in that The data types of the electricity safety knowledge data include: structured data, semi-structured data and unstructured data.
3. The method according to claim 2, characterized in that The integrating and extracting the electricity safety knowledge data based on the data type of the electricity safety knowledge data includes: Based on preset node tables of various types, the field information in the structured data and semi-structured data in the power safety knowledge data is integrated to form a structured graph node table; Performing entity extraction on the unstructured data in the power safety knowledge data to obtain entities of the power safety knowledge data; Based on the pre-established R-BERT-CNN model, performing relationship extraction on the unstructured data in the power safety knowledge data to obtain the relationship between entities of the power safety knowledge data; The structured graph node table, the entities of the electricity safety knowledge data, and the relationships between the entities of the electricity safety knowledge data are the preliminary knowledge representation.
4. The method according to claim 3, characterized in that The extracting entities from the unstructured data in the electricity safety knowledge data includes: Based on a dictionary method, entity extraction is performed on the unstructured data in the electricity safety knowledge data to obtain a first entity set; Based on a rule-based method, entity extraction is performed on the unstructured data in the electricity safety knowledge data to obtain a second entity set; The first entity set and the second entity set are deduplicated and a union is taken to obtain entities of the electricity safety knowledge data.
5. The method according to claim 4, characterized in that The dictionary-based method extracts entities from the unstructured data in the power safety knowledge data, including: Based on a pre-established entity dictionary in the field of power safety, a forward maximum matching algorithm is used to identify entities of unstructured data in the power safety knowledge data to obtain a first entity set.
6. The method according to claim 4, characterized in that The rule-based method extracts entities from the unstructured data in the power safety knowledge data, including: An entity recognition method based on word-forming characteristic character rules is used to extract entities from the unstructured data in the power safety knowledge data to obtain a third entity set; An entity recognition method based on part-of-speech combination rules is used to extract entities from the unstructured data in the power safety knowledge data to obtain a fourth entity set; The third entity set and the fourth entity set are deduplicated and a union is taken to obtain the second entity set.
7. The method according to claim 5, characterized in that The process of establishing the entity dictionary in the field of power safety includes: Perform natural language text preprocessing on the power knowledge text to obtain a raw corpus; Using the LAC word segmentation tool to segment the raw corpus to obtain a familiar corpus; Based on preset entity names and their corresponding label codes, the words in the familiar corpus are annotated to obtain preset entity names and label codes corresponding to the words in the familiar corpus; The entity dictionary in the field of power safety is constructed by using the words in the familiar corpus and their corresponding entity names and label codes.
8. The method according to claim 6, characterized in that The entity recognition method based on word-forming characteristic character rules extracts entities from the unstructured data in the power safety knowledge data, including: Perform natural language text preprocessing on the power knowledge text to obtain a raw corpus; Using the LAC word segmentation tool to segment the raw corpus to obtain a familiar corpus; The words in the familiar corpus corresponding to each preset entity name are annotated using the BIOES mode annotation rule, and irrelevant characters in the words in the familiar corpus are annotated as O, and single characters in the words in the familiar corpus are annotated as S, so as to obtain a word-forming feature character set corresponding to each preset entity name; Based on the word-forming feature character sets corresponding to the preset entity names, regular expression matching technology is used to perform entity extraction on the unstructured data in the electricity safety knowledge data to obtain a third entity set.
9. The method according to claim 6, characterized in that The entity recognition method based on part-of-speech combination rules extracts entities from the unstructured data in the power safety knowledge data, including: Perform natural language text preprocessing on the power knowledge text to obtain a raw corpus; Using the LAC word segmentation tool to segment the raw corpus to obtain a familiar corpus; Using a part-of-speech segmentation tool to perform part-of-speech tagging on the words in the familiar corpus to obtain a part-of-speech tagging sequence, and fusing the part-of-speech tagging sequence with a set of word-forming feature characters corresponding to each preset entity name to obtain a fused part-of-speech tagging sequence; Based on the fused part-of-speech tagging sequence, regular expression matching technology is used to perform entity extraction on the unstructured data in the electricity safety knowledge data to obtain a fourth entity set.
10. The method according to claim 3, characterized in that The process of establishing the pre-established R-BERT-CNN model includes: Perform natural language text preprocessing on the power knowledge text to obtain a raw corpus; Using the LAC word segmentation tool to segment the raw corpus to obtain a familiar corpus; Performing entity annotation on the words in the familiar corpus to obtain entity names, entity annotations, and relationships between entities corresponding to the words in the familiar corpus; Constructing a data set using words in the familiar corpus and their corresponding entity names, entity annotations, and relationships between entities; The R-BERT-CNN model is trained and verified using the data set to obtain the pre-established R-BERT-CNN model.
11. The method according to claim 10, characterized in that The method of using the data set to train and verify the R-BERT-CNN model includes: Dividing the data set into a training set and a validation set; The words in the training set and their corresponding entity names and entity annotations are used as input layer training samples of the R-BERT-CNN model, and the relationships between entities corresponding to the words in the training set are used as output layer training samples of the R-BERT-CNN model, and the R-BERT-CNN model is trained to obtain a trained R-BERT-CNN model; The trained R-BERT-CNN model is verified using the verification set to obtain a verification result. If the accuracy of the verification result is greater than or equal to the accuracy threshold, the verification is successful, and the trained R-BERT-CNN model is the pre-established R-BERT-CNN model. If the verification result is less than the accuracy threshold, the data set is re-acquired to train the R-BERT-CNN model until the verification is successful.
12. The method according to claim 3, characterized in that The performing knowledge fusion on the preliminary knowledge representation to obtain the standard knowledge representation of the electricity safety knowledge data includes: Preprocessing the preliminary knowledge representation to obtain a preprocessed preliminary knowledge representation; Based on a hash function, entities of the electricity safety knowledge data in the preprocessed preliminary knowledge representation are divided into blocks; Using Map-Reduce operation to perform load balancing operation on entities of the electricity safety knowledge data after block division in the preprocessed preliminary knowledge representation; Entity disambiguation and coreference resolution are performed on entities of the power safety knowledge data after the load balancing operation to obtain the standard knowledge representation.
13. The method according to claim 12, characterized in that The preprocessing of the preliminary knowledge representation comprises: Extracting field information corresponding to the entity of the power safety knowledge data from the structured graph node table, and adding the field information corresponding to the entity of the power safety knowledge data to the text sequence of the entity of the power safety knowledge data, to obtain an updated entity of the power safety knowledge data; The structured graph node table, the entities of the updated power safety knowledge data, and the relationships between the entities of the power safety knowledge data are the preliminary knowledge representation after preprocessing.
14. The method according to claim 13, characterized in that The entity disambiguation and coreference resolution of the entities of the power safety knowledge data after the load balancing operation includes: Based on the EDAG edit distance method, the attribute similarity between entities of the power safety knowledge data after load balancing is calculated, and the attribute similarity vector is obtained by combining the similarities of individual attributes. Based on the attribute similarity between entities of the power safety knowledge data after the load balancing operation, the attribute similarity vectors are clustered to obtain entity similarity scores between entities of the power safety knowledge data after the load balancing operation; Based on the entity similarity scores, entity disambiguation and coreference resolution are performed on the entities of the power safety knowledge data after the load balancing operation to obtain the final entities of the power safety knowledge data; The entities of the final electricity safety knowledge data and the relationship between the entities of the final electricity safety knowledge data are represented by the standard knowledge.
15. The method according to claim 14, characterized in that The performing entity disambiguation and coreference resolution on the entities of the power safety knowledge data after the load balancing operation based on the entity similarity score includes: According to the entity similarity scores, the entities of the power safety knowledge data after the load balancing operation are ranked in descending order, and the first-ranked entity of the power safety knowledge data after the load balancing operation is disambiguated to obtain the disambiguated entity of the power safety knowledge data; Based on the entity similarity score, different expressions corresponding to the same entity in the entity of the power safety knowledge data after disambiguation are identified, and the different expressions corresponding to the same entity are merged to obtain the final entity of the power safety knowledge data.
16. The method according to claim 1, characterized in that The storing of the standard knowledge representation comprises: The standard knowledge representation is stored using RDF triple text or graph database to obtain the electricity safety knowledge graph.
17. A device for constructing an electricity safety knowledge graph, characterized in that: include: A collection unit, used for collecting electricity safety knowledge data; an acquisition unit, configured to integrate and extract knowledge from the power safety knowledge data based on the data type of the power safety knowledge data, and obtain a preliminary knowledge representation of the power safety knowledge data; A fusion unit, used for performing knowledge fusion on the preliminary knowledge representation to obtain a standard knowledge representation of the electricity safety knowledge data; A storage unit is used to store the standard knowledge representation to obtain an electricity safety knowledge graph.
18. A computer device, characterized in that: include: at least one processor and memory; The memory is used to store one or more programs; When the one or more programs are executed by the at least one processor, the method for constructing the power safety knowledge graph as described in any one of claims 1 to 16 is implemented.
19. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed, it implements the method for constructing an electricity safety knowledge graph as described in any one of claims 1 to 16.
Citation Information
Cited By
Knowledge graph construction method and system based on unsupervised learning
CN119474405A
Spot market stability regulation section checking method, system, equipment and medium
CN119940732A
