Power grid language model-oriented power transmission and transformation equipment defect corpus construction method

CN117474010BActive Publication Date: 2026-09-22ELECTRIC POWER RESEARCH INSTITUTE OF STATE GRID SHANDONG ELECTRIC POWER COMPANY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311437551.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-31
Publication Date
2026-09-22
Estimated Expiration
2043-10-31

AI Technical Summary

Technical Problem

[0004]电网输变电设备的缺陷及检修记录大多是包含了设备故障详情及检修具体操作的文本数据,具有极高的专业价值;但是,发明人发现,电网输变电设备的缺陷及检修记录数据体量大、形式多、来源广的特点导致了这些饱含价值的数据难以统一格式、人工查阅和学习周期长,最终表现出电网领域输变电设备缺陷相关历史积累文本数据实际利用率低、利用耗时长的问题

Benefits of technology

[0044]1、本发明创新性的提出了一种面向电网语言模型的输变电设备缺陷语料库构建方法,提出了包含文本表、实体表和关系表的电网领域输变电设备缺陷语料库模式,结合命名实体识别、关系识别、知识图谱和大语言模型等技术,从电网领域海量的输变电设备缺陷相关原始数据中提炼缺陷数据并形成电网领域输变电设备缺陷语料库,为基于缺陷数据的数据分类、数据挖掘、数据预测、数据决策等任务提供了重要的数据资源,也为电网领域语言模型(如命名实体识别模型、关系识别模型、大语言模型等)的训练提供高质量有标注数据集。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117474010B_ABST
    Figure CN117474010B_ABST
Patent Text Reader

Abstract

The application provides a power grid language model-oriented power transmission and transformation equipment defect corpus construction method, and belongs to the technical field of electric power data processing. The application divides data into structured, semi-structured and unstructured data, designs a corpus structure as a relational database containing a text table, an entity table and a relationship table, and innovatively provides a power grid language model-oriented rich-information power transmission and transformation equipment defect corpus construction scheme. The scheme adapts excellent language models in the field of natural language processing to the field of power grids, designs multiple power grid language models, and compared with a traditional corpus containing only text corpus, the corpus designed and constructed by the application contains entity and relationship information in the text corpus, and enriches the information of the traditional corpus. In addition, the application gives an application scheme of corpus generation data set for the power grid language model, and innovatively realizes the ecological closed-loop logic of continuously self-optimizing corpus with the expansion of the scale.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power data processing technology, and in particular to a method for constructing a corpus of defects in power transmission and transformation equipment oriented towards a power grid language model. Background Technology

[0002] The statements in this section are merely background information related to the present invention and do not necessarily constitute prior art.

[0003] With the continuous development of power grid business, the advancement of ubiquitous power Internet of Things, and the proposal and continuous maturation of smart grids, the scale of historical text data related to power grid business is constantly increasing, the data sources are increasing day by day, and the data forms are becoming more and more diverse, with the massive and diversified characteristics of data becoming increasingly obvious.

[0004] Most of the defect and maintenance records of power grid transmission and transformation equipment are text data containing details of equipment failures and specific maintenance operations, which have extremely high professional value. However, the inventors found that the large volume, diverse formats, and wide range of sources of these defect and maintenance records of power grid transmission and transformation equipment make it difficult to standardize the format of this valuable data, and the manual review and learning cycle is long. Ultimately, this results in the problem of low actual utilization rate and long utilization time of historically accumulated text data related to defects of power grid transmission and transformation equipment. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention provides a method for constructing a corpus of defects in power transmission and transformation equipment oriented towards power grid language models. It proposes a corpus model for power grid-related power transmission and transformation equipment defects that includes text tables, entity tables, and relation tables. By combining technologies such as named entity recognition, relation recognition, knowledge graphs, and large language models, defect data is extracted from massive amounts of raw data related to power transmission and transformation equipment defects in the power grid domain, forming a corpus of defects in power grid-related power transmission and transformation equipment. This provides important data resources for tasks such as data classification, data mining, data prediction, and data-driven decision-making based on defect data, and also provides a high-quality labeled dataset for training language models in the power grid domain (such as named entity recognition models, relation recognition models, and large language models).

[0006] To achieve the above objectives, the present invention adopts the following technical solution:

[0007] In a first aspect, the present invention provides a method for constructing a corpus of defects in power transmission and transformation equipment oriented towards a power grid language model.

[0008] A method for constructing a corpus of defects in power transmission and transformation equipment oriented towards a power grid language model includes the following steps:

[0009] The acquired multi-source data on defects in power transmission and transformation equipment in the power grid sector are classified into structured data, semi-structured data, and unstructured data. The PDF files in the semi-structured data are further divided into tabular PDF files and text PDF files.

[0010] The table PDF file is extracted using a table OCR algorithm to obtain the extracted table file. The extracted table file and the table file in the semi-structured data constitute the total table file. The table structuring algorithm based on the power grid text multi-classification model is used to extract data from the total table file. The extraction results and the structured data together constitute the attribute-accurate record data in the database. Based on the attribute-accurate record data in the database, the structured text corpus, entity corpus and relation corpus are obtained.

[0011] The text PDF file is extracted using a text OCR algorithm to obtain an extracted text file. The extracted text file and unstructured data constitute a text file containing complex text sequences. Based on the text file containing complex text sequences, an unstructured text corpus, an entity corpus, and a relation corpus are obtained.

[0012] Structured text corpora, entity corpora, and relation corpora, and unstructured text corpora, entity corpora, and relation corpora together constitute the total text corpora, entity corpora, and relation corpora.

[0013] A text table is generated based on the total text corpus, an entity table is generated based on the total entity corpus, and a relation table is generated based on the total relation corpus. The text table, entity table, and relation table together form a corpus of defects in power transmission and transformation equipment in the power grid field.

[0014] As a further limitation of the first aspect of the present invention, the recognition of the table PDF file includes:

[0015] Using edge detection, binarization, and connected component analysis algorithms, the table in the PDF document is located to determine the position and size of the table, followed by denoising and cropping.

[0016] The preprocessed table image is divided into cells using a row- and column-based segmentation algorithm, resulting in several cells for subsequent content recognition.

[0017] The OCR algorithm is used to recognize the content of each cell, and the cell content is filled into the table file according to the relative position of the cells after division, thus converting the table PDF into a table file.

[0018] As a further limitation of the first aspect of the present invention, the recognition of text PDF files includes:

[0019] By using edge detection, binarization, and text region segmentation algorithms, the text in the PDF is located, its position and size are determined, and then denoising and cropping are performed.

[0020] The content of each text segment is recognized based on OCR technology;

[0021] By combining the location information and font size characteristics of the text, all the identified text is spliced ​​together to complete the transformation into complex text data.

[0022] As a further limitation of the first aspect of the present invention, the data extraction of the total table file based on the table structuring algorithm of the power grid text multi-classification model includes:

