A method and system for constructing a corpus for highway construction safety training

By performing OCR cleaning and syntactic analysis on the highway construction safety training corpus, and combining the semantic extension of Word2Vec and BERT models, an entity-relation structure was constructed. This solved the problem of poor consistency in the existing corpus, achieved the construction of a high-quality and reliable corpus, and improved the consistency and coverage of annotation.

CN121255962BActive Publication Date: 2026-03-06CENT SOUTH UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511832789.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-08
Publication Date
2026-03-06
Estimated Expiration
2045-12-08

AI Technical Summary

Technical Problem

Existing methods for constructing highway construction safety training corpora suffer from poor consistency and difficulties in corpus reuse, making it difficult to centrally and uniformly organize construction safety knowledge and affecting the training effectiveness and the accuracy and reliability of annotation results.

Method used

By employing clause-level cleaning and segmentation methods using OCR, regular rules, and syntactic dependency analysis, unstructured documents are transformed into semantically complete clause-level corpus units. Combining a dual-model semantic expansion mechanism of Word2Vec and BERT, an entity-relation structure is constructed. A dual-index evaluation system of Cohen's Kappa coefficient and F1-score is used to ensure the consistency and coverage of annotations.

Benefits of technology

It significantly improves the purity and machine readability of the corpus, ensuring that security knowledge expressed differently but with the same meaning in different regulatory texts can be effectively linked and integrated, providing a standardized and structured semantic description framework, and improving the reusability and reliability of the corpus.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121255962B_ABST
    Figure CN121255962B_ABST
Patent Text Reader

Abstract

This invention relates to the field of natural language processing technology and discloses a method and system for constructing a corpus for highway construction safety training. The method includes the following steps: processing initial corpus to obtain corpus units; identifying keywords within the corpus units to construct an extended dictionary; constructing annotation rules for entity names and relation types, and annotating entity names and relation types based on these rules to obtain an entity-relation structure; performing multi-person collaborative annotation on the entity-relation structure based on the annotation rules to obtain a human collaborative annotation structure; performing consistency evaluation and coverage assessment on the entity-relation structure and the human collaborative annotation structure to obtain consistency evaluation coefficients and coverage evaluation coefficients; and constructing a structured corpus based on the consistency evaluation coefficients and coverage evaluation coefficients. This invention solves the problems of poor consistency and difficulty in corpus reuse in existing methods for constructing corpora based on construction safety.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing technology, and in particular to a method and system for constructing a corpus for highway construction safety training. Background Technology

[0002] Highway construction projects are characterized by long construction periods, large operating areas, complex procedures, and diverse risk factors. This necessitates that construction workers adhere to numerous safety provisions from laws, industry standards, and company regulations. These provisions are crucial for ensuring construction safety and form the core of safety training for construction personnel. However, current practices in construction safety training present several significant problems. First, construction safety knowledge is distributed across various levels of laws, administrative regulations, departmental rules, national standards, industry standards, and local standards. The formats, language styles, and detailed requirements of these documents differ considerably, making it difficult to centralize and organize knowledge uniformly. Safety training requires manual sifting through different documents, which is time-consuming, labor-intensive, and prone to overlooking key information. Second, different regulatory and standard documents exhibit semantic differences in their descriptions of similar construction behaviors or safety risks. This difference leads to inconsistent understanding of the provisions among construction workers, reducing training effectiveness and increasing the difficulty of safety training. Currently, safety training materials are mostly in Word or PDF format, lacking structured processing at the provision level. While some studies have attempted to digitize accident cases or safety regulations, these efforts largely remain at the level of keyword indexing or simple database retrieval. For tasks requiring Natural Language Processing (NLP), ontology modeling, or knowledge graph construction, the lack of high-quality clause-level corpora has become a bottleneck restricting intelligent modeling and reasoning. In manual or semi-automatic annotation processes, a unified system of entity and relation categories is often lacking, and different annotators may employ different granularities or semantic understandings, leading to inconsistent annotation results. Furthermore, the lack of rigorous quality control mechanisms results in issues with corpus consistency and coverage, thus affecting the accuracy and reliability of downstream applications (such as named entity recognition, relation extraction, and knowledge graph construction). Therefore, existing methods for constructing corpora based on construction safety suffer from low accuracy and poor reliability. Summary of the Invention

[0003] This invention provides a method and system for constructing a corpus for highway construction safety training, in order to solve the problems of poor consistency and difficulty in corpus reuse in existing construction safety-based corpus construction methods.

[0004] To achieve the above objectives, the present invention employs the following technical solution:

[0005] In a first aspect, the present invention provides a method for constructing a corpus for highway construction safety training, comprising the following steps:

[0006] S1. Obtain initial corpus related to construction safety, and process the initial corpus to obtain corpus units;

[0007] S2. Determine keywords in the corpus units, construct a word vector model to extend the semantic similarity of the keywords to obtain first related approximate words, construct a language representation model to extend the semantic similarity of the keywords to obtain second related approximate words, determine candidate words based on the first related approximate words and the second related approximate words, and construct an extended dictionary based on the candidate words;

[0008] S3. Determine the entity names in the corpus unit and the relation types in the extended dictionary, construct the annotation rules for the entity names and the relation types, and annotate the entity names and the relation types based on the annotation rules to obtain the entity-relation structure;

[0009] S4. Based on the annotation rules, perform multi-person collaborative annotation on the entity-relationship structure to obtain a human collaborative annotation structure;

