A method for extracting safety knowledge and building knowledge graph for construction workers

Through the safety knowledge framework and deep learning technology, combined with comparative learning ideas and BERT encoder, the automation problem of safety knowledge extraction and knowledge graph construction in the construction safety ontology model is solved, and the efficient extraction and graph construction of construction workers' safety knowledge are realized, improving Improve the efficiency and accuracy of construction safety training.

CN116069951BActive Publication Date: 2024-10-15HUAZHONG UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310175037.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-28
Publication Date
2024-10-15
Estimated Expiration
2043-02-28

AI Technical Summary

Technical Problem

The existing construction safety ontology model lacks safety knowledge for construction workers' safety knowledge learning and the definition of core concepts and relationships between concepts, resulting in model construction that is time-consuming and laborious and difficult to update, and it is impossible to achieve synchronous and automatic extraction of relationships between entities.

Method used

Using the security knowledge framework construction method, combined with natural language processing and deep learning technology, the CASREL model is improved to the CL-CASREL model, and the comparative learning idea and BERT encoder are used to realize the automatic extraction of security knowledge and the construction of knowledge graphs.

Benefits of technology

It realizes the automatic extraction of construction workers' safety knowledge and the construction of knowledge graph, supports efficient organization, utilization and updating, and improves the adaptive learning ability of construction safety knowledge.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116069951B_ABST
    Figure CN116069951B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field related to construction safety management, and discloses a method for extracting safety knowledge of construction workers and building a knowledge graph. The method includes: S1 collecting construction safety knowledge text data, building a safety knowledge framework and defining the levels contained in the framework and the sub-levels corresponding to each level, as well as the attribute relationships between the levels; S2 dividing part of the collected data into a training set and a test set, and classifying all entries in each of their text data according to the levels and sub-levels defined in the safety knowledge framework; S3 building a prediction model to predict the text data in the remaining collected data, so as to obtain the levels, sub-levels and attribute relationships between levels corresponding to each entry in each text data, that is, to realize the extraction of safety knowledge. Finally, the storage and retrieval of extracted safety knowledge are realized based on a graph database. Through the present invention, the problem of automatic acquisition of relationships between entities in the extraction of safety knowledge is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field related to construction safety management, and more specifically, relates to a method for extracting safety knowledge of construction workers and constructing a knowledge graph. Background Art

[0002] Various engineering documents contain a wealth of construction safety knowledge, such as construction safety standards and accident investigation reports, but the accumulated safety knowledge has not been effectively managed and organized, which is not conducive to supporting efficient personalized safety knowledge training. In order to organize construction safety knowledge resources in an orderly manner and serve the integrated application of safety knowledge, it is necessary to construct a safety knowledge extraction and knowledge graph construction method for construction workers' safety knowledge training. At present, in the field of construction safety, the semantic expression of safety risk knowledge is mainly promoted by constructing an ontology model in the construction safety field to support applications such as risk identification. However, the existing construction safety ontology model lacks the definition of safety knowledge and core concepts and the relationship between concepts for construction workers' safety knowledge learning. For the instantiation of the ontology model, researchers initially mainly used manual filling, and the model construction process was time-consuming and labor-intensive and difficult to update. The manual definition of rules for text knowledge extraction has high requirements for application scenarios such as syntactic patterns, and the applicability and robustness of the rules are very limited. In addition, the existing method of extracting entity objects based on natural language processing and deep learning cannot achieve the synchronous automatic extraction of relationships between entities.

[0003] Therefore, the following issues still need to be addressed in the process of extracting safety knowledge for construction workers and building knowledge graphs: (1) Building a safety knowledge element system for learning safety knowledge for construction workers. (2) Building a method that can automatically and synchronously extract safety knowledge concept entities and the relationships between entities in texts. Summary of the invention

[0004] In response to the above defects or improvement needs of the prior art, the present invention provides a method for extracting safety knowledge and building a knowledge graph for construction workers to solve the problem of automatically obtaining the relationship between entities in the extraction of safety knowledge.

[0005] To achieve the above objectives, according to the present invention, a method for extracting safety knowledge of construction workers and constructing a knowledge graph is provided, and the method comprises the following steps:

[0006] This data forms the original data set, constructs a security knowledge framework and defines the layers contained in the framework, the sub-layers corresponding to each layer, and the attribute relationships between each layer;