[0023] For each row in the table file related to defects in power transmission and transformation equipment in the power grid field, the cells in each column are One-Hot encoded and then input into the power grid text multi-classification model to obtain the possible corresponding structured attributes and confidence levels. Subsequently, for each structured attribute, the content of the cell with the highest confidence level is taken as the value, thus completing the transformation of table records into structured data.

[0024] As a further limitation of the first aspect of the present invention, based on the precisely recorded data with attributes in the database, and using a structured data corpus generation method based on the GPT model and rule algorithms, a structured text corpus, an entity corpus, and a relation corpus are obtained, including:

[0025] For structured data already stored in the database, the attribute set is input into the GPT model in the power grid domain to generate attribute suggestions and splicing order suggestions suitable for concatenation into text corpus. Based on these suggestions, the various attributes are combined to form preliminary text corpus. The GPT model is then used to optimize the contextual representation of the preliminary text corpus to obtain the final text corpus.

[0026] Based on the attributes recorded in the database and the final text corpus obtained by splicing, the entity locations and classifications in the corpus are obtained, and the relationships between attributes are designed based on expert experience to obtain the relationships between entities.

[0027] As a further limitation of the first aspect of the present invention, based on the text file containing the complex text sequence, an unstructured text corpus set, an entity corpus set, and a relation corpus set are obtained using the unstructured data corpus generation method based on PromptLearning.

[0028] As a further limitation of the first aspect of the present invention, the corpus is processed before being stored in the corpus, including word segmentation, stop word removal and entity knowledge fusion;

[0029] The word segmentation and stop word removal include:

[0030] The corpus to be entered into the database is processed using a word segmentation dictionary and a stop word dictionary specifically for the power grid field. The jieba word segmentation library, the professional word segmentation dictionary and stop word dictionary provided by experts for the power grid field are used, and the word segmentation and stop word removal operations of the corpus are completed according to the dictionary.

[0031] The entity knowledge fusion includes:

[0032] Construction of entity thesaurus and thesaurus knowledge graph: Based on expert experience, multi-level equipment tables of power grid, and encyclopedia data sources, thesaurus triples are obtained to construct a thesaurus and thesaurus knowledge graph for the power grid domain, which are stored in a relational database and a graph database, respectively.

[0033] For entities in the entity table, the relationships and similarities between them and the thesaurus and the thesaurus are calculated to complete the mapping, and the entity is transformed into a professional and unified synonym entity representation. The text table and relation table records related to the entity in the corpus are modified accordingly.

[0034] Secondly, this invention provides a system for constructing a corpus of defects in power transmission and transformation equipment oriented towards a power grid language model.

[0035] A system for constructing a corpus of defects in power transmission and transformation equipment oriented towards a power grid language model includes:

[0036] The data classification module is configured to: classify the acquired multi-source data on defects in power transmission and transformation equipment in the power grid field into structured data, semi-structured data and unstructured data, and divide the PDF files in the semi-structured data into tabular PDF files and text PDF files;

[0037] The table PDF file processing module is configured to: extract table files from the table PDF file using the table OCT algorithm; the extracted table files and the table files in the semi-structured data constitute a total table file; extract data from the total table file using a table structuring algorithm based on the power grid text multi-classification model; the extraction results and the structured data together constitute attribute-accurate record data in the database; and obtain structured text corpus, entity corpus, and relation corpus based on the attribute-accurate record data in the database.

[0038] The text PDF file processing module is configured to: extract text files from text PDF files using a text OCT algorithm; combine the extracted text files with unstructured data to form a text file containing complex text sequences; and obtain unstructured text corpus sets, entity corpus sets, and relation corpus sets based on the text file containing complex text sequences.

[0039] The corpus generation module is configured as follows: a structured text corpus, an entity corpus, and a relation corpus, and an unstructured text corpus, an entity corpus, and a relation corpus, which together constitute the total text corpus, entity corpus, and relation corpus.

[0040] The corpus generation module is configured to: generate a text table based on the total text corpus, generate an entity table based on the total entity corpus, generate a relation table based on the total relation corpus, and construct a corpus of defects in power transmission and transformation equipment in the power grid field based on the text table, entity table, and relation table.

[0041] Thirdly, the present invention provides a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the steps in the method for constructing a corpus of defects in power transmission and transformation equipment oriented towards a power grid language model as described in the first aspect of the present invention.

[0042] Fourthly, the present invention provides an electronic device, including a memory, a processor, and a program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps in the method for constructing a corpus of defects in power transmission and transformation equipment oriented towards a power grid language model as described in the first aspect of the present invention.

[0043] Compared with the prior art, the beneficial effects of the present invention are:

[0044] 1. This invention innovatively proposes a method for constructing a corpus of defects in power transmission and transformation equipment oriented towards power grid language models. It proposes a corpus model for power grid power transmission and transformation equipment defects that includes text tables, entity tables, and relation tables. Combining technologies such as named entity recognition, relation recognition, knowledge graphs, and large language models, it extracts defect data from massive amounts of raw data related to power transmission and transformation equipment defects in the power grid field and forms a corpus of defects in power grid power transmission and transformation equipment. This provides important data resources for tasks such as data classification, data mining, data prediction, and data decision-making based on defect data, and also provides a high-quality labeled dataset for training language models in the power grid field (such as named entity recognition models, relation recognition models, and large language models).

[0045] 2. This invention designs methods such as web crawling algorithms to collect multi-source data related to defects in power transmission and transformation equipment in the power grid field. It innovatively classifies the data according to its presentation, transforms the relationships between data, and generates corpus based on the data's format. Furthermore, it designs and implements various algorithms and models for this purpose.

[0046] 3. This invention proposes an adaptive PDF file content extraction method. Compared to the "human adaptation" method that manually distinguishes between text and tables in PDF files, this invention proposes a PDF file classification method based on the SIFT feature extraction algorithm and support vector machine. After paginating the PDF and performing image processing, the extracted features are input into the support vector machine to obtain the final classification, realizing the function of automatically distinguishing between table PDFs and text PDFs through the algorithm, i.e., "adaptive". Subsequently, image processing technology is used to obtain the table or text location information, and OCR technology is used to complete the content extraction, finally completing the adaptive content extraction of the PDF file and converting it into a table file or a text file.

[0047] 4. This invention proposes a method for splicing structured data into pseudo-human records using a large language model, and designs a rule-based algorithm to complete the entity and relation labeling of the record. This invention uses a power grid domain knowledge set to fine-tune the GPT3.5 model to obtain a power grid large language model. Then, the attribute set of structured data is input into the power grid large language model to obtain splicing attributes and sequence suggestions. After splicing, the text is optimized for context to obtain pseudo-human records as text corpus. Entity and relation labeling is completed through a rule-based algorithm to obtain entity and relation corpus.