[0010] S5. Perform consistency evaluation and coverage assessment on the entity-relationship structure and the manual collaborative annotation structure to obtain the consistency evaluation coefficient and coverage evaluation coefficient;

[0011] S6. When the consistency evaluation coefficient is greater than the first preset threshold and the coverage evaluation coefficient is greater than the second preset threshold, a structured corpus is constructed based on the entity-relationship structure.

[0012] Optionally, S1 includes:

[0013] S101. Extract initial corpus from text files related to construction safety;

[0014] S102. The initial corpus is processed to obtain corpus units, wherein the processing method includes: performing OCR recognition on the initial corpus, performing regular expression cleaning on the result obtained by OCR recognition, performing clause segmentation on the result obtained by regular expression cleaning, and finally performing syntactic analysis on the result obtained by clause segmentation.

[0015] S1021, The steps of OCR recognition include: performing optical character recognition on the scanned document in the initial corpus, and converting the scanned document into processable text;

[0016] S1022, The regular expression cleaning step includes: removing irrelevant symbols, including headers, footers and serial numbers, from the processable text;

[0017] S1023. The steps of clause segmentation include: constructing clause feature words, and performing semantic segmentation on the regular expression-cleaned processable text based on the clause feature words to obtain the segmented text;

[0018] S1024. The steps of syntactic analysis include: dissecting the subject-verb-object structure in the segmented text to obtain logically complete corpus units.

[0019] Optionally, in step S2, constructing an expanded dictionary based on the candidate words includes:

[0020] S201. Based on the purpose of construction safety training, identify keywords related to construction in the corpus units;

[0021] S202. Construct a word vector model and input the keyword into the word vector model to obtain the first related approximate word extended by the word vector model. The word vector model consists of an input layer, a hidden layer and an output layer. The input layer is used to receive the keyword and output the word vector code corresponding to the keyword. The hidden layer is used to receive the word vector code and output the word vector corresponding to the word vector code. The output layer is used to receive the word vector and output the first related approximate word corresponding to the word vector.

[0022] S203. Construct a language representation model and input the keywords into the language representation model to obtain the second related approximate words extended by the language representation model. The language representation model consists of a pre-fine-tuning module, a Transformer module, and an Embedding module. The pre-fine-tuning module is used to receive the keywords and a preset word vector expansion task. The Transformer module is used to generate corresponding word vectors based on the word vector expansion task and the keywords. The Embedding module is used to generate the second related approximate words based on the word vectors.

[0023] S204. Select similar words that exist in both the first and second related similar words as candidate words, and construct an extended dictionary based on the candidate words.

[0024] Optionally, in step S202, the keywords are input into the word vector model to obtain the first related approximate words extended by the word vector model, including:

[0025] S2021. In the input layer of the word vector model, keywords related to construction are used as target words. target words Input the vector into the input layer as a one-hot vector;

[0026] S2022. Construct the input weight matrix in the hidden layer of the word vector model. The target word, after one-hot encoding, is mapped to its word vector using the input weight matrix. The word vector dimension is N, the number of word vectors is V, and the matrix contains... For the first in the matrix Line number Column elements;

[0027] S2023. Construct the output weight matrix in the output layer of the word vector model. The output weight matrix is ​​used to calculate the prediction of context words. word vectors Used to predict the current target word The probability of the corresponding context words appearing in the matrix For the first in the matrix Line number The elements of the column, according to probability prediction, satisfy the following relationship:

[0028] ;

[0029] In the formula, For target words, For prediction words, For a given target word Time prediction words The probability of its occurrence;

[0030] S2024. Set a preset similarity threshold, output predicted words based on the word vector model, and calculate the cosine similarity between the target word and the predicted word. The cosine similarity calculation satisfies the following relationship:

[0031] ;

[0032] In the formula, Represents cosine similarity. This represents the dot product of two sentence vectors. and Let and represent the Euclidean norm of the vector, respectively, and n be the dimension of the vector. Indicate target word Corresponding word vectors Vector representation in the cosine similarity calculation formula Indicates prediction words Corresponding word vectors Vector representation in the cosine similarity calculation formula Representing vectors The One element, Representing vectors The Element;

[0033] S2025. When the cosine similarity is greater than the preset similarity threshold, the predicted word is used as the first relevant approximate word for the word vector model extension.

[0034] Optionally, S3 includes:

[0035] S301. Define 9 types of entities in the corpus unit, including: construction worker, construction location, construction activity, work requirements, hazard source, potential risk, preventive measures, accident type, and disposal measures. Define 8 types of relations in the extended dictionary, including: location, carry out, follow, discover, trigger, take, generate, and adopt. Use the 9 types of entities as entity names and the 8 types of relations as relation types.

[0036] S302. Define the annotation rules for the format of entity first character - entity other characters - non-entity characters or punctuation marks;

[0037] S303. Based on the annotation rules, formulate specific annotation principles, and annotate entity names and relation types to obtain triples based on the annotation principles. Construct an entity-relation structure based on the triples, wherein the structure of the triple is entity name-relation type-entity name. The annotation principles include: professional terminology integrity principle, longest matching principle, entity category differentiation standard, minimum granularity principle, and nested entity hierarchy preservation principle.

[0038] Optionally, the consistency evaluation in S5 uses Cohen's Kappa coefficient, and the specific calculation satisfies the following relationship:

[0039] ;

[0040] In the formula, This represents the consistency evaluation coefficient. Indicates observational consistency. Indicates the probability of random consistency;

[0041] Coverage assessment uses the F1-score, and the specific calculation satisfies the following relationship:

[0042] ;

