Energy text data structuring method and device based on relation extraction

By using a relation extraction-based approach and leveraging pre-trained language models and neural network training, the limitations of structuring energy text data were overcome, enabling more efficient entity and relation classification and generating clear and unified structured data reports.

CN116383339BActive Publication Date: 2026-04-24GUANGDONG POWER GRID CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGDONG POWER GRID CO LTD
Filing Date
2023-01-31
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing technologies have limitations in structuring energy text data. Traditional methods cannot effectively identify entities and relationships in the energy field, resulting in incomplete identification and incorrect category labeling.

Method used

A relation-based extraction method is adopted to extract entity features from energy text data using a pre-trained language model, establish entity relationships, and generate structured data reports through data augmentation and iterative training of neural networks.

Benefits of technology

It improves the structured accuracy and analyzability of energy text data, meeting the data storage and analysis needs of the energy sector.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116383339B_ABST
    Figure CN116383339B_ABST
Patent Text Reader

Abstract

The application discloses an energy text data structuring method and device based on relation extraction, obtains a first energy text data set, extracts entity features of energy text data in the first energy text data set, establishes entity relations between the energy text data, and obtains a second energy text data set; based on an energy type of the energy text data, the energy text data in the second energy text data set is subjected to data enhancement, and a third energy text data set is obtained; based on the third energy text data set, a preset neural network model is subjected to iterative training until the preset neural network model reaches a preset convergence condition, a data structuring model is obtained, the data structuring model is used to structure to-be-structured energy text data, and a structured data report is generated. The classification accuracy, analyzability and storage convenience of the energy text data are improved, and the limitation of a traditional text data structuring method in the energy field is effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of text data processing technology, and in particular to a method and apparatus for structuring energy text data based on relation extraction. Background Technology

[0002] Currently, energy big data in text format cannot be directly applied to data mining. Therefore, it is necessary to transform energy text data into data with clear structure and well-defined relationships to facilitate data storage and analysis.

[0003] Currently, structured methods applied to text data include template matching, keyword extraction, named entity recognition, and entity relation extraction. Traditional template matching and keyword extraction heavily rely on pre-defined templates and keywords when processing text data. If the text data cannot match a pre-defined template or does not contain keywords, the structured information within the text data cannot be identified. Named entity recognition can identify entities in text data, thereby extracting entities that may have relationships. However, entities in the general text domain differ significantly in data characteristics from those in the energy domain, and direct application can easily lead to incomplete entity recognition and incorrect category labeling. Therefore, traditional methods have limitations in applying to energy text data, and a structured method specifically tailored to the characteristics of energy text data is urgently needed. Summary of the Invention

[0004] This application provides a method and apparatus for structuring energy text data based on relation extraction, in order to solve the technical problem that traditional text data structuring methods have limitations in the application of energy text data.

[0005] To address the aforementioned technical problems, firstly, this application provides a method for structuring energy text data based on relation extraction, comprising:

[0006] Obtain a first energy text dataset, which includes multiple energy text data;

[0007] Using a pre-trained language model, entity features of energy text data in the first energy text dataset are extracted, and entity relationships between the energy text data are established to obtain the second energy text dataset.

[0008] Based on the energy type of the energy text data, data augmentation is performed on the energy text data in the second energy text dataset to obtain a third energy text dataset.

[0009] Based on the third energy text dataset, the preset neural network model is iteratively trained until the preset neural network model reaches the preset convergence condition, thus obtaining a data structured model.

[0010] Using the aforementioned data structuring model, the energy text data to be structured is structured to generate structured data reports.

[0011] In some implementations, obtaining the first energy text dataset includes:

[0012] Based on a preset keyword library, multiple energy text data corresponding to preset keywords are crawled from the Internet. The preset keyword library includes multiple preset keywords.

[0013] Based on a preset relational database, the entity relationships between the energy text data are labeled using triples to obtain the first energy text dataset.

[0014] In some implementations, the step of using a pre-trained language model to extract entity features from the energy text data in the first energy text dataset and establishing entity relationships between the energy text data to obtain a second energy text dataset includes:

[0015] Using a pre-trained language model, entity extraction is performed on energy text data with entity relation triples in the first energy text dataset to obtain the entity features of the energy text data.

[0016] Using a preset entity relationship template, the entity features are represented by relationship vectors based on the entity relationship triples, generating entity relationship vectors between the energy text data, thus obtaining the second energy text dataset.

[0017] In some implementations, the step of augmenting the energy text data in the second energy text dataset based on the energy type of the energy text data to obtain a third energy text dataset includes:

[0018] Extract the feature vector of each character from the energy text data in the second energy text dataset;

[0019] Using a self-attention mechanism, the word feature vectors are processed according to the energy type to obtain the third energy text dataset.

[0020] In some implementations, the step of iteratively training a preset neural network model based on the third energy text dataset until the preset neural network model reaches a preset convergence condition to obtain a data structured model includes:

[0021] The third energy text dataset is input into the preset neural network model;

[0022] Using the preset neural network model, named entity recognition is performed on the energy text data in the third energy text dataset to determine the position of each entity in the energy text data, thereby obtaining an entity set;

[0023] Extract multiple relation categories from the entity set to obtain a relation category set;

[0024] Based on the entity set and the relation category set, predict the position of the second target entity corresponding to the first target entity under the target relation category in the energy text data, and output multiple relation triples;

[0025] Based on the relation triples, the loss function of the preset neural network model is calculated, and the model parameters of the preset neural network model are updated based on the loss function until the preset neural network model reaches the preset convergence condition, thereby obtaining the data structured model.

[0026] In some implementations, based on the entity set and the relation category set, the position of the second target entity corresponding to the first target entity under the target relation category in the energy text data is predicted, and multiple relation triples are output, including:

[0027] For a first target entity in the entity set, under the target relationship category in the relationship category set, determine a second target entity that has the target relationship category with the first target entity from the entity set, and predict the position probability value of the second target entity in the energy text data;

[0028] The second target entity corresponding to the location with the highest probability value is combined with the first target entity and the target relationship category to form the relationship triplet.

[0029] In some implementations, the process of using the data structuring model to structure the energy text data to be structured and generate structured data reports includes:

[0030] Using the data structuring model, predict all relation triples in the energy text data to be structured;

[0031] The structured data report is generated based on all the aforementioned relation triples.

[0032] Secondly, this application also provides an energy text data structuring device based on relation extraction, comprising:

[0033] The acquisition module is used to acquire a first energy text dataset, which includes multiple energy text data.

[0034] The extraction module is used to extract entity features of energy text data in the first energy text dataset using a pre-trained language model, and to establish entity relationships between the energy text data to obtain the second energy text dataset.

[0035] The enhancement module is used to perform data enhancement on the energy text data in the second energy text dataset based on the energy type of the energy text data, so as to obtain a third energy text dataset;

[0036] The training module is used to iteratively train a preset neural network model based on the third energy text dataset until the preset neural network model reaches the preset convergence condition, thereby obtaining a data structured model.

[0037] The structuring module is used to structure the energy text data to be structured using the data structuring model, and generate structured data reports.

[0038] Thirdly, this application also provides a computer device, including a processor and a memory, the memory being used to store a computer program, which, when executed by the processor, implements the relation-based energy text data structuring method as described in the first aspect.

[0039] Fourthly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the relation-based energy text data structuring method as described in the first aspect.

[0040] Compared with the prior art, this application has at least the following beneficial effects:

[0041] By acquiring a first energy text dataset, which includes multiple energy text data, and using a pre-trained language model to extract entity features from the energy text data in the first energy text dataset, and establishing entity relationships between the energy text data, a second energy text dataset is obtained. This dataset is used for natural language entity extraction of energy-related text data, and relationship extraction is performed for different entities. Simultaneously, the implicit prior knowledge in the pre-trained model is used to obtain more refined relationship feature representations, improving the accuracy of relationship extraction. Then, based on the energy type of the energy text data, data augmentation is performed on the energy text data in the second energy text dataset to obtain a third energy text dataset, tailored to different energy types. Energy type assigns higher weights to related words in the text, thereby improving the accuracy of entity and relation category classification. Finally, based on the third energy text dataset, a preset neural network model is iteratively trained until it reaches a preset convergence condition, resulting in a data structuring model. This data structuring model is then used to structure the energy text data to be structured, generating structured data reports. These reports are then used to display the energy text data, making its structure clearer and more unified, thus improving its analyzability and ease of data storage. This meets the text data structuring needs in the energy field and effectively addresses the limitations of traditional text data structuring methods in the energy sector. Attached Figure Description

