A HAZOP named entity recognition and entity relationship extraction method

By using words segmentation, denoising, character distance judgment and bidirectional LSTM encoding in HAZOP named entity recognition and entity relationship extraction, the problems of word segmentation inaccuracy and spelling errors are solved, and the accuracy and analysis efficiency of entity extraction are improved. Suitable for HAZOP analysis and security management.

CN118761406BActive Publication Date: 2024-11-15CHINA SPECIAL EQUIP INSPECTION & RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411221663.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-02
Publication Date
2024-11-15
Estimated Expiration
2044-09-02

AI Technical Summary

Technical Problem

In the prior art, in the HAZOP named entity recognition and entity relationship extraction, inaccurate word segmentation leads to a decrease in the accuracy of entity extraction, and it is difficult to effectively deal with spelling errors and spelling deviations, affecting the efficiency and accuracy of analysis.

Method used

Using HAZOP named entity recognition and entity relationship extraction methods, high-quality vocabulary units are established through the steps of word segmentation, denoising, character distance judgment, splicing and word meaning judgment, and using bidirectional LSTM encoding and word embedding representation, combined with synonyms correction and semantic analysis, optimize model parameters to improve the accuracy of entity recognition and relationship extraction.

Benefits of technology

It improves word segmentation accuracy and accuracy, reduces deviations caused by typos and misspellings, enhances the accuracy of entity extraction, and provides higher quality data support, suitable for HAZOP analysis, risk assessment and safety management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118761406B_ABST
    Figure CN118761406B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of chemical safety analysis, and in particular to a HAZOP named entity recognition and entity relationship extraction method, which includes the following steps: a database establishment step, a text representation step, a word embedding representation step, a bidirectional LSTM encoding step, a named entity recognition step, a relationship extraction step, an optimization classification output step, and an output result step. The present application has the effect of improving the accuracy of entity recognition and relationship extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of chemical safety analysis, and in particular to a HAZOP named entity recognition and entity relationship extraction method. Background Art

[0002] At present, knowledge graphs can help integrate and manage a large amount of information related to HAZOP, including process flow, equipment parameters, safety standards, etc. By constructing a knowledge graph related to HAZOP, this information can be managed and utilized more effectively, improving the efficiency and accuracy of analysis. The knowledge graph can record and accumulate the experience and results of previous HAZOP analyses to form a knowledge base. By analyzing and mining historical data, potential patterns and laws can be discovered, providing reference and reference for the continuous improvement of HAZOP analysis methods and processes.

[0003] To realize the knowledge graph, a variety of technologies are needed, including entity recognition and relationship extraction, to identify entities in the text and link them to corresponding entities in the knowledge graph, and to extract the relationship between entities from the text.

[0004] In the prior art, entity recognition and relationship extraction include the following steps: text preprocessing: including word segmentation, part-of-speech tagging, removal of stop words, etc., to prepare text data for subsequent processing; feature extraction: extracting features from the text that may be useful for identifying entities, such as word form, part of speech, contextual information, syntactic structure, etc.; model training: using labeled data to train machine learning models or deep learning models, which can learn how to classify words or phrases in the text into different entity types; entity recognition: applying the trained model to process new text data to identify the entities and their corresponding categories; post-processing: correcting and optimizing the recognition results, such as solving the recognition problem of overlapping entities, merging adjacent similar entities, etc.; However, when performing text preprocessing, inaccurate word segmentation can easily lead to a large deviation from the actual meaning during subsequent entity recognition and extraction, resulting in a decrease in the accuracy of entity extraction. Summary of the invention

[0005] In order to improve the accuracy of entity recognition and relationship extraction, the present application provides a HAZOP named entity recognition and entity relationship extraction method.

[0006] In the first aspect, the present application provides a HAZOP named entity recognition and entity relationship extraction method, which adopts the following technical solution:

[0007] A HAZOP named entity recognition and entity relationship extraction method comprises the following steps:

[0008] Establish database: Extract keywords based on historical information and HAZOP analysis reports, and establish a database that stores entities and their entity relationships;

[0009] Text representation: preprocess the input text to form a word sequence, which includes word segmentation, part-of-speech tagging, word grouping and word meaning judgment;

[0010] Word segmentation: dividing text into meaningful lexical units;

[0011] Denoising: Remove stop words and common but meaningless words from the text;

[0012] Character distance judgment: Get the character distance between two adjacent vocabulary units and judge whether it is less than or equal to T. If so, execute the splicing step; otherwise, execute the word meaning judgment step;

[0013] Combining: combining two adjacent vocabulary units to form a new vocabulary unit, and then performing the word meaning judgment step;

[0014] Word meaning judgment: judge whether the meaning of the vocabulary unit is complete. If so, form a vocabulary unit set and perform the part-of-speech tagging step. Otherwise, re-execute the word segmentation step;

[0015] Part-of-speech tagging: Tagging words according to their part of speech in a vocabulary unit set;

[0016] Word embedding representation: Convert the preprocessed text into word embedding representation, and convert each word into a vector to represent its semantic information;

[0017] Bidirectional LSTM encoding: The word embedding vector sequence is input into the bidirectional LSTM to capture the contextual information between words and form context-related word vectors;

[0018] Named Entity Recognition: Use the model to perform named entity recognition on the output of the bidirectional LSTM;

[0019] Relation extraction: After identifying the named entities, perform relationship extraction to analyze the relationships between entities;