[0043] ;

[0044] ;

[0045] In the formula, Indicates the coverage assessment coefficient. Indicates the accuracy of the assessment. Indicates the assessment of recall. This represents the number of entities that were correctly identified by both annotators and whose boundaries and types are completely consistent. This indicates the number of entities that were identified by the second annotator but were not identified or were incorrectly identified by the first annotator. This indicates the number of entities that the first annotator identified but the second annotator did not identify or misidentified.

[0046] Optionally, S6 further includes:

[0047] When the consistency evaluation coefficient is less than or equal to the first preset threshold or the coverage evaluation coefficient is less than or equal to the second preset threshold, the annotation rules are adjusted, and a new entity-relationship structure is obtained by re-annotating based on the adjusted annotation rules.

[0048] Secondly, embodiments of this application provide a corpus construction system for highway construction safety training, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method as described in any one of the first aspects.

[0049] Beneficial effects:

[0050] This invention provides a corpus construction method for highway construction safety training. Through clause-level cleaning and segmentation based on OCR, regular rules, and syntactic dependency analysis, it transforms scattered and redundant unstructured documents (such as PDFs and Word documents) into semantically complete and uniformly formatted clause-level corpus units. These steps effectively remove redundant information such as headers, footers, and serial numbers, significantly improving the purity and machine readability of the corpus, providing high-quality, directly usable structured data input for subsequent natural language processing tasks. Furthermore, it employs a dual-model semantic expansion mechanism combining the Word2Vec model and the BERT language representation model. The Word2Vec model captures static semantic similarity at the lexical distribution level, while the BERT model relies on its powerful contextual understanding capabilities for dynamic semantic prediction. Cross-validation between the two significantly improves the ability to discover synonyms, near-synonyms, and hyponyms and hypernyms. This overcomes the shortcomings of traditional manual expansion, which is highly subjective and has low coverage, ensuring that safety knowledge expressed differently but with the same semantics in different regulatory texts can be effectively associated and integrated. A standardized and structured semantic description framework for highway construction safety is provided through a unified annotation system of nine entity types and eight relationship types, along with detailed annotation rules. This system covers the complete knowledge chain from "construction location → construction activities → operational requirements → hazard sources → accident types → emergency response," and, combined with principles such as completeness of professional terminology and longest matching, ensures a high degree of consistency in the results produced by different annotators, solving the previous problems of inconsistent annotation granularity and difficulty in reusing results. A dual-index evaluation system based on Cohen's Kappa coefficient and F1-score enables a comprehensive quantitative assessment of the annotation process. The Kappa coefficient focuses on the consistency of subjective judgment among annotators, while the F1-score objectively measures the coverage and accuracy of the annotation results from two dimensions: precision and recall. This comprehensive evaluation model of "subjective + objective" and "consistency + coverage," coupled with a manual review mechanism, ensures the high reliability of the final corpus, improves its reusability, and provides a solid guarantee for its value as a benchmark dataset. Attached Figure Description

[0051] Figure 1 This is a flowchart of a preferred embodiment of the present invention for constructing a corpus for highway construction safety training;

[0052] Figure 2 This is a schematic diagram of the Skip-Gram word vector model of a preferred embodiment of the present invention;

[0053] Figure 3 A schematic diagram of the structure of the BERT model provided in a preferred embodiment of the present invention;

[0054] Figure 4A schematic diagram of the structure related to safety training knowledge for highway construction workers provided in a preferred embodiment of the present invention;

[0055] Figure 5 Example diagram of entity annotation provided for a preferred embodiment of the present invention. Detailed Implementation

[0056] The technical solution of the present invention will be clearly and completely described below. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0057] Unless otherwise defined, the technical or scientific terms used in this invention shall have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Similarly, the terms "an" or "a" and similar terms do not indicate a quantity limitation, but rather indicate the presence of at least one. The terms "connected" or "linked" and similar terms are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up," "down," "left," "right," etc., are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship also changes accordingly.

[0058] Please see Figure 1 This application provides a method for constructing a corpus for highway construction safety training, including the following steps:

[0059] S1. Obtain initial corpus related to construction safety and process the initial corpus to obtain corpus units;

[0060] S2. Identify keywords in the corpus units, construct a word vector model to expand the semantic similarity of the keywords to obtain the first related approximate words, construct a language representation model to expand the semantic similarity of the keywords to obtain the second related approximate words, determine candidate words based on the first and second related approximate words, and construct an extended dictionary based on the candidate words;

[0061] S3. Determine the entity names in the corpus units and the relation types in the extended dictionary, construct the annotation rules for entity names and relation types, and annotate the entity names and relation types based on the annotation rules to obtain the entity-relation structure;

[0062] S4. Based on the annotation rules, perform multi-person collaborative annotation on the entity-relation structure to obtain the human collaborative annotation structure;

[0063] S5. The consistency evaluation coefficient and coverage evaluation coefficient are obtained by performing consistency evaluation and coverage evaluation on the entity-relationship structure and the manual collaborative annotation structure.

[0064] S6. When the consistency evaluation coefficient is greater than the first preset threshold and the coverage evaluation coefficient is greater than the second preset threshold, construct a structured corpus based on the entity-relationship structure.