[0042] Figure 1 This is a flowchart illustrating the energy text data structuring method based on relation extraction, as shown in an embodiment of this application.

[0043] Figure 2 This is a schematic diagram illustrating energy text data in an embodiment of this application;

[0044] Figure 3 This is a schematic diagram of the structure of an energy text data structuring device based on relation extraction, as shown in an embodiment of this application.

[0045] Figure 4 This is a schematic diagram of the structure of a computer device shown in an embodiment of this application. Detailed Implementation

[0046] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0047] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a relation-based energy text data structuring method provided in an embodiment of this application. The relation-based energy text data structuring method of this application can be applied to computer devices, including but not limited to smartphones, laptops, tablets, desktop computers, physical servers, and cloud servers. Figure 1 As shown, the energy text data structuring method based on relation extraction in this embodiment includes steps S101 to S105, which are detailed below:

[0048] Step S101: Obtain a first energy text dataset, which includes multiple energy text data.

[0049] Step S102: Using a pre-trained language model, extract entity features from the energy text data in the first energy text dataset, and establish entity relationships between the energy text data to obtain the second energy text dataset.

[0050] Step S103: Based on the energy type of the energy text data, perform data augmentation on the energy text data in the second energy text dataset to obtain the third energy text dataset.

[0051] Step S104: Based on the third energy text dataset, iteratively train the preset neural network model until the preset neural network model reaches the preset convergence condition to obtain the data structured model.

[0052] Step S105: Using the data structuring model, the energy text data to be structured is structured to generate a structured data report.

[0053] This embodiment acquires a first energy text dataset, which includes multiple energy text data. Using a pre-trained language model, it extracts entity features from the energy text data in the first energy text dataset and establishes entity relationships between the energy text data, resulting in a second energy text dataset. This dataset is used for natural language entity extraction of energy-related text data and for relationship extraction for different entities. Simultaneously, it utilizes the implicit prior knowledge in the pre-trained model to obtain more refined relationship feature representations, improving the accuracy of relationship extraction. Then, based on the energy type of the energy text data, it performs data augmentation on the energy text data in the second energy text dataset, resulting in a third energy text dataset. Different energy types assign higher weights to related words in the text, thereby improving the accuracy of entity and relation classification. Finally, based on the third energy text dataset, a preset neural network model is iteratively trained until it reaches a preset convergence condition, resulting in a data structuring model. This data structuring model is then used to structure the energy text data to be structured, generating structured data reports. These reports are then used to display the energy text data, making its structure clearer and more unified, thus improving its analyzability and ease of data storage. This meets the text data structuring needs in the energy field and effectively addresses the limitations of traditional text data structuring methods in the energy sector.

[0054] In some embodiments, step S101 includes:

[0055] Based on a preset keyword library, multiple energy text data corresponding to preset keywords are crawled from the Internet. The preset keyword library includes multiple preset keywords.

[0056] Based on a preset relational database, the entity relationships between the energy text data are labeled using triples to obtain the first energy text dataset.

[0057] In this embodiment, energy economic text data is widely available on the internet, primarily obtained through government disclosures, industry analyses, and media reports. Data published on the websites of government departments such as the National Bureau of Statistics, the National Energy Administration, and local statistical bureaus tends to be macro-level, consisting mostly of comprehensive and holistic statistical data, lacking precision down to a specific city. However, its text format is generally standardized and consistent. In contrast, text data from industry analyses and media reports often originate from different institutions, resulting in significant differences in text format and data description. However, this type of text data is typically more specific, such as data on a particular type of energy at a specific time and in a specific region.