[0007] S2 divides part of the data in the original data set into a training set and a test set, classifies all entries in each text data in the training set and the test set according to the hierarchy and sub-hierarchy defined in the security knowledge framework, and determines the attribute relationship between each hierarchy, so as to obtain the hierarchy corresponding to each text data, the sub-hierarchy and the attribute relationship between the hierarchies;

[0008] S3 builds a prediction model, takes the text data in the training set in step S2 as input, and the hierarchy, sub-hierarchy and attribute relationship corresponding to the text data as output, so as to train the prediction model, use the test set to verify the prediction model, and use the prediction model obtained after training to predict the text data in the remaining original data set, so as to obtain the hierarchy, sub-hierarchy and attribute relationship between each hierarchy corresponding to each entry in each text data in the remaining original data set, that is, to realize the extraction of security knowledge.

[0009] Further preferably, after step S3, the safety knowledge extracted in step S3 is imported into the graph database to obtain the hierarchies, sub-hierarchies and attribute relationships between the hierarchies corresponding to all text data in the text data, so as to obtain a construction safety knowledge graph.

[0010] Further preferably, in step S1, the hierarchy includes construction resources, construction activities, construction locations, risk factors, potential risks and preventive measures.

[0011] Further preferably, in step S1, the attribute relationships between the construction resources and the construction activities, preventive measures and risk factors are implement, have and implement, the attribute relationships between the construction activities and the construction location, risk factors and preventive measures are located, have and need, the attribute relationships between the risk factors and the potential risks and construction location are located and cause, the attribute relationship between the potential risks and preventive measures is need, and the attribute relationship between the preventive measures and the construction location is located.

[0012] Further preferably, in step S1, the collected construction safety knowledge text data is obtained from the "Construction Law of the People's Republic of China", "Construction Project Safety Management Regulations", "Uniform Standard for Construction Project Construction Quality Acceptance", "Technical Specifications for Safety of Height Operations in Construction", "Technical Regulations for Safety in the Use of Construction Machinery", "Construction Safety Inspection Standards", "Construction Safety Operating Procedures" or "Metro Project Construction Safety Evaluation Standards", as well as production safety accident reports disclosed by the Housing and Urban-Rural Development Departments and Bureaus of various provinces and cities.

[0013] Further preferably, in step S3, the prediction model is an improved CASREL model obtained by combining the CASREL model with the contrastive learning idea box, that is, the CL-CASREL model.

[0014] Further preferably, the contrastive learning concept includes a data enhancement module, a BERT encoder, a mapping head and a contrastive loss function.

[0015] Further preferably, the CL-CASREL model includes a data enhancement module and a BERT encoder, the data enhancement module is used to convert data into positive samples and negative samples, the output features of the BERT encoder include two branches, namely BERT embedding and an aggregate sequence of security knowledge text, the BERT embedding is used to extract security knowledge, and the aggregate sequence of security knowledge text is used to perform contrastive learning to obtain contrastive loss, which is used to correct the parameters of the BERT encoder.

[0016] Further preferably, the method for extracting security knowledge using the CL-CASREL model comprises the following steps:

[0017] S31 generates positive samples and negative samples using the text data in the training set to form a positive and negative sample set;

[0018] S32 divides the data in the positive and negative sample sets into two parts, and inputs the two parts of data into the BERT encoder respectively, and the encoder simultaneously outputs an aggregate sequence of security knowledge texts;

[0019] The aggregated sequence of security knowledge texts obtained from the two parts of S33 data is calculated through contrastive learning to obtain contrast loss;

[0020] S34 returns the obtained contrast loss to the BERT encoder, and modifies the parameters of the encoder, thereby continuously updating the encoder until the loss is stable.

[0021] In general, the above technical solutions conceived by the present invention have the following beneficial effects compared with the prior art:

[0022] 1. The present invention uses the safety knowledge framework, natural language processing and deep learning technology to automatically extract the safety knowledge of construction workers and construct a safety knowledge graph to support the efficient organization, utilization, storage and update of construction safety knowledge, and provide a basis for the adaptive learning of construction safety knowledge;

[0023] 2. In the present invention, the CASREL model is improved into the CL-CASREL model. The CL-CASREL model combines the CASREL model with the idea of ​​contrastive learning, and improves the prediction accuracy through the data enhancement method, thereby making up for the problems of insufficient data in the training stage and insufficient model generalization ability;