[0065] In the above embodiments, by transforming originally scattered and redundant unstructured documents (such as PDFs and Word documents) into semantically complete and uniformly formatted clause-level corpus units, the purity and machine readability of the corpus are significantly improved, providing high-quality, directly usable structured data input for subsequent natural language processing tasks. A dual-model semantic expansion mechanism combining the Word2Vec model and the BERT language representation model is employed. The Word2Vec model captures static semantic similarity at the lexical distribution level, while the BERT model relies on its powerful contextual understanding capabilities for dynamic semantic prediction. Cross-validation between the two significantly improves the ability to discover synonyms, near-synonyms, and hyponyms. This method overcomes the shortcomings of traditional manual expansion, which is highly subjective and has low coverage, ensuring that safety knowledge expressed differently but with the same semantics in different regulatory texts can be effectively associated and integrated. Through a unified annotation system and detailed annotation rules, a standardized and structured semantic description framework is provided for the field of highway construction safety, solving the problems of inconsistent annotation granularity and difficulty in reusing results.

[0066] In this embodiment, to address the issue of insufficient semantic coverage, a dual-model semantic expansion mechanism based on the combination of the Word2Vec and BERT models is proposed. First, the Word2Vec model is used to expand the keywords, obtaining first relevant approximations and constructing a first relevant approximation set. Then, the BERT model is used to expand the same keywords, obtaining second relevant approximations and constructing a second relevant approximation set. For the selection of expanded approximations, the approximation must satisfy the condition that it is both a first relevant approximation from the Word2Vec model and a second relevant approximation from the BERT model. Only when a relevant approximation appears in both the first and second relevant approximation sets will it be selected as a candidate word to construct the expanded dictionary. That is, candidate words jointly identified by Word2Vec and BERT are added to the expanded dictionary.

[0067] Optionally, step S1 includes:

[0068] S101. Extract initial corpus from text files related to construction safety;

[0069] S102. The initial corpus is processed to obtain corpus units. The processing methods include: performing OCR recognition on the initial corpus, performing regular expression cleaning on the results of OCR recognition, performing clause segmentation on the results of regular expression cleaning, and finally performing syntactic analysis on the results of clause segmentation.

[0070] S1021, The steps of OCR recognition include: performing optical character recognition on the scanned document in the initial corpus, and converting the scanned document into processable text;

[0071] S1022, The steps of regular expression cleaning include: removing irrelevant symbols, including headers, footers and serial numbers, from the processable text;

[0072] S1023. The steps of clause segmentation include: constructing clause feature words, and performing semantic segmentation on the regular expression-cleaned processable text based on the clause feature words to obtain the segmented text;

[0073] S1024. The steps of syntactic analysis include: dissecting the subject-verb-object structure in the segmented text to obtain logically complete corpus units.

[0074] In the above embodiments, the corpus data mainly comes from industry documents and national standard service platforms issued by authoritative institutions such as the Ministry of Transport and the Ministry of Housing and Urban-Rural Development. Texts highly relevant to construction safety training are selected, and the latest versions of specifications with strong adaptability are given priority. These include laws, administrative regulations, departmental rules, administrative normative documents, national standards, industry standards, and local standards, totaling 127 documents, covering a complete system from the legal framework for safe production to specific construction technical specifications.

[0075] After acquiring the corpus data, it needs to be processed to ensure the smooth progress of subsequent steps. The processing steps include OCR recognition, regular expression cleaning, clause segmentation, and syntactic analysis. OCR recognition: For scanned PDF files, Optical Character Recognition (OCR) technology is used to convert them into processable text. Regular expression cleaning: Irrelevant symbols (such as headers, footers, and serial numbers) are removed using regular expressions to ensure consistent text formatting. Clause segmentation: Semantic segmentation is performed based on the characteristic words of the legal clauses (such as "must," "shall," and "prohibited"). Syntactic analysis: The subject-verb-object structure of the clauses is analyzed using dependency parsing trees to ensure the logical integrity of the clauses. After the above processing, clause-level corpus units are finally obtained. Each clause contains semantically complete security requirements, risk warnings, or emergency response content, facilitating subsequent modeling.

[0076] This embodiment uses the "Technical Specifications for Safety in Highway Engineering Construction" as an example:

[0077] Select some clauses from the "Technical Regulations for Safety in Highway Engineering Construction", such as: "Construction workers must wear safety helmets when entering the construction site, and it is strictly forbidden to work at heights without a safety belt."

[0078] The above clauses were subjected to OCR recognition: If the clause was a PDF scan, it was first extracted into editable text using OCR; regular expression cleaning was performed: page numbers and headers "Chapter ×" were removed, and the main text was retained; clause segmentation was performed: the clauses were segmented according to keywords such as "must" and "strictly prohibited", resulting in two independent clauses: ① "Construction workers must wear safety helmets when entering the construction site"; ② "It is strictly prohibited to work at heights without wearing a safety belt". Syntactic analysis was performed: the subject "construction workers", the predicate "wear / not wear", and the object "safety helmet / safety belt" were identified. This yielded two clause-level corpora with complete semantics, which can be directly used as input for subsequent modeling.

[0079] Optionally, step S2 includes:

[0080] S201. Based on the purpose of construction safety training, identify keywords related to construction in the corpus units;

[0081] S202. Construct a word vector model and input keywords into the word vector model to obtain the first related approximate word extended by the word vector model. The word vector model consists of an input layer, a hidden layer and an output layer. The input layer is used to receive keywords and output the word vector code corresponding to the keywords. The hidden layer is used to receive word vector codes and output the word vectors corresponding to the word vector codes. The output layer is used to receive word vectors and output the first related approximate word corresponding to the word vectors.