[0058] Because the energy big data field is vast, including "electricity," "coal," "oil," and "LNG," and each energy field may contain different types (e.g., the electricity field includes "thermal power," "hydropower," "wind power," and "nuclear power"), a high-frequency terminology database for the energy economics field is pre-constructed, including various energy types. During text data collection, keywords from this database are used for filtering, and adjacent text segments are categorized to identify potentially valuable text data. Furthermore, experts in relevant fields analyze common relationships in the text data, classifying those with significant utility and constructing a relational database with k different relationships. Based on this database, entity relation triples appearing in the text data are then labeled.

[0059] In some embodiments, step S102 includes:

[0060] Using a pre-trained language model, entity extraction is performed on energy text data with entity relation triples in the first energy text dataset to obtain the entity features of the energy text data.

[0061] Using a preset entity relationship template, the entity features are represented by relationship vectors based on the entity relationship triples, generating entity relationship vectors between the energy text data, thus obtaining the second energy text dataset.

[0062] In this embodiment, considering the diverse and highly specialized nature of energy economic data, text features exhibit certain specificities under different relationships. Therefore, this embodiment aims to obtain vector representations of relationships in a low-dimensional space to enhance the system's subsequent performance in text feature extraction.

[0063] Pre-trained language models, through pre-training on large-scale text corpora and fine-tuning in downstream tasks, have achieved good results in natural language processing tasks. This embodiment uses the pre-trained language model BERT to obtain entity feature vectors and obtains relation embedding representations by constructing templates. Specifically, for expressions containing triples...<e1,r,e2> Given a statement S, where e1 and e2 represent the subject and object, and r represents the relation category. The feature vectors of e1 and e2 are obtained using BERT. and Since relation r is strongly correlated with entities e1 and e2, the pre-trained language model can output the semantic features of specific words in different contexts. Therefore, the input template T, "The relation between...", is constructed. <e1>and <e2>"is r", and retrieve BERT's relational character. <r>The output feature vector h r .

[0064] It should be noted that this embodiment will embed the information about the layer. <e1>and <e2>The word vectors are replaced with those from the previous steps. and To supplement the contextual semantics of the input sample statement. The output h r As the embedding representation of relation r, multiple samples containing relation r are extracted from the dataset, and the final relation embedding vector is obtained by max pooling the relation embedding vectors obtained from these samples.

[0065] In some embodiments, step S103 includes:

[0066] Extract the feature vector of each character from the energy text data in the second energy text dataset;

[0067] Using a self-attention mechanism, the word feature vectors are processed according to the energy type to obtain the third energy text dataset.

[0068] In this embodiment, the aforementioned t different types of energy text each have their own distinct semantic features. The meaning of the same character also changes under different energy types. For example, "weak trend" implies a shortening of sunshine hours under photovoltaic energy, while under wind power it implies factors related to climate change. Based on this, a text energy type information enhancement module is established. A feature vector matrix T(t*d) is randomly initialized, where each feature vector corresponds to a certain energy type of the text.