[0024] 3. The above technical solutions conceived by the present invention can improve the ability to extract safety knowledge from various types of construction safety knowledge texts, establish a safety knowledge map, assist in construction safety training, and improve the safety knowledge level of construction workers. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 It is a flow chart of knowledge extraction and knowledge graph construction of the present invention constructed according to the preferred embodiment of the present invention;

[0026] Figure 2 It is a flow chart of constructing the security knowledge framework of the present invention constructed according to the preferred embodiment of the present invention;

[0027] Figure 3 is a framework diagram of a CL-CASREL model constructed according to a preferred embodiment of the present invention;

[0028] Figure 4 It is the training process of the CL-CASREL model constructed according to the preferred embodiment of the present invention;

[0029] Figure 5 It is a framework diagram of a construction safety knowledge triplet extraction algorithm constructed according to a preferred embodiment of the present invention;

[0030] Figure 6 is a schematic diagram of BERT construction safety knowledge text input constructed according to a preferred embodiment of the present invention;

[0031] Figure 7 It is a schematic diagram of the processing flow of the MLP mapping header constructed according to the preferred embodiment of the present invention. DETAILED DESCRIPTION

[0032] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0033] A method for extracting safety knowledge of construction workers, such as Figure 1 and Figure 2 As shown, it includes two steps:

[0034] S1 The construction safety knowledge framework is constructed, including the following steps:

[0035] S1.1 Data collection, more specifically:

[0036] Publicly available construction safety standards and specifications as well as production safety accident investigation reports are collected as text data sources for construction safety knowledge, including the "Construction Law of the People's Republic of China", "Construction Project Safety Management Regulations", "Uniform Standard for Construction Project Construction Quality Acceptance", "Technical Specifications for Safety of Height Operations in Construction", "Technical Regulations for Safety in the Use of Construction Machinery", "Construction Safety Inspection Standards", "Construction Safety Operating Procedures", "Metro Project Construction Safety Evaluation Standards", and production safety accident reports disclosed by the Housing and Urban-Rural Development Departments and Bureaus of various provinces and cities.

[0037] S1.2 Safety knowledge framework construction, using Protégé and the seven-step method to construct the worker safety knowledge ontology, including the following steps:

[0038] S1.2.1 Define the domain and scope of the construction safety knowledge framework, clarify the intention of building the safety knowledge framework, and define professional fields and application scenarios.

[0039] More specifically, the construction of the safety knowledge framework is intended to serve the definition of the data model of the safety knowledge graph for construction workers, covering the conceptual terms related to construction safety knowledge and the relationships between concepts; safety knowledge specifically covers the knowledge that construction workers use to understand the potential safety risks of construction activities, master the safety measures that should be taken and implemented, and clarify the consequences of violating safety regulations.

[0040] S1.2.2 Review the existing knowledge framework for construction safety and examine the possibility of reusing the existing knowledge framework for construction safety;

[0041] S1.2.3 Define important terms in the construction safety knowledge framework;

[0042] More specifically, there are two approaches: top-down and bottom-up. The top-down approach refers to abstracting the knowledge points, terms and concepts in the field of construction safety to extract the most common concepts. The bottom-up approach refers to clustering specific concepts with highly overlapping attributes or relationships based on a large amount of existing text data on construction safety knowledge to abstract common concept expressions.

[0043] Furthermore, the important terms in the construction safety knowledge framework are defined, and the top-level concept classes of the construction safety knowledge framework are determined.

[0044] Furthermore, the top-level concept classes include construction resources, construction activities, construction locations, risk factors, potential risks and preventive measures.

[0045] Furthermore, the construction resources refer to the various factors that form productivity in construction activities; the construction activities refer to the construction activities of construction projects; the construction location refers to the spatial location where construction activities are carried out; the risk factors refer to potential factors that may lead to accidents; the potential risks refer to risk events that may be caused by risk factors; and the preventive measures refer to the measures that must be taken to ensure construction safety and control the hazards of safety accidents.

[0046] S1.2.4 Define the construction safety knowledge framework classes and class hierarchies, and establish relationships between concepts;

[0047] More specifically, in defining the construction safety knowledge framework classes and class hierarchies, the classes of the safety knowledge framework represent a collection of concepts with the same characteristics, and the class hierarchical structure is defined by the relationship between classes.

