Power industry structured text generation method based on NLP technology
By using a structured text generation method for the power industry based on NLP technology, the problem of unstructured data being difficult to analyze in the power industry has been solved, achieving efficient and accurate data processing and report generation, and the generated text conforms to power industry standards.
Patent Information
- Application Number
- CN202411483807.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2044-10-22
AI Technical Summary
In the power industry, unstructured data is difficult to use directly for intelligent analysis and decision-making. Traditional manual processing is time-consuming and prone to errors, so there is a need to automatically generate structured text to improve efficiency and accuracy.
A structured text generation method for the power industry based on NLP technology is adopted, including data acquisition, preprocessing, feature extraction, power expert knowledge annotation, BERT model training, rule and template generation, and ROUGE evaluation, to ensure that the generated text meets the needs and standards of the power industry.
It achieves efficient and accurate data processing and report generation, and the generated text is structured, professional and conforms to power industry standards. The text quality has been improved through multiple rounds of iterative optimization of models and rules.
Smart Images

Figure CN119692310B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of electric power, more specifically, relates to a structured text generation method for electric power industry based on NLP technology. BACKGROUND
[0002] With the digital transformation of the electric power industry, the amount of data generated by the power system is growing rapidly, involving sensor data, device logs, user reports, maintenance records and other data sources. These data provide rich information resources for the operation, fault diagnosis and equipment maintenance of the power system. However, most of these data exist in unstructured form, especially the natural language text in user reports and maintenance records, which is difficult to be directly used for intelligent analysis and decision-making of the power system. Therefore, how to convert these unstructured data into structured text for analysis has become an important problem in the electric power industry.
[0003] Traditional manual methods for processing these data are very time-consuming and prone to errors, especially in fault handling and maintenance decision-making, power companies often need to generate standardized report texts by analyzing a large number of logs and reports. Therefore, the electric power industry urgently needs a technical solution that can automatically generate structured text to more efficiently and accurately complete data processing and report generation. SUMMARY
[0004] The application provides a structured text generation method for electric power industry based on NLP technology, which realizes efficient and accurate data processing and report generation.
[0005] The structured text generation method for electric power industry based on NLP technology comprises the following steps:
[0006] Step 1: Collect sensor data, device logs, user reports and maintenance record data from the power system, and preprocess the collected data;
[0007] Step 2: Perform primary feature extraction on the preprocessed data, and further extract important features in the data using PCA feature extraction technology to reduce high-dimensional data to key features, and standardize the extracted key features;
[0008] Step 3: Label the extracted feature data using electric power expert knowledge, including fault type, device state and event category; use classification algorithm to classify the labeled data, and organize the data according to predefined categories;
[0009] Step 4: training using the BERT model, inputting data including labeled key feature data and text data, training the BERT model using a supervised learning method to generate text meeting the needs of the power industry; iteratively optimizing the BERT model according to the training results, adjusting the feature extraction and classification strategy;
[0010] Step 5: designing rules and templates for text generation, determining the structure, language style and use of professional terms of the text according to the business needs of the power industry and the purpose of generating the text; using the trained BERT model combined with pre-designed rules and templates to automatically generate structured text, and checking the generated text using predefined verification rules;
[0011] Step 6: using the ROUGE evaluation index to evaluate the quality of the generated text, identifying the shortcomings of the generated text, and further optimizing the BERT model and text generation rules.
[0012] The power industry structured text generation method based on NLP technology aims to efficiently and accurately complete data processing and report generation. The method first collects sensor data, device logs, user reports and other multi-source data from the power system and performs preprocessing. Then, the key features are extracted using primary feature extraction and PCA dimensionality reduction technology, and standardized processing is performed. Then, the feature data is labeled using power expert knowledge, and the labeled data is classified and sorted using a classification algorithm. Then, the BERT model is trained, the labeled key feature data and text data are input, and the supervised learning is used to generate text meeting the needs of the power industry, and the feature extraction and classification strategy are iteratively optimized. Then, structured text is generated combined with pre-designed rules and templates, and the text is checked using verification rules. Finally, the quality of the text is evaluated by the ROUGE evaluation index, and the model and generation rules are further optimized, thereby achieving the goal of efficient and accurate power industry text generation.
[0013] Preferably, the step 2 includes the following steps:
[0014] Time series feature extraction: for time series data, the following primary features are extracted:
[0015]
[0016] In the formula: μ represents the mean of the time series; N represents the number of points of the time series data; x i represents the i-th time series point number;
[0017]
[0018] In the formula: σ 2 represents the variance of the time series data;
[0019] Max and Min: the maximum and minimum values in the time series data;
[0020] Event record feature extraction: the primary features extracted for event records in device logs and user reports include the number of events occurring in a unit of time and the proportion of different types of events in a unit of time;
[0021] Numerical measurement feature extraction: for numerical measurement data in maintenance records, the primary feature extracted is the average repair time;
[0022] Data standardization: before PCA, the primary features are standardized so that each feature has a mean of 0 and a variance of 1;
[0023] Covariance matrix calculation: for the standardized feature dataset, the covariance matrix is calculated:
[0024]
[0025] where C represents the covariance matrix; N represents the number of samples; z i represents the feature vector of the i-th sample; μ represents the feature mean vector;
[0026] Eigenvalue decomposition: the covariance matrix is subjected to eigenvalue decomposition to obtain the eigenvalues and eigenvectors:
[0027] Cv = λv;
[0028] where v represents the eigenvector; λ represents the eigenvalue;
[0029] Select principal components: select the eigenvectors corresponding to the largest k eigenvalues as the new feature space;
[0030] Dimensionality reduction conversion: project the original data into the selected principal component space to obtain the key features after dimensionality reduction, where the projection expression is as follows:
[0031] Y = XV k ;
[0032] where Y represents the data after dimensionality reduction; X represents the standardized primary feature data; V k represents the matrix composed of the first k eigenvectors;
[0033] Standardization: the extracted key features are subjected to standardization.
[0034] Preferably, the labeling of the extracted feature data in step 3 includes manual labeling and automatic labeling;
[0035] First, the automatic labeling feature data is adopted, and the data that cannot be labeled by automatic labeling is labeled by power expert knowledge;
[0036] The automatic labeling base historical data and known labels are matched for labeling:
[0037]
[0038] In the formula: L i represents the labeling category of the i-th feature data point; F(x i ) represents the fault score function corresponding to the i-th feature data point; T1 and T2 are fault thresholds set according to the power industry standard;
[0039] Wherein:
[0040] F(x i ) = α1·Voltage Deviation + α2·Current Deviation + α3·Temperature;
[0041] In the formula: Voltage Deviation represents voltage deviation, which is the difference between the current voltage and the rated voltage of the equipment; Current Deviation represents current deviation, which represents the difference between the current current and the rated current of the equipment; Temperature represents the current temperature of the equipment; α1, α2, α3 represent the fault coefficient, which is given based on expert experience.
[0042] Preferably, the data classification adopts a random forest model for classification.
[0043] Preferably, the training step of the BERT model in step 4 is as follows:
[0044] Feature input: for each input sample, the feature vector X and its corresponding labeled text T are jointly input into the BERT model, and the text data needs to be segmented and encoded before being input into the BERT model. The input format is as follows:
[0045] [CLS] + Token1 + Token2 + … + [SEP];
[0046] Wherein: [CLS] represents a classification mark; [SEP] represents a separator between sentences; Token represents a word in the text;
[0047] Objective function: cross-entropy loss function is used to optimize the text generation ability of the BERT model:
[0048]
[0049] In the formula: L represents the loss value; N represents the number of words in the sample; yi represents the actual label of the i-th word; represents the prediction probability of the i-th word generated by the BERT model;
[0050] By minimizing the loss function, the model can gradually generate more accurate text.
[0051] The beneficial effects of the present application include:
[0052] The present application aims to achieve efficient and accurate data processing and report generation through the power industry structured text generation method based on NLP technology. First, the method collects sensor data, device logs, user reports and other multi-source data from the power system and performs preprocessing. Then, the key features are extracted using primary feature extraction and PCA dimensionality reduction technology, and standardized processing is performed. Then, the feature data is labeled using power expert knowledge, and the labeled data is classified and sorted by classification algorithm. Then, the BERT model is trained, the labeled key feature data and text data are input, and supervised learning is used to generate text that meets the needs of the power industry, and the feature extraction and classification strategy are optimized through multiple iterations. Then, the structured text is generated combined with the pre-designed rules and templates, and the text is checked using the verification rules. Finally, the text quality is evaluated by the ROUGE evaluation index, and the model and generation rules are further optimized, so as to achieve the goal of efficient and accurate power industry text generation. BRIEF DESCRIPTION OF DRAWINGS
[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0054] Figure 1 The overall step block diagram provided by the embodiments of the present application. DETAILED DESCRIPTION
[0055] In order to make the technical problems, technical solutions and beneficial effects of the present application more clear, the following will further describe the present application in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.
[0056] Referring to Figure 1 for further explanation of the optimal embodiments of the present application;
[0057] The power industry structured text generation method based on NLP technology includes the following steps:
[0058] Step 1: Collect sensor data, device logs, user reports, and maintenance record data from the power system, and preprocess the collected data;
[0059] Step 2: Perform primary feature extraction on the preprocessed data, and further extract important features in the data using PCA feature extraction technology, reducing high-dimensional data to key features, and standardizing the extracted key features;
[0060] Step 3: Use power expert knowledge to label the extracted feature data, including fault type, device state, and event category; use classification algorithms to classify the labeled data, and organize the data according to predefined categories;
[0061] Step 4: Train the BERT model, input data including labeled key feature data and text data, use supervised learning method to train the BERT model, generate text that meets the needs of the power industry; according to the training results, iteratively optimize the BERT model, adjust the feature extraction and classification strategy;
[0062] Step 5: Design rules and templates for text generation, determine the structure, language style, and use of professional terms of the text according to the business needs of the power industry and the purpose of generating text; use the trained BERT model combined with pre-designed rules and templates to automatically generate structured text, and use predefined verification rules to check the generated text;
[0063] Step 6: Use ROUGE evaluation index to evaluate the quality of the generated text, identify the shortcomings of the generated text, and further optimize the BERT model and text generation rules.
[0064] The power industry structured text generation method based on NLP technology aims to efficiently and accurately complete data processing and report generation. This method first collects multi-source data such as sensor data, device logs, and user reports from the power system, and preprocesses the data. Then, key features are extracted using primary feature extraction and PCA dimension reduction technology, and standardized processing is performed. Subsequently, feature data is labeled using power expert knowledge, and the labeled data is classified and organized using classification algorithms. Then, the BERT model is trained, the labeled key feature data and text data are input, and supervised learning is used to generate text that meets the needs of the power industry, and the feature extraction and classification strategy is iteratively optimized. Subsequently, structured text is generated combined with pre-designed rules and templates, and the text is checked using verification rules. Finally, the quality of the text is evaluated by the ROUGE evaluation index, and the model and generation rules are further optimized, thereby achieving the goal of efficient and accurate power industry text generation.
[0065] As a possible implementation form of the embodiment, the step 2 comprises the following steps:
[0066] Time series feature extraction: For time series data, the following primary features are extracted:
[0067]
[0068] where μ represents the mean of the time series; N represents the number of points of the time series data; x i represents the i-th time series point number;
[0069]
[0070] where σ 2 represents the variance of the time series data;
[0071] Maximum and minimum: the maximum and minimum in the time series data, respectively;
[0072] Event record feature extraction: For the event records in the device logs and user reports, the primary features extracted include the number of events occurring in a unit time and the proportion of different types of events in a unit time;
[0073] Numerical measurement feature extraction: For the numerical measurement data in the maintenance records, the primary feature extracted is the average maintenance time;
[0074] Data standardization: Before PCA, the primary features are standardized so that each feature has a mean of 0 and a variance of 1;
[0075] Covariance matrix calculation: For the standardized feature data set, the covariance matrix is calculated:
[0076]
[0077] where C represents the covariance matrix; N represents the number of samples; z i represents the feature vector of the i-th sample; μ represents the feature mean vector;
[0078] Eigenvalue decomposition: the covariance matrix is subjected to eigenvalue decomposition to obtain the eigenvalues and eigenvectors:
[0079] Cv = λv;
[0080] where v represents the eigenvector; λ represents the eigenvalue;
[0081] Principal component selection: the eigenvectors corresponding to the largest k eigenvalues are selected as the new feature space;
[0082] Dimensionality reduction: project the original data into the selected principal component space to obtain the key features after dimensionality reduction, wherein the projection expression is as follows:
[0083] Y = XV k ;
[0084] In the formula, Y represents the data after dimensionality reduction; X represents the standardized primary feature data; V k represents a matrix composed of the first k feature vectors;
[0085] Standardization: standardize the extracted key features.
[0086] As a possible implementation manner of the embodiment, the labeling of the extracted feature data in step 3 includes manual labeling and automatic labeling.
[0087] First, automatically label the feature data, and label the data that cannot be automatically labeled by using power expert knowledge;
[0088] The automatic labeling is performed by similarity matching of the historical data and known labels:
[0089]
[0090] In the formula, L i represents the labeling category of the i-th feature data point; F(x i ) represents the fault score function corresponding to the i-th feature data point; T1 and T2 are fault thresholds set according to the power industry standard;
[0091] Wherein:
[0092] F(x i ) = a1 · Voltage Deviation + a2 · Current Deviation + a3 · Temperature;
[0093] In the formula, Voltage Deviation represents voltage deviation, which is the difference between the current voltage and the rated voltage of the equipment; Current Deviation represents current deviation, which represents the difference between the current current and the rated current of the equipment; Temperature represents the current temperature of the equipment; a1, a2, a3 represent fault coefficients, which are given based on expert experience.
[0094] As a possible implementation manner of the embodiment, the data classification adopts a random forest model for classification; wherein the training steps of the classification model are as follows:
[0095] Input data preparation:
[0096] Input Features (X): After feature extraction and labeling, we use the standardized feature data as the input to the model. Each sample (such as sensor data from a device, work logs, etc.) is represented as a feature vector X = [x1, x2, ..., x...]. n ]; where each x i These are different characteristics, such as temperature, voltage, and current;
[0097] Output Labels (C): Labels are category information generated by the labeling step, such as "fault type" (e.g., overload, short circuit, etc.) or "equipment status" (e.g., normal, minor fault, major fault);
[0098] Building a random forest model: Create multiple decision tree models, each learning independently from the training data, as follows:
[0099] Random sampling: Performing multiple random samplings on the dataset to form different subsets.
[0100] Random feature selection: When each decision tree splits at a node, a subset of features are randomly selected to reduce the impact of a single feature on the model's decision.
[0101] Decision tree generation: Build a decision tree on each subset of samples until all nodes can be classified.
[0102] Classification Formula: The final classification result of a random forest is based on the voting results of multiple decision trees. The specific formula is as follows:
[0103]
[0104] In the formula: C represents the final classification result; P t (c|X) represents the prediction probability of the t-th decision tree for category c; T represents the total number of decision trees;
[0105] Ultimately, the random forest selects the most likely category as the classification result by combining the prediction results of multiple trees;
[0106] After the model completes the classification, the data will be organized according to the categories predicted by the model:
[0107] Merging similar events: All events of the same type (such as the same equipment failure type or equipment status) will be merged together.
[0108] Output format preparation: Based on the subsequent text generation or data analysis process, convert the categorized data into a suitable format for further processing.
[0109] Model validation:
[0110] After the classification is completed, we need to evaluate the model using the validation set. The validation set is a randomly selected part of the original dataset and does not participate in the training of the model. The evaluation indicators use one of the following indicators:
[0111] Accuracy: the proportion of correct classification by the model;
[0112] Recall: the proportion of correctly predicted positive samples among all positive samples;
[0113] F1 score: the harmonic mean of precision and recall, which comprehensively measures the performance of the model.
[0114] After testing with the validation set, evaluate the performance of the model. If the result is not satisfactory, you can adjust the model parameters based on the validation results, such as:
[0115] Number of trees: increase or decrease the number of decision trees, affecting the complexity and stability of the model.
[0116] Feature selection: adjust the number of features used by each tree to enhance the generalization ability of the model.
[0117] Based on the validation results, the random forest model can be adjusted in the following ways:
[0118] Adjust the number of trees: appropriately increase the number of trees to improve the classification accuracy of the model.
[0119] Optimize feature selection: according to the feature importance score, retain the features that have a greater impact on classification and eliminate redundant features.
[0120] Handle unbalanced data: for class imbalance problems, you can improve the model's recognition ability for minority classes by increasing data sampling, cost-sensitive learning, and other methods.
[0121] Through the random forest model, combined with the labeled data in the power industry, we can effectively classify the data. The advantages of random forest are its ability to handle high-dimensional, multi-class data and its robustness to noise. Through model training, validation and adjustment, we can finally build an efficient and stable classification model for device state monitoring and fault diagnosis.
[0122] As a possible implementation of this embodiment, the training step of the BERT model in step 4 is as follows:
[0123] Feature input: for each input sample, the feature vector X and its corresponding labeled text T are jointly input into the BERT model. The text data needs to be segmented and encoded before inputting into the BERT model. The input format is as follows:
[0124] [CLS] + Token1 + Token2 + … + [SSEP];
[0125] Where: [CLS] represents the classification tag; [SEP] represents the separator between sentences; Token represents the word in the text;
[0126] Objective function: Use cross-entropy loss function to optimize the text generation ability of BERT model:
[0127]
[0128] In the formula: L represents the loss value; N represents the number of words in the sample; y i represents the actual label of the i-th word; represents the predicted probability of the i-th word generated by the BERT model;
[0129] By minimizing the loss function, the model can gradually generate more accurate text.
[0130] As a possible implementation of this embodiment, step 5 includes the following steps:
[0131] Design of text generation rules: Design rules for text generation to ensure that the generated content meets the business needs and professional language habits of the power industry. These rules determine the structure, language style, use of professional terms, and accuracy of the text.
[0132] Rule design content includes:
[0133] Text structure: Determine the overall architecture of the text, which usually includes five parts: title, event description, cause analysis, treatment suggestion, and conclusion. The order and content of these parts may vary depending on the type of event.
[0134] For example, for a device failure report, the text structure may be as follows:
[0135] Title: Device name + failure type + time.
[0136] Event description: Briefly describe the current state of the device.
[0137] Cause analysis: Give possible reasons for the failure.
[0138] Treatment suggestion: Based on the type of failure, make treatment suggestions.
[0139] Conclusion: The results of the event handling or follow-up measures.
[0140] Language style: Power industry texts usually need to be concise, accurate, and emphasize logic and operability. Long sentences should be avoided, and accurate terms and standard expressions should be used. For example:
[0141] Use the terms "power outage," "equipment overload," "excessive current," etc. correctly.
[0142] Choose concise sentence patterns, such as "The equipment has returned to normal operation" instead of "After repair, the equipment finally returned to normal state."
[0143] Professional terminology: Ensure the use of terms related to the power industry and use fixed expressions in specific situations. For example:
[0144] For equipment maintenance processes, common terms include "inspection," "replacement," "repair," "re-calibration," etc.
[0145] For fault types, common terms include "overload," "short circuit," "insulation damage," etc.
[0146] Template design: In order to improve the consistency and readability of generated text, design fixed text templates to ensure that reports can be quickly generated in accordance with industry standards under different event types.
[0147] The design of the template needs to consider the following aspects:
[0148] Title template:
[0149] Template: "[Device name] + [Fault type] + [Time] report"
[0150] Example: "Transformer overload fault report - October 21, 2024, 14:30"
[0151] Event description template:
[0152] Template: "Device [device name] occurred [fault type] at [time], current status is [device status]."
[0153] Example: "Device A occurred overload fault at October 21, 2024, 14:30, current status is automatically powered off."
[0154] Reason analysis template:
[0155] Template: "According to sensor data and device logs, the fault may be caused by [reason], manifested as [related phenomenon]."
[0156] Example: "According to sensor data, the fault may be caused by loose cable connection, manifested as abnormal device current fluctuation."
[0157] Treatment suggestion template:
[0158] Template: "Suggest [problem part] to be [specific operation], including [further operation]."
[0159] Example: "Recommend tightening and testing the cable connection and checking for short circuits in the associated circuit."
[0160] Conclusion Template:
[0161] Template: "After processing, the device status is [status], and it is recommended to follow up with [follow-up measures]."
[0162] Example: "After processing, the device status has returned to normal operation, and it is recommended to follow up with strengthening device current monitoring to prevent overload from occurring again."
[0163] Generation with BERT Model:
[0164] After having the rules and templates, the BERT model trained in the previous steps is used to generate text that can be filled into these templates; the model outputs relevant text content according to the input event features during the generation process, matching different parts of the template; the sequence of the generation process is as follows:
[0165] Input Features: The key features extracted and labeled in step 3 (such as device status, fault type, and cause) are used as input.
[0166] Template Filling: According to the input features, match the corresponding template and fill in the specific content in the template.
[0167] If the input features indicate that the device has an overload fault, the BERT model will generate text related to "overload" and fill in the corresponding template according to the rules.
[0168] Automatic Adjustment: If the generated text by the model is ambiguous or does not conform to business specifications, use rules to automatically adjust the generated text. For example:
[0169] If: The BERT-generated text contains inappropriate sentence patterns (such as lengthy or ambiguous descriptions), it is corrected to concise industry-standard language through predefined rules.
[0170] If: The model-generated professional terms do not match (such as incorrect fault type description), check whether the correct terms are used through template rules.
[0171] Verification and Adjustment: Use predefined verification rules to check the generated text to ensure that the text meets the expected quality standards and industry specifications. These verification rules include:
[0172] Term Verification: Check if the professional terms in the generated text are correct, for example, whether "overload" is used in the appropriate place.
[0173] Sentence structure verification: Check if the structure of the sentence meets the requirements, whether there are syntax errors or logical errors.
[0174] Consistency verification: Ensure that the information described in the text, such as device status, fault cause, treatment suggestion, etc., is consistent before and after. For example, if the text mentions that the device is overloaded, the subsequent cause analysis and treatment suggestions must be related to overload.
[0175] Verification rules may include logical matching formulas, such as:
[0176] if(T=overload) then R={check cable, test current};
[0177] Where: T represents the fault type in the generated text (such as overload); R represents the optional action set of treatment suggestions;
[0178] Through the verification rules, ensure that the generated text meets the logic and operation process of the power industry;
[0179] Generation example
[0180] Title: Device A overload fault report - October 21, 2024 14:30
[0181] Event description: Device A occurred overload fault on October 21, 2024 14:30, the current state is automatic power-off.
[0182] Cause analysis: According to the sensor data, the fault may be caused by loose cable connection, which shows abnormal device current fluctuation.
[0183] Treatment suggestion: It is suggested to tighten and test the cable connection part, and check whether there is a short circuit in the related circuit.
[0184] Conclusion: After the treatment is completed, the device state has returned to normal operation, and it is suggested to strengthen the device current monitoring to prevent overload from occurring again.
[0185] Through the design of rules and templates, combined with the BERT model to generate text, ensure that the generated structured text meets the standards of the power industry. Through the design of standardized templates, pre-defined rules, verification mechanisms, the automatically generated text can meet the business needs and industry standards of different power events.
[0186] As a possible implementation of the embodiment, step 6 includes the following steps:
[0187] The purpose of Step 6 is to use the ROUGE (Recall-Oriented Understudy for Gisting Evaluation) evaluation index to evaluate the quality of the automatically generated structured text, so as to identify the shortcomings in the generated text and further optimize the BERT model and text generation rules. ROUGE is a commonly used index for evaluating text summarization tasks, which can quantify the similarity between automatically generated text and reference text (such as manually written power reports).
[0188] Reference text construction: In order to conduct ROUGE evaluation, a set of reference texts need to be constructed, which are usually high-quality texts written by power industry experts or professional report writers, serving as standards for generated texts;
[0189] Content of reference text: The reference text should contain complete descriptions of different types of power events (such as fault reports, equipment maintenance records, etc.), conforming to the business needs and specifications of the power industry. Each type of event corresponds to a set of reference texts for comparison with generated texts of the same type.
[0190] Comparison of generated text and reference text: After constructing the reference text, compare the automatically generated text with the reference text one by one, as follows:
[0191] Text alignment: For each type of event (e.g. overload failure of a certain device), align the generated text with the corresponding reference text. This ensures the accuracy of the comparison results.
[0192] Content matching: Compare the content of the generated text and the reference text, mainly comparing the coverage of important information points in the text, such as device name, fault type, fault cause, treatment measures, etc.
[0193] Calculation of ROUGE evaluation index:
[0194] ROUGE-N (Recall): N-gram-based recall rate, indicating the proportion of N-grams in the generated text that match the reference text, formula as follows:
[0195]
[0196] In the formula: N-gram represents the sequence of N consecutive words in the generated text and the reference text; count(N-gram) represents the number of occurrences of N-gram in the text; CK represents the reference text; SC represents the generated text;
[0197] ROUGE-N (Precision): N-gram-based precision, indicating the proportion of N-grams in the generated text that match the reference text, formula as follows:
[0198]
[0199] ROUGE-L: an evaluation metric based on the longest common subsequence (LCS), reflecting the similarity between generated text and reference text in sentence structure, with the formula as follows:
[0200]
[0201] where CK, D represents the length of the reference text, and LCS(SC, CK) represents the length of the longest common subsequence between the generated text and the reference text.
[0202] According to the calculated ROUGE indicators, specific problems in the generated text can be identified, including:
[0203] Insufficient information coverage: the generated text may lack some key event descriptions or cause analysis.
[0204] Language style mismatch: the sentence structure or word choice of the generated text may not conform to the standard language style of the power industry, or differ from the description method in the reference text.
[0205] Professional term usage error: some generated terms may not conform to industry standards, resulting in inconsistencies with professional terms in the reference text.
[0206] Unreasonable structure: the text structure may not conform to the predetermined template, resulting in logical order errors or incompleteness in some parts.
[0207] After identifying the problems in the generated text, targeted optimization is carried out to improve the quality of text generation. Specific optimization strategies include:
[0208] Optimize BERT model:
[0209] Train data enhancement: increase the diversity of high-quality labeled data, covering more types of power industry events, especially the parts where the model performs poorly in generating text.
[0210] Fine-tune the model: adjust the hyperparameters of the BERT model or use a more suitable loss function to improve the accuracy and coverage of the generated text.
[0211] Optimize text generation rules:
[0212] Adjust the template design: according to the evaluation results, optimize the structure of the text generation template to ensure the logical and content integrity of the generated text. For example, add conditional judgments in the template to ensure that specific types of events contain necessary descriptions and analysis in the generated text.
[0213] Enhanced Term Verification: Introduce stricter term verification rules to ensure that the generated text conforms to industry terminology standards.
[0214] Adjust Feature Extraction and Classification Strategy:
[0215] Optimize feature extraction and classification algorithms in steps 2 and 3 to generate more representative key features, helping the BERT model generate more accurate text.
[0216] After completing the optimization of the model and generation rules, regenerate the text and perform ROUGE evaluation again. Through multiple iterations, gradually improve the quality of the generated text until the ROUGE indicators of the generated text and the reference text meet the business requirements.
[0217] Evaluate the generated text through ROUGE indicators, identify text quality issues, and improve text generation quality by optimizing the BERT model and generation rules. This step ensures that the generated structured text meets the business needs and quality standards of the power industry, with high information coverage, accurate professional terms, and logical text structure.
[0218] The above is only a preferred embodiment of the present application, and is not intended to limit the present application. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for generating structured text in the power industry based on NLP technology, characterized in that, The method comprises the following steps: Step 1: Collecting sensor data, device logs, user reports and maintenance record data from the power system, and preprocessing the collected data; Step 2: Primary feature extraction is performed on the preprocessed data, and then PCA feature extraction technology is used to further extract important features in the data, reducing high-dimensional data to key features, and the extracted key features are standardized; Step 3: The extracted feature data is labeled using power expert knowledge, including fault type, device state and event category; and a classification algorithm is used to classify the labeled data, and the data is sorted according to the predefined categories; The labeling of the extracted feature data in step 3 includes manual labeling and automatic labeling; First, the feature data is automatically labeled, and the data that cannot be automatically labeled is labeled using power expert knowledge; The automatic labeling is based on similarity matching of historical data and known labels: ; In the formula: represents the labeled class of the i-th feature data point; represents the failure score function corresponding to the i-th feature data point; and is a failure threshold value set according to the power industry standard; Step 4: Training the BERT model, the input data includes the labeled key feature data and the text data, and the BERT model is trained using a supervised learning method to generate text that meets the needs of the power industry; the BERT model is iteratively optimized according to the training results, and the feature extraction and classification strategies are adjusted; ; In the formula: represents a voltage deviation, which is the difference between the current voltage and the rated voltage of the device; represents a current deviation, which represents the difference between the current current and the rated current of the device; represents the current temperature of the device; , , represents a fault coefficient, which is given based on expert experience; Step 5: Designing rules and templates for text generation, determining the structure, language style and use of professional terms of the text according to the business needs of the power industry and the purpose of generating the text; using the trained BERT model combined with the pre-designed rules and templates, automatically generating structured text, and checking the generated text using predefined verification rules; Step 6: Using the ROUGE evaluation index to evaluate the quality of the generated text, identifying the shortcomings of the generated text, and further optimizing the BERT model and text generation rules. The step 2 2. The method for generating structured text in the power industry based on NLP technology according to claim 1, characterized in that, Comprises the following steps: Time series feature extraction: For time series data, the following primary features are extracted: Maximum and minimum: the maximum and minimum values in the time series data; ; In the formulae: denotes the mean value of the time series; denotes the number of points of the time series data; denotes the number of points of the i-th time series; = ; In the formulae: denotes the variance of the time series data; Event record feature extraction: The primary features extracted from the event records in the device logs and user reports include the number of events occurring in a unit of time and the proportion of different types of events in a unit of time; Numerical measurement feature extraction: For numerical measurement data in maintenance records, the primary feature extracted is the average repair time; Data standardization: Before PCA, the primary features are standardized to have a mean of 0 and a variance of 1; Covariance matrix calculation: Calculate the covariance matrix for the standardized feature dataset: Eigenvalue decomposition: Perform eigenvalue decomposition on the covariance matrix to obtain eigenvalues and eigenvectors: ; where C represents a covariance matrix; N2 represents a number of samples; represents a feature vector of the i-th sample; represents a feature mean vector; Select principal components: Select the eigenvectors corresponding to the largest k eigenvalues as the new feature space; ; In the formulae: denotes the eigenvector; denotes the eigenvalue; Dimensionality reduction conversion: Project the original data into the selected principal component space to obtain the reduced key features, where the projection expression is as follows: Standardization: Standardize the extracted key features. ; In the formula: represents the data after dimension reduction; represents the primary feature data after standardization; represents a matrix composed of the first k eigenvectors; The data classification uses a random forest model for classification. 3.The power industry structured text generation method based on NLP technology of claim 1, wherein, The training steps of the BERT model in step 4 are as follows:
4. The method for generating structured text in the power industry based on NLP technology according to claim 1, wherein, Feature input: For each input sample, the feature vector X is input into the BERT model together with its corresponding labeled text T. The text data needs to be segmented and encoded before being input into the BERT model. The input format is as follows: ; wherein: represents a classification label; represents a separator between sentences; Token1 and Token2 represent words in the text; Objective function: The cross-entropy loss function is used to optimize the text generation ability of the BERT model: ; In the formula, L represents a loss value; N3 represents the number of words in the sample; represents the actual label of the i-th word; represents the prediction probability of the i-th word generated by the BERT model; By minimizing the loss function, the model can gradually generate more accurate text.
Citation Information
Patent Citations
AR-based ring main unit, branch box and substation collaborative management and control method
CN118710235A
Photovoltaic array fault diagnosis method based on composite information
US20210135625A1