[0048] 5. This invention proposes an adaptive table file structuring method based on a power grid text multi-classification model. It designs a text multi-classification model for the power grid field, where the category set is the attribute set of structured data. The model is trained using pre-structured data. When structuring table files, the traditional "human adaptation" method requires experts to manually match each column of the table record with the attribute set of the structured data. However, this invention, for each table record, the content of each column is sequentially input into the power grid field text multi-classification model to obtain the classification and confidence score. Then, for each category, the text with the highest confidence score is taken as the value of that attribute, automatically completing the structuring of the table file, i.e., "adaptive".

[0049] 6. This invention proposes a unified information extraction model for entities and equipment defect relationships of power transmission and transformation equipment in the power grid field based on Prompt Learning. It is used to extract the text, entities, and relationships required to build a corpus from complex unstructured text. The design approach based on prompt learning effectively utilizes language model fine-tuning technology and combines it with a Prompt template designed by power grid experts. This enables the model to exhibit better pattern learning ability with small samples. It can complete the structured extraction task of complex text sequences when samples are scarce in the early stage of building a corpus of power transmission and transformation equipment defects in the power grid field, and obtain entity corpora and relation corpora, continuously expanding the scale of high-quality labeled samples.

[0050] 7. This invention proposes a method for fusing entity knowledge of power transmission and transformation equipment based on a thesaurus of professional terms in the power grid field and a thesaurus of synonyms. When text corpus, entity corpus and relation corpus are obtained, the entity corpus is searched and matched, and finally the different expressions of the same professional term are mapped and unified. The text corpus and relation corpus are modified accordingly to achieve data consistency.

[0051] 8. This invention proposes a construction scheme for an information-rich corpus of defects in power transmission and transformation equipment in the power grid field. The corpus structure is designed as a relational database containing text tables, entity tables, and relation tables. By adapting excellent language models from the field of natural language processing to the power grid field, a variety of power grid language models are designed. Compared with traditional corpora that only contain text corpora, the corpus designed and constructed in this invention contains entity and relation information from the text corpus, which can reflect more semantic, contextual and other natural language information, thus completing the information enrichment process.

[0052] 9. This invention proposes a method for generating a power grid language model dataset based on a corpus of defects in power transmission and transformation equipment in the power grid field. This method can generate knowledge sets to support the fine-tuning of large language models in the power grid field and generate high-quality labeled sequence sets to support the training of named entity recognition models and relation recognition models, effectively improving the training effect of power grid language models and increasing the accuracy and efficiency of defect identification. As the scale of the corpus continues to expand, the training effect of the power grid language model used in the corpus construction process of this invention will also continuously improve with the expansion of the dataset. The optimization of the model will further improve the quality of the corpus. The two iteratively form a closed-loop chain of corpus self-optimization.

[0053] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0054] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.

[0055] Figure 1 This is a flowchart illustrating the method for constructing a corpus of defects in power transmission and transformation equipment based on a power grid language model, as provided in Embodiment 1 of the present invention.

[0056] Figure 2 This is a logic diagram of the entity knowledge fusion algorithm provided in Embodiment 1 of the present invention;

[0057] Figure 3 This is an ER diagram of a power transmission and transformation equipment defect corpus provided in Embodiment 1 of the present invention for a power grid language model.

[0058] Figure 4 This is a sample diagram of the text corpus table storage data provided in Embodiment 1 of the present invention;

[0059] Figure 5 This is a sample diagram of entity corpus table storage data in the corpus provided in Embodiment 1 of the present invention;

[0060] Figure 6 This is a sample diagram of the relational corpus table storage data provided in Embodiment 1 of the present invention;

[0061] Figure 7 This is a sample record diagram of a semi-structured data table file provided in Embodiment 1 of the present invention;

[0062] Figure 8 This is a sample diagram of the unified extraction model of named entities and relations based on Prompt Learning provided in Embodiment 1 of the present invention;

[0063] Figure 9 Example diagrams are generated for the dataset used in the Finetune large language model for power grids provided in Embodiment 1 of the present invention;

[0064] Figure 10 Example diagrams of dataset generation for the named entity recognition model and relation recognition model provided in Embodiment 1 of the present invention;

[0065] Figure 11 This is a schematic diagram of the self-optimizing ecological closed-loop logic of the corpus provided in Embodiment 1 of the present invention. Detailed Implementation

[0066] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0067] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0068] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.

[0069] Example 1:

[0070] like Figure 1 As shown, Embodiment 1 of the present invention provides a method for constructing a defect corpus of power transmission and transformation equipment oriented towards a power grid language model, including the following process:

[0071] (1) This invention designs and implements methods such as web crawling and knowledge base collection to collect and organize multi-source data related to power transmission and transformation equipment. Finally, based on the data representation format, it accurately completes the division of structured, semi-structured, and unstructured data. Among them, structured data refers to records that have been stored in relational databases and contain many attributes, such as defect data that has been organized by enterprises in the power grid field, which accurately records defect information according to attributes such as time, defective equipment, and defect status; unstructured data refers to text files containing complex text sequences, such as manual defect records converted into text files, and the text of the power grid field power transmission and transformation equipment defect encyclopedia on Wikipedia; semi-structured data mainly includes PDF files and tabular files, such as PDF files that store photos of paper defect record reports and defect record tables, and electronic tabular files that store defect records.

[0072] (2) For semi-structured data, this invention designs and implements a PDF classification algorithm based on support vector machine to distinguish PDF files into table PDFs and text PDFs; this invention designs a conversion algorithm based on image processing algorithm and OCR technology to complete the conversion of table PDFs into table files and text PDFs into unstructured data (text files); and constructs a Bert multi-classification model for power grid transmission and transformation equipment to complete the conversion of table files into structured data.

[0073] (3) For structured data already stored in relational databases, this invention uses power grid professional knowledge set to fine-tune the GPT3.5 large language model, and completes the sequence splicing through the structured data attribute sequence splicing suggestion generated by power grid GPT, and optimizes its contextual expression as text corpus; then, it combines rule algorithm to extract the power transmission and transformation equipment information entities and equipment defect relationships to obtain entity corpus and relation corpus.

[0074] (4) For unstructured data that consists of text files containing complex text sequences, this invention uses the PromptLearning method combined with a large language model to complete the unified extraction of entities of power grid transmission and transformation equipment and the relationship between defects of power grid transmission and transformation equipment. Finally, the text sequence is used as text corpus, and entity corpus and relationship corpus are extracted through the model.

[0075] (5) For the text corpus, entity corpus and relation corpus obtained by the above scheme, the present invention performs word segmentation and removes stop words on the text corpus based on the power grid professional word segmentation dictionary and stop word dictionary. Then, an entity knowledge fusion method is designed: the entity corpus is matched and mapped based on the power grid professional thesaurus and the thesaurus knowledge graph. Finally, different expressions of the same professional term are fused and the text corpus and relation corpus are adjusted accordingly to improve the data quality of the corpus.