[0020] Optimize classification output: Use gradient descent and back-propagation algorithms to iteratively update model parameters;

[0021] Output: Combine the results of named entity recognition and relation extraction to generate the final output.

[0022] By adopting the above technical solution, according to the process production type of the chemical plant, and then combining the historical accident and failure information of the historical chemical plant and information such as HAZOP analysis reports, keyword extraction is carried out, and a database is established. Then, according to the text input by the query user, preprocessing is performed, word segmentation is carried out, and then stop words such as "de", "le", "zai" are removed. Then, character distance judgment is carried out. If it is less than or equal to T, it indicates that there may be misspelling or continuous spelling, and the merging step is executed to splice two adjacent lexical units. Then, the merged lexical unit and the original lexical unit are judged for word meaning. If the word meaning is complete, according to the part of speech, annotation is carried out, and the lexical unit set is represented by word embedding to form word embedding vectors. Then, bidirectional LSTM encoding is carried out to form context-related word vectors. Then, named entity recognition and relation extraction are executed, the model parameters are iteratively updated, and the two results are integrated to output the final result; Database establishment: The steps of establishing the database provide data support for subsequent text processing and model training. Through text preprocessing, combined with steps such as word segmentation, denoising, character distance judgment, merging, and word meaning judgment, this method can accurately segment the text into meaningful lexical units and carry out accurate part-of-speech annotation, providing high-quality input for subsequent word embedding and model processing, and can improve the accuracy and precision of word segmentation, be more in line with the meaning of the original text, reduce the deviation of the original text caused by misspelled words, misspellings, etc., and improve the efficiency and quality of text processing; and enable the output result to be directly used in fields such as HAZOP analysis, risk assessment, and safety management, with higher accuracy, and can provide strong data support for decision-makers, thereby improving the accuracy of entity recognition and relation extraction.

[0023] Optionally, between the character distance judgment step and the merging step, a near-synonym correction step and a semantic analysis step are also set;

[0024] Near-synonym correction: Obtain the characters between two adjacent lexical units, perform synonymous, homomorphic, and homophonic replacements, and match and screen in the database to judge whether they exist in the database. If so, retain the vocabulary existing in the database to form a replacement vocabulary set. Otherwise, execute the merging step;

[0025] Semantic analysis: Substitute the replacement vocabulary set into the original sentence to judge whether the semantic environment compliance degree is greater than the set compliance degree threshold G. If so, execute the sorting and screening step. Otherwise, execute the merging step;

[0026] Sorting and screening: Sort the replacement vocabulary greater than the set compliance degree threshold in descending order of the semantic environment compliance degree, and update it to the lexical unit to form multiple lexical unit sets.

[0027] By adopting the above technical solution, before the splicing step, synonym correction is performed, and the erroneous characters are replaced with synonyms, homographs, and homophones, and then matched with the entities existing in the database. If the same vocabulary exists, a replacement vocabulary set is formed and brought into the semantic environment to determine whether the degree of conformity is greater than the set conformity threshold. If so, the conformity is sorted to form a new semantic vocabulary set. Otherwise, the splicing step is directly executed. By setting the above method, spelling errors and incomplete vocabulary units caused by them are reduced, the repeated execution of steps is reduced, computing power is saved, word segmentation is made more accurate, deviation from the semantics of the original text is reduced, the accuracy of entity extraction is improved, and the increase of subsequent cumulative errors is reduced.

[0028] Optionally, a domain orientation acquisition step is provided before the synonym correction step;

[0029] Field-oriented acquisition: The focus is on acquiring the field or query authority of the text editor, and the synonym correction steps are performed based on the field or query authority direction.

[0030] By adopting the above technical solution, when conducting text queries, the field to which the text editor belongs or the process he is responsible for or the authority he is granted is obtained to make a bias. When making synonym corrections, the correction direction is changed to improve the directionality, reduce the correction deviation, further improve the accuracy of word segmentation, and then improve the accuracy of entity extraction.

[0031] Optionally, after the result outputting step, an updating step is further provided;

[0032] Update: Perform manual verification based on the output results, and update the verified replacement vocabulary into the database.

[0033] By adopting the above technical solution, after the result is output, the query result is authenticated, and the authenticated replacement vocabulary is added to the database, and the database is updated. By updating the entity vocabulary, the database is made more comprehensive.

[0034] Optionally, a repeated judgment step is provided between the character distance judgment step and the word meaning judgment step;

[0035] Repeat judgment: judge whether there are continuous repeated strings in the vocabulary unit. If so, execute the vocabulary optimization step. Otherwise, execute the word meaning judgment step.

[0036] Optimize vocabulary: filter the string, optimize vocabulary units, and then perform word meaning determination steps.

[0037] By adopting the above technical solution, after the character distance judgment step, whether there is a continuous repeated character string in the vocabulary unit, if so, the character string is removed from the current vocabulary unit to form a new vocabulary unit, so that the vocabulary unit is optimized, thereby improving the accuracy of word segmentation, facilitating subsequent processing steps, and improving the accuracy of entity extraction.

[0038] Optionally, a vocabulary optimization step is provided between the repeated determination step and the vocabulary optimization step;

[0039] Vocabulary optimization: obtain a vocabulary unit that is less than the character length Z, obtain two vocabulary units close to the vocabulary unit, obtain a character string of character length Z close to the vocabulary unit between two adjacent vocabulary units, and determine whether it is the same as the vocabulary unit. If so, execute the vocabulary optimization step.