[0048] Furthermore, in the Protégé security knowledge framework modeling tool, the class is represented by "Class", the class hierarchy is expressed by "Class hierarchy", and the class relationship is defined by "Subclass of", setting "Owl: Thing" as the parent of all classes.

[0049] Furthermore, in the process of setting up “Owl: Thing”, the six top-level conceptual safety knowledge frameworks of construction resources, construction activities, construction locations, risk factors, potential risks, and preventive measures determined in step S1.2.3 are used as the parent classes of all classes.

[0050] Furthermore, the six top-level conceptual safety knowledge frameworks all have corresponding subcategories. The "construction resources" category includes "construction workers", "materials", and "machinery and equipment" subcategories; the "construction activities" category consists of "part and sub-item construction" and "measure project construction", and the specific content can be listed in accordance with the "Uniform Standard for Construction Quality Acceptance of Building Engineering" and other specifications; the "construction location" includes two subcategories: "project components" that are under construction on the main body of the project and "safety facilities" that are under construction on temporary facilities and supporting structures; the "risk factors" cover three categories: "unsafe behavior of workers", "unsafe state of objects", and "unsafe factors of the environment"; the "potential risks" category mainly refers to the five most common types of casualties during the construction of construction projects, namely "falling from heights", "object strikes", "collapse", "mechanical injuries", and "electric shock"; the "preventive measures" include "personal protective equipment", "restricted areas", "safety training", "inspections", "other safeguards", and can be further expanded.

[0051] S1.2.5 Define the attributes of the construction safety knowledge class and the relationships between the attributes;

[0052] More specifically, the attributes of the construction safety knowledge class are defined to supplement the description of the characteristics of the class defined in the safety knowledge framework or to add constraints to the class, including object attributes and data attributes.

[0053] Furthermore, object attributes refer to the relationship between two classes or instances, while data attributes refer to the characteristics of a certain aspect of a class or instance, which can be expressed by numerical data or string data.

[0054] Furthermore, the object attributes include a class relationship defined by "Subclass of", which uses "is_a" to establish a relationship between a subclass and a parent class to form a hierarchical structure of the security knowledge framework class.

[0055] Furthermore, the object attributes also include the following definitions of the top-level concept class in step S1.2.3: there is an implementation relationship between "construction resources" and "construction activities", "risk factors" and "preventive measures"; there is an occurrence location relationship between "construction activities", "risk factors", "preventive measures" and "construction locations"; "construction activities" have "risk factors"; the implementation of "construction activities" and "potential risks" requires corresponding risk "preventive measures"; "risk factors" will lead to the occurrence of "potential risks".

[0056] S1.2.6 Define attribute restrictions;

[0057] More specifically, S1.2.6 attribute constraints add different constraints through data attributes and object attributes, such as quantity description, inclusion description and other constraints, to serve the security knowledge framework reasoning.

[0058] S1.2.7 Construction of safety knowledge framework example

[0059] S2 security knowledge extraction based on natural language processing and deep learning, refer to the following Figure 3 , 4 , 5, and 6 for explanation.

[0060] The present invention proposes a model framework that integrates unsupervised learning and supervised learning, that is, a model framework that integrates contrastive learning with the existing CASREL model, and names it CL-CASREL. Figure 3 This model combines the existing CASREL model with the idea of ​​contrastive learning to make up for the problems of insufficient data and insufficient model generalization ability in the training phase, and to extract security knowledge.

[0061] Furthermore, the extracted safety knowledge refers to knowledge triples, including entities and the relationships between entities. Taking "construction activities" with "hazardous factors" as an example: "construction at heights" has "falling risks", the two entities refer to "construction at heights" and "falling risks", and the relationship refers to "having".

[0062] Furthermore, the core idea of ​​contrastive learning is to generate positive and negative sample pairs through data augmentation construction, and design contrastive loss for unsupervised learning, so that the positive sample pairs are close in the projection space, while the negative sample pairs are far apart in the projection space.

[0063] Furthermore, the core component of contrastive learning consists of four parts: data augmentation module, BERT encoder f(·), mapping head g(·), and contrastive loss function. The CASREL model consists of BERT encoder f(·), entity tagger, and relation-specific entity tagger. The overall structure of the CASREL model that integrates contrastive learning ideas, CL-CASREL, is shown in Figure 3.

[0064] Furthermore, the overall training process of the model is as follows Figure 4 As shown, a step-by-step training method is adopted. The specific steps are as follows:

[0065] S1 uses the training set and the positive and negative sample pairs generated by it for unsupervised learning and calculates the contrast loss function, thereby adjusting the BERT encoder parameters through data augmentation using positive and negative sample pairs, so that the negative sample pairs and the positive sample pairs are far away from each other, and the positive sample pairs are close to each other.

[0066] After completing the first step, S2 takes the training set for supervised learning, compares the knowledge triples extracted by the model with the labeled triples, calculates the loss function, and further adjusts the parameters in CL-CASREL. The model is then tested with the test set.

[0067] Furthermore, step 1 includes:

[0068] S1.1 Divide the collected original data into training set and test set, and generate positive and negative sample pairs through the training set

[0069] The positive and negative sample pairs generated by S1.2 and the training set (equivalent to the positive sample pairs) are extracted through the BERT encoder to represent the text aggregation sequence h[cls]

[0070] S1.3 Use the mapping head g(·) to map h[cls] to the "space where contrast loss is applied" in a nonlinear way to obtain z[cls]

[0071] S1.4 calculates the loss using the contrastive loss function. If the loss is stable, proceed to step 2, otherwise continue to adjust the parameters in the BERT encoder in the CL-CASREL model.

[0072] Step 2 includes:

[0073] S2.1 Pass the data in the training set through the BERT encoder in the CL-CASREL model to obtain the BERT embedding of the text

[0074] S2.2 Extracting knowledge triples using the entity relation extraction module consisting of an “entity tagger” and a “relation-specific entity tagger”

[0075] S2.3 calculates the loss between the extracted knowledge triples and the labeled knowledge triples through the triple extraction loss function, thereby adjusting the parameters of other modules in the CL-CASREL model except the mapping head g(·) until the loss is stable.

[0076] Next, the positive and negative sample pair generation method mentioned in step 1 and step 2, the BERT encoder, the mapping head g(·), the entity marker, the entity marker for a specific relationship, and the loss function are described.

[0077] Furthermore, during the training phase, the output features of the BERT encoder of the CL-CASREL model are used as two branch tasks. The aggregate sequence representation h[cls] of the security knowledge text is used for contrast loss measurement, and the BERT embedding is input into the entity tagger module of the CASREL model for knowledge triple extraction. The contrast loss training effect will affect the extraction effect of knowledge triples by affecting the hyperparameters of the BERT encoder.

[0078] Furthermore, the data augmentation module aims to design positive and negative sample pairs for the calculation of contrast loss for unsupervised learning.

[0079] Furthermore: positive sample pairs are generated in three ways: (1) machine translation, translating the construction safety knowledge text into English and then into Chinese; (2) swapping, randomly swapping the positions of two words in the construction safety knowledge text; (3) truncation, randomly replacing a certain proportion of words with [MASK].

[0080] Negative sample pairs randomly replace the annotated entities in the security knowledge text with entities of different categories in other sentences with a certain probability to generate new sentences.

[0081] Furthermore, the BERT encoder uses the pre-trained BERT model proposed by Devlin to encode the contextual information of the text. Its core structure consists of N identical Transformer encoder stacks. j Extract feature information x j can be input into the subsequent entity tagger and the entity tagger of specific relationship. Figure 5 As shown in Figure 1, BERT’s representation for a given text input consists of three parts: (1) token embedding; (2) segment embedding; and (3) position embedding.

[0082] Furthermore, Figure 6 As shown in Figure 1, each sentence begins with a [CLS] tag embedded as the start tag. After BERT processing, the [CLS] is processed to obtain the aggregate sequence representation h[cls] of the security knowledge text, as shown in Figure 1. Figure 5 As shown in the figure, in the first step of model training, the h[cls] output obtained by processing the BERT encoder is used as part of contrastive learning, while the BERT embedding obtained in the second step of the model is passed through the entity tagger and the entity tagger for a specific relationship to extract knowledge triples.

[0083] Furthermore, the mapping head g(·) maps the aggregate sequence representation h[cls] of the security knowledge text obtained by data augmentation to the space where the contrast loss is applied. The projection representation h[cls] is mapped by nonlinear mapping, as Figure 7 As shown, the mapping operation is implemented using a two-layer multilayer perceptron, and h[cls] is obtained by two fully connected layers, batch standard processing, and ReLU activation function to obtain z[cls].