[0082] S203. Construct a language representation model and input keywords into the language representation model to obtain the second related approximate words extended by the language representation model. The language representation model consists of a pre-fine-tuning module, a Transformer module, and an Embedding module. The pre-fine-tuning module is used to receive keywords and a preset word vector extension task. The Transformer module is used to generate corresponding word vectors based on the word vector extension task and keywords. The Embedding module is used to generate the second related approximate words based on the word vectors.

[0083] S204. Select similar words that exist in both the first and second related similar words as candidate words, and construct an extended dictionary based on the candidate words.

[0084] Optionally, step S202 includes:

[0085] S2021. In the input layer of the word vector model, keywords related to construction are used as target words. target words Input the vector into the input layer as a one-hot vector;

[0086] S2022. Construct the input weight matrix in the hidden layer of the word vector model. The target word, after one-hot encoding, is mapped to its word vector using the input weight matrix. The word vector dimension is N, the number of word vectors is V, and the matrix contains... For the first in the matrix Line number Column elements;

[0087] S2023. Construct the output weight matrix in the output layer of the word vector model. The output weight matrix is ​​used to calculate the prediction of context words. word vectors Used to predict the current target word The probability of the corresponding context words appearing in the matrix For the first in the matrix Line number The elements of the column, according to probability prediction, satisfy the following relationship:

[0088] (1)

[0089] In the formula, For target words, For prediction;

[0090] S2024. Set a preset similarity threshold, output predicted words based on the word vector model, and calculate the cosine similarity between the target word and the predicted word. The cosine similarity calculation satisfies the following relationship:

[0091] (2)

[0092] In the formula, Represents cosine similarity. This represents the dot product of two sentence vectors. and Let and represent the Euclidean norm of the vector, respectively, and n be the dimension of the vector. Indicate target word Corresponding word vectors Vector representation in the cosine similarity calculation formula Indicates prediction words Corresponding word vectors Vector representation in the cosine similarity calculation formula Representing vectors The One element, Representing vectors The Element;

[0093] S2025. When the cosine similarity is greater than the preset similarity threshold, the predicted word is used as the first relevant approximate word for the word vector model extension.

[0094] In the above embodiments, to address the problem of insufficient semantic coverage, this invention proposes a dual-model semantic expansion mechanism based on the combination of Word2Vec and BERT. For the Word2Vec model, the Skip-gram architecture of the Word2Vec word vector model is used to model the composition of the neural network, such as... Figure 2 As shown, the model mainly consists of three layers:

[0095] Input Layer, target words The input is in the form of a one-hot vector;

[0096] Hidden layer, through input weight matrix Mapping one-hot encoding to word vectors of the target word The dimension is N;

[0097] The output layer outputs a weight matrix. Calculate and predict context words word vectors Used to predict the current target word The probability of the corresponding context words appearing is given in Equation (1).

[0098] When training the Word2Vec model, the training parameters were set as follows: Vector Size: 200, WindowSize: 5, Min-count: 3, Iterations: 10, Negative Sampling: 10. Based on the trained Word2Vec model, each keyword initially determined by experts was expanded using synonyms or semantically similar words through cosine similarity. The cosine similarity between the keyword to be expanded and all words in the model was calculated. A similarity threshold of 0.7 was set, and synonyms or semantically similar words with a similarity higher than the threshold were selected. The automatic expansion results were manually reviewed, and irrelevant words or words with high similarity but semantic inconsistencies were removed, forming a list of expanded keywords. For example, the keyword "high-altitude fall" was expanded using the Word2Vec word vector model to obtain similar words such as "falling from a height," "dropping from a height," and "falling objects from the air."

[0099] As for the BERT model, its structure is as follows: Figure 3As shown, BERT can dynamically generate word representations based on context, effectively solving problems such as semantic ambiguity and polysemous word recognition. BERT's pre-training includes two tasks: Masked Language Model (MLM) and Next Sentence Prediction (NSP), giving the model strong sentence-level semantic understanding capabilities. Candidate words obtained through context prediction are combined with Word2Vec results for cross-validation. The open-source Chinese pre-trained model "bert-base-chinese" is selected, whose model structure parameters include a 12-layer Transformer encoder, a hidden layer dimension of 768, 12 attention heads, and a maximum input length of 512. This model is loaded through the "Hugging Face Transformers" library and uses "bert-base-chinese" weights. The keywords to be analyzed and the corpus terms are input into the BERT model to obtain the semantic representation of the sentence (CLS Token embedding). The cosine similarity between the keyword sentence vector and the candidate text sentence vector is calculated.

[0100] Given two sentence vectors, , The formula for calculating the cosine similarity between the two is detailed in formula (2). Set the semantic similarity threshold to 0.8 and filter out clauses or keyword combinations that are semantically similar to the keywords. For example: keyword sentence vector A=(0.2,0.3,...,0.1), clause sentence vector B=(0.1,0.4,...,0.2). If the cosine value calculated by formula (2) is close to 1, it indicates that the two are highly similar in meaning.

[0101] By adding candidate words jointly identified by Word2Vec and BERT to the expanded dictionary, a keyword system is constructed. For example: original corpus: "edge protection"; expanded result: {edge operation, opening operation, foundation pit edge operation}.

[0102] This embodiment uses the term "edge protection" appearing in a certain clause as data input. First, the Word2Vec model is used to train word vectors based on construction safety corpus to obtain candidate synonyms for "edge protection," including "edge work" and "excavation pit edge." Then, the BERT model is used to predict: in the context of "construction personnel must perform [mask]," candidates such as "opening work" and "temporary protection" are predicted. Finally, cross-validation is performed: candidate words jointly identified by Word2Vec and BERT are added to the expanded dictionary. In the final dictionary, "edge protection" is expanded to: {edge work, excavation pit edge, opening work, temporary protection}.