[0040] By adopting the above technical solution, after completing the repeated judgment step, by obtaining a vocabulary less than the vocabulary length Z, and comparing it with the previous and next two vocabulary units, whether there is a repeated character string, if so, the vocabulary unit is removed from the vocabulary unit set, and the number and order of key vocabulary units of a single sentence are optimized. Through the above method, the accuracy of word segmentation is further improved, the error superposition of subsequent steps is reduced, and the accuracy of entity extraction is improved.

[0041] Optionally, in the part-of-speech tagging step, when performing part-of-speech tagging, the sentence sequence of the original text is obtained and sequence tagging is performed.

[0042] By adopting the above technical solution, through sequential annotation, the changes to the meaning of the original text are reduced, which is easy to read and understand, and can truly express the actual problems that users want to query, making the export of results more accurate and practical.

[0043] Optionally, a correction judgment step is further provided between the synonym correction step and the semantic analysis step;

[0044] Correction judgment: obtain the number of synonym corrections N in a single sentence, and judge whether it is greater than or equal to the correction limit number D. If so, execute the error reporting step, otherwise, execute the semantic analysis step;

[0045] Error report: Remind the query personnel to review the query text.

[0046] By adopting the above technical solution, by obtaining the number of synonym corrections in a single sentence and comparing it with the maximum correction limit, the occurrence of excessive modifications and corrections in a single sentence can be reduced, the distortion of the original sentence can be reduced, and the word segmentation effect can be improved, thereby further improving the accuracy of entity recognition and relationship extraction.

[0047] Optionally, after the sorting and screening step, a comprehensive calculation step is also provided;

[0048] Comprehensive calculation: Calculate the semantic health of each sentence , and then execute the semantic health judgment step, where the semantic health The calculation model is as follows:

[0049] ;

[0050] In the formula, is the semantic environment conformity of the i-th replacement vocabulary unit in a single sentence, is the weight of the i-th replacement vocabulary unit in a single sentence;

[0051] Semantic Health Judgment: Judgment Is it greater than or equal to the health threshold? , if so, perform the optimization replacement step;

[0052] Optimization replacement: Optimize multiple vocabulary unit sets and optimize and eliminate the vocabulary unit sets whose semantic health exceeds the health threshold.

[0053] By adopting the above technical solution, through comprehensive calculation steps, it is evaluated whether a single sentence deviates too much, and the vocabulary unit set used to replace the vocabulary that deviates too much from the original text is eliminated, thereby reducing the waste of computing power and reducing the impact of the extraction results with large deviations on the judgment of the query personnel, thereby improving the accuracy of entity recognition and relationship extraction.

[0054] Optionally, after the comprehensive calculation step, a first coefficient correction step is further provided;

[0055] First coefficient correction: Update the semantic health calculation model as follows:

[0056] .

[0057] By adopting the above technical solution, when the average semantic environment conformity of multiple replacement words in a single sentence is small, the semantic health is attenuated, and the vocabulary unit set is further optimized to reduce the waste of computing power. At the same time, the impact of extraction results with large deviations on the judgment of query personnel is reduced, thereby improving the accuracy of entity recognition and relationship extraction.

[0058] Optionally, after the comprehensive calculation step, a second coefficient correction step is further provided;

[0059] Second coefficient correction: Get the semantic environment conformity of the replacement vocabulary in each sentence less than the mitigation value of the semantic environment conformity Number of , the updated semantic health calculation model is as follows:

[0060] ;

[0061] In the formula, the calculation model of Z is as follows: .

[0062] By adopting the above technical solution, by obtaining an environment compliance value less than the semantic environment compliance mitigation value , and then combined with the actual number of replacement words, the semantic health is updated and calculated, the health is adjusted and attenuated, and the vocabulary unit set is further optimized to reduce the waste of computing power, improve the reliability of word segmentation, facilitate the subsequent vector conversion, and make entity recognition extraction more accurate.

[0063] In summary, the present application includes at least one of the following beneficial technical effects:

[0064] 1. Through text preprocessing, combined with word segmentation, denoising, character distance judgment, spelling and word meaning judgment, this method can accurately segment the text into meaningful vocabulary units and perform accurate part-of-speech tagging, providing high-quality input for subsequent word embedding and model processing, and can improve the precision and accuracy of word segmentation, be more in line with the meaning of the original text, reduce the original text deviation caused by typos, misspellings and other reasons, and improve the efficiency and quality of text processing; and the output results can be directly used in HAZOP analysis, risk assessment and safety management, etc., with higher accuracy, which can provide strong data support for decision makers, thereby improving the accuracy of entity extraction;

[0065] 2. Before the combination step, synonym correction is performed, and the wrong characters are replaced with synonyms, homographs, and homophones, and then matched with the entities in the database. If the same vocabulary exists, a replacement vocabulary set is formed and brought into the semantic environment to determine whether the degree of conformity is greater than the set conformity threshold. If so, the conformity is sorted to form a new semantic vocabulary set. Otherwise, the combination step is directly executed. By setting the above method, spelling errors are reduced, resulting in incomplete vocabulary units, repeated execution of steps is reduced, computing power is saved, word segmentation is more accurate, deviation from the original text semantics is reduced, the accuracy of entity extraction is improved, and the subsequent cumulative error increase is reduced.