[0069] Optionally, the text S = {w1, w2, ..., w n Input the pre-trained language model BERT to obtain the feature vector h for each character. i ,i∈N. Then, the feature vector T of the energy type j in this text is... j With the feature vector h of each character i Concatenation. This is equivalent to adding additional conditional information to each character feature of the original text. Furthermore, considering that the degree of correlation between words at the same position in a sentence and their context varies under different energy types, self-attention operations are performed between the concatenated character vectors to obtain text energy type-enhanced character feature vectors. The expression for the self-attention mechanism is:

[0070]

[0071] in, For the enhanced word feature vector, SelfAttention represents the self-attention operation, h i Let T be the feature vector of the i-th character. j For the j-th energy type, This indicates a splicing operation.

[0072] In some embodiments, step S104 includes:

[0073] The third energy text dataset is input into the preset neural network model;

[0074] Using the preset neural network model, named entity recognition is performed on the energy text data in the third energy text dataset to determine the position of each entity in the energy text data, thereby obtaining an entity set;

[0075] Extract multiple relation categories from the entity set to obtain a relation category set;

[0076] Based on the entity set and the relation category set, predict the position of the second target entity corresponding to the first target entity under the target relation category in the energy text data, and output multiple relation triples;

[0077] Based on the relation triples, the loss function of the preset neural network model is calculated, and the model parameters of the preset neural network model are updated based on the loss function until the preset neural network model reaches the preset convergence condition, thereby obtaining the data structured model.

[0078] In this embodiment, a sentence often contains multiple relations, and the same word plays a different role under different relations. Based on this, this embodiment intends to encode the word features under different relations separately, obtain the differentiated semantic expression of the text under different relations, and decode the triples under the specified relations.

[0079] Specifically, such as Figure 2 The diagram shown illustrates the energy text data. This process includes:

[0080] (1) Named entity recognition: Input statement S = {w1, w2, ..., w n The text may contain multiple entities. The neural network determines the start and end positions of these entities by encoding the features of words in the text. For example, the sentence "The inherent intermittency of new energy sources such as wind power brings many adverse effects to the safe and stable operation of the power grid" includes two entities: "wind power" and "intermittency," with start positions of (1,2) and (11,13), respectively. For all word vectors h output by the aforementioned text energy information enhancement module... i For each position i∈N, the probability value p of each position as the start and end position is obtained through a fully connected layer and a sigmoid activation function. i and q j When p i or q j A position greater than the threshold of 0.5 is considered a correct activation position. Each starting position is combined with its nearest neighbor's ending position to form an entity and placed into a candidate entity set C, such as C = {(1,2),(11,13),…,(s n ,e n The formula is as follows:

[0081] p i =Sigmoid(W1h) i +b1), i∈n;

[0082] q j =Sigmoid(W2h) j +b2),j∈n;

[0083] C = {(i,j)|p i >0.5,q j >0.5}.

[0084] (2) Relation Filtering: The dataset may contain multiple relations, but only a few relations in a sentence are often valid. Therefore, feature encoding and triple extraction for all relations is costly, and expanding the search space will introduce additional noise into the model. This step includes a relation filtering module to filter out the set of possible relation categories in the input sentence. Determining implicit relations in a sentence requires global sentence information. Therefore, entity representations and word feature vectors are concatenated as input, passed through a fully connected layer and a sigmoid activation function, to determine the activation probabilities of different relation categories. The formula is shown below:

[0085] c i =MaxPool(s i ,…,e i ),c i ∈C;

[0086]

[0087]

[0088] (3) Position prediction under specified relations: Optionally, the prediction process for relation triples includes:

[0089] For a first target entity in the entity set, under the target relationship category in the relationship category set, determine a second target entity that has the target relationship category with the first target entity from the entity set, and predict the position probability value of the second target entity in the energy text data;

[0090] The second target entity corresponding to the location with the highest probability value is combined with the first target entity and the target relationship category to form the relationship triplet.

[0091] Furthermore, based on the relation triplets output by the model and the entity relation triplets obtained in step S102, the model error (i.e., the loss function) is calculated. The model parameters are updated using algorithms such as gradient descent with the loss function. The preset neural network model with updated model parameters is used to continue predicting relation triplets of energy text data, and the loss function is calculated. If the loss function is less than the preset value or the number of iterations reaches the preset number, it indicates that the preset neural network model has reached the convergence condition, and the target data structured model is obtained.

[0092] In this step, within a relation triple <1,,2>, the semantic relation between entities e1 and e2 is r, indicating a semantic association between them. Knowing the feature vectors of entity e1 and relation r, information related to entity e2 can be inferred. Based on this, this embodiment designs a position prediction task under a specified relation. Under each relation, the feature vector of entity e1 and the embedding representation of relation r are input. An entity is selected from the candidate entity set C as the subject e1, and its entity feature vector c is concatenated. i With relational embedding h r The position of object e2 in statement S is predicted using a neural network. The formula is shown below:

[0093]

[0094]