[0084] Furthermore, the entity tagger aims to identify all possible entities in the input security knowledge text by decoding the encoding vectors produced by the BERT encoder.

[0085] Furthermore, Figure 5 As shown in the entity tagger section, the entity tagger uses two identical binary classifiers to assign a binary label (0 / 1) to each tag to indicate whether the current tag corresponds to the start or end position of the entity, that is, the sentence part corresponding to the two 1s is an entity. The detailed operation of the entity tagger on each tag is as follows:

[0086]

[0087]

[0088] in, and Respectively represent the probability of identifying the i-th token in the input sequence as the start position and the end position of the entity. If the probability exceeds a certain threshold, the corresponding token will be assigned label 1, otherwise it will be assigned label 0. i is the encoded representation of the i-th token in the input sequence, i.e. x i =h N [i] W start and W end is the trainable weight, b start and b end is the deviation, and σ represents the sigmoid function.

[0089] Furthermore, the entity tagger optimizes the following likelihood function to identify the span of an entity s given an input text representation x:

[0090]

[0091] Where L represents the length of the text. If is true, then Otherwise 0. is true, then Otherwise 0. is the binary label for the start position of the i-th tokenized entity in x, Indicates the end position of the entity character.

[0092] θ={W srarr , W end , b srart , b end}

[0093] Furthermore, the relation-specific entity tagger simultaneously identifies the relation associated with the entity obtained by the entity tagger and the entity corresponding to the relation. Figure 5 As shown, in the relationship of "implementation", the entity of "not wearing a seat belt" starts with 1 and ends with 1. In the relationship of "causing", the entity of "falling" starts with 1 and ends with 1.

[0094] Furthermore, the operation for each tag is as follows:

[0095]

[0096]

[0097] in, and They represent the probability of identifying the start and end positions of the i-th token in the input sequence as an entity, respectively. represents the encoded representation vector of the k-th entity detected by the entity tagger. and are trainable weights, and is the deviation, and σ represents the sigmoid function.

[0098] Furthermore, the entity tagger for a particular relation r optimizes the following likelihood function to identify the span of entity o with relation r given a sentence representation x and entity s:

[0099]

[0100] in, is the binary label for the start position of the i-th tokenized entity in x, Indicates the end position of the entity character. For an empty object parameter

[0101]

[0102] Furthermore, the loss function designs a contrast loss function and a triple extraction function. In the actual training process, a step-by-step training method is adopted, first using the generated positive and negative samples and 80% of the original data for unsupervised learning, and then using 80% of the original data for supervised learning.

[0103] Furthermore, the contrastive loss function aims to train the CL-CASREL model so that positive sample pairs are closer in the representation space and negative sample pairs are farther away, thereby adjusting the hyperparameters of the BERT encoder to extract security knowledge triplets.

[0104]

[0105] in, is an indicator function. If k≠i, the result is 1, z i and z j is the projection representation, and τ represents the temperature coefficient.

[0106] Furthermore, the triple extraction loss function is used for relation triple extraction to identify all possible construction safety knowledge triples (entity s, relation r, entity o). The model is trained by maximizing the objective function J(Θ) on shuffled mini-batches using Adam stochastic gradient descent.

[0107] Furthermore, given the annotated text x of the training set D j A set of possibly overlapping triplets T j ={(s, r, o)}, the goal is to maximize the data likelihood of the training set D, J(Θ) is expressed as

[0108]

[0109] Where s∈T j Indicates that it appears in T j Entity s in triple. T j |s is the set of triples led by entity s in (r,o)∈T j |s is T j The (r,o) pairs in the triples introduced by entity s in R. R is the set of all possible relations. R\T j |s represents all relations except the one led by s. φ Represents an "empty" entity. p θ (s|x) and p θr (o|s, x) has been defined in the previous formula

[0110] The construction safety knowledge graph is constructed according to the following method:

[0111] The safety knowledge entities and their relationships extracted from the text data are imported into the Neo4j graph database to store and generate the construction safety knowledge graph.