[0103] Optionally, step S3 includes:

[0104] S301. Define 9 types of entities in the corpus unit. The 9 types of entities include: construction worker, construction location, construction activity, operation requirements, hazard source, potential risk, prevention measures, accident type, and disposal measures. Define 8 types of relations in the extended dictionary. The 8 types of relations include: location, carry out, follow, discover, trigger, take, generate, and adopt. Use the 9 types of entities as entity names and the 8 types of relations as relation types.

[0105] S302. Define the annotation rules for the format of entity first character - entity other characters - non-entity characters or punctuation marks;

[0106] S303. Based on the annotation rules, formulate specific annotation principles. Based on the annotation principles, annotate entity names and relation types to obtain triples, and construct entity-relation structure based on triples. The structure of triples is entity name-relation type-entity name. The annotation principles include: professional terminology integrity principle, longest match principle, entity category differentiation standard, minimum granularity principle, and nested entity hierarchy preservation principle.

[0107] In the above embodiments, the initial corpus is first analyzed and statistically analyzed, and a task-oriented semantic induction method is used to construct an entity and relation classification system. First, the frequently occurring semantic structures in the text are analyzed to summarize their implicit logical order and event relationships; then, combined with the keyword system constructed in the previous expanded dictionary, entity and relation categories are divided. Entities and their relationships form a knowledge association structure, such as typical scenario chains like "construction location → construction activity → work requirements → risk source → accident type → emergency response," etc. Figure 4 As shown in Table 1, the entity categories and semantic levels cover the entire process of construction activities, work specifications, risk identification, and emergency response, demonstrating strong structural rationality and domain representativeness. Named entity annotation adopts the BIO (Border I / O) system of sequence tagging, where B (Begin) represents the first character of the entity, I (Inside) represents the other characters of the entity, and O (Outside) represents non-entity characters or punctuation marks. Entity label definitions are shown in Table 1.

[0108]

[0109] To ensure consistency and accuracy in labeling, this study has developed strict guidelines, the specific rules of which are as follows.

[0110] Rule 1: Principle of Terminology Integrity. To maintain the semantic integrity of technical terms, technical terms should be labeled as a whole to avoid being segmented. For example, "concrete culvert" should be labeled as a single construction location entity (B-LOC, I-LOC, I-LOC, I-LOC, I-LOC), and "concrete" and "culvert" should not be labeled separately.

[0111] Rule 2: Longest Match Principle. Entity boundary determination prioritizes the longest match principle. That is, when a phrase may correspond to multiple entity types, the longest semantically complete segment is selected for annotation. For example, in the sentence: "The slope of the roadbed engineering slope excavation should meet safety requirements, and reverse slope excavation is strictly prohibited," "roadbed engineering slope" should be annotated as a complete construction location entity (B-LOC, I-LOC, I-LOC, I-LOC), while "excavation" should be annotated as a construction activity entity (B-ACT, I-ACT). Figure 5 As shown.

[0112] Rule 3: Entity Category Differentiation Criteria. When entity boundaries are ambiguous or category determination is difficult, such as when "Operational Requirements" and "Preventive Measures" are not clearly distinguishable in the text or have overlapping parts, a clear distinction criteria should be established: when the description focuses on safe operational requirements during construction, it should be labeled "Operational Requirements"; when it focuses on risk source identification and potential risk prevention, it should be labeled "Preventive Measures." For example, "The slope should meet safety requirements, and reverse slope excavation is strictly prohibited." This emphasizes safe operation and is labeled "Operational Requirements" (B-REQ, I-REQ, ...). "When cracks or collapse risks are discovered, people and machinery should be evacuated to a safe distance." This emphasizes risk source identification ("cracks discovered") and potential risk prevention ("collapse risk"), and therefore, "people and machinery should be evacuated to a safe distance" should be labeled "Preventive Measures" (B-PRE, I-PRE, ...).

[0113] Rule 4: Composite entities should be labeled using the principle of minimum granularity. For example, a long sentence such as "planar position adjustment after bracket installation" should be broken down into two independent entities: "bracket installation" (B-ACT, I-ACT, I-ACT, I-ACT) and "planar position adjustment" (B-REQ, I-REQ, I-REQ, I-REQ, I-REQ, I-REQ).

[0114] Rule 5: Nested entities must retain hierarchical relationships. A nested entity is one entity contained within another or intersecting with other entities. For nested entities, their hierarchical relationship information must be retained, identified by the entity's role in the triple (head entity / tail entity) and the relationship type. For example... Figure 3-5As shown, the entity "people and machinery evacuated to a safe distance" exists as a single head entity in the knowledge triple, while "collapse risk" serves as the tail entity of multiple triples and the head entity of other triples, demonstrating the multi-role characteristics of nested entities under different semantic relationships.

[0115] Safety training knowledge for highway construction workers is represented by triples (head entity, relation, tail entity). In the text corpus data feature analysis example above, there are various forms, including single-head entities, multi-head entities, single-tail entities, multi-tail entities, coexistence of single-head and single-tail entities, single-head and multi-tail entities, coexistence of multi-head and single-tail entities, and coexistence of multi-head and multi-tail entities, exhibiting typical nested entity characteristics. For example, "people and machinery evacuated to a safe distance" is only the head entity in the triple (people and machinery evacuated to a safe distance, prevention, collapse risk), and is not related to other triples, indicating that this entity exists in the form of a single-head entity. On the other hand, "collapse risk" is not only a common tail entity in the triples (people and machinery evacuated to a safe distance, prevention, collapse risk) and (crack, trigger, collapse risk), but also the head entity in the triple (collapse risk, generation, collapse accident), indicating that this entity coexists as a single-head entity and a multi-tail entity.