[0066] 3. Through comprehensive calculation steps, evaluate whether there are too many deviations in a single sentence, eliminate the vocabulary unit sets used to replace vocabulary that deviate too much from the original text, reduce the waste of computing power, and at the same time reduce the impact of extraction results with large deviations on the judgment of query personnel, thereby improving the accuracy of entity recognition and relationship extraction. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] Figure 1is an overall flow chart of the extraction method in Example 1 of the present application;

[0068] Figure 2 It is a flowchart of the sub-steps of the text representation step in Example 1 of the present application;

[0069] Figure 3 This is a flow chart from the synonym correction step to the sorting and screening step in Example 2 of the present application;

[0070] Figure 4 is a flowchart of the update steps in Example 2 of the present application;

[0071] Figure 5 is a flowchart of repeating the judgment step to the vocabulary optimization step in Example 2 of the present application;

[0072] Figure 6 It is a flowchart of the correction judgment step and the error reporting step in Example 2 of the present application;

[0073] Figure 7 It is a flow chart from the comprehensive calculation step to the optimization replacement step in Example 2 of the present application. DETAILED DESCRIPTION

[0074] The following combination Figures 1 to 7 This application is described in further detail.

[0075] This embodiment discloses a HAZOP named entity recognition and entity relationship extraction method.

[0076] Example 1: Reference Figure 1 and Figure 2 ,HAZOP named entity recognition and entity relationship extraction method,including the following steps:

[0077] S1: Establish database: extract keywords based on historical data and establish a database that stores entities and their entity relationships;

[0078] Specifically, historical data is obtained from online data and historical safety analysis reports within relevant chemical systems; first, based on HAZOP analysis, the disordered and semi-structured safety evaluation information is converted into structured and standardized safety analysis knowledge, and then keywords are extracted to obtain entity vocabulary and entity relationships, which are stored as information data to form a database.

[0079] S2: Text representation: preprocess the input text to form a word sequence, which includes a word segmentation step S201, a denoising step S202, a character distance determination step S203, a splicing step S204, a word meaning determination step S205 and a part-of-speech tagging step S206;

[0080] S201: Word Segmentation: Split the text into meaningful lexical units;

[0081] Specifically, split the query text vocabulary given by the query person, which can be divided into single characters, two - character words, three - character words or multi - character words to form meaningful lexical units;

[0082] S202: Denoising: Remove stop words and eliminate common but meaningless words in the text;

[0083] Specifically, stop words usually refer to words that frequently appear in the text but have no practical meaning or contribution to the analysis and processing of the text; these words are often functional words in the context, such as prepositions, articles, conjunctions, etc. They usually do not help much in understanding the theme and structure of the text. Articles: such as "a", "an", "the" in English, and "一个", "这个" in Chinese. They are used to modify nouns but can often be ignored in text analysis; Conjunctions: such as "和", "但是", "因为", etc. These words are used to connect sentences or sentence components and also contribute limitedly to the core meaning of text analysis; Auxiliary words and modal particles: such as "的", "了", "呢" in Chinese. These words are mainly used to express mood or form sentence structures but can usually be regarded as noise in text processing. Removing the above - mentioned words facilitates the optimization of text processing and reduces the noise in subsequent entity extraction.

[0084] S203: Character Distance Judgment: Obtain the character distance between two adjacent lexical units and determine whether it is less than or equal to T. If so, execute the combination step; otherwise, execute the word - meaning judgment step;

[0085] Specifically, stop words are recorded as half a character, and other words are calculated according to the actual characters represented by the Chinese character length or word length. For example, "的" is recorded as half a character, and "时间" is recorded as four characters. Among them, the value of T is 2, that is, the maximum allowable error distance for one Chinese character. When the character distance is less than or equal to T, that is, when there are stop words, or single Chinese characters or two English words, it may be a misspelling or accidental input, and the combination step is executed; otherwise, the word - meaning judgment step is normally executed.

[0086] S204: Combination: Combine two adjacent lexical units to form a new lexical unit;

[0087] Specifically, combine two adjacent lexical units to reduce the incompleteness of words caused by misspelling, extra typing, etc.

[0088] S205: Word - meaning Judgment: Judge whether the word - meaning of the segmented words is complete. If so, form a lexical unit set and execute the part - of - speech tagging step; otherwise, re - execute the word - segmentation step;

[0089] Specifically, using pre-trained language models such as BERT, GPT, and ELMo, we can have a deeper semantic understanding of the text; these models are trained on large amounts of text data and can capture the complex relationships between words; by fine-tuning these models to adapt to specific entity extraction tasks, we can more effectively determine whether the meaning of a word is complete or correct.

[0090] S206: Part-of-speech tagging: tagging according to the part-of-speech of the vocabulary in the vocabulary unit set;

[0091] S3: Word embedding representation: Convert the preprocessed text into word embedding representation, converting each word into a vector to represent its semantic information;

[0092] S4: Bidirectional LSTM encoding: The word embedding vector sequence is input into the bidirectional LSTM to capture the contextual information between words and form context-related word vectors;

[0093] Specifically, the bidirectional LSTM learns the representation of words from left to right and from right to left respectively to form context-related word vectors; based on the bidirectional LSTM, the ELMo model introduces the concepts of residual connection and layer normalization to improve the stability and expressiveness of the model. These technologies enable ELMo to better capture the semantic features of words and to more flexibly adjust the representation capabilities of the model in different tasks; and the model uses a BiLSTM decoding model that integrates a multi-head attention mechanism, and its working steps are as follows:

[0094] Input encoding: Input the word embedding vector sequence into the BiLSTM layer to obtain the context-fused representation of each time step.

[0095] Multi-head attention: The output of BiLSTM is used as the input of the multi-head attention mechanism. Through the calculation process of multi-head attention, the model can learn the contextual dependencies of different positions. The multi-head attention mechanism first converts the output of BiLSTM into multiple sets of query Q (Query), key K and value V (Value) vectors through three different sets of linear projection matrices. These queries, keys and values ​​are divided into multiple "heads", each head processing a part of the dimension. This allows the model to learn different aspects of the input sequence in parallel. The linear projection is as follows:

[0096] ; ; ;

[0097] For each head, the dot product attention scores between the query and all keys are calculated, and then these scores are normalized using the softmax function so that the score of each element represents its importance to other elements in the sequence. Self-attention is calculated as follows:

[0098] ;

[0099] in, is the attention weight matrix, is the dimension of the key vector, and this division operation is used to scale the dot product to avoid the vanishing gradient problem.

[0100] Use the attention score from the previous step to perform a weighted sum of the values ​​to get the output of each head. The formula is as follows,

[0101] ;

[0102] is the output of each head, representing a weighted value vector.

[0103] Stitching and final linear projection: The formula is as follows:

[0104] ;

[0105] in, is the final output of the multi-head attention layer, is another linear projection matrix used to concatenate the outputs of all heads and transform them back to the original dimensional space.

[0106] Decoding process: Assume that the input of the decoder at each time step t is (which may be the output of the previous time step), then: ), is the decoder state at the current time step, is the state at the previous time step.

[0107] The output layer formula is as follows: ;

[0108] in, is the output of the current time step, is the weight matrix of the output layer, is the bias term. Through the above formula, the model can comprehensively utilize the rich context information provided by the multi-head attention mechanism and the powerful time series processing capability of BiLSTM at each step to generate accurate sequence output.

[0109] S5: Named Entity Recognition: Use a dedicated sub-model to perform named entity recognition on the output of the bidirectional LSTM;

[0110] Specifically, this sub-model is a classifier, which can be rule-based, traditional machine learning methods (such as support vector machines), or deep learning methods (such as neural networks);

[0111] S6: Relation extraction: After identifying the named entities, relation extraction is performed to analyze the relationships between entities;

[0112] Specifically, after the named entities are identified, another sub-model can be used for relationship extraction; the task of this sub-model is to analyze the relationship between the identified entities in the text, which is achieved through classifiers or other structures.

[0113] S7: Optimize classification output: Use gradient descent and back propagation algorithms to iteratively update model parameters;

[0114] S8: Output results: Combine the results of named entity recognition and relation extraction to generate the final output.

[0115] Specifically, the results of NER and RE are combined to generate the final output. This may include the label sequence of named entities and the relationship information between entities. These results can be used for various natural language processing tasks, such as information extraction, knowledge graph construction, etc.

[0116] Specifically, models for entity recognition and relation extraction are used to perform multiple related tasks simultaneously, such as named entity recognition (NER) and relation extraction (RE). Its goal is to exploit the correlation between tasks to improve the performance of each task; to this end, it is crucial to design an effective loss function that can guide the model to optimize all tasks simultaneously.

[0117] Its model loss function: entity recognition loss (NER) and relation extraction loss (RE). The final loss function is the weighted sum of these two parts, namely:

[0118] ;

[0119] in, and is a hyperparameter used to balance the losses of the two tasks.

[0120] The NER task uses a cross entropy loss function. For a given input sequence, the cross entropy between the probability distribution of each label output by the model and the probability distribution of the true label can be expressed as:

[0121] ;

[0122] Where N is the sequence length, C is the number of entity categories, is the true probability that the th character belongs to category c (either 0 or 1), is the probability that the model predicts that the i-th character belongs to category c.

[0123] The relation extraction task also uses cross entropy loss, which is calculated in a similar way to entity recognition loss. Assume that the cross entropy between the probability distribution of relation types predicted by the model and the probability distribution of the actual relation types is:

[0124] ;

[0125] Where M is the number of possible entity pairs, R is the number of relation categories, is the true probability (0 or 1) that the j-th entity pair has relationship r, is the probability that the model predicts that the j-th entity pair has relationship r.

[0126] Regularization, also known as weight decay, is one of the commonly used regularization methods. It adds the weight of model parameters to the loss function. The penalty term of the norm is used to reduce the size of the model parameters, thereby reducing the complexity of the model and preventing overfitting. is the loss weight for entity recognition, is the loss weight for relation extraction. yes Regularization term, yes Regularization term coefficient; .

[0127] The implementation principle of Example 1 of the present application is as follows: first, a database is established based on historical information, and then a text message is inputted in a simulated manner, the text information is preprocessed, it is segmented, and then stop words are removed, and then the segmentation is optimized through character distance judgment, splicing, and word meaning judgment to reduce unreasonable segmentation and deviation from the original meaning of the text, and then the vocabulary unit is converted into a vector representation through part-of-speech tagging and word embedding representation; then it is converted into a context-related word vector through bidirectional LSTM encoding, and then named entity recognition is performed, and relationship extraction is performed, and then the final result is obtained through optimized classification output.

[0128] Example 2: Reference Figure 3 The difference between this embodiment and the first embodiment is that between the character distance determination step and the combination step, a synonym correction step S207, a semantic analysis step S208 and a sorting and screening step S209 are provided;