[0076] (6) Construct a corpus containing three database tables: text, entity, and relation, corresponding to the text corpus, entity corpus, and relation corpus finally obtained by the above scheme, for structured storage of defect information of power transmission and transformation equipment in the power grid field. Among them, the text table is the main body of the corpus storage, the entity table stores the named entities and entity types identified in each record of the text table, and the relation table stores the relationships between entities and relationship types identified in each record of the text table.

[0077] (7) For the training and optimization of the power grid language model, this scheme designs a dataset generation algorithm to support the large model Finetune and a dataset generation algorithm to support named entity recognition and relation recognition based on the corpus constructed by the above scheme. It can generate high-quality and effective labeled datasets, improve the knowledge learning effect of the large language model in the power grid field, and improve the recognition effect of named entity recognition, relation recognition and unified information extraction model.

[0078] More specifically, it includes the following processes:

[0079] S1: Data Collection and Classification

[0080] With the continuous accumulation and growth of defect information in power grid transmission and transformation equipment, data sources have become increasingly diversified. To effectively collect multi-source data, this invention employs the Scrapy framework to design a web crawler algorithm to scrape defect information from Wikipedia. In addition, we also collected multi-source data including database records related to actual power grid transmission and transformation equipment, defect case work orders, defect case statistical tables, defect standards (PDF files), and photo files. After screening and processing, this data, obtained through various channels, was precisely divided into three categories according to its presentation format: structured data, semi-structured data, and unstructured data. Furthermore, this invention also designed transformation, processing, and corpus generation schemes for different types of data.

[0081] S1.1: A Wikipedia crawler based on the Scrapy framework

[0082] To collect information on defects in power grid transmission and transformation equipment, we used the Scrapy framework to crawl relevant information from Wikipedia. This crawler allowed us to obtain a large amount of authoritative and detailed information on power grid transmission and transformation equipment defects, which we then stored in a structured database.

[0083] The algorithm flow is as follows:

[0084] S1.1.1: Determine the starting point for crawling, such as the Wikipedia page for defect information on power transmission and transformation equipment in the power grid field, and obtain the URL of that page.

[0085] S1.1.2: Send a request to retrieve the page content from the URL, parse the HTML, and extract all links on the page.

[0086] S1.1.3: Filter all links to find those that point to knowledge pages related to defects in power transmission and transformation equipment in the power grid sector.

[0087] S1.1.4: After filtering, a list of links to knowledge pages related to defects in power transmission and transformation equipment in the power grid field is obtained.

[0088] S1.1.5: Iterate through the list of links, access each knowledge page URL one by one, and obtain the page content.

[0089] S1.1.6: Parse and process the page content to extract information related to defects in power transmission and transformation equipment in the power grid sector. Natural language processing techniques can be used for analysis and extraction.

[0090] S1.1.7: Store the extracted information in the database.

[0091] S1.1.8: Repeat steps S1.1.2-S1.1.7 until all relevant knowledge pages have been accessed and the information extracted.

[0092] S1.1.9: Further process and analyze the extracted information as needed to meet actual requirements.

[0093] S1.2: Data Type Division

[0094] The collected multi-source data is categorized into three data types: structured data, semi-structured data, and unstructured data. Among them:

[0095] S1.2.1: Structured data refers to records related to power grid transmission and transformation equipment that are already stored in a relational database. Examples include defect data compiled by power grid companies, which precisely records defect information according to attributes such as time, defective equipment, and defect details. This data has a clear structure and format, allowing for direct querying and analysis.

[0096] S1.2.2: Semi-structured data refers to data containing certain structured information, such as tables and PDFs. Examples include PDF files containing photos of paper defect record reports and defect record forms, as well as electronic form files containing defect records. This data can be converted into structured and unstructured data using appropriate technologies (such as PDF form recognition technology and OCR technology) for further processing and analysis.

[0097] S1.2.3: Unstructured data refers to data primarily represented as complex text, such as defect case work orders, defect standards, manually recorded defects converted to text files, and text from the Wikipedia encyclopedia of power grid transmission and transformation equipment defects. This data lacks a fixed format and structure and requires analysis and processing using techniques such as natural language processing.

[0098] By classifying data types, we can better process and analyze different types of data, and improve the accuracy and efficiency of data processing.

[0099] S2: Conversion of semi-structured PDF files to unstructured data based on OCR technology

[0100] For PDF files containing tables or text segments, this invention employs OCR technology for text recognition and conversion, transforming them into processable semi-structured table files or unstructured complex text data. In this section, we will introduce a data conversion method for PDF files related to defects in power transmission and transformation equipment in the power grid field based on OCR technology: First, an algorithm is designed to distinguish between table PDFs and text PDFs; then, table OCR and text OCR are performed separately for different PDFs.

[0101] S2.1: PDF File Classification Algorithm

[0102] To address the problem of PDF file classification, this invention designs a classification algorithm to categorize PDF files, determining whether they are table PDFs or text PDFs. The algorithm flow is as follows:

[0103] (1) Perform page segmentation and region division on the PDF file to obtain the image information of each page.

[0104] (2) For the obtained image information, the SIFT feature extraction algorithm is used to extract features for subsequent classification.

[0105] (3) Label some text PDF files and table PDF files respectively, extract features and correspond them to their classifications, and use them as training sets.

[0106] (4) Train the Support Vector Machine (SVM) in the machine learning algorithm based on the training set after expert annotation.

[0107] (5) For the PDF to be processed, after extracting features, input them into the support vector machine to obtain classification.

[0108] S2.2: OCR Recognition Scheme for PDF Tables

[0109] For PDF tables, this invention employs the following OCR-based scheme for recognition and conversion:

[0110] (1) Table location: First, the table location in the PDF document is determined by edge detection, binarization and connected component analysis algorithms to determine the position and size of the table, followed by denoising and cropping.

[0111] (2) Cell segmentation: Subsequently, the preprocessed table image is segmented into cells using a row-column based segmentation algorithm to obtain several cells for subsequent content recognition.

[0112] (3) Cell content recognition: Finally, we use OCR technology to recognize the content of each cell and fill the cell content into the table file according to the relative position relationship after the cell division, thus converting the table PDF into a table file.

[0113] S2.3: OCR Recognition Scheme for Text PDFs

[0114] For text PDFs, this invention employs the following OCR-based scheme for recognition and conversion:

[0115] (1) Text localization: First, the text in the PDF is located by edge detection, binarization and text region segmentation algorithms to determine the position and size of the text. Then, denoising and cropping are performed.

[0116] (2) Text recognition: Subsequently, the content of each text segment is recognized based on OCR technology.

[0117] (3) Text splicing: Finally, all the identified texts are spliced ​​together by combining the text's location information, text size and other characteristics to complete the transformation into complex text data.

[0118] By using PDF file data conversion methods based on OCR technology, we can convert PDF files into text data or tabular data, laying the foundation for subsequent processing and analysis.