[0112] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for extracting safety knowledge of construction workers and constructing a knowledge graph, characterized in that: The method comprises the following steps: S1 collects construction safety knowledge text data to form an original data set, builds a safety knowledge framework and defines the levels contained in the framework and the sub-levels corresponding to each level, as well as the attribute relationships between each level; S2 divides part of the data in the original data set into a training set and a test set, classifies all entries in each text data in the training set and the test set according to the hierarchy and sub-hierarchy defined in the security knowledge framework, and determines the attribute relationship between each hierarchy, so as to obtain the hierarchy corresponding to each text data, the sub-hierarchy and the attribute relationship between the hierarchies; S3 builds a prediction model, takes the text data in the training set in step S2 as input, and the hierarchy, sub-hierarchy and attribute relationship corresponding to the text data as output, so as to train the prediction model, use the test set to verify the prediction model, and use the prediction model obtained after training to predict the text data in the remaining original data set, so as to obtain the hierarchy, sub-hierarchy and attribute relationship between each hierarchy corresponding to each entry in each text data in the remaining original data set, that is, to realize the extraction of security knowledge.

2. A method for extracting safety knowledge of construction workers and constructing a knowledge graph as claimed in claim 1, characterized in that: In step S3, the prediction model is an improved CASREL model obtained by combining the CASREL model with the contrastive learning idea box, namely, the CL-CASREL model.

3. A method for extracting safety knowledge of construction workers and constructing a knowledge graph as claimed in claim 2, characterized in that: The contrastive learning concept includes a data enhancement module, a BERT encoder, a mapping head and a contrastive loss function.

4. A method for extracting safety knowledge of construction workers and constructing a knowledge graph as claimed in claim 3, characterized in that: The CL-CASREL model includes a data enhancement module and a BERT encoder. The data enhancement module is used to convert data into positive samples and negative samples. The output features of the BERT encoder include two branches, namely BERT embedding and an aggregate sequence of security knowledge text. The BERT embedding is used to extract security knowledge, and the aggregate sequence of security knowledge text is used to perform contrastive learning to obtain contrastive loss, which is used to correct the parameters of the BERT encoder.

5. A method for extracting safety knowledge of construction workers and constructing a knowledge graph as claimed in claim 4, characterized in that: The method for extracting security knowledge using the CL-CASREL model comprises the following steps: S31 generates positive samples and negative samples using the text data in the training set to form a positive and negative sample set; S32 divides the data in the positive and negative sample sets into two parts, and inputs the two parts of data into the BERT encoder respectively, and the encoder simultaneously outputs an aggregate sequence of security knowledge texts; The aggregated sequence of security knowledge texts obtained from the two parts of S33 data is calculated through contrastive learning to obtain contrast loss; S34 returns the obtained contrast loss to the BERT encoder, and modifies the parameters of the encoder, thereby continuously updating the encoder until the loss is stable.

6. A method for extracting safety knowledge of construction workers and constructing a knowledge graph as claimed in claim 1, characterized in that: After step S3, the safety knowledge extracted in step S3 is imported into the graph database to obtain the hierarchies, sub-hierarchies and attribute relationships between the hierarchies corresponding to all the text data in the text data, so as to obtain the construction safety knowledge graph.

7. A method for extracting safety knowledge of construction workers and constructing a knowledge graph as claimed in claim 6, characterized in that: In step S1, the hierarchy includes construction resources, construction activities, construction locations, risk factors, potential risks and preventive measures.

8. A method for extracting safety knowledge of construction workers and constructing a knowledge graph as claimed in claim 7, characterized in that: In step S1, the attribute relationships between the construction resources and the construction activities, preventive measures and risk factors are implement, have and implement respectively; the attribute relationships between the construction activities and the construction location, risk factors and preventive measures are located, have and need respectively; the attribute relationships between the risk factors and the potential risks and the construction location are located and cause respectively; the attribute relationship between the potential risks and preventive measures is need; and the attribute relationship between the preventive measures and the construction location is located.

9. A method for extracting safety knowledge of construction workers and constructing a knowledge graph as claimed in claim 7, characterized in that: In step S1, the collected construction safety knowledge text data is obtained from the "Construction Law of the People's Republic of China", "Construction Project Safety Management Regulations", "Uniform Standards for Construction Quality Acceptance of Construction Projects", "Technical Specifications for Safety of Height Operations in Construction", "Technical Regulations for Safety in the Use of Construction Machinery", "Construction Safety Inspection Standards", "Construction Safety Operating Procedures" or "Metro Project Construction Safety Evaluation Standards", as well as the production safety accident reports disclosed by the Housing and Urban-Rural Development Departments and Bureaus of various provinces and cities.