Inspection report quality evaluation method, electronic equipment and program product
By integrating the characteristics of special equipment inspection report data with preset knowledge graphs and calculation of abnormal scores, automated quality assessment is realized, solving the problems of low efficiency and high labor consumption in traditional evaluation methods, and improving the evaluation efficiency and data utilization rate.
Patent Information
- Application Number
- CN202510306191.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2025-08-01
AI Technical Summary
In the prior art, the quality evaluation method of special equipment inspection reports has problems of low work efficiency and high labor consumption.
By obtaining preset knowledge graphs and inspection report data from preset databases, using graph feature extraction and text feature extraction strategies, perform feature fusion, determine the entity distribution difference between the inspection report data and the knowledge graph, calculate abnormal scores, and realize automated quality evaluation.
It improves the efficiency of quality assessment, reduces labor costs, improves data utilization, and improves the inefficiency problem of traditional assessment methods.
Smart Images

Figure CN120408208A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of artificial intelligence, and in particular, to a method for evaluating the quality of inspection reports, an electronic device, and a program product. Background Art
[0002] The special equipment inspection report is an objective, fair, scientific, and authoritative evaluation result of the quality and safety performance of special equipment issued by a special equipment inspection agency (hereinafter referred to as the "special inspection agency"), and is also an important basis for the legal supervision of the special equipment safety supervision department. The quality of the inspection report is closely related to the interests of the recipient unit, and at the same time directly affects the authority of the special inspection agency. It is both the final product of the special inspection agency and a legally valid certification document. Therefore, the quality of the special equipment inspection report directly reflects the work quality of inspection and testing. Therefore, the quality of special equipment inspection reports has always been the focus of the quality management work of special inspection agencies.
[0003] In the prior art, the quality control of inspection reports is usually offline manual transfer and manual statistics, and the spot check result data is collected and statistically analyzed offline, resulting in problems such as low work efficiency and high labor consumption. Summary of the Invention
[0004] In view of this, the purpose of the embodiments of the present application is to provide a method for evaluating the quality of inspection reports, an electronic device, and a program product, which can improve the problems of low work efficiency and high labor consumption in the traditional method for evaluating the quality of inspection reports.
[0005] To achieve the above technical objectives, the technical solutions adopted in the present application are as follows:
[0006] In a first aspect, an embodiment of the present application provides a method for evaluating the quality of inspection reports, the method including:
[0007] Obtaining a preset knowledge graph and randomly selected inspection report data from a preset database;
[0008] Based on a preset graph feature extraction strategy, extracting features from the preset knowledge graph to obtain first feature information representing the entity association relationship of the preset knowledge graph;
[0009] Based on a preset text feature extraction strategy, extracting features from the inspection report data to obtain second feature information representing the structural features of the inspection report data;
[0010] Performing feature fusion on the first feature information and the second feature information to obtain fusion features corresponding to the inspection report;
[0011] Determine an anomaly score that characterizes the difference between the first entity distribution in the inspection report data and the second entity distribution in the preset knowledge graph according to the fusion feature and the preset knowledge graph;
[0012] Perform quality assessment on the inspection report data according to the fusion feature and the anomaly score to obtain an assessment result.
[0013] Combined with the first aspect, in some alternative implementation manners, based on a preset graph feature extraction strategy, extract features from the preset knowledge graph to obtain first feature information that characterizes the entity association relationship of the preset knowledge graph, including:
[0014] Obtain the adjacency matrix in the preset knowledge graph;
[0015] Perform graph convolutional feature extraction on the preset knowledge graph according to the adjacency matrix to obtain the first feature information:
[0016]
[0017] In the formula, represents the first feature information obtained by the (l + 1)-th layer of graph convolution, A represents the adjacency matrix, D represents the degree matrix used to normalize the adjacency matrix, represents the trainable weight matrix of the l-th layer of graph convolution, and σ(·) represents the ReLU activation function.
[0018] Combined with the first aspect, in some alternative implementation manners, based on a preset text feature extraction strategy, extract features from the inspection report data to obtain second feature information that characterizes the structural feature of the inspection report data, including:
[0019] Perform vector conversion on the inspection report data to obtain a word vector matrix corresponding to the inspection report data;
[0020] According to the word vector matrix, use a context encoder to determine a hidden state matrix corresponding to the word vector matrix:
[0021]
[0022] In the formula, LSTM(·) represents the long short-term memory network in the context encoder, h represents the dimension of the feature vector extracted by the long short-term memory network, represents the word vector matrix of the i-th inspection report data, d represents the dimension of the word vector in the word vector matrix, W forward 、W backward respectively represent the trainable forward and reverse LSTM parameter matrices;
[0023] Determine the attention weight vector corresponding to the word vector matrix according to the hidden state matrix:
[0024]
[0025] wherein represents a learnable attention transformation matrix, and b a represents a learnable first bias vector, represents a learnable attention query vector;
[0026] Determine the second feature information according to the hidden state matrix and the attention weight vector:
[0027]
[0028] wherein T represents the length of the word vector matrix, and α i,j represents the attention weight vector of the j-th word in the word vector matrix corresponding to the i-th test report data, and H i,j represents the hidden state matrix of the j-th word in the word vector matrix corresponding to the i-th test report data, represents the second feature information corresponding to the i-th test report data.
[0029] Combined with the first aspect, in some alternative embodiments, performing feature fusion on the first feature information and the second feature information to obtain the fusion feature corresponding to the test report includes:
[0030] Broadcast the first feature information to align the dimension of the first feature information with that of the second feature information:
[0031] F′ g = Repeat(F g , dim = 0, repeats = N)
[0032] wherein F′ g represents the broadcast first feature information, F g represents the first feature information, Repeat(,,) represents the broadcast operation, dim represents the broadcast dimension, and repeats represents the number of replications in dimension dim;
[0033] Determine the gating weight according to the broadcast first feature information and the second feature information:
[0034] g = σ(W g [F′ g ; F t )
[0035] where g represents the gating weight, σ represents the sigmoid function, and W g represents a learnable weight matrix, and F t represents the second feature information;
[0036] According to the gating weight, perform weighted fusion on the broadcast first feature information and the second feature information to obtain the fused feature:
[0037]
[0038] where F represents the fused feature, ⊙ represents element-wise multiplication of vectors, represents the vector concatenation operation.
[0039] Combined with the first aspect, in some alternative embodiments, determining an anomaly score representing the difference between the distribution of the first entities in the inspection report data and the distribution of the second entities in the preset knowledge graph according to the fused feature and the preset knowledge graph includes:
[0040] Randomly select features of multiple dimensions from the fused feature as a feature subset;
[0041] Perform a tree-like partitioning on the features in the feature subset through a preset cut-off value to obtain a left tree and a right tree, where the features with feature values less than or equal to the preset cut-off value are assigned to the left tree;
[0042] For the left tree and the right tree, repeatedly randomly select a new preset cut-off value and perform the tree-like partitioning on the features in the left tree and the right tree until all the features in the feature subset are isolated, or the tree depth of the left tree or the right tree is greater than or equal to a preset tree depth limit, to obtain an isolated tree composed of multiple left trees and right trees with different tree depths;
[0043] Repeatedly randomly select features of multiple dimensions from the fused feature as a new feature subset and construct the isolated tree based on the new feature subset until the number of isolated trees reaches a preset number to obtain multiple isolated trees;
[0044] For the multiple isolated trees, determine the path expected length of the multiple isolated trees:
[0045]
[0046] where E(N) represents the path expected length, N represents the number of features in the multiple isolated trees, ln(N - 1) represents the sum of the reciprocals of the natural number sequence from 1 to N - 1, and γ represents the Euler constant;
[0047] For any one feature in the isolated tree, correct the path length of the any one feature in the isolated tree where it is located to obtain the actual path length corresponding to the any one feature:
[0048]
[0049] In the formula, h corrected (d i ) represents the actual path length corresponding to any one feature d i , h(d i ) represents the path length of any one feature d i in the isolated tree where it is located, H(L - 1) = ln(L - 1) + γ, ln(L - 1) represents the sum of the reciprocals of the natural number sequence from 1 to L - 1, and L represents the tree depth of the isolated tree where any one feature d i is located;
[0050] According to the actual path length, determine the average path length corresponding to the any one feature:
[0051]
[0052] In the formula, P(d i ) represents the average path length, and M represents the number of isolated trees in multiple isolated trees;
[0053] According to the first entity distribution and the second entity distribution, determine the difference penalty term between the first entity distribution and the second entity distribution:
[0054]
[0055] In the formula, L1 represents the difference penalty term, δ represents the first preset weighting parameter, pdata(q) represents the first entity distribution, and pg(q) represents the second entity distribution;
[0056] According to the path expected length, the average path length, and the difference penalty term, determine the anomaly score:
[0057]
[0058] In the formula, s a represents the anomaly score.
[0059] Combined with the first aspect, in some alternative embodiments, according to the fusion feature and the anomaly score, perform quality assessment on the inspection report data to obtain an assessment result, including:
[0060] According to the fusion feature and the anomaly score, determine the quality score of the inspection report data through the following formula:
[0061]
[0062] Where R represents the quality score, σ(·) represents the sigmoid activation function, Represents the trainable weight matrix, w s represents the second preset weighting parameter, b represents the second learnable bias vector, F represents the fusion feature, s a represents the anomaly score;
[0063] The quality of the inspection report data is evaluated according to the quality score to obtain the evaluation result.
[0064] In conjunction with the first aspect, in some optional implementations, performing a quality assessment on the inspection report data according to the quality score to obtain the assessment result includes:
[0065] When the quality score is greater than or equal to a first preset threshold, determining that the evaluation result is a first result indicating that the inspection report data is excellent;
[0066] When the quality score is greater than or equal to a second preset threshold and less than the first preset threshold, determining that the evaluation result is a second result indicating that the inspection report data is qualified;
[0067] When the quality score is less than the second preset threshold, the evaluation result is determined to be a third result indicating that the inspection report data is unqualified.
[0068] In conjunction with the first aspect, in some optional implementations, before obtaining the preset knowledge graph and the randomly selected inspection report data from the preset database, the method further includes:
[0069] Get the target document collection;
[0070] Performing word segmentation processing on each document in the target document set to obtain a word segmentation set corresponding to each document;
[0071] Performing vector conversion on the word segmentation set to obtain a document word vector matrix corresponding to the target document set;
[0072] According to the document word vector matrix, performing syntactic analysis on the word sequence in the document word vector matrix to construct a dependency tree set;
[0073] Based on a preset bidirectional encoding strategy, entity recognition is performed on the document word vector matrix to construct a candidate entity set;
[0074] Clustering each entity in the candidate entity set to obtain multiple clustered entities as an entity class set;
[0075] Performing relation extraction on the entity class set according to the dependency tree set and the entity class set to obtain a relation triple set;
[0076] Constructing a knowledge graph according to the entity class set and the relation triple set as the preset knowledge graph, where the preset knowledge graph includes the entity class set and the adjacency matrix corresponding to the entity class set.
[0077] In a second aspect, an embodiment of the present application further provides an electronic device, which includes a processor and a memory coupled to each other. The memory stores a computer program. When the computer program is executed by the processor, the electronic device is enabled to execute the above method.
[0078] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program runs on a computer, the computer is enabled to execute the above method.
[0079] The invention adopting the above technical solution has the following advantages:
[0080] In the technical solution provided by the present application, first, a preset knowledge graph and randomly selected inspection report data are obtained from a preset database, and based on a preset graph feature extraction strategy, feature extraction is performed on the preset knowledge graph to obtain first feature information. Then, based on a preset text feature extraction strategy, feature extraction is performed on the inspection report data to obtain second feature information. Then, the first feature information and the second feature information are fused to obtain a fusion feature corresponding to the inspection report, and based on the fusion feature and the preset knowledge graph, an anomaly score representing the difference between the first entity distribution in the inspection report data and the second entity distribution in the preset knowledge graph is determined. Finally, based on the fusion feature and the anomaly score, quality assessment is performed on the inspection report data to obtain an assessment result. In this way, by performing feature extraction and fusion comparison on the randomly selected inspection report data and the data in the pre-constructed knowledge graph, the difference between the randomly selected inspection report data and the data in the knowledge graph is determined as the anomaly score, and then the quality of the inspection report data is evaluated according to the anomaly score, realizing the automated assessment of the inspection report data, reducing the labor cost and subjective influence in the quality assessment process, improving the quality assessment efficiency and data utilization rate, and improving the problems of low efficiency and large labor consumption existing in the traditional inspection report quality assessment method. Description of the Drawings
[0081] This application can be further illustrated by the non-limiting embodiments shown in the accompanying drawings. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0082] Figure 1 It is a structural block diagram of an electronic device provided by an embodiment of this application.
[0083] Figure 2 It is a schematic flowchart of a method for evaluating the quality of inspection reports provided by an embodiment of this application.
[0084] Figure 3 It is a structural block diagram of a platform for evaluating the quality of inspection reports provided by an embodiment of this application.
[0085] Icons: 100 - Electronic device; 101 - Processor; 102 - Memory; 200 - Platform for evaluating the quality of inspection reports; 210 - Acquisition module; 220 - First feature extraction module; 230 - Second feature extraction module; 240 - Feature fusion module; 250 - Determination module; 260 - Evaluation module. Detailed implementation manners
[0086] The following will describe this application in detail with reference to the accompanying drawings and specific embodiments. It should be noted that in the drawings or the description, similar or identical parts are denoted by the same reference numerals, and the implementation manners not depicted or described in the drawings are in the forms known to those of ordinary skill in the art. In the description of this application, the terms "first", "second", etc. are only used for distinguishing descriptions and cannot be construed as indicating or implying relative importance.
[0087] Please refer to Figure 1 , an electronic device 100 provided by an embodiment of this application may include a processor 101 and a memory 102. A computer program is stored in the memory 102. When the computer program is executed by the processor 101, the electronic device 100 can perform the corresponding steps in the following method for evaluating the quality of inspection reports.
[0088] In this embodiment, the processor 101 may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor 101 may be a general-purpose processor 101. For example, the processor 101 may be a central processing unit 101 (CPU), a digital signal processor 101 (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application.
[0089] The memory 102 may be, but is not limited to, a random access memory 102, a read-only memory 102, a programmable read-only memory 102, an erasable programmable read-only memory 102, an electrically erasable programmable read-only memory 102, etc. In this embodiment, the memory 102 may be used to store a preset database, a preset graph feature extraction strategy, first feature information, a preset text feature extraction strategy, second feature information, fusion features, anomaly scores, evaluation results, a target document set, a word segmentation set, a document word vector matrix, a dependency tree set, a preset bidirectional encoding strategy, a candidate entity set, an entity class set, a relationship triple set, etc. Of course, the memory 102 may also be used to store a program, and the processor 101 executes the program after receiving an execution instruction.
[0090] It can be understood that Figure 1 the structure of the electronic device 100 shown in Figure 1 is only a schematic structural diagram, and the electronic device 100 may further include more Figure 1 components than those shown.
[0091] In this embodiment, the electronic device 100 may be a personal computer, a laptop, a cloud server, etc. It is used to obtain a preset knowledge graph and randomly selected inspection report data from a preset database. Then, based on a preset graph feature extraction strategy, feature extraction is performed on the preset knowledge graph to obtain first feature information. Then, based on a preset text feature extraction strategy, feature extraction is performed on the inspection report data to obtain second feature information. Then, the first feature information and the second feature information are fused to obtain a fusion feature corresponding to the inspection report, and based on the fusion feature and the preset knowledge graph, an anomaly score representing the difference degree between the first entity distribution in the inspection report data and the second entity distribution in the preset knowledge graph is determined. Finally, based on the fusion feature and the anomaly score, quality assessment is performed on the inspection report data to obtain an assessment result.
[0092] Please refer to Figure 2 , this application also provides a method for quality assessment of inspection reports, which can be applied to the above-mentioned electronic device 100 and executed or implemented by the electronic device 100 for each step of the method. Among them, the method for quality assessment of inspection reports may include the following steps:
[0093] Step 110, obtaining a preset knowledge graph and randomly selected inspection report data from a preset database;
[0094] Step 120, based on a preset graph feature extraction strategy, performing feature extraction on the preset knowledge graph to obtain first feature information representing the entity association relationship of the preset knowledge graph;
[0095] Step 130, based on a preset text feature extraction strategy, performing feature extraction on the inspection report data to obtain second feature information representing the structural features of the inspection report data;
[0096] Step 140, performing feature fusion on the first feature information and the second feature information to obtain a fusion feature corresponding to the inspection report;
[0097] Step 150, based on the fusion feature and the preset knowledge graph, determining an anomaly score representing the difference degree between the first entity distribution in the inspection report data and the second entity distribution in the preset knowledge graph;
[0098] Step 160, based on the fusion feature and the anomaly score, performing quality assessment on the inspection report data to obtain an assessment result.
[0099] In the above embodiment, a preset knowledge graph and randomly extracted test report data are first obtained from a preset database, and based on a preset graph feature extraction strategy, feature extraction is performed on the preset knowledge graph to obtain first feature information. Then, based on a preset text feature extraction strategy, feature extraction is performed on the test report data to obtain second feature information. Feature fusion is then performed on the first feature information and the second feature information to obtain a fusion feature corresponding to the test report, and based on the fusion feature and the preset knowledge graph, an anomaly score is determined to characterize the difference between the first entity distribution in the test report data and the second entity distribution in the preset knowledge graph. Finally, based on the fusion feature and the anomaly score, the test report data is quality assessed to obtain an assessment result. In this way, by performing feature extraction and fusion comparison on the randomly extracted test report data and the data in the pre-constructed knowledge graph, the difference between the randomly extracted test report data and the data in the knowledge graph is determined as an anomaly score, and then the quality of the test report data is assessed based on the anomaly score, thereby realizing automated assessment of the test report data, reducing the labor cost and subjective influence in the quality assessment process, improving the quality assessment efficiency and data utilization, and improving the problems of low efficiency and high labor consumption in the traditional test report quality assessment method.
[0100] The following is a detailed description of the various steps in the inspection report quality assessment method:
[0101] Prior to step 110, the method may include:
[0102] Get the target document collection;
[0103] Performing word segmentation processing on each document in the target document set to obtain a word segmentation set corresponding to each document;
[0104] Performing vector conversion on the word segmentation set to obtain a document word vector matrix corresponding to the target document set;
[0105] According to the document word vector matrix, performing syntactic analysis on the word sequence in the document word vector matrix to construct a dependency tree set;
[0106] Based on a preset bidirectional encoding strategy, entity recognition is performed on the document word vector matrix to construct a candidate entity set;
[0107] Clustering each entity in the candidate entity set to obtain multiple clustered entities as an entity class set;
[0108] performing relationship extraction on the entity class set according to the dependency tree set and the entity class set to obtain a relationship triple set;
[0109] Construct a knowledge graph based on the entity class set and the relation triple set as the preset knowledge graph, where the preset knowledge graph includes the entity class set and the adjacency matrix corresponding to the entity class set.
[0110] In this embodiment, the target document set can be inspection reports that are pre-collected and filled in by the user as standard, qualified, or excellent, and multiple target documents are used as the above-mentioned target document set. In this way, by using standard, qualified, or excellent inspection reports as a comparison reference for subsequent inspection report data, the quality evaluation of inspection report data can be realized. It can be understood that the smaller the abnormality degree (or the greater the similarity) between the subsequently obtained inspection report data and the target document set, the greater the possibility that the inspection report data is qualified or excellent data.
[0111] In this embodiment, after obtaining the target document set D = {D1, D2,..., D N}, each document is tokenized to generate a word sequence: L i represents the original number of words in document D i , and then the documents are unified to a fixed length. Among them, if the original number of words in a document is greater than the length T (i.e., the number of words) preset by the user, the word sequence is truncated to retain the length preset by the user. If the original number of words in a document is less than the length preset by the user, the word sequence is padded so that the total number of times is the length preset by the user. After tokenization, the word sequence is vectorized through a pre-trained Word2Vec model to obtain word vectors: d = 300 represents the vector dimension determined by the user. For each document D i , a T×300 matrix is generated based on the word vectors, and finally the word vector matrices of all documents are stacked to obtain a three-dimensional tensor as the document word vector matrix:
[0112]
[0113] In the formula, X represents the document word vector matrix.
[0114] In this embodiment, for each vector matrix corresponding to a target document in the document word vector matrix, the vector matrix of the target document is syntactically parsed through the natural language processing tool StanfordParser to generate a dependency tree for recording the subject-predicate-object relationship (such as device - cutting - product) between the tokens in the target document. The set of dependency trees corresponding to all target documents is the above-mentioned dependency tree set.
[0115] After the construction of the dependency tree set is completed, the document word vector matrix is encoded by a bidirectional encoder (BiLSTM, Bi-directional Long Short-Term Memory) to obtain the hidden state matrix H corresponding to the document word vector matrix t = BiLSTM(X t-3:t+3 ; W h ), the hidden layer dimension h of the bidirectional encoder is 256, and the window k = 3. Then, the hidden state matrix corresponding to the document word vector matrix is mapped to the label space through another trainable weight matrix to generate the probability score P(y t ) = Softmax(W e H t + b e ), and then the candidate entity set is constructed according to the probability scores: E = {X i,j:j+l |y j ,…,y j+l}.
[0116] For each candidate entity E in the candidate entity set i , the candidate entity is encoded by BERT (Bidirectional Encoder Representation from Transformers, a pre-trained language representation model) to generate the CLS vector For any candidate entity pair composed of two candidate entities, based on the candidate entity pair (e i , e j ), the cosine similarity is calculated for the CLS vectors corresponding to the two different candidate entities, and the cosine similarity Then, through the preset similarity threshold τ = 0.7, the entity class set C = SpectralClustering(S, τ = 0.7) is generated based on the spectral clustering algorithm
[0117] After determining the above dependency tree set and entity class set, relation extraction is performed based on the above dependency tree set and entity class set to obtain the relation triple set R = {(C i , r k , C j )}. Then, the adjacency matrix is constructed based on the relation triple set
[0118]
[0119] where N represents the total number of target documents, and df(r) represents the number of documents containing the relation r
[0120] Finally, a knowledge graph is constructed based on the entity class set and the adjacency matrix to serve as the preset knowledge graph.
[0121] In step 110, the inspection report data (electronic document) filled in by the staff after equipment inspection and the preset knowledge graph constructed in advance can be stored in the memory 102 of the above-mentioned electronic device 100 as a preset database.
[0122] In this embodiment, the acquisition of the preset knowledge graph and the inspection report data can be based on computer instructions issued by the user through the processor 101 and called from the above-mentioned memory 102.
[0123] In step 120, based on the preset graph feature extraction strategy, feature extraction is performed on the preset knowledge graph to obtain first feature information representing the entity association relationship of the preset knowledge graph, which may include:
[0124] Obtain the adjacency matrix in the preset knowledge graph;
[0125] According to the adjacency matrix, perform graph convolutional feature extraction on the preset knowledge graph to obtain the first feature information:
[0126]
[0127] In the formula, represents the first feature information obtained by the (l + 1)-th layer of graph convolution, A represents the adjacency matrix, D represents the degree matrix used to normalize the adjacency matrix, represents the trainable weight matrix of the l-th layer of graph convolution, and σ(·) represents the ReLU activation function.
[0128] In this embodiment, the association relationship between entities in the target document is extracted through a graph convolutional network. For example, between device x - working temperature - between 25°C and 36°C.
[0129] In step 130, based on the preset text feature extraction strategy, feature extraction is performed on the inspection report data to obtain second feature information representing the structural features of the inspection report data, which may include:
[0130] Perform vector conversion on the inspection report data to obtain the word vector matrix corresponding to the inspection report data;
[0131] According to the word vector matrix, use a context encoder to determine the hidden state matrix corresponding to the word vector matrix:
[0132]
[0133] Wherein, LSTM(·) represents the long short-term memory network in the context encoder, h represents the dimension of the feature vector extracted by the long short-term memory network, represents the word vector matrix of the i-th test report data, d represents the dimension of the word vector in the word vector matrix, W forward and W backward respectively represent the trainable forward and backward LSTM parameter matrices;
[0134] Determine the attention weight vector corresponding to the word vector matrix according to the hidden state matrix:
[0135]
[0136] Wherein, represents the learnable attention transformation matrix, b a represents the learnable first bias vector, represents the learnable attention query vector;
[0137] Determine the second feature information according to the hidden state matrix and the attention weight vector:
[0138]
[0139] Wherein, T represents the length of the word vector matrix, α i,j represents the attention weight vector of the j-th word in the word vector matrix corresponding to the i-th test report data, H i,j represents the hidden state matrix of the j-th word in the word vector matrix corresponding to the i-th test report data, represents the second feature information corresponding to the i-th test report data.
[0140] In this embodiment, the global semantic information in the test report data is extracted by a bidirectional long short-term memory network (BiLSTM), and the dimensions of the word vector matrix are compressed and unified.
[0141] It can be understood that the first feature information extracted by the graph convolutional network provides structured knowledge, and the second feature information extracted by the bidirectional long short-term memory network provides semantic details. Feature fusion of the two can improve the comprehensiveness of feature representation.
[0142] In step 140, feature fusion of the first feature information and the second feature information to obtain the fusion feature corresponding to the test report may include:
[0143] Broadcast the first feature information to align the dimension of the first feature information with that of the second feature information:
[0144]
[0145] In the formula, F′ g represents the first feature information after broadcasting, F g represents the first feature information, Repeat(,,) represents the broadcast operation, dim represents the dimension of the broadcast, and repeats represents the number of times of replication on the dimension dim;
[0146] Determine the gating weight according to the first feature information after the broadcast and the second feature information:
[0147] g = σ(W g [F′ g ; F t ) (12)
[0148] In the formula, g represents the gating weight, σ represents the sigmoid function, W g represents the learnable weight matrix, and F t represents the second feature information;
[0149] Perform weighted fusion on the first feature information after the broadcast and the second feature information according to the gating weight to obtain the fused feature:
[0150]
[0151] In the formula, F represents the fused feature, ⊙ represents element-wise multiplication of vectors, represents the vector concatenation operation.
[0152] In this way, through dynamic feature fusion based on the gating weight for the first feature and the second feature, dynamically adjust the weights of the two, associate the knowledge graph with the inspection report, and improve the flexibility and adaptability of feature fusion.
[0153] In step 150, according to the fused feature and the preset knowledge graph, determining the anomaly score representing the difference between the first entity distribution in the inspection report data and the second entity distribution in the preset knowledge graph may include:
[0154] Randomly select features of multiple dimensions from the fused feature as a feature subset;
[0155] Perform a tree-like partition on the features in the feature subset through a preset cut-off value to obtain a left tree and a right tree, where the features with feature values less than or equal to the preset cut-off value are assigned to the left tree;
[0156] For the left tree and the right tree, randomly select a new preset splitting value repeatedly, and perform the tree-like partitioning on the features in the left tree and the right tree until all the features in the feature subset are isolated, or the tree depth of the left tree or the right tree is greater than or equal to the preset tree depth limit, to obtain isolated trees composed of multiple left trees and right trees with different tree depths;
[0157] Repeatedly randomly select features of multiple dimensions from the fused features as a new feature subset, and construct the isolated trees based on the new feature subset until the number of the isolated trees reaches the preset number, to obtain multiple isolated trees;
[0158] For the multiple isolated trees, determine the path expected length of the multiple isolated trees:
[0159]
[0160] In the formula, E(N) represents the path expected length, N represents the number of features in the multiple isolated trees, ln(N - 1) represents the sum of the reciprocals of the natural number sequence from 1 to N - 1, and γ represents the Euler constant;
[0161] For any feature in the isolated tree, correct the path length of the any feature in the isolated tree where it is located to obtain the actual path length corresponding to the any feature:
[0162]
[0163] In the formula, h corrected (d i ) represents the actual path length corresponding to any feature d i , h(d i ) represents the path length of any feature d i in the isolated tree where it is located, H(L - 1) = ln(L - 1) + γ, ln(L - 1) represents the sum of the reciprocals of the natural number sequence from 1 to L - 1, and L represents the tree depth of the isolated tree where any feature d i is located;
[0164] According to the actual path length, determine the average path length corresponding to the any feature:
[0165]
[0166] In the formula, P(d i ) represents the average path length, and M represents the number of isolated trees in the multiple isolated trees;
[0167] According to the first entity distribution and the second entity distribution, determine the difference penalty term between the first entity distribution and the second entity distribution:
[0168]
[0169] Wherein, L1 represents a difference penalty term, δ represents a first preset weighting parameter, pdata(q) represents a first entity distribution, and pg(q) represents a second entity distribution;
[0170] Determine the anomaly score according to the path expected length, the average path length, and the difference penalty term:
[0171]
[0172] Wherein, s a represents the anomaly score.
[0173] In this embodiment, a plurality of isolation trees are constructed based on the fusion features to obtain an isolation forest. For each isolation tree in the isolation forest, according to the path length of the isolation samples in the isolation tree (which can be understood as the number of times of division during the construction of the isolation tree), determine the anomaly score of the isolation sample (that is, the total of the fusion features, the feature corresponding to a single dimension (i.e., an entity)). Facilitate subsequent quality assessment of the inspection report data based on the anomaly scores of each entity in the inspection report data.
[0174] In step 160, according to the fusion features and the anomaly score, perform a quality assessment on the inspection report data to obtain an assessment result, which may include:
[0175] According to the fusion features and the anomaly score, determine the quality score of the inspection report data through the following formula:
[0176]
[0177] Wherein, R represents the quality score, σ(·) represents the sigmoid activation function, represents a trainable weight matrix, w s represents a second preset weighting parameter, b represents a learnable second bias vector, F represents the fusion feature, s a represents the anomaly score;
[0178] Perform a quality assessment on the inspection report data according to the quality score to obtain the assessment result.
[0179] In this embodiment, the value of w s can be -0.1. By comprehensively considering the fusion features of the above inspection report data and the preset knowledge graph, as well as the anomaly scores of each entity in the subsequent fusion features, judge the treatment evaluation result of the inspection report data.
[0180] In this embodiment, performing quality assessment on the inspection report data according to the quality score to obtain the evaluation result may include:
[0181] When the quality score is greater than or equal to a first preset threshold, determining that the evaluation result is a first result indicating that the inspection report data is excellent;
[0182] When the quality score is greater than or equal to a second preset threshold and less than the first preset threshold, determining that the evaluation result is a second result indicating that the inspection report data is qualified;
[0183] When the quality score is less than the second preset threshold, determining that the evaluation result is a third result indicating that the inspection report data is unqualified.
[0184] In this embodiment, the first preset threshold and the second preset threshold can be flexibly set according to user requirements.
[0185] It should be noted that those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working process of the above-described electronic device 100 can refer to the corresponding processes of the foregoing steps in the method, and will not be elaborated herein.
[0186] The embodiment of the present application further provides a computer program product, including a computer program, and the computer program implements the above-described inspection report quality evaluation method when executed by a processor 101.
[0187] In the present application, for the convenience of implementing the above-described inspection report quality evaluation method, with reference to Figure 3 , the present application further provides an inspection report quality evaluation platform 200 as the implementation environment of the above-described inspection report quality evaluation method. The platform includes:
[0188] An acquisition module 210, configured to acquire a preset knowledge graph and randomly selected inspection report data from a preset database;
[0189] A first feature extraction module 220, configured to perform feature extraction on the preset knowledge graph based on a preset graph feature extraction strategy to obtain first feature information representing the entity association relationship of the preset knowledge graph;
[0190] A second feature extraction module 230, configured to perform feature extraction on the inspection report data based on a preset text feature extraction strategy to obtain second feature information representing the structural features of the inspection report data;
[0191] A feature fusion module 240, configured to perform feature fusion on the first feature information and the second feature information to obtain fusion features corresponding to the inspection report;
[0192] A determination module 250, configured to determine an anomaly score representing the difference between the first entity distribution in the inspection report data and the second entity distribution in the preset knowledge graph according to the fusion feature and the preset knowledge graph;
[0193] An evaluation module 260, configured to perform a quality evaluation on the inspection report data according to the fusion feature and the anomaly score, and obtain an evaluation result.
[0194] In this embodiment, the user pre-constructs a knowledge graph of qualified quality inspection reports based on a large number of inspection reports (i.e., the target document set described above), and obtains a preset knowledge graph. And a device inspection report recorded by the user during work and the preset knowledge graph are jointly used to construct a database to obtain a preset database. During the user's use of the platform, the inspection report data randomly extracted from the preset database is input into the platform. Then, the first feature extraction module 220 extracts features from the preset knowledge graph to obtain first feature information, and the second feature extraction module 230 extracts features from the inspection report data to obtain second feature information. Then, the first feature information and the second feature information are fused through the feature fusion module 240 to obtain a fusion feature. Then, the determination module 250 determines the anomaly score corresponding to each entity in the fusion feature. Finally, according to the fusion feature and the anomaly score corresponding to each entity in the fusion feature, a quality evaluation is performed on the inspection report data to obtain an evaluation result. In this way, the automatic spot check and quality evaluation of the inspection report data are realized. The evaluation result obtained from the quality evaluation can also be applied to subsequent data statistics, and based on the linear data change situation, the reasons for the quality defects of the inspection report can be judged.
[0195] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented through hardware, or can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, and the software product can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various implementation scenarios of the present application.
[0196] In summary, the embodiments of the present application provide a method for evaluating the quality of inspection reports, an electronic device, and a program product. In the technical solution, first, a preset knowledge graph and randomly selected inspection report data are obtained from a preset database, and based on a preset graph feature extraction strategy, the preset knowledge graph is feature-extracted to obtain first feature information. Then, based on a preset text feature extraction strategy, the inspection report data is feature-extracted to obtain second feature information. Then, the first feature information and the second feature information are feature-fused to obtain the fused features corresponding to the inspection reports, and based on the fused features and the preset knowledge graph, an anomaly score representing the difference degree between the first entity distribution in the inspection report data and the second entity distribution in the preset knowledge graph is determined. Finally, based on the fused features and the anomaly score, the quality of the inspection report data is evaluated to obtain an evaluation result. In this way, by performing feature extraction and fusion comparison on the randomly selected inspection report data and the data in the pre-constructed knowledge graph, the difference between the randomly selected inspection report data and the data in the knowledge graph is determined as the anomaly score, and then the quality of the inspection report data is evaluated according to the anomaly score, realizing the automated evaluation of the inspection report data, reducing the labor cost and subjective influence in the quality evaluation process, improving the quality evaluation efficiency and data utilization rate, and improving the problems of low efficiency and large labor consumption existing in the traditional inspection report quality evaluation method.
[0197] In the embodiments provided in the present application, it should be understood that the disclosed platform and method can also be implemented in other ways. The platform and method embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions, and operations of the platform, method, and computer program product according to multiple embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that each block in the block diagram and / or flowchart, as well as the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. In addition, the functional modules in the various embodiments of the present application can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part.
[0198] The above are only the embodiments of the present application and are not used to limit the protection scope of the present application. For those skilled in the art, the present application can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for evaluating the quality of inspection reports, characterized in that, The method comprises: Obtain a preset knowledge graph and randomly selected inspection report data from a preset database; Based on a preset graph feature extraction strategy, feature extraction is performed on the preset knowledge graph to obtain first feature information representing the entity association relationship of the preset knowledge graph; Based on a preset text feature extraction strategy, feature extraction is performed on the inspection report data to obtain second feature information representing structural features of the inspection report data; Performing feature fusion on the first feature information and the second feature information to obtain a fusion feature corresponding to the inspection report; Determining, based on the fusion feature and the preset knowledge graph, an anomaly score representing a difference between a first entity distribution in the inspection report data and a second entity distribution in the preset knowledge graph; A quality assessment is performed on the inspection report data based on the fusion features and the anomaly score to obtain an assessment result.
2. The method according to claim 1, wherein Based on a preset graph feature extraction strategy, feature extraction is performed on the preset knowledge graph to obtain first feature information representing the entity association relationship of the preset knowledge graph, including: Obtaining an adjacency matrix in the preset knowledge graph; According to the adjacency matrix, graph convolution feature extraction is performed on the preset knowledge graph to obtain the first feature information: In the formula, represents the first feature information obtained by the (l + 1)-th layer of graph convolution, A represents the adjacency matrix, and D represents the degree matrix used to normalize the adjacency matrix. represents the trainable weight matrix of the l-th layer of graph convolution, and σ(·) represents the ReLU activation function.
3. The method according to claim 1, characterized in that, Based on a preset text feature extraction strategy, feature extraction is performed on the inspection report data to obtain second feature information representing structural features of the inspection report data, including: Performing vector conversion on the inspection report data to obtain a word vector matrix corresponding to the inspection report data; According to the word vector matrix, the context encoder is used to determine the hidden state matrix corresponding to the word vector matrix: In the formula, LSTM(·) represents the long short-term memory network in the context encoder, h represents the dimension of the feature vector extracted by the long short-term memory network, represents the word vector matrix of the i-th test report data, d represents the dimension of the word vector in the word vector matrix, W forward and W backward respectively represent the trainable forward and reverse LSTM parameter matrices; According to the hidden state matrix, the attention weight vector corresponding to the word vector matrix is determined: In the formula, represents a learnable attention transformation matrix, and b a represents a learnable first bias vector, represents a learnable attention query vector; Determine the second feature information according to the hidden state matrix and the attention weight vector: Where T represents the length of the word vector matrix, α i,j represents the attention weight vector of the j-th word in the word vector matrix corresponding to the i-th test report data, H i,j represents the hidden state matrix of the j-th word in the word vector matrix corresponding to the i-th test report data, F t (i) represents the second feature information corresponding to the i-th test report data.
4. The method according to claim 1, characterized in that, Performing feature fusion on the first feature information and the second feature information to obtain a fusion feature corresponding to the inspection report includes: Broadcasting the first feature information to align dimensions of the first feature information with the second feature information: F′ g = Repeat(F g , dim = 0, repeats = N) Wherein, F' g represents the first feature information after broadcasting, F g represents the first feature information, Repeat(,,) represents the broadcast operation, dim represents the dimension of the broadcast, and repeats represents the number of times of replication in dimension dim; Determine a gating weight according to the broadcasted first feature information and the second feature information: g = σ(W g [F′ g ; F t ) where g represents the gating weight, σ represents the sigmoid function, and W g represents the learnable weight matrix, and F t represents the second feature information; The first feature information and the second feature information after broadcasting are weightedly fused according to the gating weight to obtain the fused feature: F = g ⊙ F' g ⊕ (1 - g) ⊙ F t Where F represents the fusion feature, ⊙ represents the vector element-by-element multiplication, and ⊕ represents the vector concatenation operation.
5. The method according to claim 1, characterized in that, Determining, based on the fusion feature and the preset knowledge graph, an anomaly score representing a difference between a first entity distribution in the inspection report data and a second entity distribution in the preset knowledge graph, including: Randomly selecting features of multiple dimensions from the fused features as feature subsets; Performing tree division on the features in the feature subset according to a preset cutoff value to obtain a left tree and a right tree, wherein the features whose feature values are less than or equal to the preset cutoff value are divided into the left tree; For the left tree and the right tree, repeatedly randomly select new preset splitting values, and perform the tree-like partitioning on the features in the left tree and the right tree until all the features in the feature subset are isolated, or the tree depth of the left tree or the right tree is greater than or equal to the preset tree depth limit, to obtain isolated trees composed of multiple left trees and right trees with different tree depths; Repeatedly randomly select features of multiple dimensions from the fused features as a new feature subset, and construct the isolated trees based on the new feature subset until the number of isolated trees reaches the preset number, to obtain multiple isolated trees; For the multiple isolated trees, determine the path expected length of the multiple isolated trees: In the formula, E(N) represents the path expected length, N represents the number of features in the multiple isolated trees, ln(N - 1) represents the sum of the reciprocals of the natural number sequence from 1 to N - 1, and γ represents the Euler constant; For any feature in the isolated tree, correct the path length of the any feature in the isolated tree where it is located to obtain the actual path length corresponding to the any feature; where h corrected (d i ) represents the actual path length corresponding to any feature d i , h(d i ) represents the path length of any feature d i in the isolated tree where it is located, H(L - 1) = ln(L - 1) + γ, ln(L - 1) represents the sum of the reciprocals of the natural number sequence from 1 to L - 1, and L represents the tree depth of the isolated tree where any feature d i is located; According to the actual path length, determine the average path length corresponding to the any feature; where P(d i ) represents the average path length, and M represents the number of isolated trees among multiple isolated trees; According to the first entity distribution and the second entity distribution, determine the difference penalty term between the first entity distribution and the second entity distribution: In the formula, L1 represents the difference penalty term, δ represents the first preset weighting parameter, pdata(q) represents the first entity distribution, and pg(q) represents the second entity distribution; According to the path expected length, the average path length, and the difference penalty term, determine the anomaly score; where s a represents the anomaly score.
6. The method according to claim 1, wherein According to the fused features and the anomaly score, perform quality assessment on the test report data to obtain an assessment result, including: According to the fused features and the anomaly score, determine the quality score of the test report data through the following formula: wherein, R represents a quality score, σ(·) represents a sigmoid activation function, represents a trainable weight matrix, w s represents a second preset weighting parameter, b represents a learnable second bias vector, F represents a fused feature, s a represents an anomaly score; Perform quality assessment on the test report data according to the quality score to obtain the assessment result.
7. The method according to claim 6, wherein Perform quality assessment on the test report data according to the quality score to obtain the assessment result, including: When the quality score is greater than or equal to the first preset threshold, determine that the assessment result is the first result indicating that the test report data is excellent; When the quality score is greater than or equal to the second preset threshold and less than the first preset threshold, determine that the assessment result is the second result indicating that the test report data is qualified; When the quality score is less than the second preset threshold, determine that the assessment result is the third result indicating that the test report data is unqualified.
8. The method according to claim 1, characterized in that, Before obtaining the preset knowledge graph and the randomly selected test report data from the preset database, the method further includes: Obtain a target document set; Perform word segmentation processing on each document in the target document set to obtain a word segmentation set corresponding to each document; Perform vector conversion on the word segmentation set to obtain a document word vector matrix corresponding to the target document set; According to the document word vector matrix, perform syntactic analysis on the word sequence in the document word vector matrix to construct a dependency tree set; Based on a preset bidirectional encoding strategy, entity recognition is performed on the document word vector matrix to construct a candidate entity set; Cluster each entity in the candidate entity set to obtain multiple clustered entities as an entity class set; According to the dependency tree set and the entity class set, perform relationship extraction on the entity class set to obtain a relationship triple set; Construct a knowledge graph based on the entity class set and the relationship triple set as the preset knowledge graph, where the preset knowledge graph includes the entity class set and the adjacency matrix corresponding to the entity class set.
9. An electronic device, characterized in that, The electronic device includes a processor and a memory coupled to each other. The memory stores a computer program. When the computer program is executed by the processor, the electronic device is caused to execute the method according to any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium. When the computer program runs on a computer, the computer is caused to execute the method according to any one of claims 1-8.