[0119] S3: Conversion of semi-structured tabular files to structured data based on a multi-classification model of power grid text.

[0120] To address the problem of converting semi-structured tabular files into structured data, this invention constructs a power grid text classification model to analyze tabular files and classify each cell in the tabular file into its corresponding structured attributes.

[0121] Considering the inherent language understanding capabilities of BERT pre-trained models, i.e., their ease of deployment as web services, this invention constructs a multi-classification model for power grid transmission and transformation equipment defect text (hereinafter referred to as the power grid text multi-classification model) based on BERT pre-trained models to complete multi-classification tasks. The input of this model is a text sequence (one-hot encoding of the content of a cell in a table file), and the output is the structured attributes corresponding to the text sequence. We use existing structured data and its corresponding attributes as the training set for model training and evaluation, and use the cross-entropy function as the model's loss function to measure the model's results and guide its training. After model training, we apply it to the conversion of semi-structured table files into structured data.

[0122] Specifically, for each row in a table document related to defects in power transmission and transformation equipment in the power grid sector, the cells in each column are One-Hot encoded and then input into a power grid text multi-classification model to obtain the possible corresponding structured attributes and confidence levels. Subsequently, for each structured attribute, the content of the cell with the highest confidence level is taken as the value, completing the transformation of table records into structured data.

[0123] By employing a multi-classification model for power grid text, this invention can transform semi-structured tabular files into structured data, providing a foundation for subsequent processing. Compared to traditional expert-based tabular data structuring methods, this invention's deep learning-based approach, while ensuring transformation confidence, is universally applicable to various types of tables, improving data transformation efficiency and guaranteeing data transformation quality.

[0124] S4: Structured Data Corpus Generation Based on GPT Model and Rule-Based Algorithm

[0125] Structured data in the power grid field typically contains multiple attributes, which need to be concatenated into a complete text corpus for further analysis and processing. We fine-tuned the GPT model and then used it in combination with rule-based algorithms to generate high-quality structured data corpora.

[0126] The Genesis Language Testing (GPT) model, proposed by OpenAI, is a pre-trained language model based on the Transformer architecture. It uses unsupervised learning to pre-train the language model and then fine-tunes it as needed for specific tasks. Specifically, during pre-training, the GPT model uses a large amount of unlabeled text corpus to learn general language patterns and potential relationships. GPT's pre-training tasks include masked language modeling and next-sentence prediction. The masked language modeling task involves masking certain words in the input sentence and having the model predict the content of the masked words, thus learning the relationships between words. The next-sentence prediction task asks the model to determine whether two consecutive sentences are consecutive, thus learning the relationships between sentences. During pre-training, the GPT model continuously adjusts its parameters to maximize the prediction accuracy for all sentences in the corpus, thereby continuously improving its language understanding capabilities. When fine-tuning the GPT model, we typically use domain-specific data to make the model more suitable for tasks within that domain. The fine-tuning process typically involves two main steps: First, we need to create a small dataset, and then use the GPT model to fine-tune the dataset so that the model can better adapt to the text features of the domain and generate text that is more suitable for the specific domain.

[0127] In this invention, we construct a power grid expertise set based on various power grid regulations, systems, and defect classification documents to fine-tune the GPT model, making it more suitable for generating structured data in the power grid field and closer to the power grid domain. During the fine-tuning process, we use the cross-entropy function as the model's loss function to calculate the error between the model's predictions and the true labels, guiding the model's training process.

[0128] For structured data already stored in the database, we input its attribute (column name) set into the GPT model for the power grid domain to generate attribute suggestions and splicing order suggestions suitable for concatenating into a text corpus. Based on these suggestions, we can combine the various attributes to initially form a text corpus. Subsequently, we use the GPT model to optimize the contextual expression of the text corpus, making its transitions smoother and more natural, more similar to manually recorded defect reports, and more readable and understandable.

[0129] Once the final text corpus is obtained, the algorithm of this invention is designed as follows: based on the attributes recorded in the database and the concatenated text corpus, the entity positions and classifications in the corpus are obtained, and the relationships between attributes are designed based on expert experience to obtain the relationships between entities.

[0130] Thus, for a single piece of structured data stored in the database, we have obtained its text corpus (stored in a text table), entity set (stored in an entity table), and relation set (stored in a relation table). By applying this method, we can generate high-quality text, entity, and relation corpora, providing a more reliable, faster, and more efficient standardized data source for defect analysis and processing in the power grid field.

[0131] S5: Generation of unstructured data corpora based on PromptLearning

[0132] For unstructured data containing complex text, this invention constructs a unified extraction model based on deep learning technology to perform named entity recognition and relation recognition tasks, thereby transforming the complex text in the unstructured data into the corpus data required for the corpus constructed in this invention. This section mainly introduces the scheme of this invention for unified extraction of unstructured data corpus by constructing a deep learning model based on Prompt Learning.

[0133] First, regarding the model architecture, we adopted the Transformer model for text representation learning and applied it to the unified task of named entity recognition and relation recognition in this invention. We selected a pre-trained BERT model as the base model and trained it based on the Prompt Learning approach.

[0134] Prompt learning is a prompt-based learning method that enables models to learn specific patterns, thereby improving language understanding and reasoning in domain-specific tasks. This invention designs a unified structural pattern for named entity recognition and relation recognition tasks. Combining expert experience with a finely tuned large language model for the power grid domain, it proposes numerous prompts for entities such as equipment categories, defect relationships, and defect events. The model is trained based on these prompts to improve accuracy and recall with small sample sizes. Specifically, the deep learning model constructed in this invention parses the pattern and makes predictions step by step (e.g., for an entity node in a pattern without child nodes, its prompt is the entity name to be predicted, such as "equipment"; while for an entity node with child nodes, the prediction result of the node is linked with the child node entity name after predicting the beginning and end of the node to obtain the prediction result). Then, the prompt is constructed and linked with the text to obtain the prediction result. This process is repeated until all nodes of the pattern have been traversed.

[0135] In terms of training logic, we fine-tuned the BiGRU model and optimized it using a CRF layer. A CRF layer is a Conditional Random Field model used for sequence labeling tasks, which can globally optimize the labeling results of text sequences. By using the CRF layer, we can enable the model to perform sequence labeling and classification more accurately and stably in named entity recognition and relation recognition tasks.

[0136] For the task of named entity recognition and relation unification in the field of power grid transmission and transformation equipment, the following is a Prompt example:

[0137] Input: "A leakage current has been detected on the 110kV switchgear of the substation."

[0138] Prompt: "Please identify the equipment entities related to power transmission and transformation equipment in this sentence."

[0139] Output: "A leakage current phenomenon has occurred on the [LOC] 110kV switchgear [DEV] in the substation."