[0116] This embodiment uses the clause "Electrical work must be performed with insulating gloves" as an example. Entity identification: Electrical work (Activity), Insulating gloves (Requirement); Relationship annotation: Activity → require → Requirement; BIO annotation: B-Activity I-Activity O B-Requirement. Structured annotation data is generated: Entity: {Electrical work, Insulating gloves} Relationship: {Electrical work – require → Insulating gloves} BIO: B-Activity I-Activity O B-Requirement.

[0117] Optionally, the annotation platform used in S4 is Docano, which supports multi-user collaboration, rule pre-annotation, version management, and data export.

[0118] Optionally, in S5, the consistency evaluation uses Cohen's Kappa coefficient, which satisfies the following relationship:

[0119] (3)

[0120] In the formula, This represents the consistency evaluation coefficient. Indicates observational consistency. Indicates the probability of random consistency;

[0121] Coverage evaluation uses the F1-score, and the specific calculation satisfies the following relationship:

[0122] (4)

[0123] (5)

[0124] (6)

[0125] In the formula, Indicates the coverage assessment coefficient. Indicates the accuracy of the assessment. Indicates the assessment of recall. This represents the number of entities that were correctly identified by both annotators and whose boundaries and types are completely consistent. This indicates the number of entities that were identified by the second annotator but were not identified or were incorrectly identified by the first annotator. This indicates the number of entities that the first annotator identified but the second annotator did not identify or misidentified.

[0126] Set Kappa>0.8 and F1>0.85 as the quality acceptance standards.

[0127] Optionally, S5 also includes manual review and conflict resolution for samples with low consistency.

[0128] In this embodiment, 200 labeled samples were selected for each of the three semantic dimensions: operation control, risk prevention, and emergency response. Cohen's Kappa was used to measure the consistency of entity boundaries, and the macro-average F1 score was used to measure the effectiveness of relation labeling. The results show that the Kappa value of all sample sets is above 0.80, and the F1 score is above 0.85, indicating that the labeling has high consistency. Detailed results are shown in Table 2.

[0129]

[0130] In addition, experts reviewed 40 annotations for each sample set, finding occasional ambiguities in category assignment and a small number of segmentation errors in long technical expressions. Based on these observations, the study further refined the annotation guidelines, including enhancing boundary delimitation rules and introducing scenario-based disambiguation strategies. The overall expert review pass rate for the revised corpus reached 92%.

[0131] Optionally, S6 also includes:

[0132] When the consistency evaluation coefficient is less than or equal to the first preset threshold or the coverage evaluation coefficient is less than or equal to the second preset threshold, the annotation rules are adjusted, and new entity-relationship structures are obtained by re-annotating based on the adjusted annotation rules.

[0133] This application also provides a corpus construction system for highway construction safety training, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described in any one of the methods for corpus construction for highway construction safety training.

[0134] Optionally, a computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the method described in any one of the methods for constructing a corpus for highway construction safety training.

[0135] The preferred embodiments of the present invention have been described in detail above. It should be understood that those skilled in the art can make numerous modifications and variations based on the concept of the present invention without creative effort. Therefore, all technical solutions that can be obtained by those skilled in the art based on the concept of the present invention through logical analysis, reasoning, or limited experimentation on the basis of existing technology should be within the scope of protection defined by the claims.

Claims

1. A corpus construction method for highway construction safety training, characterized by, The method comprises the following steps: S1, obtaining initial corpus related to construction safety, and processing the initial corpus to obtain corpus units; S2, determining key words in the corpus units, constructing a word vector model to expand the semantic similarity of the key words to obtain first related approximate words, constructing a language representation model to expand the semantic similarity of the key words to obtain second related approximate words, determining candidate words based on the first related approximate words and the second related approximate words, and constructing an extended dictionary based on the candidate words; S3, determining entity names in the corpus units and relationship categories in the extended dictionary, constructing annotation rules for the entity names and the relationship categories, and annotating the entity names and the relationship categories based on the annotation rules to obtain an entity-relation structure; S4, multi-person collaborative annotation is performed on the entity-relation structure based on the annotation rules to obtain an artificial collaborative annotation structure; S5, consistency evaluation and coverage evaluation are performed on the entity-relation structure and the artificial collaborative annotation structure to obtain a consistency evaluation coefficient and a coverage evaluation coefficient; S6, when the consistency evaluation coefficient is greater than a first preset threshold and the coverage evaluation coefficient is greater than a second preset threshold, a structured corpus library is constructed based on the entity-relation structure; In S2, the extended dictionary is constructed based on the candidate words, comprising: S201, determining construction-related key words in the corpus units based on construction safety training purposes; S202, constructing a word vector model and inputting the key words into the word vector model to obtain first related approximate words expanded by the word vector model, wherein the word vector model is composed of an input layer, a hidden layer and an output layer, wherein the input layer is used to receive the key words and output key word corresponding word vector encoding, the hidden layer is used to receive the word vector encoding and output word vector encoding corresponding word vector, and the output layer is used to receive the word vector and output word vector corresponding first related approximate words; S203, constructing a language representation model and inputting the key words into the language representation model to obtain second related approximate words expanded by the language representation model, wherein the language representation model is composed of a pre-tuning module, a Transformer module and an Embedding module, wherein the pre-tuning module is used to receive the key words and a preset word vector expansion task, the Transformer module is used to generate corresponding word vectors based on the word vector expansion task and the key words, and the Embedding module is used to generate second related approximate words based on the word vectors; S204, selecting approximate words existing in the first related approximate words and the second related approximate words as candidate words, and constructing an extended dictionary based on the candidate words; In S5, the consistency evaluation is evaluated by Cohen's Kappa coefficient, and the specific calculation satisfies the following relationship: ; wherein denotes a conformity evaluation coefficient, denotes an observed conformity, denotes a random conformity probability; The coverage evaluation is evaluated by F1-score, and the specific calculation satisfies the following relationship: ; ; ; In the formula, denotes the coverage evaluation coefficient, denotes the evaluation accuracy, denotes the evaluation recall, denotes the number of entities that are correctly identified by both annotators and the boundaries and types of which are completely consistent, denotes the number of entities that are identified by the second annotator but not identified or incorrectly identified by the first annotator, denotes the number of entities that are identified by the first annotator but not identified or incorrectly identified by the second annotator.