[0095] in This represents the vector concatenation operation, where σ represents the Sigmoid activation function. W2 and b2 are trainable model parameters. This represents the probability that a given character in the sentence represents the starting position of the corresponding object entity. The position 'd' with the highest probability is selected. If 'd' belongs to the candidate entity set C, then an entity is found to form a triple; otherwise, the position prediction is invalid. This process is repeated until all triples under all relations are output.

[0096] In some embodiments, step S105 includes:

[0097] Using the data structuring model, predict all relation triples in the energy text data to be structured;

[0098] The structured data report is generated based on all the aforementioned relation triples.

[0099] In this embodiment, the output of the above model is structured entity relation triples, and all triples can be stored in plain text files such as xls and csv. Considering that each triple is extracted within a specific context, the output structured information also includes the original text location of the triple and its corresponding energy type. Furthermore, considering that text data often contains important additional information that is not directly related to energy but is crucial for data analysis, such as time and geographical location, this invention uses Python scripts to extract this type of information from the text data and append it to the corresponding triples as additional labels. Finally, this structured data, along with key contextual information, is output and visualized using graphics libraries such as matplotlib and seaborn to generate data reports.

[0100] It should be noted that this application can extract key energy-related information from unstructured raw text data and automatically generate data reports. This method saves data storage space and enhances data analyzability. Furthermore, this application can assign higher weights to relevant words in sentences based on different energy types, significantly improving the accuracy of entity and relation classification. In addition, this application can utilize the implicit prior knowledge in pre-trained language models to obtain more refined relation feature representations. This relation embedding can support subsequent modules in capturing the differentiated semantic expressions of words under different relation categories, improving the model's triple extraction performance under specified relations.

[0101] To implement the relation-based energy text data structuring method corresponding to the above method embodiments, and to achieve the corresponding functions and technical effects. See also Figure 3 , Figure 3 This diagram illustrates a structural block diagram of an energy text data structuring device based on relation extraction, according to an embodiment of this application. For ease of explanation, only the parts relevant to this embodiment are shown. The energy text data structuring device based on relation extraction provided in this embodiment includes:

[0102] The acquisition module 301 is used to acquire a first energy text dataset, which includes multiple energy text data.

[0103] Extraction module 302 is used to extract entity features of energy text data in the first energy text dataset using a pre-trained language model, and to establish entity relationships between the energy text data to obtain a second energy text dataset;

[0104] Enhancement module 303 is used to perform data enhancement on the energy text data in the second energy text dataset based on the energy type of the energy text data to obtain a third energy text dataset;

[0105] Training module 304 is used to iteratively train a preset neural network model based on the third energy text dataset until the preset neural network model reaches a preset convergence condition, thereby obtaining a data structured model.

[0106] The structuring module 305 is used to structurate the energy text data to be structured using the data structuring model, and generate a structured data report.

[0107] In some embodiments, the acquisition module 301 is specifically used for:

[0108] Based on a preset keyword library, multiple energy text data corresponding to preset keywords are crawled from the Internet. The preset keyword library includes multiple preset keywords.

[0109] Based on a preset relational database, the entity relationships between the energy text data are labeled using triples to obtain the first energy text dataset.

[0110] In some embodiments, the extraction module 302 is specifically used for:

[0111] Using a pre-trained language model, entity extraction is performed on energy text data with entity relation triples in the first energy text dataset to obtain the entity features of the energy text data.

[0112] Using a preset entity relationship template, the entity features are represented by relationship vectors based on the entity relationship triples, generating entity relationship vectors between the energy text data, thus obtaining the second energy text dataset.

[0113] In some embodiments, the enhancement module 303 is specifically used for:

[0114] Extract the feature vector of each character from the energy text data in the second energy text dataset;

[0115] Using a self-attention mechanism, the word feature vectors are processed according to the energy type to obtain the third energy text dataset.

[0116] In some embodiments, the training module 304 includes:

[0117] The input unit is used to input the third energy text dataset into the preset neural network model;

[0118] The identification unit is used to perform named entity recognition on the energy text data in the third energy text dataset using the preset neural network model, determine the position of each entity in the energy text data, and obtain an entity set.

[0119] An extraction unit is used to extract multiple relation categories from the entity set to obtain a relation category set;

