Nuclear power entity classification method and device, electronic device and storage medium
By using an entity classification model to perform multi-level processing on nuclear power plant texts, the problem of poor entity classification results in nuclear power plants has been solved, enabling efficient management and retrieval of nuclear power plant documents.
Patent Information
- Application Number
- CN202510041877.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-12-26
- Estimated Expiration
- 2045-01-10
AI Technical Summary
In existing technologies, the classification of nuclear power entities is poor, failing to effectively consider the impact of nuclear power-specific terminology on entity classification models, resulting in nuclear power plant documentation being difficult to find and easily lost.
An entity classification model is used to process target nuclear power text, including knowledge retrieval, multi-level text encoding, feature fusion and entity edge detection. The accuracy of nuclear power entity classification is improved by using a first text encoding layer, a second text encoding layer, a feature fusion layer and an entity classification layer.
It significantly improved the effectiveness of nuclear power entity classification, ensured the efficiency of finding and managing nuclear power plant documents, and reduced the risk of document loss.
Smart Images

Figure CN120067326B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of nuclear power entity detection, and in particular to a nuclear power entity classification method and device, an electronic device, and a storage medium. BACKGROUND
[0002] Nuclear power entity classification is an important content for efficient management of nuclear power related documents by nuclear power plants. However, as the categories of nuclear power related documents (such as nuclear reaction types, nuclear facilities and equipment, safety measures in engineering, etc.) continue to increase, the information sorting and information query difficulty for nuclear power plant related institutions, units and individuals continues to increase, and the situation of difficulty in finding and even loss of nuclear power plant documents may occur.
[0003] Currently, entity classification is usually performed by a deep learning model (such as Lattice Long Short-Term Memory, Lattice LSTM) to identify the entity categories of a text. However, this method does not consider the influence of nuclear power field specific terms in nuclear power related texts on the recognition performance of the entity classification model, resulting in poor effect of nuclear power entity classification. Therefore, how to improve the effect of nuclear power entity classification is still a difficult problem to be solved in the industry. SUMMARY
[0004] The present application aims to at least solve one of the technical problems existing in the prior art. To this end, the present application proposes a nuclear power entity classification method and device, an electronic device, and a storage medium, which can improve the effect of nuclear power entity classification.
[0005] The nuclear power entity classification method according to the first aspect of the present application comprises:
[0006] obtaining a target nuclear power text, and performing knowledge retrieval on the target nuclear power text from a preset nuclear power knowledge base to obtain a retrieved nuclear power knowledge text;
[0007] obtaining a pre-trained entity classification model; wherein the entity classification model comprises a first text encoding layer, a second text encoding layer, a feature fusion layer, an entity edge detection layer, and an entity classification layer;
[0008] performing first encoding on the target nuclear power text by using the first text encoding layer to obtain first nuclear power text features;
[0009] performing first encoding on the retrieved nuclear power knowledge text by using the first text encoding layer to obtain first retrieved knowledge text features;
[0010] performing second encoding on the target nuclear power text by using the second text encoding layer to obtain second nuclear power text features;
[0011] The second search knowledge text feature is obtained by performing second coding on the search nuclear power knowledge text by using the second text coding layer.
[0012] The first nuclear power text feature, the second nuclear power text feature, the first search knowledge text feature and the second search knowledge text feature are fused by the feature fusion layer to obtain a fused nuclear power text feature.
[0013] The fused nuclear power text feature is subjected to entity edge detection by the entity edge detection layer to obtain a nuclear power entity edge feature.
[0014] In the entity classification layer, the fused nuclear power text feature is subjected to entity classification according to the nuclear power entity edge feature to obtain a target nuclear power entity category.
[0015] According to some embodiments of the present application, the first coding of the target nuclear power text to obtain a first nuclear power text feature comprises:
[0016] The target nuclear power text is subjected to word segmentation to obtain a target nuclear power character.
[0017] The target nuclear power character is subjected to relative position coding to obtain a relative position coding table.
[0018] The target nuclear power character is subjected to character position embedding processing based on a preset character coding table and the relative position coding table to obtain a nuclear power character position sequence.
[0019] The target nuclear power character is subjected to entity marking to obtain a nuclear power character entity.
[0020] The target nuclear power text is subjected to attention processing according to the nuclear power character position sequence and the nuclear power character entity to obtain the first nuclear power text feature.
[0021] According to some embodiments of the present application, the attention processing of the target nuclear power text according to the nuclear power character position sequence and the nuclear power character entity to obtain the first nuclear power text feature comprises:
[0022] The target nuclear power text is subjected to query feature extraction according to the nuclear power character position sequence and a preset query parameter matrix to obtain a nuclear power character query feature.
[0023] The target nuclear power text is subjected to key feature extraction according to the nuclear power character position sequence, the nuclear power character entity, a preset key parameter matrix and a preset entity coding table to obtain a nuclear power character key feature.
[0024] extracting value features of the target nuclear power text according to the nuclear power character position sequence, the nuclear power character entity, a preset value parameter matrix, and the entity coding table, to obtain nuclear power character value features;
[0025] performing attention weighting on the nuclear power character query features, the nuclear power character key features, and the nuclear power character value features, to obtain the first nuclear power text features.
[0026] According to some embodiments of the present application, the second encoding of the target nuclear power text to obtain second nuclear power text features comprises:
[0027] transforming the target nuclear power text into a nuclear power token sequence;
[0028] performing word embedding processing on the nuclear power token sequence to obtain a nuclear power token vector;
[0029] performing attention encoding on the nuclear power token vector to obtain the second nuclear power text features.
[0030] According to some embodiments of the present application, the fusion of the first nuclear power text features, the second nuclear power text features, the first search knowledge text features, and the second search knowledge text features to obtain fused nuclear power text features comprises:
[0031] performing cross-attention weighting processing on the first nuclear power text features and the second nuclear power text features to obtain initial fused nuclear power text features;
[0032] splicing the initial fused nuclear power text features and the first nuclear power text to obtain spliced nuclear power text features;
[0033] performing cross-attention weighting processing on the first search knowledge text features and the second search knowledge text features to obtain initial fused knowledge text features;
[0034] splicing the initial fused nuclear knowledge text features and the first nuclear knowledge text to obtain spliced knowledge text features;
[0035] splicing the spliced nuclear power text features and the spliced knowledge text features to obtain spliced nuclear knowledge text features;
[0036] performing linear transformation on the spliced nuclear knowledge text features to obtain the fused nuclear power text features.
[0037] According to some embodiments of the present application, the entity edge detection of the fused nuclear power text features to obtain nuclear power entity edge features comprises:
[0038] perform entity label prediction on the fusion nuclear power text feature to obtain a predicted nuclear power label entity label;
[0039] perform label score calculation on the predicted nuclear power label entity label through a preset transition matrix and a preset emission matrix to obtain an entity label score;
[0040] obtain a true nuclear power label entity label of the fusion nuclear power text feature, and perform entity edge detection on the fusion nuclear power text feature according to the true nuclear power label entity label, the predicted nuclear power label entity label and the entity label score to obtain a nuclear power entity edge feature.
[0041] According to some embodiments of the present application, the performing entity classification on the fusion nuclear power text feature according to the nuclear power entity edge feature to obtain a target nuclear power entity class includes:
[0042] perform character component recognition on the fusion nuclear power text feature to obtain a nuclear power character component feature;
[0043] perform entity class recognition on the nuclear power entity edge feature according to the nuclear power character component feature to obtain the target nuclear power entity class.
[0044] According to some embodiments of the present application, the performing character component recognition on the fusion nuclear power text feature to obtain a nuclear power character component feature includes:
[0045] perform character recognition on the fusion nuclear power text feature to obtain a target nuclear power character feature;
[0046] perform component recognition on the fusion nuclear power text feature to obtain a target nuclear power component feature;
[0047] splicing the target nuclear power character feature and the target nuclear power component feature to obtain the nuclear power character component feature.
[0048] According to some embodiments of the present application, the performing entity class recognition on the nuclear power character component feature according to the nuclear power entity edge feature to obtain the target nuclear power entity class includes:
[0049] splicing the nuclear power entity edge feature and the nuclear power character component feature to obtain a spliced nuclear power entity feature;
[0050] performing entity class probability prediction on the spliced nuclear power entity feature to obtain a nuclear power entity class probability;
[0051] selecting a nuclear power entity class with the highest nuclear power entity class probability as the target nuclear power entity class.
[0052] According to some embodiments of the present application, the knowledge retrieval of the target nuclear power text from the preset nuclear power knowledge base comprises:
[0053] Obtaining the index category of the target nuclear power text;
[0054] Obtaining the candidate nuclear power knowledge text of the nuclear power knowledge base according to the index category;
[0055] Calculating the text similarity between the candidate nuclear power knowledge text and the target nuclear power text, and selecting the candidate nuclear power knowledge text with the highest text similarity as the retrieved nuclear power knowledge text.
[0056] According to some embodiments of the present application, before the obtaining of the pre-trained entity classification model, further comprising:
[0057] Obtaining training nuclear power text and an original entity classification model, and obtaining the true entity category of the training nuclear power text;
[0058] First encoding the training nuclear power text through the first text encoding layer to obtain first training nuclear power text features;
[0059] Second encoding the training nuclear power text through the second text encoding layer to obtain second training nuclear power text features;
[0060] Fusing the first training nuclear power text features and the second training nuclear power text features through the feature fusion layer to obtain fused training nuclear power text features;
[0061] Performing entity edge detection on the fused training nuclear power text features through the entity edge detection layer to obtain training nuclear power entity edge features;
[0062] In the entity classification layer, performing entity classification prediction on the fused training nuclear power text features according to the training nuclear power entity edge features to obtain a predicted entity category;
[0063] Calculating the loss value of the predicted entity category and the true entity category according to a preset loss function;
[0064] Updating the model parameters of the entity classification model based on the loss value, returning to perform first encoding of the training nuclear power text through the first text encoding layer until the entity classification model meets a preset training condition, and obtaining the pre-trained entity classification model.
[0065] According to some embodiments of the present application, the calculation of the loss value of the predicted entity category and the true entity category according to a preset loss function comprises:
[0066] obtain an edge detection loss function of the training nuclear power entity edge feature, and obtain an edge loss function weight of the edge detection loss function;
[0067] obtain a classification loss function of the predicted entity category, and obtain a classification loss function weight of the classification loss function;
[0068] According to the edge detection loss function, the edge loss function weight, the classification loss function, and the classification loss function weight, a loss value of the predicted entity category and the real entity category is calculated.
[0069] According to the second aspect of the embodiment of the application, the nuclear power entity classification device comprises:
[0070] The knowledge retrieval module is configured to obtain target nuclear power text, and perform knowledge retrieval on the target nuclear power text from a preset nuclear power knowledge base to obtain retrieved nuclear power knowledge text.
[0071] The entity classification model acquisition module is configured to acquire a pre-trained entity classification model, wherein the entity classification model comprises a first text encoding layer, a second text encoding layer, a feature fusion layer, an entity edge detection layer, and an entity classification layer.
[0072] The nuclear power text first encoding module is configured to perform first encoding on the target nuclear power text by using the first text encoding layer to obtain first nuclear power text features.
[0073] The nuclear power knowledge text first encoding module is configured to perform first encoding on the retrieved nuclear power knowledge text by using the first text encoding layer to obtain first retrieved knowledge text features.
[0074] The nuclear power text second encoding module is configured to perform second encoding on the target nuclear power text by using the second text encoding layer to obtain second nuclear power text features.
[0075] The nuclear power knowledge text second encoding module is configured to perform second encoding on the retrieved nuclear power knowledge text by using the second text encoding layer to obtain second retrieved knowledge text features.
[0076] The feature fusion module is configured to fuse the first nuclear power text features, the second nuclear power text features, the first retrieved knowledge text features, and the second retrieved knowledge text features by using the feature fusion layer to obtain fused nuclear power text features.
[0077] The entity edge detection module is configured to perform entity edge detection on the fused nuclear power text features by using the entity edge detection layer to obtain nuclear power entity edge features.
[0078] The entity classification module is configured to perform entity classification on the fusion nuclear power text feature according to the nuclear power entity edge feature in the entity classification layer, to obtain a target nuclear power entity category.
[0079] In a third aspect, an electronic device is provided, which includes a memory and a processor. The memory stores a computer program. The processor implements the method of nuclear power entity classification according to any one of the embodiments of the first aspect of the present application when executing the computer program.
[0080] In a fourth aspect, a computer readable storage medium is provided, which stores a program. The program is executed by a processor to implement the method of nuclear power entity classification according to any one of the embodiments of the first aspect of the present application.
[0081] According to the method and device of nuclear power entity classification, the electronic device, and the storage medium, the following beneficial effects are achieved. According to the method of nuclear power entity classification, a target nuclear power text is obtained, and knowledge retrieval is performed on the target nuclear power text from a preset nuclear power knowledge base to obtain a retrieved nuclear power knowledge text. A pre-trained entity classification model is obtained. The entity classification model includes a first text encoding layer, a second text encoding layer, a feature fusion layer, an entity edge detection layer, and an entity classification layer. The first text encoding layer is used to perform first encoding on the target nuclear power text to obtain a first nuclear power text feature. The first text encoding layer is used to perform first encoding on the retrieved nuclear power knowledge text to obtain a first retrieved knowledge text feature. The second text encoding layer is used to perform second encoding on the target nuclear power text to obtain a second nuclear power text feature. The second text encoding layer is used to perform second encoding on the retrieved nuclear power knowledge text to obtain a second retrieved knowledge text feature. The feature fusion layer is used to fuse the first nuclear power text feature, the second nuclear power text feature, the first retrieved knowledge text feature, and the second retrieved knowledge text feature to obtain a fusion nuclear power text feature. The entity edge detection layer is used to perform entity edge detection on the fusion nuclear power text feature to obtain a nuclear power entity edge feature. In the entity classification layer, entity classification is performed on the fusion nuclear power text feature according to the nuclear power entity edge feature to obtain a target nuclear power entity category. In this way, the effect of nuclear power entity classification can be improved.
[0082] Additional aspects and advantages of the application will be made apparent by the following description and the appended claims. BRIEF DESCRIPTION OF DRAWINGS
[0083] The above and / or additional aspects and advantages of the application will become apparent and be made clear to the reader by the following description and the appended claims, taken in conjunction with the accompanying drawings.
[0084] Figure 1A flowchart of a nuclear power entity classification method provided by an embodiment of the present application is shown in FIG. 1.
[0085] Figure 2 A flowchart of step S101 in FIG. 1 is shown in FIG. 2. Figure 1
[0086] Figure 3 Another flowchart of a nuclear power entity classification method provided by an embodiment of the present application is shown in FIG. 3.
[0087] Figure 4 A flowchart of step S307 in FIG. 3 is shown in FIG. 4. Figure 3
[0088] Figure 5 A flowchart of step S103 in FIG. 1 is shown in FIG. 5. Figure 1
[0089] Figure 6 A flowchart of step S505 in FIG. 5 is shown in FIG. 6. Figure 5
[0090] A flowchart of step S105 in FIG. 1 is shown in FIG. 7. Figure 7 Figure 1 A flowchart of step S107 in FIG. 7 is shown in FIG. 8.
[0091] Figure 8 Figure 1 A flowchart of step S108 in FIG. 8 is shown in FIG. 9.
[0092] Figure 9 A flowchart of step S109 in FIG. 9 is shown in FIG. 10. Figure 1
[0093] Figure 10 A flowchart of step S1001 in FIG. 10 is shown in FIG. 11. Figure 1
[0094] Figure 11 A flowchart of step S1002 in FIG. 11 is shown in FIG. 12. Figure 10
[0095] A flowchart of step S1002 in FIG. 11 is shown in FIG. 12. Figure 12 Figure 10 A structure diagram of a nuclear power entity classification apparatus provided by an embodiment of the present application is shown in FIG. 13.
[0096] Figure 13 A hardware structure diagram of an electronic device provided by an embodiment of the present application is shown in FIG. 14.
[0097] DETAILED DESCRIPTION Figure 14
[0098] Embodiments of the present application are described below in detail, examples of which are shown in the drawings, wherein the same or similar notations represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the drawings are exemplary only, for the purpose of explaining the present application, and should not be understood as a limitation of the present application.
[0099] In the description of the present application, the meaning of one or more is one or more, the meaning of multiple is two or more, greater than, less than, more than, etc. are understood as not including the number, above, below, within, etc. are understood as including the number. If it is described as first, second, it is only for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features or the sequence of indicated technical features.
[0100] In the description of the present application, it should be understood that the orientation description, such as the orientation or position relationship indicated by up, down, left, right, front, back, etc. is based on the orientation or position relationship shown in the drawings, which is only for the purpose of describing the present application and simplifying the description, and is not intended to indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation of the present application.
[0101] In the description of the present application, the description of the terms "one embodiment", "some embodiments", "exemplary embodiment", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In the present description, the exemplary description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0102] In the description of the present application, it should be noted that, unless otherwise explicitly limited, the words such as setting, installing, connecting, etc. should be broadly understood, and those skilled in the art can reasonably determine the specific meaning of the above words in the present application in combination with the specific content of the technical solution. In addition, the identification of the specific steps in the following does not represent the limitation of the order and execution logic of the steps, and the execution order and execution logic between the steps should be understood and inferred with reference to the content described in the embodiments.
[0103] Nuclear power entity classification is an important content for nuclear power plant to efficiently manage nuclear power related documents. However, with the continuous increase of various categories of nuclear power related documents (such as nuclear reaction types, nuclear facilities and equipment, safety measures in engineering, etc.), the information sorting and information query difficulty of nuclear power plant related institutions, units and individuals is increasing, and the situation that the nuclear power plant documents are difficult to find or even lost may occur.
[0104] Currently, entity classification is usually performed by a deep learning model (such as Lattice Long Short-Term Memory, Lattice LSTM) to identify the entity category of the text. However, this method does not consider the influence of the nuclear power field-specific terms in the text related to nuclear power on the recognition performance of the entity classification model, resulting in poor effect of nuclear power entity classification. Therefore, how to improve the effect of nuclear power entity classification is still a difficult problem to be solved in the industry.
[0105] Therefore, using an entity classification model to perform entity classification on the target nuclear power text can effectively consider the influence of the nuclear power field-specific terms in the text related to nuclear power on the recognition performance of the entity classification model, and help to improve the application effect of the entity classification model in the nuclear power field.
[0106] The present application aims to at least solve one of the technical problems existing in the prior art. To this end, the present application proposes a nuclear power entity classification method and device, electronic equipment and storage medium, which can improve the effect of nuclear power entity classification.
[0107] Further explanation is made below based on the accompanying drawings:
[0108] Reference Figure 1 According to the nuclear power entity classification method of the present application, the nuclear power entity classification method can include, but is not limited to:
[0109] Step S101, obtaining a target nuclear power text, and performing knowledge retrieval on the target nuclear power text from a pre-set nuclear power knowledge base to obtain a retrieved nuclear power knowledge text;
[0110] Step S102, obtaining a pre-trained entity classification model; wherein the entity classification model includes a first text encoding layer, a second text encoding layer, a feature fusion layer, an entity edge detection layer and an entity classification layer;
[0111] Step S103, using the first text encoding layer to perform first encoding on the target nuclear power text to obtain first nuclear power text features;
[0112] Step S104, using the first text encoding layer to perform first encoding on the retrieved nuclear power knowledge text to obtain first retrieved knowledge text features;
[0113] Step S105, using the second text encoding layer to perform second encoding on the target nuclear power text to obtain second nuclear power text features;
[0114] Step S106, using the second text encoding layer to perform second encoding on the retrieved nuclear power knowledge text to obtain second retrieved knowledge text features;
[0115] In step S107, the first nuclear power text feature, the second nuclear power text feature, the first search knowledge text feature, and the second search knowledge text feature are fused by a feature fusion layer to obtain a fused nuclear power text feature.
[0116] In step S108, the fused nuclear power text feature is subjected to entity edge detection by an entity edge detection layer to obtain a nuclear power entity edge feature.
[0117] In step S109, the fused nuclear power text feature is subjected to entity classification according to the nuclear power entity edge feature in an entity classification layer to obtain a target nuclear power entity category.
[0118] According to the nuclear power entity classification method shown in steps S101 to S109 of some embodiments of the present application, a target nuclear power text is obtained, and knowledge search is performed on the target nuclear power text from a preset nuclear power knowledge base to obtain a search nuclear power knowledge text. A pre-trained entity classification model is obtained. The entity classification model includes a first text encoding layer, a second text encoding layer, a feature fusion layer, an entity edge detection layer, and an entity classification layer. The target nuclear power text is first encoded by the first text encoding layer to obtain a first nuclear power text feature. The search nuclear power knowledge text is first encoded by the first text encoding layer to obtain a first search knowledge text feature. The target nuclear power text is second encoded by the second text encoding layer to obtain a second nuclear power text feature. The search nuclear power knowledge text is second encoded by the second text encoding layer to obtain a second search knowledge text feature. The first nuclear power text feature, the second nuclear power text feature, the first search knowledge text feature, and the second search knowledge text feature are fused by the feature fusion layer to obtain a fused nuclear power text feature. The fused nuclear power text feature is subjected to entity edge detection by the entity edge detection layer to obtain a nuclear power entity edge feature. The fused nuclear power text feature is subjected to entity classification according to the nuclear power entity edge feature in the entity classification layer to obtain a target nuclear power entity category. In this way, the effect of nuclear power entity classification can be improved.
[0119] In step S101 of some embodiments, specifically, the target nuclear power text can be a nuclear reaction type of a nuclear power plant, a nuclear facility and equipment related maintenance log, an operation manual, a safety report, and the like.
[0120] Specifically, the target nuclear power text can be text data extracted from a maintenance log, an operation manual, or a safety report of a nuclear power plant, and the text data contains rich nuclear power field information, such as device name, operation procedure, technical parameter, and the like.
[0121] Referring to Figure 2 According to some embodiments of the present application, step S101 performs knowledge search on the target nuclear power text from a preset nuclear power knowledge base to obtain a search nuclear power knowledge text, which can include, but is not limited to:
[0122] In step S201, an index category of the target nuclear power text is obtained.
[0123] In step S202, a candidate nuclear power knowledge text of the nuclear power knowledge base is obtained according to the index category.
[0124] In step S203, a text similarity between the candidate nuclear power knowledge text and the target nuclear power text is calculated, and a candidate nuclear power knowledge text with the highest text similarity is selected as the retrieval nuclear power knowledge text.
[0125] In step S101, the embodiment of the present application obtains the retrieval nuclear power knowledge text by performing knowledge retrieval on the target nuclear power text from the preset nuclear power knowledge base, and can find professional nuclear power knowledge related to the target nuclear power text, thereby providing a nuclear power data basis for subsequent entity classification. This process can include several sub-steps.
[0126] In step S201 of some embodiments, specifically, the index category can be a category determined based on the content of the target nuclear power text, such as nuclear power plant equipment, operation procedures, safety protocols, etc.
[0127] Specifically, through the index category of the target nuclear power text, the retrieval range of the knowledge base can be effectively reduced, thereby facilitating subsequent improvement of the efficiency of knowledge retrieval.
[0128] In step S202 of some embodiments, specifically, the nuclear power knowledge base refers to a database storing a large amount of professional knowledge in the nuclear power field, and the nuclear power knowledge base includes device information, operation standards, historical events, and technical specifications of the nuclear power plant, etc.
[0129] Specifically, the candidate nuclear power knowledge text refers to a document or record in the knowledge base that is similar to the target nuclear power text.
[0130] Specifically, the index category of the target nuclear power text is used as a retrieval tag, and a category tag with the same category as the retrieval category is retrieved in the nuclear power knowledge base, and all candidate nuclear power knowledge texts similar to the target nuclear power text in the knowledge base are obtained according to the category tag.
[0131] Specifically, obtaining the candidate nuclear power knowledge text of the nuclear power knowledge base according to the index category can provide basic data for subsequent text similarity calculation.
[0132] In step S203 of some embodiments, specifically, the retrieval nuclear power knowledge text refers to a nuclear power database text with the highest similarity to the target nuclear power text.
[0133] Specifically, the candidate nuclear power knowledge text and the target nuclear power knowledge text can be converted into vector representations by Word2Vec, and the text similarity between the candidate nuclear power knowledge text and the target nuclear power text can be calculated by methods such as cosine similarity or Euclidean distance. The cosine similarity measures the similarity between two vectors by calculating the cosine of the angle between them, with a value ranging from -1 (completely dissimilar) to 1 (completely similar); the Euclidean distance determines the similarity by measuring the distance between two vectors in Euclidean space, and the smaller the distance, the higher the similarity.
[0134] Further, by selecting the candidate nuclear power knowledge text with the highest text similarity as the retrieval nuclear power knowledge text, it is ensured that the final selected retrieval nuclear power knowledge text is most similar in content to the target nuclear power text. Since the retrieval nuclear power knowledge text contains the most relevant nuclear power domain knowledge to the target nuclear power text, it provides key information for subsequent entity classification, which helps the subsequent model to better understand and classify the entities in the target nuclear power text, effectively improving the accuracy of subsequent entity recognition.
[0135] Through the steps S201 to S203 shown in the embodiments of the present application, the candidate nuclear power knowledge text is matched by precise index categories, improving the efficiency of knowledge base retrieval, and by calculating the similarity between the candidate nuclear power knowledge text and the target nuclear power text, the most relevant retrieval knowledge nuclear power text to the target nuclear power text is finally selected, providing a solid data foundation for subsequent entity classification, ensuring the accuracy of the retrieval result.
[0136] In step S102 of some embodiments, specifically, the pre-trained entity classification model includes a first text encoding layer, a second text encoding layer, a feature fusion layer, an entity edge detection layer, and an entity classification layer.
[0137] Specifically, the first text encoding layer can be a TENER network layer, which is used to encode the relative positions of the target nuclear power text and the retrieval nuclear power knowledge text, thereby extracting the corresponding text features of the target nuclear power text and the retrieval nuclear power knowledge text; the second text encoding layer can be a Llama-7B network layer, which is used to capture the context information of the target nuclear power text and the retrieval nuclear power knowledge text, thereby extracting the corresponding context text features of the target nuclear power text and the retrieval nuclear power knowledge text; the feature fusion layer is implemented through a cross-attention mechanism, which is used to realize the fusion between the first nuclear power text features, the second nuclear power text features, the first retrieval knowledge text features, and the second retrieval knowledge text features; the entity edge detection layer is implemented through a conditional random field sequence labeling model, which is used to perform entity edge detection on the fused nuclear power text features; the entity classification layer is implemented through a character-level convolutional neural network, which is used to perform entity classification on the fused nuclear power text features.
[0138] In step S102, the embodiment of the present application obtains a pre-trained entity classification model, realizes accurate recognition and classification of entities in nuclear power text through multi-level nuclear power text processing and feature extraction, and the pre-trained entity classification model can capture nuclear power field specific nuclear power text features and entity features, significantly improving the effect of the entity classification model on nuclear power entity classification. This process can include several sub-steps of training the entity classification model before.
[0139] Referring to Figure 3 According to some embodiments of the present application, before obtaining the pre-trained entity classification model in step S102, the nuclear power entity classification method can also include, but is not limited to:
[0140] Step S301, obtaining training nuclear power text and original entity classification model, and obtaining real entity categories of the training nuclear power text;
[0141] Step S302, first encoding the training nuclear power text through a first text encoding layer to obtain first training nuclear power text features;
[0142] Step S303, second encoding the training nuclear power text through a second text encoding layer to obtain second training nuclear power text features;
[0143] Step S304, fusing the first training nuclear power text features and the second training nuclear power text features through a feature fusion layer to obtain fused training nuclear power text features;
[0144] Step S305, performing entity edge detection on the fused training nuclear power text features through an entity edge detection layer to obtain training nuclear power entity edge features;
[0145] Step S306, in the entity classification layer, performing entity classification prediction on the fused training nuclear power text features according to the training nuclear power entity edge features to obtain predicted entity categories;
[0146] Step S307, calculating the loss value of the predicted entity categories and the real entity categories according to a preset loss function;
[0147] Step S308, updating the model parameters of the entity classification model based on the loss value, and returning to perform first encoding of the training nuclear power text through the first text encoding layer until the entity classification model meets the preset training condition, obtaining the pre-trained entity classification model.
[0148] Step S301 of some embodiments, specifically, the training nuclear power text refers to text data related to the nuclear power field, which can include but is not limited to technical documents, operation manuals, accident reports, maintenance records and other text data of nuclear power.
[0149] Specifically, the real entity category refers to the correct nuclear power entity category matched with the training nuclear power text. The real entity category can include power stations (nuclear power stations in different regions), systems (various systems of nuclear power stations, such as reactor coolant systems and turbine bypass systems), equipment function identifiers (various equipment identifiers inside nuclear power stations, such as No. 3 unit reactor coolant system one-loop coolant valve), monitoring and detection (various monitoring and detection activities of nuclear power stations, such as radiation level monitoring and equipment integrity detection), operation procedures (operation and maintenance procedures of nuclear power stations, such as start-up procedures, shutdown procedures, maintenance and repair procedures), events (industrial events of nuclear power, such as switch quantity changes), algorithms (industrial algorithms of nuclear power, such as transformer thermal life evaluation algorithms), and time sequence variables (signals generated by various sensors and actuators in nuclear power, such as No. 3 auxiliary transformer interval bus side current signals).
[0150] In the training process of the entity classification model, obtaining the training nuclear power text and its real entity category is the first step to build an effective entity classification model. The training nuclear power text is the basis for model learning, and the real entity category label is the goal of model learning. By obtaining the real entity category of the training nuclear power text, necessary information is provided for subsequent nuclear power text feature learning and entity prediction, and a model prediction accuracy evaluation standard is provided to ensure that the model can achieve high-accuracy entity recognition and classification in actual nuclear power applications.
[0151] In step S302 of some embodiments, specifically, the first training text feature refers to a text feature containing relative position and context information of the nuclear power text.
[0152] Specifically, the first training nuclear power text is first converted into a character sequence. In the first encoding layer TENER network, the training nuclear power text is encoded according to the character representation and relative position information in the training nuclear power text to convert each character into a vector representation in a high-dimensional space. These vectors can capture effective semantic information of the training nuclear power text, and encoding the training nuclear power text according to the relative position information can help enhance the entity classification model's ability to perceive the direction of context feature information.
[0153] In step S303 of some embodiments, specifically, the second training nuclear power text feature refers to a text feature containing context semantic information.
[0154] Specifically, the second training nuclear power text is encoded by the second text encoding layer Llama-7B network, which can extract text features different from the first text encoding layer and effectively capture and analyze subtle semantics and structures in the training nuclear power text.
[0155] In step S304 of some embodiments, the first and second training nuclear power text features are combined by the cross-attention mechanism of the feature fusion layer to obtain a fused training nuclear power text feature. After being processed by the feature fusion layer, the fused training nuclear power text feature forms a comprehensive feature representation, which not only contains semantic information of the training nuclear power text vocabulary, but also contains structure and context information of the nuclear power text. In this way, the features extracted by different encoding layers are integrated to form a more comprehensive feature representation, which provides more abundant nuclear power text information for subsequent entity edge detection and entity classification.
[0156] In step S305 of some embodiments, the entity edge detection layer performs entity prediction on each word or character in the fused training nuclear power text feature by using a sequence labeling model (such as a conditional random field) to determine whether the word or character belongs to the beginning or internal part of a nuclear power entity, and labels the word or character with an entity start label or an entity internal label to determine the boundary of the nuclear power entity. In this process, the entity edge detection considers the dependency relationship between different nuclear power entity labels to ensure the logical consistency and semantic correctness of the boundary of the nuclear power entity.
[0157] In step S306 of some embodiments, the predicted entity category refers to the nuclear power entity category that is most likely to match the training nuclear power text as predicted by the entity classification model.
[0158] Specifically, the entity classification layer receives the training nuclear power entity edge features from the entity edge detection layer, which indicate the boundary positions of each nuclear power entity in the text, and also receives the fused training nuclear power text features from the feature fusion layer, which contain rich semantic and syntactic information and provide necessary context for nuclear power entity classification. The fused training nuclear power text features and the entity edge features are processed by a convolutional neural network, and the possible categories of each nuclear power entity are output. This process requires the entity classification model to have the ability to recognize specific entity categories in the nuclear power field, so the training data of the model needs to cover real entity category information to enable the model to learn to distinguish different nuclear power entity categories, which helps to improve the accuracy of nuclear power entity classification.
[0159] In step S307 of some embodiments, the loss value of the predicted entity category and the real entity category is calculated according to a preset loss function. Figure 4 According to some embodiments of the present application, step S307 calculates the loss value of the predicted entity category and the real entity category according to a preset loss function, which can include but is not limited to:
[0160] In step S401, an edge detection loss function for training nuclear power entity edge features is obtained, and an edge loss function weight of the edge detection loss function is obtained.
[0161] In step S402, a classification loss function of a predicted entity category is obtained, and a classification loss function weight of the classification loss function is obtained.
[0162] In step S403, a loss value of the predicted entity category and the real entity category is calculated according to the edge detection loss function, the edge loss function weight, the classification loss function and the classification loss function weight.
[0163] In some embodiments of the present application, by calculating the loss value of the predicted entity category and the real entity category according to the preset loss function, the difference between the model prediction output and the real entity category label can be measured, and by calculating the loss value and subsequently determining the model parameter gradient, the weight and bias update of the model is realized to reduce the prediction error of the entity category, thereby improving the accuracy of the nuclear power entity classification.
[0164] In step S307, this calculation process includes several key operations:
[0165] In step S401 of some embodiments, specifically, the edge detection loss function is used to evaluate the performance of the entity edge detection layer, that is, the accuracy of identifying entity boundaries. The edge detection loss function measures the difference between the predicted entity edge of the entity classification model and the real entity edge.
[0166] Specifically, the edge loss function weight is a hyperparameter used to adjust the proportion of edge detection in the overall loss, so as to ensure that the entity classification model pays enough attention to the identification of entity boundaries in the training process.
[0167] In step S402 of some embodiments, specifically, the classification loss function is used to evaluate the performance of the entity classification layer, that is, the accuracy of predicting the entity category. The classification loss function compares the difference between the probability distribution of the predicted category and the probability distribution of the real category.
[0168] Specifically, the classification loss function weight is also a hyperparameter, which is used to adjust the proportion of the entity classification task in the overall loss calculation, so as to ensure that the model pays appropriate attention to the prediction of the entity category in the training process.
[0169] In step S403 of some embodiments, specifically, the edge detection loss function and the classification loss function are combined together through their weights to form a comprehensive loss function. The comprehensive loss function calculates the total loss value of the predicted entity category and the real entity category, which reflects the overall performance of the entity classification model in the entity edge detection and entity classification tasks.
[0170] Further, the total loss value is a weighted sum of the edge detection loss and the classification loss, where each loss is multiplied by its corresponding weight, which helps the entity classification model to optimize the identification of entity edges and the prediction of entity categories simultaneously during the training process, and by adjusting the weights, a balance between the two tasks of entity edge detection and entity classification can be achieved, so as to determine the optimal entity classification model.
[0171] Through the embodiments provided by steps S401 to S403, the entity classification model can be continuously adjusted and optimized during the training process, reducing the prediction error and improving the accuracy of nuclear power entity identification. The use of such a comprehensive loss function enables the entity classification model to more comprehensively learn to identify entity categories from nuclear power text, improving the accuracy of nuclear power entity classification.
[0172] In some more specific embodiments of the present application, the edge detection loss function can be represented by the following formula:
[0173]
[0174] wherein loss B represents the edge detection loss function, represents the score of the real nuclear power annotated entity label that matches the fusion training nuclear power text feature under the given input fusion training nuclear power text feature ; represents the fusion training nuclear power text feature; N represents the number of fusion training nuclear power text features; represents the real nuclear power annotated entity label corresponding to the fusion training nuclear power text feature; represents the score of all possible predicted nuclear power annotated entity labels that match the fusion training nuclear power text feature under the given input fusion training nuclear power text feature ; represents all possible predicted nuclear power annotated entity labels that match the fusion training nuclear power text feature.
[0175]
[0176] wherein loss f represents the classification loss function, x i represents the i-th fusion training nuclear power text feature, yi represents the i-th real entity category corresponding to xi, represents the angle between the i-th fusion training nuclear power text feature and the weight vector between the i-th real entity category yi, j≠y i represents a predicted entity category that does not belong to the real entity category, denotes a function for adjusting the angle θ, which can enhance the entity class distinguishing ability of the entity classification model, denotes a correction function of the real entity class corresponding angle.
[0177] Specifically, the final loss function is as follows:
[0178] Loss = a • loss B + β • loss F
[0179] Wherein, Loss denotes the loss value of the final loss function, a denotes the edge loss function weight, β denotes the classification loss function weight, loss B denotes the edge detection loss function, loss F denotes the classification loss function.
[0180] Some embodiments of step S308, specifically, based on the loss value, the entity classification model parameters will be updated to the model learning back propagation process, in this way, the entity classification model can learn how to reduce the prediction error, and gradually improve the accuracy of prediction.
[0181] Further, after updating the entity classification model parameters, the entity classification model will be encoded again by the first text encoding layer to the training nuclear power text, repeating the whole encoding, fusion, detection and classification process until the entity classification model meets the preset training condition, such as reaching a certain accuracy or loss value less than the preset loss threshold, after meeting the training condition, the pre-trained entity classification model is obtained, which can be used for actual nuclear power text entity classification task, through the entity classification model parameter updating process, the entity classification model not only learns how to extract useful features from the nuclear power text, but also learns how to accurately classify entities according to these features, so as to improve the classification effect of the entity classification model in the nuclear power field entity classification.
[0182] Via steps S301 to S308, the whole model training process is an iterative deep learning training process, the model gradually learns how to accurately identify and classify nuclear power entities from nuclear power text through continuous learning and adjustment, which provides a strong nuclear power text data basis for entity classification task, and helps to realize efficient and accurate nuclear power entity identification.
[0183] Referring to Figure 5 , according to some embodiments of the present application, step S103 utilizes the first text encoding layer to encode the target nuclear power text for the first time, and obtains the first nuclear power text feature, which can include, but is not limited to:
[0184] Step S501, the target nuclear power text is segmented to obtain the target nuclear power character;
[0185] Step S502: Encode the target nuclear power plant character using relative position encoding to obtain a relative position encoding table;
[0186] Step S503: Based on the preset character encoding table and relative position encoding table, perform character position embedding processing on the target nuclear power plant character to obtain the nuclear power plant character position sequence;
[0187] Step S504: Mark the target nuclear power character as an entity to obtain the nuclear power character entity;
[0188] Step S505: Perform attention processing on the target nuclear power text based on the nuclear power character position sequence and nuclear power character entity to obtain the first nuclear power text feature.
[0189] In some embodiments, step S501 specifically involves representing the target nuclear power character as a nuclear power character sequence c = {c1, c2, ..., c...}. n}, where c1 represents the first target nuclear power character and cn represents the nth target nuclear power character.
[0190] The initial step is to segment the target nuclear power plant text into words. By segmenting the target nuclear power plant text, the continuous text is divided into individual characters or words, forming a sequence of target nuclear power plant characters. This step decomposes the target nuclear power plant text into smaller, manageable units through the model, which is crucial for the entity classification model to understand the structure of the target nuclear power plant text.
[0191] In some embodiments, step S502 specifically involves encoding the relative positions of these target nuclear power characters to generate a relative position encoding table corresponding to the nuclear power characters. This is achieved by encoding the relative position information between characters through a combination of sine and cosine functions, thereby enhancing the entity classification model's ability to perceive the direction of contextual feature information. Relative position encoding helps the entity classification model capture the relative distance and direction between characters or words, providing a foundation for understanding long-distance dependencies in the target nuclear power text.
[0192] In some embodiments, step S503 specifically involves the following steps: After obtaining the relative position encoding of the nuclear power plant character, the TENER network performs character position embedding processing on the target nuclear power plant character based on a preset character encoding table and a relative position encoding table. The character encoding table maps each character to a vector in a high-dimensional space, and the relative position encoding provides the position information of the character or word in the nuclear power plant character sequence. By combining the information from these two character encodings and relative encodings, a nuclear power plant character position sequence is generated, which contains rich feature representations of the nuclear power plant character semantics and relative position information, facilitating the subsequent extraction of more accurate first nuclear power plant text features.
[0193] In step S504 of some embodiments, specifically, the entity label can be obtained by using the entity dictionary related to nuclear power extracted from the training nuclear power text and the maximum entity matching algorithm. n} to mark each nuclear power character with the index of the longest entity in the entity dictionary, and mark the nuclear power character without entity matching as 0; wherein e1 represents the entity label matched with the first target nuclear power character, and en represents the entity label matched with the nth target nuclear power character.
[0194] In step S505 of some embodiments, specifically, the TENER network performs attention processing on the target nuclear power text according to the nuclear power character position sequence and the nuclear power character entity. When the target nuclear power text is processed through the attention mechanism, different attention degrees can be given to different nuclear power characters, especially a higher attention degree can be given to the characters related to nuclear power entity recognition, so that the entity classification model can focus on the key feature information in the nuclear power text, thereby extracting the first nuclear power text feature which is most important for subsequent entity classification. The first nuclear power text feature is obtained by in-depth analysis of the nuclear power text by the nuclear power model, and contains rich nuclear power text semantic and structural information, providing a data basis for subsequent entity classification of the model.
[0195] Through steps S501 to S505, the original nuclear power text is converted into a series of rich representations of quantified features through word segmentation, relative position coding, character position embedding, entity labeling and attention processing on the target nuclear power text. These representations can be used by the entity classification model for accurate entity classification, significantly enhancing the ability of the model to recognize and classify nuclear power entities in nuclear power professional field text.
[0196] In some more specific embodiments of the application, the relative position coding can be represented by the following formula:
[0197]
[0198] wherein R t,-t represents the relative position coding table of the target nuclear power character, used to capture the relative position information between different positions of the target nuclear power character, generated by the combination of sine and cosine functions to enhance the perception ability of the entity classification model to the relative position information; t represents the current position of the target nuclear power character; -t represents the opposite position of the current position of the target nuclear power character; c0 represents the scaling factor of the frequency, used to adjust the period of sine and cosine; d represents the feature dimension.
[0199] Specifically, the nuclear power character sequence can be represented by the following formula:
[0200]
[0201] wherein, represents the nuclear power character position sequence of the nth target nuclear power character processed by the first layer TENER network, and the nuclear power character position sequence contains semantic information and position information of the target nuclear power character; E c represents the character encoding table of the target nuclear power character c; c n represents the nth target nuclear power character; R t,-t represents the relative position encoding table of the target nuclear power character; n represents the number of target nuclear power characters.
[0202] Referring to Figure 6 According to some embodiments of the present application, the step S505 performs attention processing on the target nuclear power text according to the nuclear power character position sequence and the nuclear power character entity to obtain the first nuclear power text feature, which can include, but is not limited to:
[0203] Step S601, according to the nuclear power character position sequence and the preset query parameter matrix, the target nuclear power text is extracted to obtain the nuclear power character query feature;
[0204] Step S602, according to the nuclear power character position sequence, the nuclear power character entity, the preset key parameter matrix and the preset entity encoding table, the target nuclear power text is extracted to obtain the nuclear power character key feature;
[0205] Step S603, according to the nuclear power character position sequence, the nuclear power character entity, the preset value parameter matrix and the entity encoding table, the target nuclear power text is extracted to obtain the nuclear power character value feature;
[0206] Step S604, the nuclear power character query feature, the nuclear power character key feature and the nuclear power character value feature are weighted by attention to obtain the first nuclear power text feature.
[0207] In some embodiments of the present application, the target nuclear power text is processed by attention according to the nuclear power character position sequence and the nuclear power character entity, which not only enables the model to focus on the key information in the target nuclear power text, but also extracts the rich semantic and position information containing the target nuclear power text, providing a basis for subsequent entity classification tasks. This process is carried out in step S505, which can include the following sub-steps.
[0208] In step S601 of some embodiments, specifically, the feature extraction of the target nuclear power text in the TENER network is a multi-step process involving query, key, and value feature extraction. First, the TENER network extracts query features from the text based on the nuclear power character position sequence and a preset query parameter matrix. In this step, the model uses the position information of the characters and the query parameter matrix to generate query features that can capture the semantic information of each character in the target nuclear power text and provide a basis for the attention mechanism.
[0209] In step S602 of some embodiments, specifically, the TENER network extracts key features based on the nuclear power character position sequence, nuclear power character entities, a preset key parameter matrix, and an entity encoding table. In the key feature extraction process, the TENER network not only considers the position information of the nuclear power characters but also combines the entity information of the nuclear power characters, which enables the TENER network to identify characters related to nuclear power entities in the text and further distinguish different nuclear power entities through the combination of the key parameter matrix and the entity encoding table.
[0210] In step S603 of some embodiments, specifically, the TENER network extracts value features based on the nuclear power character position sequence, nuclear power character entities, a preset value parameter matrix, and an entity encoding table. The purpose of value feature extraction is to provide relevant value information for the attention mechanism and combine it with the key features to determine the parts of the target text that the TENER network should focus on, providing the TENER network with a more comprehensive understanding of the content of the target nuclear power text.
[0211] In step S604 of some embodiments, the TENER network performs attention weighting on the query features, key features, and value features. This step involves calculating the similarity between the query features and the key features to determine the attention weights of each nuclear power character, which are used to weight the value features to generate the final first nuclear power text features. These first nuclear power text features not only contain the semantic and positional information of the nuclear power characters but also incorporate relevant entity information, enabling the TENER network to more accurately identify and classify nuclear power characters related to nuclear power entities.
[0212] Through the steps S601 to S604, the TENER network can extract rich nuclear power text features from the target nuclear power text, providing a solid data foundation for subsequent entity edge recognition and entity classification. The introduction of the attention mechanism enables the TENER network to dynamically adjust its focus based on the context of the nuclear power text content, thereby improving the accuracy of the TENER network in processing complex nuclear power texts.
[0213] In some more specific embodiments of the present application, the nuclear power character query feature can be represented by the following formula:
[0214]
[0215] wherein, represents the nuclear power character query feature of the nth target nuclear power character after being processed by the lth TENER network; represents the nuclear power character position sequence of the nth target nuclear power character after being processed by the (l-1)th TENER network; represents the query parameter matrix of the nuclear power character query feature q and the nuclear power character position sequence h after being processed by the lth TENER network.
[0216] Further, the nuclear power character key feature can be represented by the following formula:
[0217]
[0218] wherein, represents the nuclear power character key feature of the nth target nuclear power character after being processed by the lth TENER network; represents the nuclear power character position sequence of the nth target nuclear power character after being processed by the (l-1)th TENER network; represents the key parameter matrix of the nuclear power character key feature k and the nuclear power character position sequence h after being processed by the lth TENER network; Eent represents an entity encoding table; e n represents the entity label matched with the nth target nuclear power character; represents the entity parameter matrix of the entity label and the nuclear power character key feature k after being processed by the lth TENER network; T represents a matrix transpose.
[0219] Specifically, the nuclear power character value feature can be represented by the following formula:
[0220]
[0221] wherein, represents the nuclear power character value feature of the nth target nuclear power character after being processed by the lth TENER network; represents the nuclear power character position sequence of the nth target nuclear power character after being processed by the (l-1)th TENER network; represents the key parameter matrix of the nuclear power character value feature v and the nuclear power character position sequence h after being processed by the lth TENER network; Eent represents an entity encoding table; e n represents the entity label matched with the nth target nuclear power character; denotes the entity parameter matrix of the entity label e
[0222] Further, the logic of the formula is that if the entity label e n If there is no corresponding target nuclear character matching, e n = 0, at this time the nuclear character key feature is determined only by the nuclear character position sequence of the target nuclear character and the key parameter matrix, and the nuclear character value feature is determined only by the nuclear character position sequence of the target nuclear character and the value parameter matrix; if the entity label e n If there is a corresponding target nuclear character matching, the nuclear character key feature or the nuclear character value feature is determined by the nuclear character position sequence and the entity encoding table and its corresponding parameter matrix.
[0223] Specifically, through the above attention weighting processing, if the TENER network is stacked through 12 layers of attention mechanism, the final TENER network can output a first nuclear power text feature vector of 77x768 dimensions.
[0224] In step S104 of some embodiments, specifically, the first retrieval knowledge text feature refers to a text feature containing retrieval knowledge text relative position and context information.
[0225] Specifically, the method of using the first text encoding layer to perform first encoding on the retrieval nuclear power knowledge text to obtain the first retrieval knowledge text feature is consistent with the method of using the first text encoding layer to perform first encoding on the target nuclear power text to obtain the first nuclear power text feature, which will not be described here.
[0226] Specifically, by converting the retrieval nuclear power knowledge text into a character sequence, in the first encoding layer TENER network, the retrieval nuclear power knowledge text is encoded according to the character representation and relative position information in the retrieval nuclear power knowledge text, so as to convert each character into a vector representation in a high-dimensional space. These vectors can capture effective semantic information of the retrieval nuclear power knowledge text, and by performing relative position encoding on the retrieval nuclear power knowledge text, it is helpful to enhance the perception ability of the TENER network to the direction of context feature information.
[0227] Referring to Figure 7 According to some embodiments of the present application, step S105 of performing second encoding on the target nuclear power text to obtain the second nuclear power text feature can include, but is not limited to:
[0228] Step S701 converts the target nuclear power text into a nuclear power token sequence;
[0229] Step S702 performs word embedding processing on the nuclear power token sequence to obtain a nuclear power token vector;
[0230] Step S703, the attention encoding is performed on the nuclear power word vector to obtain a second nuclear power text feature.
[0231] In some embodiments of the present application, by performing the second encoding on the target nuclear power text, the context relationship features of the target nuclear power text can be effectively captured, and a nuclear power domain data basis is further provided for subsequent nuclear power entity classification. This process is performed in step S105 and can include the following sub-steps.
[0232] Step S701 of some embodiments, specifically, converting the target nuclear power text into a nuclear power token sequence is the first step of text encoding by the Llama-7B network. This process involves decomposing continuous target nuclear power text strings into discrete tokens, which can be words, characters, or word units based on nuclear power professional terms. For nuclear power domain text, tokens can include nuclear power technical terms, device names, chemical substance names, etc.
[0233] Specifically, the purpose of converting the target nuclear power text into a nuclear power token sequence is to convert the target nuclear power text into a form that can be processed by the Llama-7B network, so that the Llama-7B network can perform subsequent feature extraction.
[0234] Step S702 of some embodiments, specifically, the word embedding processing of the nuclear power token sequence is implemented by Embedding the nuclear power token sequence. By performing Embedding operation on the nuclear power token sequence, each token can be mapped to a point in a high-dimensional vector space. This vector captures the semantic and syntactic features of the token, and for nuclear power text, word embedding processing enables the Llama-7B network to learn representations of professional terms related to the nuclear power domain, which are crucial for the Llama-7B network to understand the content of the target nuclear power text.
[0235] Step S106 of some embodiments, the second retrieval knowledge text feature is a feature obtained by encoding the retrieval nuclear power knowledge text by the Llama-7B network.
[0236] Specifically, the method of using the second text encoding layer to perform second encoding on the retrieval nuclear power knowledge text to obtain the second retrieval knowledge text feature is consistent with the method of using the second text encoding layer to perform second encoding on the target nuclear power text to obtain the second nuclear power text feature. This will not be repeated here.
[0237] Specifically, the second text encoding layer is used to encode the retrieved nuclear power knowledge text, and these vectors can capture the long-distance dependencies of the retrieved nuclear power knowledge text, so as to extract the context-related retrieved knowledge text features, thereby providing further data basis for subsequent entity classification model.
[0238] In step S703 of some embodiments, specifically, the nuclear power token vector is input into a Transformer encoder, which is composed of a self-attention mechanism and a feedforward neural network. The self-attention mechanism enables the Llama-7B network to consider other tokens in the sequence when processing the current token, thereby capturing the long-distance dependencies between tokens. The feedforward network further processes the tokens to enhance the Llama-7B network's understanding of the details of the target nuclear power text features, thereby improving the accuracy of the second nuclear power text feature extraction.
[0239] Through steps S701 to S703, the attention-encoded nuclear power token vector is integrated into the second nuclear power text feature, which contains deep information of the text, such as the context relationship of the text, thereby providing a data basis for subsequent entity classification tasks, and enabling the entity classification model to more accurately identify and classify nuclear power entities in the nuclear power text.
[0240] In some more specific embodiments of the present application, if the character sequence c = {c1, c2, …, c n} of the target nuclear power text is input into the Llama-7B model, the model converts the character sequence into a high-dimensional feature vector of 77x1280.
[0241] Referring to Figure 8 According to some embodiments of the present application, step S107 fuses the first nuclear power text feature, the second nuclear power text feature, the first retrieved knowledge text feature, and the second retrieved knowledge text feature to obtain a fused nuclear power text feature, which can include, but is not limited to:
[0242] In step S801, the first nuclear power text feature and the second nuclear power text feature are subjected to cross-attention weighting processing to obtain an initial fused nuclear power text feature.
[0243] In step S802, the initial fused nuclear power text feature and the first nuclear power text are spliced to obtain a spliced nuclear power text feature.
[0244] In step S803, the first retrieved knowledge text feature and the second retrieved knowledge text feature are subjected to cross-attention weighting processing to obtain an initial fused knowledge text feature.
[0245] Step S804, splicing the initial fusion nuclear power knowledge text feature and the first nuclear power knowledge text to obtain a spliced knowledge text feature;
[0246] Step S805, splicing the spliced nuclear power text feature and the spliced nuclear power knowledge text feature to obtain a spliced nuclear power knowledge text feature;
[0247] Step S806, performing linear transformation on the spliced nuclear power knowledge text feature to obtain a fusion nuclear power text feature.
[0248] In some embodiments of the present application, the nuclear power text features and the retrieved knowledge text features of different encoding layers are fused, which can enhance data retrieval of nuclear power text using knowledge in the database, effectively alleviate the problem of data scarcity of the model in nuclear power entity classification, and improve the understanding ability of the entity classification model for professional text in the nuclear power field. In step S107, this calculation process includes several key operations:
[0249] In step S801 of some embodiments, specifically, the first nuclear power text feature and the second nuclear power text feature are processed by cross-attention weighting. This step involves calculating the correlation between the two sets of features to determine the importance of each feature in the final representation. Through attention weighting processing, it is convenient for the subsequent entity classification model to identify which features are more important in representing nuclear power text.
[0250] Specifically, the core task of cross-attention is to combine the query vector (Q) and the key-value vector (K, V) to generate an aligned feature vector. In order to realize cross-attention, the key and value need to be projected to the same dimension as the query. The key vector and the value vector can be projected to the same dimension as the query vector by using a projection matrix. Finally, the query vector, the key vector and the value vector are weighted and summed according to the attention weight to obtain an initial fusion nuclear power text feature with the same dimension as the first nuclear power text feature. Among them, the first nuclear power text feature is used as the query vector, and the second nuclear power text feature is used as the key vector and the value vector.
[0251] In step S802 of some embodiments, specifically, the initial fusion nuclear power text feature is spliced with the first nuclear power text feature to form a spliced nuclear power text feature. This step integrates the advantages of features of two encoding layers, combines feature information of different network layers, and can more comprehensively perceive the position information and subtle changes of nuclear power text, effectively solving the problems of poor understanding of complex text and unclear expression of professional terms in the nuclear power field, which leads to poor subsequent entity classification.
[0252] In step S803 of some embodiments, the initial fused knowledge text feature is obtained by weighted summation of the retrieved knowledge text features, which integrates the advantages of the features output by the first text encoding layer and the second text encoding layer, forming a more rich and balanced feature representation. This feature not only contains the semantic information of the text, but also incorporates the evaluation information of the importance of different parts of the nuclear power text by the entity classification model.
[0253] Specifically, the method of cross-attention weighted processing of the first retrieved knowledge text feature and the second retrieved knowledge text feature to obtain the initial fused knowledge text feature is consistent with the method of cross-attention weighted processing of the first nuclear power text feature and the second nuclear power text feature to obtain the initial fused nuclear power text feature, which will not be repeated here.
[0254] In step S804 of some embodiments, the feature extraction layer combines the initial fused nuclear power knowledge text feature and the first nuclear power knowledge text feature by concatenation, merging the feature vectors of different sources along the feature dimension to form a new feature vector. The concatenated knowledge text feature contains all the information of the initial fused feature and the first nuclear power knowledge text feature, which realizes the combination of nuclear power text features obtained from different levels and different angles, and facilitates the entity classification model to understand the knowledge text from a more comprehensive perspective.
[0255] Specifically, the method of concatenating the initial fused nuclear power knowledge text feature and the first nuclear power knowledge text to obtain the concatenated knowledge text feature is consistent with the method of concatenating the initial fused nuclear power text feature and the first nuclear power text to obtain the concatenated nuclear power text feature, which will not be repeated here.
[0256] In step S805 of some embodiments, the concatenated nuclear power text feature and the concatenated nuclear power knowledge text feature are concatenated to form the concatenated nuclear power knowledge text feature. This step combines the nuclear power text feature and the retrieved knowledge feature to form a more comprehensive feature representation, which not only covers the internal information of the nuclear power text, but also incorporates the rich nuclear power corpus of the external knowledge base. This realizes the process of retrieving and enhancing the nuclear power text with knowledge data extracted from the preset prior knowledge database, effectively alleviates the problem of lack of nuclear power data in nuclear power entity classification, and facilitates subsequent improvement of the effect of nuclear power entity classification.
[0257] In step S806 of some embodiments, specifically, the linear transformation usually involves a fully connected layer. Due to the high dimension of the feature vectors after splicing, directly using these high-dimensional features may introduce redundant information and noise. The fully connected layer fuses and compresses these high-dimensional features through linear transformation, so that the model can reduce unnecessary redundancy while retaining important information. At the same time, the fully connected layer can introduce non-linear mapping through the activation function, enhance the model's understanding of complex semantic relationships, and improve the expression ability of text features.
[0258] Through steps S801 to S806 shown in the embodiments of the present application, the retrieved knowledge text features and the nuclear power text features are combined to form a comprehensive feature representation, which helps the model to more accurately capture key text information in the nuclear power field in the subsequent entity classification task, and to more effectively utilize the knowledge in the nuclear power field, thereby improving the accuracy and robustness of the subsequent model in nuclear power entity classification.
[0259] In some more specific embodiments of the present application, the core task of cross-attention is to combine the query vector (Q) and the key-value vector (K, V) to generate the aligned feature vector. The feature fusion layer receives the first nuclear power text feature of 77x768 output by the TENER network and the second nuclear power text feature of 77x1280 output by the LLaMA-7B network, takes the 77x1280-dimensional feature as the key and value vectors, and takes 77x768 as the query vector, to realize the fusion of different vector dimensions. The key and value vectors need to be projected into the same 768-dimensional space as the query vector.
[0260] Further, the projection matrix WK of the key vector is 1280x768-dimensional, the projection matrix WV of the value vector is 1280x768-dimensional, and the projection matrix WQ of the query vector is 768x768-dimensional. Through the projection of the projection matrices WK, WV, and WQ on the query, key, and value vectors, the 77x768-dimensional query, key, and value vectors are obtained.
[0261] Further, the dot product of the query vector and the key vector is calculated to obtain an attention weight matrix of 77x77-dimensional. The dot product of the attention weight matrix and the value vector is further calculated to output an initial fusion nuclear power text feature of 77x768-dimensional. The initial fusion nuclear power text feature of 77x768-dimensional is spliced with the first nuclear power text feature vector of 77x768-dimensional to obtain a spliced nuclear power text feature f of 77x1536-dimensional. n .
[0262] Similarly, the initial fusion nuclear power knowledge text feature of 77x768-dimensional is spliced with the first nuclear power knowledge text of 77x768-dimensional to obtain a spliced knowledge text feature f of 77x1536-dimensional. L .
[0263] Referring to Figure 9 According to some embodiments of the present application, the step S108 of performing entity edge detection on the fused nuclear power text features to obtain nuclear power entity edge features can include, but is not limited to:
[0264] The step S901 of performing entity label prediction on the fused nuclear power text features to obtain predicted nuclear power labeled entity labels;
[0265] The step S902 of performing label score calculation on the predicted nuclear power labeled entity labels by using a preset transition matrix and a preset emission matrix to obtain entity label scores;
[0266] The step S903 of obtaining true nuclear power labeled entity labels of the fused nuclear power text features, and performing entity edge detection on the fused nuclear power text features according to the true nuclear power labeled entity labels, the predicted nuclear power labeled entity labels and the entity label scores to obtain nuclear power entity edge features.
[0267] In some embodiments of the present application, the entity edge detection on the fused nuclear power text features involves identifying the boundaries of entities in the text and assigning correct boundary class labels to these entities. In the step S108, this process includes several key operations:
[0268] The step S901 of some embodiments, specifically, the predicted nuclear power labeled entity labels refer to all possible nuclear power entity boundary labels associated with the fused nuclear power text features, including B (Begin) labels, indicating the beginning of a nuclear power entity; I (Inside) labels, indicating the internal part of the same nuclear power entity following the B label; E (End) labels indicating the end of a nuclear power entity. And a B label should only be followed by an I label or another B label (if starting a new nuclear power entity), that is, an I label should not appear without a preceding B label, because an I label indicates the middle part of an entity, not the beginning.
[0269] Specifically, the entity boundary label prediction on the fused nuclear power text features is performed by using a conditional random field of an entity edge detection layer. This step utilizes the rich information in the fused features to predict the entity boundary class that each character or word unit in the nuclear power text may belong to, to achieve preliminary identification of the entity edge.
[0270] In step S902 of some embodiments, specifically, the transition matrix is used to measure the transition probability between different two continuous entity labels, which helps the entity edge detection layer to understand the sequence relationship between entity labels; and the emission matrix is used to measure the matching degree between the fused nuclear power text features and the predicted nuclear power labeled entity labels. Through the joint action of the two matrices, a score is calculated for each predicted nuclear power labeled entity label, which reflects the appropriateness of the predicted nuclear power labeled entity label in the given context.
[0271] In step S903 of some embodiments, specifically, the entity edge detection layer obtains the real nuclear power labeled entity labels of the fused nuclear power text features, and these real labels are the labeled information used to train the conditional random field model, which provides the correct entity edge information for the conditional random field model. Then, the conditional random field model performs entity edge detection on the fused nuclear power text features according to the real nuclear power labeled entity labels, the predicted nuclear power labeled entity labels, and the entity label scores, that is, the predicted nuclear power labeled entity label with the highest score is selected as the nuclear power entity edge feature by comparing the scores of the predicted label and the real label.
[0272] Through steps S901 to S903 shown in the embodiments of the present application, not only the accurate edge of the entity can be identified, but also the selection of the entire entity boundary label sequence can be optimized by considering the dependency relationship in the fused nuclear power text features, thereby improving the accuracy and efficiency of the overall entity edge recognition.
[0273] According to some more specific embodiments of the present application, the optimization target of the conditional random field model is to increase the proportion of the score of the real nuclear power labeled entity label in the total sum of all labeled entity labels.
[0274] Specifically, the predicted nuclear power labeled entity label can be represented by the following formula:
[0275]
[0276] Wherein, represents the score of the predicted nuclear power labeled entity label that matches the input fused training nuclear power text feature . represents the fused training nuclear power text feature; N represents the number of the fused training nuclear power text features; represents the possible predicted nuclear power labeled entity label that matches the fused training nuclear power text feature; A [i]n-1,[i]n represents the transition matrix, which is used to measure the transition probability between two continuous labels [i] n-1 and [i] n ; [i] n-1 represents the predicted nuclear power annotation entity label corresponding to the n-1th fusion training nuclear power text feature; n represents the predicted nuclear power annotation entity label corresponding to the n-1th fusion training nuclear power text feature; represents the emission matrix, which is used to measure the matching degree of the n-1th fusion training nuclear power text feature and the predicted nuclear power annotation entity label corresponding to the n-1th fusion training nuclear power text feature[i] n .
[0277] Specifically, the entity edge detection can be represented by the following formula:
[0278]
[0279] wherein, represents the true nuclear power annotation entity label corresponding to the given input fusion training nuclear power text feature . represents the probability of the true nuclear power annotation entity label corresponding to the fusion training nuclear power text feature relative to all possible predicted nuclear power annotation entity labels matching the fusion training nuclear power text feature; represents the fusion training nuclear power text feature; N represents the number of fusion training nuclear power text features; represents the true nuclear power annotation entity label corresponding to the fusion training nuclear power text feature; represents all possible predicted nuclear power annotation entity labels matching the fusion training nuclear power text feature; represents the score of the true nuclear power annotation entity label corresponding to the fusion training nuclear power text feature given the input fusion training nuclear power text feature . represents the score of all possible predicted nuclear power annotation entity labels corresponding to the fusion training nuclear power text feature given the input fusion training nuclear power text feature .
[0280] Referring to Figure 10 , according to some embodiments of the present application, the step S109 performs entity classification on the fusion nuclear power text feature according to the nuclear power entity edge feature to obtain the target nuclear power entity class, which can include, but is not limited to:
[0281] Step S1001, character component recognition is performed on the fusion nuclear power text feature to obtain a nuclear power character component feature;
[0282] Step S1002, the nuclear power character component feature is subjected to entity class recognition according to the nuclear power entity edge feature to obtain the target nuclear power entity class.
[0283] Referring to Figure 11According to some embodiments of the present application, the character and component recognition of the fused nuclear power text features in step S1001 can include, but is not limited to:
[0284] Step S1101, character recognition of the fused nuclear power text features to obtain target nuclear power character features;
[0285] Step S1102, component recognition of the fused nuclear power text features to obtain target nuclear power component features;
[0286] Step S1103, splicing the target nuclear power character features and the target nuclear power component features to obtain nuclear power character and component features.
[0287] In some embodiments of the present application, Chinese characters are composed of components and strokes, and the components and strokes contain a large amount of semantic information. The character-level convolutional neural network of the entity classification layer is composed of two parts: enhanced character vectors of entities and character vectors considering components, and different component or stroke information can be extracted by different convolution kernels of the character-level convolutional neural network, so that nuclear power character component and stroke features can be obtained, which are helpful to reveal the potential meaning and category attributes of the nuclear power characters. In step S1001, this process includes several key operations:
[0288] In step S1101 of some embodiments, the enhanced character vector part of the character-level convolutional neural network is used to perform convolution and pooling processing on the fused nuclear power text features, so as to convert each character stroke in the text into a numerical feature that can be processed by the model, i.e., target nuclear power character features. These features can include semantic information, grammatical information and context information of the characters in the nuclear power text, which are helpful to improve the accuracy of subsequent entity category recognition.
[0289] In step S1102 of some embodiments, the character vector part considering components of the character-level convolutional neural network is used to perform convolution and pooling processing on the fused nuclear power text features according to the 768-dimensional vector of Word2Vec of Chinese dictionary, so as to extract component feature information of each Chinese character, i.e., target nuclear power component features. These features are helpful to reveal the potential meaning and category attributes of the characters, and facilitate further improvement of the accuracy of subsequent entity category recognition.
[0290] In step S1103 of some embodiments, the target nuclear power character features and the target nuclear power component features are spliced to form a new feature vector containing component and stroke information, i.e., nuclear power character and component features, which provide more rich character information for the entity classification layer. When performing the subsequent entity category recognition task, the entity boundaries and category information in the nuclear power text can be more accurately captured.
[0291] Via steps S1101 to S1103 shown in the embodiments of the present application, the entity classification layer can combine the semantic information of the character strokes and the semantic information of the radicals to form a comprehensive feature representation, which helps to improve the accuracy and robustness of the entity classification layer in the nuclear power field text.
[0292] Referring to Figure 12 According to some embodiments of the present application, step S1002 performs entity category identification on the nuclear power character radical features according to the nuclear power entity edge features to obtain a target nuclear power entity category, which can include but is not limited to:
[0293] Step S1201 concatenates the nuclear power entity edge features and the nuclear power character radical features to obtain concatenated nuclear power entity features;
[0294] Step S1202 performs entity category probability prediction on the concatenated nuclear power entity features to obtain a nuclear power entity category probability;
[0295] Step S1203 selects a nuclear power entity category with the highest nuclear power entity category probability as the target nuclear power entity category.
[0296] In some embodiments of the present application, the nuclear power entity edge features provide boundary information of the entity in the nuclear power text, indicating the start and end positions of the nuclear power entity in the text, providing basic positioning information for the entity classification model to identify the entity, while the nuclear power character radical features provide rich semantic information of the radicals and components of each character in the nuclear power text for the entity classification model. According to the entity category identification of the nuclear power character radical features according to the nuclear power entity edge features, the entity classification model can more accurately identify the nuclear power entity in the nuclear power text. In step S1002, this process includes several key operations:
[0297] Step S1201 of some embodiments, specifically, concatenating the nuclear power entity edge features and the nuclear power character radical features is a key step that can integrate two different types of feature information. The nuclear power entity edge features provide detailed information of the entity boundary in the text, while the nuclear power character radical features contain semantic information of the character strokes and radicals. By concatenating the two features, the entity classification model can obtain a more comprehensive nuclear power entity feature representation, which integrates the boundary information of the nuclear power entity and the semantic meaning of the nuclear power character, helping to improve the effect of nuclear power entity classification subsequently.
[0298] In step S1202 of some embodiments, specifically, the entity category probability of the spliced nuclear power entity features can be predicted through the Model A-Softmax algorithm, that is, calculate the probability that each spliced nuclear power entity feature vector belongs to the possible entity categories, so as to realize the prediction of the possibility that the spliced nuclear power entity features belong to each entity category. These probabilities reflect the confidence level of the model for different entity categories and are the basis for the model to predict entity categories.
[0299] In step S1203 of some embodiments, specifically, the entity classification model selects the category with the highest nuclear power entity category probability as the target nuclear power entity category. This decision-making process is based on probability values. Selecting the category with the highest probability means that the entity classification model believes that this category best matches the spliced nuclear power entity features. This probability-based decision-making method enables the entity classification model to select the most likely correct entity category when facing uncertainty, thereby improving the accuracy of nuclear power entity classification.
[0300] Through steps S1201 to S1203 provided by the embodiments of the present application, the target nuclear power entity category is based on the comprehensive analysis result of entity edges and character radical features. Through the entity category prediction of the spliced nuclear power entity features, the entity classification model can improve the recognition ability of nuclear power entities in the text of the nuclear power field, and the entity category prediction method combining entity edges and character radical features makes the nuclear power entity classification more accurate and reliable, which helps to improve the effect of nuclear power entity classification for the text in the nuclear power field.
[0301] Through steps S1001 to S1002 provided by the embodiments of the present application, the model can combine nuclear power character radical recognition and nuclear power entity edge features for entity category prediction, effectively solving the problem of not considering the impact of nuclear power field-specific nouns in the text related to nuclear power on the recognition performance of the entity classification model, and significantly improving the effect of nuclear power entity classification.
[0302] According to some more specific embodiments of the present application, in the nuclear power field, "氵" (water radical) is used in nuclear power plants for equipment or processes involving water and other liquids, such as "cooling tower", "steam generator", "drainage system". These terms involve key operations such as cooling, evaporation, and water treatment. The radical "金" in the nuclear power field is related to components and materials made of metal or metal materials, such as "copper", "iron", "lead", etc., which are commonly seen in discussions about reactor structural materials, shielding materials, etc. Based on the radical, nuclear power characters can be accurately assigned to the correct entity categories.
[0303] It should be noted that, first, the embodiment of the present application obtains the retrieved nuclear power knowledge text by performing knowledge retrieval on the target nuclear power text from the preset nuclear power knowledge base, can enhance the learning ability of the entity classification model to the nuclear power field professional text in combination with the nuclear power field professional knowledge corpus, and realizes the extraction of the features containing semantics, structure and context information of the nuclear power field related text based on the double encoders by performing first encoding and second encoding on the target nuclear power text and the retrieved nuclear power knowledge text; secondly, by fusing the first nuclear power text features, the second nuclear power text features, the first retrieved knowledge text features and the second retrieved knowledge text features, the fusion of the text, semantics, structure and context information of the nuclear power field can be realized, and rich information is provided for subsequent entity edge detection and entity classification; finally, by performing entity edge detection on the fused nuclear power text features, the starting and ending positions of the entity in the nuclear power text are indicated, and the entity boundary basis is provided for the entity classification of the fused nuclear power text features, effectively solving the problem that the influence of the nuclear power field special terms in the text related to nuclear power on the recognition performance of the entity classification model is not considered, and significantly improving the effect of nuclear power entity classification.
[0304] With reference to Figure 13 According to the nuclear power entity classification device of the second aspect embodiment of the present application, the following can be included, but are not limited to:
[0305] The knowledge retrieval module 1301 is configured to obtain the target nuclear power text, and perform knowledge retrieval on the target nuclear power text from the preset nuclear power knowledge base to obtain the retrieved nuclear power knowledge text.
[0306] The entity classification model acquisition module 1302 is configured to acquire a pre-trained entity classification model; wherein the entity classification model comprises a first text encoding layer, a second text encoding layer, a feature fusion layer, an entity edge detection layer and an entity classification layer.
[0307] The nuclear power text first encoding module 1303 is configured to perform first encoding on the target nuclear power text by using the first text encoding layer to obtain the first nuclear power text features.
[0308] The nuclear power knowledge text first encoding module 1304 is configured to perform first encoding on the retrieved nuclear power knowledge text by using the first text encoding layer to obtain the first retrieved knowledge text features.
[0309] The nuclear power text second encoding module 1305 is configured to perform second encoding on the target nuclear power text by using the second text encoding layer to obtain the second nuclear power text features.
[0310] The nuclear power knowledge text second encoding module 1306 is configured to perform second encoding on the retrieved nuclear power knowledge text by using the second text encoding layer to obtain the second retrieved knowledge text features.
[0311] The feature fusion module 1307 is configured to fuse the first nuclear power text feature, the second nuclear power text feature, the first search knowledge text feature and the second search knowledge text feature through a feature fusion layer to obtain a fused nuclear power text feature.
[0312] The entity edge detection module 1308 is configured to perform entity edge detection on the fused nuclear power text feature through an entity edge detection layer to obtain a nuclear power entity edge feature.
[0313] The entity classification module 1309 is configured to perform entity classification on the fused nuclear power text feature according to the nuclear power entity edge feature in an entity classification layer to obtain a target nuclear power entity category.
[0314] It can be seen that the contents in the above nuclear power entity classification method embodiments are all applicable to the embodiments of the nuclear power entity classification device. The nuclear power entity classification device embodiments specifically implement the same functions as the above nuclear power entity classification method embodiments, and achieve the same beneficial effects as the above nuclear power entity classification method embodiments.
[0315] With reference to Figure 14 , Figure 14 The electronic device of another embodiment is illustrated, and the electronic device includes:
[0316] The processor 1401 can be implemented in a general-purpose CPU (Central Processing Unit), a microprocessor, an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits, and is configured to execute related programs to implement the technical solutions provided by the embodiments of the present application.
[0317] The memory 1402 can be implemented in the form of a ROM (Read Only Memory), a static storage device, a dynamic storage device, or a RAM (Random Access Memory). The memory 1402 can store an operating system and other application programs. When the technical solutions provided by the embodiments of the present application are implemented by software or firmware, the related program codes are stored in the memory 1402 and are called and executed by the processor 1401 to implement the nuclear power entity classification method of the embodiments of the present application.
[0318] The input / output interface 1403 is configured to implement information input and output.
[0319] The communication interface 1404 is configured to realize the communication interaction between the device and other devices, and can realize the communication through a wired manner (for example, a USB, a network cable, or the like) or a wireless manner (for example, a mobile network, a WI-FI, a Bluetooth, or the like).
[0320] The bus 1405 is configured to transmit information between various components (for example, the processor 1401, the memory 1402, the input / output interface 1403, and the communication interface 1404) of the device.
[0321] The processor 1401, the memory 1402, the input / output interface 1403, and the communication interface 1404 are connected to each other through the bus 1405.
[0322] The embodiment of the present application further provides a computer program product, which comprises a computer program. The processor of the computer device reads the computer program and executes, so that the computer device executes the nuclear power entity classification method.
[0323] The terms "first", "second", "third", "fourth" and the like in the description of the present disclosure and the above drawings, if any, are used to distinguish similar objects, and do not necessarily indicate a particular order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "contain" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device containing a series of steps or units does not necessarily have to be limited to the clearly listed steps or units, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0324] It should be understood that in the present disclosure, "at least one" means one or more, and "multiple" means two or more. "And / or" is used to describe the association relationship of the associated objects, which means that there can be three relationships, for example, "A and / or B" can represent three cases of only A, only B and A and B existing at the same time, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the front and rear associated objects. "At least one of the following" or similar expressions means any combination of these items, which can include, but is not limited to, any combination of single item or multiple items. For example, at least one of a, b or c can represent a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0325] It should be understood that, in the description of the embodiments of the present application, the meaning of multiple (or multiple items) is two or more, greater than, less than, more than, and the like are not included in the number, above, below, and the like are included in the number.
[0326] In several embodiments provided by the present disclosure, it should be understood that the disclosed system, device and method can be implemented by other manners. For example, the above-described device embodiments are only illustrative, for example, the division of units is only a logical function division, and actual implementation can have another division manner, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0327] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0328] In addition, the functional units in each embodiment of the present disclosure can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of software functional unit.
[0329] If the integrated unit is realized in the form of software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present disclosure essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of software product, and the computer software product is stored in a storage medium, which can include, but is not limited to, a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the embodiments of the present disclosure. The foregoing storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, and various media that can store program codes.
[0330] It should also be understood that the various embodiments provided by the present application can be combined in any way to achieve different technical effects.
[0331] The above is a specific explanation of the embodiments of the present disclosure, but the present disclosure is not limited to the above-described embodiments, and those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present disclosure, and these equivalent modifications or substitutions are included in the scope defined by the claims of the present disclosure.
Claims
1. A method for classifying nuclear power plant entities, characterized in that, The method comprises the following steps: acquiring a target nuclear power text, and performing knowledge retrieval on the target nuclear power text from a preset nuclear power knowledge base to obtain a retrieved nuclear power knowledge text; acquiring a pre-trained entity classification model; wherein the entity classification model comprises a first text encoding layer, a second text encoding layer, a feature fusion layer, an entity edge detection layer, and an entity classification layer; first encoding the target nuclear power text using the first text encoding layer to obtain first nuclear power text features; wherein the first nuclear power text features comprise semantic information, position information of nuclear power characters, and related information of entities; first encoding the retrieved nuclear power knowledge text using the first text encoding layer to obtain first retrieved knowledge text features; second encoding the target nuclear power text using the second text encoding layer to obtain second nuclear power text features; wherein the second nuclear power text features comprise text features of context semantic information; second encoding the retrieved nuclear power knowledge text using the second text encoding layer to obtain second retrieved knowledge text features; fusing the first nuclear power text features, the second nuclear power text features, the first retrieved knowledge text features, and the second retrieved knowledge text features through the feature fusion layer to obtain fused nuclear power text features; performing entity edge detection on the fused nuclear power text features through the entity edge detection layer to obtain nuclear power entity edge features; performing entity classification on the fused nuclear power text features according to the nuclear power entity edge features in the entity classification layer to obtain target nuclear power entity categories.
2. The method of claim 1, wherein, The first encoding of the target nuclear power text to obtain first nuclear power text features comprises: performing word segmentation on the target nuclear power text to obtain target nuclear power characters; performing relative position encoding on the target nuclear power characters to obtain a relative position encoding table; performing character position embedding processing on the target nuclear power characters based on a preset character encoding table and the relative position encoding table to obtain a nuclear power character position sequence; performing entity marking on the target nuclear power characters to obtain nuclear power character entities; performing attention processing on the target nuclear power text according to the nuclear power character position sequence and the nuclear power character entities to obtain the first nuclear power text features.
3. The method of claim 2, wherein, The attention processing on the target nuclear power text according to the nuclear power character position sequence and the nuclear power character entities to obtain the first nuclear power text features comprises: performing query feature extraction on the target nuclear power text according to the nuclear power character position sequence and a preset query parameter matrix to obtain nuclear power character query features; performing key feature extraction on the target nuclear power text according to the nuclear power character position sequence, the nuclear power character entities, a preset key parameter matrix, and a preset entity encoding table to obtain nuclear power character key features; performing value feature extraction on the target nuclear power text according to the nuclear power character position sequence, the nuclear power character entities, a preset value parameter matrix, and the entity encoding table to obtain nuclear power character value features; The nuclear power character query feature, the nuclear power character key feature and the nuclear power character value feature are attention weighted to obtain the first nuclear power text feature.
4. The method of claim 1, wherein, The second encoding of the target nuclear power text to obtain a second nuclear power text feature comprises: The target nuclear power text is converted into a nuclear power word sequence; The nuclear power word sequence is subjected to word embedding processing to obtain a nuclear power word vector; The nuclear power word vector is subjected to attention encoding to obtain the second nuclear power text feature.
5. The method of claim 1, wherein, The fusion of the first nuclear power text feature, the second nuclear power text feature, the first search knowledge text feature and the second search knowledge text feature to obtain a fused nuclear power text feature comprises: The first nuclear power text feature and the second nuclear power text feature are subjected to cross-attention weighting processing to obtain an initial fused nuclear power text feature; The initial fused nuclear power text feature and the first nuclear power text are spliced to obtain a spliced nuclear power text feature; The first search knowledge text feature and the second search knowledge text feature are subjected to cross-attention weighting processing to obtain an initial fused knowledge text feature; The initial fused nuclear knowledge text feature and the first nuclear knowledge text are spliced to obtain a spliced knowledge text feature; The spliced nuclear power text feature and the spliced knowledge text feature are spliced to obtain a spliced nuclear knowledge text feature; The spliced nuclear knowledge text feature is subjected to linear transformation to obtain the fused nuclear power text feature.
6. The method of claim 1, wherein, The entity edge detection of the fused nuclear power text feature to obtain a nuclear power entity edge feature comprises: The fused nuclear power text feature is subjected to entity annotation prediction to obtain a predicted nuclear power annotation entity label; The predicted nuclear power annotation entity label is subjected to label score calculation through a preset transition matrix and a preset emission matrix to obtain an entity label score; The real nuclear power annotation entity label of the fused nuclear power text feature is obtained, and the fused nuclear power text feature is subjected to entity edge detection according to the real nuclear power annotation entity label, the predicted nuclear power annotation entity label and the entity label score to obtain the nuclear power entity edge feature.
7. The method of claim 1, wherein, The entity classification of the fused nuclear power text feature according to the nuclear power entity edge feature to obtain a target nuclear power entity category comprises: The character component recognition of the fused nuclear power text feature to obtain a nuclear power character component feature; The nuclear power character component feature is subjected to entity category recognition according to the nuclear power entity edge feature to obtain the target nuclear power entity category.
8. The method of claim 7, wherein, The character component recognition of the fused nuclear power text feature to obtain a nuclear power character component feature comprises: The character recognition of the fused nuclear power text feature to obtain a target nuclear power character feature; The component recognition of the fused nuclear power text feature to obtain a target nuclear power component feature; The target nuclear power character feature and the target nuclear power component feature are spliced to obtain the nuclear power character component feature.
9. The method of claim 7, wherein, The entity category recognition of the nuclear power character component feature according to the nuclear power entity edge feature to obtain the target nuclear power entity category comprises: The nuclear power entity edge feature and the nuclear power character component feature are spliced to obtain a spliced nuclear power entity feature; An entity category probability of the spliced nuclear power entity feature is predicted to obtain a nuclear power entity category probability; A nuclear power entity category with the highest category probability is selected as the target nuclear power entity category.
10. The method of claim 1, wherein, The knowledge retrieval from the preset nuclear power knowledge base to the target nuclear power text obtains a retrieved nuclear power knowledge text, which includes: An index category of the target nuclear power text is obtained; A candidate nuclear power knowledge text of the nuclear power knowledge base is obtained according to the index category; A text similarity between the candidate nuclear power knowledge text and the target nuclear power text is calculated, and a candidate nuclear power knowledge text with the highest text similarity is selected as the retrieved nuclear power knowledge text.
11. The method of claim 1, wherein, Before the pre-trained entity classification model is obtained, the following steps are further included: A training nuclear power text and an original entity classification model are obtained, and a true entity category of the training nuclear power text is obtained; The training nuclear power text is first encoded by the first text encoding layer to obtain a first training nuclear power text feature; The training nuclear power text is second encoded by the second text encoding layer to obtain a second training nuclear power text feature; The first training nuclear power text feature and the second training nuclear power text feature are fused by the feature fusion layer to obtain a fused training nuclear power text feature; The fused training nuclear power text feature is subjected to entity edge detection by the entity edge detection layer to obtain a training nuclear power entity edge feature; In the entity classification layer, the fused training nuclear power text feature is subjected to entity classification prediction according to the training nuclear power entity edge feature to obtain a predicted entity category; A loss value of the predicted entity category and the true entity category is calculated according to a preset loss function; Model parameters of the entity classification model are updated based on the loss value, and the first encoding of the training nuclear power text by the first text encoding layer is performed until the entity classification model meets a preset training condition, thereby obtaining the pre-trained entity classification model.
12. The method of claim 11, wherein, The loss value of the predicted entity category and the true entity category calculated according to the preset loss function includes: An edge detection loss function of the training nuclear power entity edge feature is obtained, and an edge loss function weight of the edge detection loss function is obtained; A classification loss function of the predicted entity category is obtained, and a classification loss function weight of the classification loss function is obtained; The loss value of the predicted entity category and the true entity category is calculated according to the edge detection loss function, the edge loss function weight, the classification loss function and the classification loss function weight.
13. A nuclear entity classification apparatus, characterized by It includes: A knowledge retrieval module is configured to obtain a target nuclear power text and perform knowledge retrieval on the target nuclear power text from a preset nuclear power knowledge base to obtain a retrieved nuclear power knowledge text; An entity classification model acquisition module is configured to obtain a pre-trained entity classification model; wherein the entity classification model includes a first text encoding layer, a second text encoding layer, a feature fusion layer, an entity edge detection layer and an entity classification layer. The nuclear power text first encoding module is configured to perform first encoding on the target nuclear power text by using the first text encoding layer to obtain first nuclear power text features; wherein the first nuclear power text features include semantic information, position information of nuclear power characters, and related information of entities; The nuclear power knowledge text first encoding module is configured to perform first encoding on the search nuclear power knowledge text by using the first text encoding layer to obtain first search knowledge text features; The nuclear power text second encoding module is configured to perform second encoding on the target nuclear power text by using the second text encoding layer to obtain second nuclear power text features; wherein the second nuclear power text features include text features of context semantic information; The nuclear power knowledge text second encoding module is configured to perform second encoding on the search nuclear power knowledge text by using the second text encoding layer to obtain second search knowledge text features; The feature fusion module is configured to fuse the first nuclear power text features, the second nuclear power text features, the first search knowledge text features, and the second search knowledge text features by using the feature fusion layer to obtain fused nuclear power text features; The entity edge detection module is configured to perform entity edge detection on the fused nuclear power text features by using the entity edge detection layer to obtain nuclear power entity edge features; The entity classification module is configured to perform entity classification on the fused nuclear power text features according to the nuclear power entity edge features in the entity classification layer to obtain a target nuclear power entity category.
14. An electronic device, comprising: Comprise: A memory and a processor, the memory stores a computer program, and the processor realizes the nuclear power entity classification method in any one of claims 1 to 12 when executing the computer program.
15. A computer-readable storage medium, characterized in that, The storage medium stores a program, and the program is executed by the processor to realize the nuclear power entity classification method in any one of claims 1 to 12.
Citation Information
Patent Citations
Text processing method and device, model training method and device, computer equipment and storage medium
CN112084331A
Text processing method and device, electronic equipment and storage medium
CN114064894A