2. The corpus construction method for highway construction safety training according to claim 1, wherein, S1 comprises: S101, extracting initial corpus from text files related to construction safety; S102, processing the initial corpus to obtain a corpus unit, wherein the processing manner comprises: performing OCR identification on the initial corpus, performing regular cleaning on the result obtained by the OCR identification, performing clause segmentation on the result obtained by the regular cleaning, and finally performing syntax analysis on the result obtained by the clause segmentation; S1021, the step of OCR identification comprises: performing optical character recognition on a scanned file in the initial corpus to convert the scanned file into processable text; S1022, the step of regular cleaning comprises: removing irrelevant symbols including headers, footers and serial numbers in the processable text; S1023, the step of clause segmentation comprises: constructing clause feature words, and performing semantic segmentation on the processable text after the regular cleaning to obtain segmented text according to the clause feature words; S1024, the step of syntax analysis comprises: parsing the subject-predicate-object structure in the segmented text to obtain a logically complete corpus unit.

3. The corpus construction method for highway construction safety training according to claim 1, wherein, The S202 comprises: S2021、In the input layer of the word vector model, the key words related to construction are taken as target words , target words are input to the input layer in the form of one-hot vectors; S2022、In the hidden layer of the word vector model, an input weight matrix is constructed The target word that has undergone one-hot encoding is mapped to a word vector of the target word by using the input weight matrix The dimension of the word vector is N, the number of the word vectors is V, and in the matrix is an element in the i-th row and the j-th column of the matrix is an element in the i-th row and the j-th column of the matrix is an element in the i-th row and the j-th column of the matrix S2023. Construct the output weight matrix in the output layer of the word vector model. The output weight matrix is ​​used to calculate the prediction of context words. word vectors Used to predict the current target word The probability of the corresponding context words appearing in the matrix For the first in the matrix Line number The elements of the column, according to probability prediction, satisfy the following relationship: ; wherein, is the target word, is the predicted word, is the given target word is the predicted word is the probability of occurrence of the predicted word; S2024, a preset similarity threshold, based on the word vector model output prediction word, and calculate the cosine similarity between the target word and the prediction word, the cosine similarity calculation satisfies the following relationship: ; wherein, denotes the cosine similarity, denotes the dot product of two sentence vectors, and denotes the Euclidean norm of a vector, n is the dimension of the vector, denotes the target word the corresponding word vector the vector representation in the cosine similarity formula, denotes the predicted word the corresponding word vector the vector representation in the cosine similarity formula, denotes the vector the element of the vector at position i, denotes the element of the vector at position i, at position i. S2025, when the cosine similarity is greater than the preset similarity threshold, the prediction word is taken as the first relevant approximate word of the word vector model expansion.

4. The corpus construction method for highway construction safety training according to claim 1, wherein, The S3 comprises: S301, defining 9 types of entities in the corpus unit, the 9 types of entities comprising: construction workers, construction locations, construction activities, work requirements, danger sources, potential risks, preventive measures, accident types and disposal measures, defining 8 types of relationships in the extended dictionary, the 8 types of relationships comprising: positioning, carrying out, following, discovering, triggering, taking, producing and adopting, taking the 9 types of entities as entity names and taking the 8 types of relationships as relationship categories; S302, formulating an annotation rule in the format of entity first character-entity other character-non-entity character or punctuation symbol; S303, formulating a specific annotation principle based on the annotation rule, annotating the entity names and relationship categories based on the annotation principle to obtain triples, and constructing an entity-relationship structure based on the triples, wherein the structure of the triples is entity name-relationship category-entity name, and the annotation principle comprises: professional term integrity principle, longest match principle, entity category differentiation standard, minimum granularity principle and nested entity level reservation principle.

5. The corpus construction method for highway construction safety training according to claim 1, wherein, The S6 further comprises: When the consistency evaluation coefficient is less than or equal to a first preset threshold or the coverage evaluation coefficient is less than or equal to a second preset threshold, adjusting the annotation rule, and re-annotating based on the adjusted annotation rule to obtain a new entity-relationship structure.

6. A corpus construction system for highway construction safety training, characterized by, A device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the method of any one of claims 1 to 5 when executing the computer program.

Citation Information

Patent Citations

  • Subway design specification text analysis and corpus construction method based on deep learning

    CN113626596A

  • Intelligent scheduling maintenance identification library construction method

    CN114996470A