[0140] In the above example, the role of the Prompt is to instruct the model to label the entities related to power grid transmission and transformation equipment in the sentence. By learning from the labeled data tasks provided by such Prompts, the model can better understand the language expressions in the power grid domain and accurately identify and label entities and relationships in sentences. During model training, we continuously optimize the Prompt design through constant testing and feedback, significantly improving the performance of the deep learning model involved in this invention in identifying entities and defect relationships of power grid transmission and transformation equipment.

[0141] In designing the loss function, we adopted a combination of cross-entropy loss and CRF loss to guide model training. The cross-entropy loss calculates the error between the model's predictions and the true labels, while the CRF loss optimizes the parameters of the CRF layer to maximize the probability of the labeled results. By combining the cross-entropy and CRF loss functions, we achieved better results than general models in the tasks of named entity recognition and defect relationship recognition of power transmission and transformation equipment in the power grid field. Furthermore, because this model uses a unified Prompt extraction, it avoids the pain point of traditional deep learning models requiring separate training for each task.

[0142] This invention addresses the highly specialized scenario of power grid equipment defect handling, characterized by limited initial sample sizes. It constructs and trains a unified deep learning extraction model based on Prompt Learning, fully utilizing power grid data to fine-tune the language model and incorporating the experience of power grid experts to optimize model performance. This model can extract the necessary text, entities, and relationships from complex, unstructured text to construct a corpus, laying a solid foundation for subsequent data processing and analysis. Compared to traditional named entity recognition and relation recognition methods, this method enables the model to learn patterns more quickly with a smaller training set, and can more accurately identify entities and relationships in complex text, thereby improving the quality and usability of the corpus in this invention.

[0143] S6: Data Pre-Ingestion Processing Solution

[0144] To improve the quality and usability of the corpus, the corpus obtained from the above processing needs to be processed before it is stored in the corpus, including word segmentation, stop word removal and entity knowledge fusion.

[0145] S6.1: Word segmentation and stop word removal

[0146] To ensure the professionalism and accuracy of the corpus, we use a word segmentation dictionary and a stop word dictionary specifically designed for the power grid industry to process the corpus to be entered into the database.

[0147] This invention utilizes the jieba word segmentation library to load a professional word segmentation dictionary and stop word dictionary for the power grid field provided by experts, and performs word segmentation and stop word removal on the corpus based on the dictionary. The segmentation results are stored in a sequence using "$" for easy subsequent application.

[0148] S6.2: Entity Knowledge Fusion

[0149] To improve the usability and professionalism of the corpus, we need to perform entity knowledge fusion on the entities in the entity table of the corpus. The specific solution is as follows:

[0150] (1) Construction of entity thesaurus and thesaurus knowledge graph: First, this invention obtains thesaurus triples based on expert experience, power grid multi-level equipment table, encyclopedia and other data sources, and constructs the power grid domain thesaurus and thesaurus knowledge graph, which are stored in relational database and graph database respectively.

[0151] (2) Entity knowledge fusion: For entities in the entity table, refer to Figure 2 After calculating the relationship and similarity between the entity and the thesaurus and the thesaurus knowledge graph, the entity is mapped. Then, the entity is transformed into a professional and unified thesaurus entity representation, and the text table and relation table records related to the entity in the corpus are modified accordingly.

[0152] By employing a preprocessing scheme for data before it is incorporated into the corpus, this invention improves the quality and usability of the corpus.

[0153] S7: Corpus Application Scheme

[0154] After the corpus in this invention is constructed, its text table, entity table, and relation table structure contain rich semantic information, and the data in it are high-quality data processed by the aforementioned algorithms. Therefore, this invention provides a solution for generating multiple datasets based on the corpus for power grid language models. As the scale of high-quality labeled datasets expands, the power grid domain GPT3.5 large language model and the entity and relation unified extraction model based on PromptLearning used in constructing the corpus in this invention can also be continuously trained and optimized to obtain better results. The better model can bring higher-quality data. The optimization of the model and the improvement of the quality of the corpus constitute a cyclical iterative process, forming a closed-loop chain.

[0155] S7.1: Dataset generation algorithm supporting the large model Finetune

[0156] The dataset required for the large model Finetune primarily contains knowledge of the relevant professional domain, without requiring extensive consideration of contextual relationships. Based on this characteristic, the algorithm flow is designed as follows:

[0157] (1) Based on the input parameters (text source, confidence level, etc.), the text corpus is filtered out;

[0158] (2) Determine the size, input size, and output size of the single sequence based on the input parameters;

[0159] (3) Determine the text corpus processing method based on the input parameters;

[0160] (4) For the discarding method, if the length of each text corpus is less than the required sequence size, it is discarded; if it is greater than the size requirement, the first n characters are processed to obtain a sequence, and the remaining characters are discarded.

[0161] (5) For the concatenation processing method, if the length of the current text corpus is less than the required sequence size, the first n characters are taken after concatenating the next corpus, and the remaining characters are used as the text corpus for the next processing. This process is repeated until the remaining corpus is less than the sequence size.

[0162] (6) Finally, the dataset is generated.

[0163] S7.2: Dataset generation algorithm supporting named entity recognition and relation recognition

[0164] The dataset required for named entity recognition and relation recognition includes text sequences, entity categories and start and end positions, and relation triples (entity, relation, entity). Based on these requirements, an algorithm is designed to generate the dataset in Doccano format, as follows:

[0165] (1) Based on the text source in the input parameters, filter to obtain the text corpus set and the corresponding entity corpus set and relation corpus set;

[0166] (2) Filter the entity corpus and relation corpus based on the confidence threshold of the input parameters;

[0167] (3) Determine the text corpus processing method based on the input parameters;

[0168] (4) Each text corpus represents a piece of data: the corresponding entity corpus is processed into entity type, start position, and end position, and added to the data; the corresponding relation corpus is processed into relation type, source entity ID, and target entity ID, and added to the data.

[0169] (5) Each text, each entity, and each relationship is assigned a unique ID, and finally the dataset is generated.

[0170] S8: Invention Effects

[0171] S8.1: Corpus of Defects in Power Transmission and Transformation Equipment in the Power Grid Sector

[0172] This invention addresses defect information in power transmission and transformation equipment in the power grid sector. It has collected over 1,000 real defect cases, over 3,000 relevant standard documents, over 10,000 relevant literature articles, over 20,000 relevant news articles, and over 10,000 real defect inspection reports. The data is presented in various formats, including database records, tabular files, PDF files, and text files, and a large-scale raw dataset of defects in power transmission and transformation equipment in the power grid sector has been constructed.

[0173] Based on this dataset, this invention utilizes natural language processing techniques such as named entity recognition, relation recognition, and large language model suggestion generation, as described in the invention's content, to construct a corpus of defects in power transmission and transformation equipment in the power grid domain. This corpus includes a text table, an entity table, and a relation table. The entity table's entity categories include: 'time', 'defect cause', 'power station or line', 'operation', 'equipment', 'defect description', 'detection technology', and 'defect trigger word'. The relation table's relation categories include: 'defect time', 'defect equipment', 'detection method', 'defect description', 'defect cause', and 'operation'. The ER diagram of the corpus structure is shown below. Figure 3 As shown.