[0120] The prediction unit is used to predict the position of the second target entity corresponding to the first target entity under the target relation category in the energy text data based on the entity set and the relation category set, and output multiple relation triples;

[0121] The update unit is used to calculate the loss function of the preset neural network model based on the relation triples, and update the model parameters of the preset neural network model based on the loss function until the preset neural network model reaches the preset convergence condition to obtain the data structured model.

[0122] In some embodiments, the prediction unit is specifically used for:

[0123] For a first target entity in the entity set, under the target relationship category in the relationship category set, determine a second target entity that has the target relationship category with the first target entity from the entity set, and predict the position probability value of the second target entity in the energy text data;

[0124] The second target entity corresponding to the location with the highest probability value is combined with the first target entity and the target relationship category to form the relationship triplet.

[0125] In some embodiments, the structuring module 305 is specifically used for:

[0126] Using the data structuring model, predict all relation triples in the energy text data to be structured;

[0127] The structured data report is generated based on all the aforementioned relation triples.

[0128] The aforementioned relation-based energy text data structuring apparatus can implement the relation-based energy text data structuring method described in the above method embodiments. The options in the above method embodiments are also applicable to this embodiment, and will not be detailed here. The remaining content of this application's embodiments can be referred to the content of the above method embodiments, and will not be repeated in this embodiment.

[0129] Figure 4 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 4 As shown, the computer device 4 of this embodiment includes: at least one processor 40 ( Figure 4 (Only one is shown in the diagram), memory 41, and computer program 42 stored in the memory 41 and executable on the at least one processor 40, wherein the processor 40 executes the computer program 42 to implement the steps in any of the above method embodiments.

[0130] The computer device 4 can be a smartphone, tablet, desktop computer, cloud server, or other computing device. This computer device may include, but is not limited to, a processor 40 and a memory 41. Those skilled in the art will understand that... Figure 4 The computer device 4 is merely an example and does not constitute a limitation on the computer device 4. It may include more or fewer components than shown, or combine certain components, or different components, such as input / output devices, network access devices, etc.

[0131] The processor 40 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0132] In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 may be an external storage device of the computer device 4, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the computer device 4. Furthermore, the memory 41 may include both internal and external storage units of the computer device 4. The memory 41 is used to store the operating system, applications, bootloader, data, and other programs, such as the program code of the computer program. The memory 41 can also be used to temporarily store data that has been output or will be output.

[0133] In addition, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above method embodiments.

[0134] This application provides a computer program product that, when run on a computer device, enables the computer device to execute the steps described in the various method embodiments above.

[0135] In the several embodiments provided in this application, it will be understood that each block in the flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the figures. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved.

[0136] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0137] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of this application. It should be understood that the above descriptions are merely specific embodiments of this application and are not intended to limit the scope of protection of this application. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application for those skilled in the art. < / r>

Claims

1. A method for structuring energy text data based on relation extraction, characterized in that, include: Obtain a first energy text dataset, which includes multiple energy text data; Using a pre-trained language model, entity features of energy text data in the first energy text dataset are extracted, and entity relationships between the energy text data are established to obtain the second energy text dataset. Based on the energy type of the energy text data, data augmentation is performed on the energy text data in the second energy text dataset to obtain a third energy text dataset. Based on the aforementioned third energy text dataset, a preset neural network model is iteratively trained until the preset neural network model reaches a preset convergence condition to obtain a data structured model. This includes: inputting the third energy text dataset into the preset neural network model; using the preset neural network model to perform named entity recognition on the energy text data in the third energy text dataset, determining the position of each entity in the energy text data, and obtaining an entity set; extracting multiple relation categories from the entity set to obtain a relation category set; based on the entity set and the relation category set, predicting the position of the second target entity corresponding to the first target entity under the target relation category in the energy text data, and outputting multiple relation triples; based on the relation triples, calculating the loss function of the preset neural network model, and updating the model parameters of the preset neural network model based on the loss function, until the preset neural network model reaches a preset convergence condition to obtain the data structured model. The step of predicting the position of the second target entity corresponding to the first target entity under the target relation category in the energy text data based on the entity set and the relation category set, and outputting multiple relation triples, includes: for the first target entity in the entity set, under the target relation category in the relation category set, determining the second target entity with the target relation category as the first target entity in the entity set, and predicting the position probability value of the second target entity in the energy text data; forming the relation triple with the second target entity corresponding to the position probability value with the first target entity and the target relation category; Using the aforementioned data structuring model, the energy text data to be structured is structured to generate structured data reports.