[0129] S207: Synonym correction: obtain characters between two adjacent vocabulary units, perform synonymous, homomorphic, and homophonic replacement, and match and filter in the database to determine whether they exist in the database. If so, retain the vocabulary existing in the database to form a replacement vocabulary set and perform a semantic analysis step. Otherwise, perform a combination step;

[0130] S208: semantic analysis: substitute the replacement vocabulary set into the original sentence, determine whether the semantic environment conformity is greater than the set conformity threshold G, if so, perform the sorting and screening step, otherwise, perform the splicing step;

[0131] S209: Sorting and screening: sorting the replacement words with a degree of conformity greater than a set threshold value of conformity in descending order of semantic environment conformity, and updating them to vocabulary units to form a plurality of vocabulary unit sets.

[0132] Specifically, possible wrong words and wrong characters are replaced by synonyms, homographs, and homophones, and matched in the database to determine whether they exist. If they exist in the database, the vocabulary existing in the database is sorted to generate a replacement vocabulary set, and then the vocabulary with a degree of conformity greater than the conformity threshold is sorted according to the degree of conformity with the semantic environment, and updated to vocabulary units to form multiple parallel vocabulary unit sets for subsequent steps; the value of G is 85%-95%, which can be determined according to the severity or the severity level of the text information, or determined according to whether the entity belongs to a deviation, an initial cause, or an intermediate event.

[0133] Among them, the semantic environment conformity is obtained by using semantic dictionary-based methods, statistics-based methods and hybrid methods;

[0134] Methods based on semantic dictionaries include: Using semantic dictionaries: Organizing words in a tree or mesh structure through semantic dictionaries (such as WordNet, HowNet, etc.), and calculating the distance or similarity between the replacement word and the target word in the semantic structure. For example, the shortest path length can be used as a measure of semantic distance, or a similarity calculation method based on information content can be used.

[0135] Sememe analysis: In dictionaries such as HowNet, words are broken down into sememes (the most basic semantic units). By analyzing the sememe composition of the replacement word and the target word, the similarity between them can be calculated. This method takes into account multiple semantic levels of words, such as basic sememes, relational sememes, etc.

[0136] Statistical methods include: Context vector model: Using a large-scale corpus, deep learning models (such as Word2Vec, BERT, etc.) are used to learn the context vector representation of words. These vectors can capture the semantic information of words in different contexts. By comparing the vector representations of the replacement word and the target word, the semantic similarity between them can be calculated.

[0137] TF-IDF weight: Calculate the term frequency (TF) and inverse document frequency (IDF) of the replacement word and the target word in the text to obtain their importance weights in the text. These weights can then be used to evaluate the semantic consistency of the replacement word in the text.

[0138] Hybrid method: Combining semantic dictionary and statistical method: Combine semantic dictionary-based method and statistical method to more comprehensively evaluate the semantic consistency of replacement words in the text. For example, the basic semantic similarity of words can be calculated using semantic dictionary, and then the similarity can be fine-tuned using context vector model.

[0139] Reference Figure 3 In other embodiments, a domain pointing acquisition step is provided before the synonym correction step;

[0140] S210: Domain-oriented acquisition: Obtain the domain or query authority preference of the text editor, and focus on executing the synonym correction step according to the domain or query authority direction.

[0141] Specifically, by obtaining the text editor's work field, the process direction he is responsible for, and the query authority he is granted, the synonym correction step is performed to make the correction biased, making the word segmentation more accurate and consistent with the meaning of the original text.

[0142] Reference Figure 4 In other implementations, after the result outputting step, an updating step is further provided;

[0143] S9: Update: Perform manual authentication based on the output results, and update the authenticated replacement vocabulary into the database.

[0144] Specifically, after the results are output, the correctness of the entity vocabulary is deduced based on the directionality of the results, the entity vocabulary is corrected through manual authentication and recognition, and the corrected replacement vocabulary is updated in the database.

[0145] Reference Figure 5 In other embodiments, between the character distance determination step and the word meaning determination step, a repetition determination step, a vocabulary optimization step and a vocabulary optimization step are also provided;

[0146] S211: Repeat determination: determine whether there are continuous repeated character strings in the vocabulary unit. If yes, execute the vocabulary optimization step. Otherwise, execute the word meaning determination step.

[0147] S212: Vocabulary optimization: obtain a vocabulary unit whose character length is less than Z, obtain two vocabulary units close to the vocabulary unit, obtain a character string of character length Z close to the vocabulary unit between two adjacent vocabulary units, and determine whether it is the same as the vocabulary unit. If so, execute the vocabulary optimization step.

[0148] S213: Optimizing vocabulary: filtering the character string, optimizing vocabulary units, and then executing the word meaning determination step.

[0149] Specifically, when there are repetitive character strings in a vocabulary unit, it may be a single repeated word that is repeatedly typed. Through recognition and judgment, the repetitive character strings are eliminated and the vocabulary units are optimized to make the vocabulary units more consistent with the semantics of the original text; then, through the vocabulary optimization step, the vocabulary units with smaller character lengths are found, and then the actual character length of the current vocabulary unit is obtained, and then the two adjacent vocabulary units before and after the vocabulary unit are obtained, and a character string with a character length of Z is intercepted from the direction close to the current vocabulary unit to the direction away from the current vocabulary unit, and then whether it is the same as the current vocabulary unit. If so, the vocabulary optimization step is executed to optimize and filter the character string and update the vocabulary unit set; the value of Z can be determined based on wrong characters, incorrect spellings, and historical data. In this embodiment, it is preferably 4 characters, that is, the distance between two Chinese characters.