[0174] The corpus currently contains 52,551 text entries, 583,277 entity entries, and 106,826 relational entries. Figure 4 , Figure 5 , Figure 6 For the text corpus, entity corpus, and relation corpus stored in the corpus, 20 records are randomly selected from each table using the SQL statement RAND() as examples to demonstrate the content volume, tag diversity, and structure of the corpus constructed by this invention.

[0175] S8.2: Functional Demonstration of the Power Grid Language Model

[0176] For example Figure 7 The semi-structured data table file shown provides a record with the following sequence generation suggestions from the fine-tuned power grid domain large language model: 'Date of discovery', 'Unit where the defect is located', 'Voltage level', 'Substation / Line', 'Defective equipment', 'Defect content', 'Defect nature'. After concatenation, the preliminary result is: "2023-07-20, XXX Central Control Station, AC 110kV, XXX Substation, #2 Main Transformer, the oil level in the bottom oil cup of the #2 Main Transformer on-load tap changer is low, close to the minimum limit, normal."

[0177] After fine-tuning the large language model for the power grid field and performing context optimization, the final result is: "On July 20, 2023, the inspection personnel found that the oil level in the bottom oil cup of the on-load tap changer of the #2 main transformer at the XXX central control station 110kV XXX substation was low, close to the minimum limit. After analysis, it was determined to be a general defect."

[0178] The text corpus, "On April 1, 2015, the on-load gas relay of transformer No. 2 at the 110kV XXX substation lacked rainproof measures, leading to water ingress and moisture, causing a high-resistance short circuit at the relay's hard contacts," is unstructured data. Through the Named Entities and Relations Unified Information Extraction Model constructed based on PromptLearning in this invention, the following results were obtained: Figure 8 The results show that the unified information extraction model constructed in this invention can complete the information extraction of defect entities and relational corpora of power transmission and transformation equipment in the power grid field.

[0179] S8.3: Dataset generation function for power grid language model

[0180] Based on the power grid transmission and transformation equipment defect corpus constructed in this invention, this invention designs and implements a dataset generation function for power grid language models, wherein the dataset generation sample for the power grid large language model Finetune is as follows. Figure 9As shown, single-record processing mode and concatenation processing mode can be specified, and the dataset size, sequence length, input length, and output length can be arbitrarily specified; a dataset generation sample for named entity recognition model and relation recognition model is shown below. Figure 10 As shown, the more common Docano format can be used to specify the dataset size, confidence level, entity category, and relationship category.

[0181] The datasets generated by the power grid language model-oriented dataset generation function designed and implemented in this invention are all input into the corresponding models in the corpus construction process for training and testing, as detailed below:

[0182] For the large-scale language model of the power grid, incremental fine-tuning was performed using the Finetune dataset generated by the dataset generation algorithm designed in this invention. During the fine-tuning process, we divided the training and validation sets and optimized the model using the cross-entropy loss function. After multiple rounds of iterative training, we evaluated the model's performance on a unified test set using the loss function, accuracy, and BLEU score. We found that the model's accuracy and efficiency in tasks such as semantic analysis and knowledge learning in the power grid domain were improved to a certain extent, and its generalization ability in the power grid domain was also enhanced.

[0183] For the named entity recognition (NAME) and relation recognition (RIR) models, we also used the datasets generated by the dataset generation algorithm designed in this invention for incremental training. During training, we divided the generated datasets into training and validation sets, keeping the other parameters, loss function, test set, and other settings consistent with the initial model training. After multiple epochs of training and validation, we calculated metrics such as accuracy, recall, and F1 score, and performed cross-validation to evaluate the effect of incremental training. Based on these metrics, we found that after incremental training, the NAME and RIR models exhibited better accuracy and stability in the power grid domain, and were able to more effectively identify the required equipment information, defect information, etc., in NAME and RIR tasks within the power grid domain.

[0184] The above results demonstrate that this invention, through the design and implementation of a dataset generation algorithm, can achieve a self-optimizing ecological closed-loop logic as the corpus expands in size, such as... Figure 11 As shown; in addition, the customizability of this function also provides a channel for constructing and obtaining high-quality professional domain datasets for the customized design and training of language models in the power grid field, which can further optimize the performance of customized professional domain models.

[0185] Example 2:

[0186] Embodiment 2 of the present invention provides a system for constructing a defect corpus of power transmission and transformation equipment oriented towards power grid language models, comprising:

[0187] The data classification module is configured to: classify the acquired multi-source data on defects in power transmission and transformation equipment in the power grid field into structured data, semi-structured data and unstructured data, and divide the PDF files in the semi-structured data into tabular PDF files and text PDF files;

[0188] The table PDF file processing module is configured to: extract table files from the table PDF file using the table OCT algorithm; the extracted table files and the table files in the semi-structured data constitute a total table file; extract data from the total table file using a table structuring algorithm based on the power grid text multi-classification model; the extraction results and the structured data together constitute attribute-accurate record data in the database; and obtain structured text corpus, entity corpus, and relation corpus based on the attribute-accurate record data in the database.

[0189] The text PDF file processing module is configured to: extract text files from text PDF files using a text OCT algorithm; combine the extracted text files with unstructured data to form a text file containing complex text sequences; and obtain unstructured text corpus sets, entity corpus sets, and relation corpus sets based on the text file containing complex text sequences.

[0190] The corpus generation module is configured to consist of a structured text corpus, an entity corpus, and a relation corpus, which together form the total text corpus, entity corpus, and relation corpus.

[0191] The corpus generation module is configured to: generate a text table based on the total text corpus, generate an entity table based on the total entity corpus, generate a relation table based on the total relation corpus, and construct a corpus of defects in power transmission and transformation equipment in the power grid field based on the text table, entity table, and relation table.

[0192] The working method of the system is the same as the method for constructing a corpus of defects in power transmission and transformation equipment oriented towards the power grid language model provided in Example 1, and will not be repeated here.

[0193] Example 3:

[0194] Embodiment 3 of the present invention provides a computer-readable storage medium storing a program thereon, which, when executed by a processor, implements the steps in the method for constructing a corpus of defects in power transmission and transformation equipment oriented towards a power grid language model as described in Embodiment 1 of the present invention.

[0195] Example 4:

[0196] Embodiment 4 of the present invention provides an electronic device, including a memory, a processor, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps in the method for constructing a corpus of defects in power transmission and transformation equipment oriented towards a power grid language model as described in Embodiment 1 of the present invention.