2. The energy text data structuring method based on relation extraction as described in claim 1, characterized in that, The acquisition of the first energy text dataset includes: Based on a preset keyword library, multiple energy text data corresponding to preset keywords are crawled from the Internet. The preset keyword library includes multiple preset keywords. Based on a preset relational database, the entity relationships between the energy text data are labeled using triples to obtain the first energy text dataset.

3. The energy text data structuring method based on relation extraction as described in claim 1, characterized in that, The process involves using a pre-trained language model to extract entity features from the energy text data in the first energy text dataset and establishing entity relationships between the energy text data to obtain a second energy text dataset, which includes: Using a pre-trained language model, entity extraction is performed on energy text data with entity relation triples in the first energy text dataset to obtain the entity features of the energy text data. Using a preset entity relationship template, the entity features are represented by relationship vectors based on the entity relationship triples, generating entity relationship vectors between the energy text data, thus obtaining the second energy text dataset.

4. The energy text data structuring method based on relation extraction as described in claim 1, characterized in that, Based on the energy type of the energy text data, data augmentation is performed on the energy text data in the second energy text dataset to obtain a third energy text dataset, including: Extract the feature vector of each character from the energy text data in the second energy text dataset; Using a self-attention mechanism, the word feature vectors are processed according to the energy type to obtain the third energy text dataset.

5. The energy text data structuring method based on relation extraction as described in claim 1, characterized in that, The process of using the data structuring model to structure the energy text data to be structured and generate structured data reports includes: Using the data structuring model, predict all relation triples in the energy text data to be structured; The structured data report is generated based on all the aforementioned relation triples.

6. A device for structuring energy text data based on relation extraction, characterized in that, include: The acquisition module is used to acquire a first energy text dataset, which includes multiple energy text data. The extraction module is used to extract entity features of energy text data in the first energy text dataset using a pre-trained language model, and to establish entity relationships between the energy text data to obtain the second energy text dataset. The enhancement module is used to perform data enhancement on the energy text data in the second energy text dataset based on the energy type of the energy text data, so as to obtain a third energy text dataset; The training module is used to iteratively train a preset neural network model based on the third energy text dataset until the preset neural network model reaches a preset convergence condition to obtain a data structured model. The module includes: inputting the third energy text dataset into the preset neural network model; using the preset neural network model to perform named entity recognition on the energy text data in the third energy text dataset, determining the position of each entity in the energy text data, and obtaining an entity set; extracting multiple relation categories from the entity set to obtain a relation category set; based on the entity set and the relation category set, predicting the position of the second target entity corresponding to the first target entity under the target relation category in the energy text data, and outputting multiple relation triples; calculating the loss function of the preset neural network model based on the relation triples, and updating the model parameters of the preset neural network model based on the loss function, until the preset neural network model reaches a preset convergence condition to obtain the data structured model. The step of predicting the position of the second target entity corresponding to the first target entity under the target relation category in the energy text data based on the entity set and the relation category set, and outputting multiple relation triples, includes: for the first target entity in the entity set, under the target relation category in the relation category set, determining the second target entity with the target relation category as the first target entity in the entity set, and predicting the position probability value of the second target entity in the energy text data; forming the relation triple with the second target entity corresponding to the position probability value with the first target entity and the target relation category; The structuring module is used to structure the energy text data to be structured using the data structuring model, and generate structured data reports.

7. A computer device, characterized in that, It includes a processor and a memory, the memory being used to store a computer program that, when executed by the processor, implements the relation-based energy text data structuring method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the relation-based energy text data structuring method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Power grid data management method and device

    CN110162792A

  • Power equipment fault defect entity relationship extraction method and device

    CN113392217A