[0150] In other implementations, in the part-of-speech tagging step, when performing part-of-speech tagging, the sentence sequence of the original text is obtained and sequence tagging is performed.

[0151] Specifically, by obtaining the sentence order and punctuation marks of the original text, it is convenient to perform sequential editing of entity vocabulary, reduce the damage to the semantics of the original text, and improve the accuracy of entity extraction.

[0152] Reference Figure 6 In other embodiments, a correction judgment step is provided between the synonym correction step and the semantic analysis step;

[0153] S214: Correction judgment: Obtain the number of synonym corrections performed in a single sentence N, and judge whether it is greater than or equal to the correction limit number D. If so, execute the error reporting step, otherwise, execute the semantic analysis step;

[0154] S215: Error reporting: Remind the query personnel to review the query text.

[0155] Specifically, by obtaining the number of synonym corrections in a single semantics, it is determined whether there are a large number of error corrections in a single sentence. If so, the original text has omissions and cannot be correctly recognized. It is meaningless to continue entity recognition and relationship extraction. At this time, the error reporting step is executed to remind the query personnel to review the query text for correction; the value of D can be determined according to the length of the sentence and the number of meaningful words in the sentence, and shall not exceed one third of the meaningful words in a single sentence.

[0156] Reference Figure 7 In other embodiments, after the sorting and screening step, a comprehensive calculation step is also provided;

[0157] S216: Comprehensive calculation: Calculate the semantic health of each sentence , and then execute the semantic health judgment step, where the semantic health The calculation model is as follows:

[0158] ;

[0159] In the formula, is the semantic environment conformity of the i-th replacement vocabulary unit in a single sentence, is the weight of the i-th replacement vocabulary unit in a single sentence;

[0160] S217: First coefficient correction: Update the semantic health calculation model as follows:

[0161] ; In the formula, , It represents the mean of the semantic environment conformity of multiple replacement words in a single sentence;

[0162] Specifically, The value of depends on the importance of the information in the text, such as deviation, initial cause or intermediate event. The higher the importance, the larger the value.

[0163] S218: Second coefficient correction: Obtaining the semantic environment conformity of the replacement vocabulary in each sentence that is less than the semantic environment conformity mitigation value Number of , the updated semantic health calculation model is as follows:

[0164] ;

[0165] In the formula, , the calculation model of Z is as follows: .

[0166] S219: Semantic Health Judgment: Judgment Is it greater than or equal to the health threshold? , if so, perform the optimization replacement step;

[0167] S220: Optimization replacement: Optimize multiple vocabulary unit sets, and optimize and eliminate vocabulary unit sets whose semantic health exceeds the health threshold.

[0168] Specifically, after forming multiple relatively suitable replacement words, the semantic environment conformity of each replacement word is different. When the semantic environment conformity of multiple replacement words is low, it may cause cumulative errors, resulting in changes in the original intention. , calculate the healthiness, and make the healthiness more suitable by modifying the two coefficients, optimize the multiple vocabulary unit sets formed, reduce the subsequent steps to continue on the basis of errors, and improve the accuracy after word segmentation; among them, the critical value of healthiness It can be obtained through model training, historical data, or experimental trial and error; the semantic environment conformity mitigation value The value of is The intermediate value between 1 and 1. The specific value can be obtained based on historical data summary.

[0169] The implementation principle of Example 2 of the present application is as follows: after word segmentation, the query scope is determined by obtaining the field to which the query personnel belongs, and after judging that the character distance is less than T through the character distance judgment step, the synonym correction step is executed, and according to the query scope, a replacement vocabulary is formed by synonymous, homomorphic, and homophonic replacement, and then the replacement vocabulary is matched with the entity vocabulary existing in the database. If it exists in the database, it is retained and converted into a replacement vocabulary set, and then it is brought into the semantic environment, and the semantic environment conformity is calculated, and then it is compared with the conformity threshold to obtain a conforming replacement vocabulary, and then it is sorted and replaced with the original vocabulary unit, and multiple vocabulary unit sets are generated, and then after part-of-speech tagging and sentence order tagging, multiple vocabulary unit sets are updated for subsequent entity recognition and relationship extraction.

[0170] After entity extraction is completed, the replacement vocabulary is updated to the database through manual verification and recognition.

[0171] When the character length is greater than T, the repetition judgment step and the vocabulary optimization step are performed to eliminate and optimize the abnormal repetition parts within a single vocabulary unit, and to delete the repetition between the vocabulary unit and the preceding or following vocabulary, so as to reduce the impact on subsequent entity recognition and relationship extraction.

[0172] After the synonym correction step is completed, the number of corrections for a single sentence is obtained and the maximum number of corrections is compared to reduce the number of replacement words for a single sentence and reduce semantic deviation. In addition, the health calculation is performed and the health comparison is performed to further optimize the formed vocabulary unit set, so that the vocabulary set of the input word embedding model is more consistent with the original text semantics, thereby improving the accuracy of subsequent entity recognition and relationship extraction.

[0173] The above are all preferred embodiments of the present application, and the protection scope of the present application is not limited thereto. Therefore, any equivalent changes made according to the structure, shape, and principle of the present application should be included in the protection scope of the present application.