[0197] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for constructing a corpus of defects in power transmission and transformation equipment oriented towards a power grid language model, characterized in that, Includes the following processes: The acquired multi-source data on defects in power transmission and transformation equipment in the power grid sector are classified into structured data, semi-structured data, and unstructured data. The PDF files in the semi-structured data are further divided into tabular PDF files and text PDF files. The table PDF file is extracted using a table OCR algorithm to obtain the extracted table file. The extracted table file and the table file in the semi-structured data constitute the total table file. The table structuring algorithm based on the power grid text multi-classification model is used to extract data from the total table file. The extraction results and the structured data together constitute the attribute-accurate record data in the database. Based on the attribute-accurate record data in the database, the structured text corpus, entity corpus and relation corpus are obtained. The text PDF file is extracted using a text OCR algorithm to obtain an extracted text file. The extracted text file and unstructured data constitute a text file containing complex text sequences. Based on the text file containing complex text sequences, an unstructured text corpus, an entity corpus, and a relation corpus are obtained. Structured text corpora, entity corpora, and relation corpora, and unstructured text corpora, entity corpora, and relation corpora together constitute the total text corpora, entity corpora, and relation corpora. A text table is generated based on the total text corpus, an entity table is generated based on the total entity corpus, and a relation table is generated based on the total relation corpus. The text table, entity table, and relation table together form a corpus of defects in power transmission and transformation equipment in the power grid field.

2. The method for constructing a defect corpus for power transmission and transformation equipment based on a power grid language model as described in claim 1, characterized in that, Recognition of PDF form files, including: Using edge detection, binarization, and connected component analysis algorithms, table location is performed on PDF documents to determine the position and size of tables, followed by denoising and cropping. The preprocessed table image is divided into cells using a row- and column-based segmentation algorithm, resulting in several cells for subsequent content recognition. The OCR algorithm is used to recognize the content of each cell, and the cell content is filled into the table file according to the relative position of the cells after division, thus converting the table PDF into a table file.

3. The method for constructing a defect corpus for power transmission and transformation equipment based on a power grid language model as described in claim 1, characterized in that, Recognition of text PDF files, including: By using edge detection, binarization, and text region segmentation algorithms, the text in the PDF is located, its position and size are determined, and then denoising and cropping are performed. The content of each text segment is recognized based on OCR technology; By combining the location information and font size characteristics of the text, all the identified text is spliced ​​together to complete the transformation into complex text data.

4. The method for constructing a defect corpus for power transmission and transformation equipment oriented towards a power grid language model as described in claim 1, characterized in that, A table-based structuring algorithm based on a power grid text multi-classification model is used to extract data from the total table file, including: For each row in the table file related to defects in power transmission and transformation equipment in the power grid field, the cells in each column are One-Hot encoded and then input into the power grid text multi-classification model to obtain the possible corresponding structured attributes and confidence levels. Subsequently, for each structured attribute, the content of the cell with the highest confidence level is taken as the value, thus completing the transformation of table records into structured data.

5. The method for constructing a defect corpus for power transmission and transformation equipment oriented towards a power grid language model as described in claim 1, characterized in that, Based on the precisely recorded data in the database, and using a structured data corpus generation method based on the GPT model and rule-based algorithms, structured text corpora, entity corpora, and relation corpora are obtained, including: For structured data already stored in the database, the attribute set is input into the GPT model in the power grid domain to generate attribute suggestions and splicing order suggestions suitable for concatenation into text corpus. Based on these suggestions, the various attributes are combined to form preliminary text corpus. The GPT model is then used to optimize the contextual representation of the preliminary text corpus to obtain the final text corpus. Based on the attributes recorded in the database and the final text corpus obtained by splicing, the entity locations and classifications in the corpus are obtained, and the relationships between attributes are designed based on expert experience to obtain the relationships between entities.

6. The method for constructing a defect corpus for power transmission and transformation equipment based on a power grid language model as described in claim 1, characterized in that, Based on the text file containing complex text sequences, and using the unstructured data corpus generation method based on PromptLearning, unstructured text corpus sets, entity corpus sets, and relation corpus sets are obtained.

7. The method for constructing a defect corpus for power transmission and transformation equipment based on a power grid language model as described in claim 1, characterized in that, The data is processed before being stored in the corpus, including word segmentation, stop word removal, and entity knowledge fusion. The word segmentation and stop word removal include: The corpus to be entered is processed using a word segmentation dictionary and a stop word dictionary specifically for the power grid field. Based on the jieba word segmentation library, the professional word segmentation dictionary and stop word dictionary for the power grid field provided by experts are loaded, and the word segmentation and stop word removal operations of the corpus are completed according to the dictionary. The entity knowledge fusion includes: Construction of entity thesaurus and thesaurus knowledge graph: Based on expert experience, multi-level equipment tables of power grid, and encyclopedia data sources, thesaurus triples are obtained to construct a thesaurus and thesaurus knowledge graph for the power grid domain, which are stored in a relational database and a graph database, respectively. For entities in the entity table, the relationships and similarities between them and the thesaurus and the thesaurus are calculated to complete the mapping, and the entity is transformed into a professional and unified synonym entity representation. The text table and relation table records related to the entity in the corpus are modified accordingly.

8. A system for constructing a corpus of defects in power transmission and transformation equipment oriented towards a power grid language model, characterized in that, include: The data classification module is configured to: classify the acquired multi-source data on defects in power transmission and transformation equipment in the power grid field into structured data, semi-structured data and unstructured data, and divide the PDF files in the semi-structured data into tabular PDF files and text PDF files; The table PDF file processing module is configured to: extract the table PDF file into an extracted table file using a table OCR algorithm; the extracted table file and the table file in the semi-structured data constitute a total table file; extract the data from the total table file using a table structuring algorithm based on the power grid text multi-classification model; the extraction result and the structured data together constitute the attribute-accurate record data in the database; and obtain the structured text corpus, entity corpus, and relation corpus based on the attribute-accurate record data in the database. The text PDF file processing module is configured to: extract text files from text PDF files using a text OCR algorithm; combine the extracted text files with unstructured data to form a text file containing complex text sequences; and obtain unstructured text corpus sets, entity corpus sets, and relation corpus sets based on the text file containing complex text sequences. The corpus generation module is configured as follows: a structured text corpus, an entity corpus, a relation corpus, and an unstructured text corpus, an entity corpus, and a relation corpus, which together constitute the total text corpus, entity corpus, and relation corpus. The corpus generation module is configured to: generate a text table based on the total text corpus, generate an entity table based on the total entity corpus, generate a relation table based on the total relation corpus, and construct a corpus of defects in power transmission and transformation equipment in the power grid field based on the text table, entity table, and relation table.

9. A computer-readable storage medium having a program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps in the method for constructing a corpus of defects in power transmission and transformation equipment oriented towards a power grid language model as described in any one of claims 1-7.

10. An electronic device comprising a memory, a processor, and a program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps in the method for constructing a corpus of defects in power transmission and transformation equipment oriented towards a power grid language model as described in any one of claims 1-7.