Claims

1. A method for HAZOP named entity recognition and entity relationship extraction, Features: The following steps are involved: Establish database: Extract keywords based on historical information and HAZOP analysis reports, and establish a database that stores entities and their entity relationships; Text representation: preprocess the input text to form a word sequence, which includes word segmentation, denoising, character distance judgment, splicing, word meaning judgment and part-of-speech tagging; Word segmentation: dividing text into meaningful lexical units; Denoising: Remove stop words and common but meaningless words from the text; Character distance judgment: Get the character distance between two adjacent vocabulary units and judge whether it is less than or equal to T. If so, execute the splicing step; otherwise, execute the word meaning judgment step; Combining: combining two adjacent vocabulary units to form a new vocabulary unit, and then performing the word meaning judgment step; Word meaning judgment: judge whether the meaning of the vocabulary unit is complete. If so, form a vocabulary unit set and perform the part-of-speech tagging step. Otherwise, re-execute the word segmentation step; Part-of-speech tagging: Tagging words according to their part of speech in a vocabulary unit set; Word embedding representation: Convert the preprocessed text into word embedding representation, and convert each word into a vector to represent its semantic information; Bidirectional LSTM encoding: The word embedding vector sequence is input into the bidirectional LSTM to capture the contextual information between words and form context-related word vectors; Named Entity Recognition: Use the model to perform named entity recognition on the output of the bidirectional LSTM; Relation extraction: After identifying the named entities, perform relationship extraction to analyze the relationships between entities; Optimize classification output: Use gradient descent and back-propagation algorithms to iteratively update model parameters; Output: Combine the results of named entity recognition and relation extraction to generate the final output; Between the character distance judgment step and the spelling step, there are also a synonym correction step, a semantic analysis step and a sorting and screening step; Synonym correction: Get the characters between two adjacent vocabulary units, replace them with synonyms, homographs, and homophones, and match and filter them in the database to determine whether they exist in the database. If so, retain the words in the database to form a replacement vocabulary set. Otherwise, perform the stitching step; Semantic analysis: Substitute the replacement vocabulary set into the original sentence to determine whether the semantic environment conformity is greater than the set conformity threshold. , if yes, then execute the sorting and screening step, otherwise, execute the splicing step; Sorting and screening: sort the replacement words with a degree greater than the set compliance threshold in descending order of semantic environment compliance, and update them to vocabulary units to form multiple vocabulary unit sets; Between the synonym correction step and the semantic analysis step, a correction judgment step is also provided; Correction judgment: obtain the number of synonym corrections N in a single sentence, and judge whether it is greater than or equal to the correction limit number D. If so, execute the error reporting step, otherwise, execute the semantic analysis step; Error reporting: reminding the query personnel to review the query text; After the sorting and screening step, a comprehensive calculation step is also provided; Comprehensive calculation: Calculate the semantic health of each sentence , and then execute the semantic health judgment step, where the semantic health The calculation model is as follows: ; In the formula, is the semantic environment conformity of the i-th replacement vocabulary unit in a single sentence, is the weight of the i-th replacement vocabulary unit in a single sentence; Semantic Health Judgment: Judgment Is it greater than or equal to the health threshold? , if so, perform the optimization replacement step; Optimization replacement: Optimize multiple vocabulary unit sets and optimize and remove vocabulary unit sets whose semantic health exceeds the health threshold; After the comprehensive calculation step, a first coefficient correction step is also provided; First coefficient correction: Update the semantic health calculation model as follows: ; In the formula, , It represents the mean of the semantic environment conformity of multiple replacement words in a single sentence.

2. The HAZOP named entity recognition and entity relationship extraction method according to claim 1, Features: A domain pointing acquisition step is also provided before the synonym correction step; Field-oriented acquisition: The focus is on acquiring the field or query authority of the text editor, and the synonym correction steps are performed based on the field or query authority direction.

3. The HAZOP named entity recognition and entity relationship extraction method according to claim 1, Features: After the result output step, an update step is also provided; Update: Perform manual verification based on the output results, and update the verified replacement vocabulary into the database.

4. The HAZOP named entity recognition and entity relationship extraction method according to claim 1, Features: A repetition judgment step is also provided between the character distance judgment step and the word meaning judgment step; Repeat judgment: judge whether there are continuous repeated strings in the vocabulary unit. If so, execute the vocabulary optimization step. Otherwise, execute the word meaning judgment step. Optimize vocabulary: filter the string, optimize vocabulary units, and then perform word meaning determination steps.

5. The HAZOP named entity recognition and entity relationship extraction method according to claim 4, Features: A vocabulary optimization step is also provided between the repeated judgment step and the vocabulary optimization step; Vocabulary optimization: obtain a vocabulary unit that is less than the character length Z, obtain two vocabulary units close to the vocabulary unit, obtain a character string of character length Z close to the vocabulary unit between two adjacent vocabulary units, and determine whether it is the same as the vocabulary unit. If so, execute the vocabulary optimization step.

6. The HAZOP named entity recognition and entity relationship extraction method according to claim 1, Features: After the comprehensive calculation step, a second coefficient correction step is also provided; Second coefficient correction: Get the semantic environment conformity of the replacement vocabulary in each sentence less than the mitigation value of the semantic environment conformity Number of , the updated semantic health calculation model is as follows: ; In the formula, , the calculation model of Z is as follows: .