A power transaction knowledge extraction method based on semantic coding and feature enhancement

By employing a method based on semantic encoding and feature enhancement, this study addresses the problems of low accuracy in identifying technical terms, weak ability to handle overlapping relationships, and insufficient long-distance semantic dependencies in the field of power trading, thereby achieving high-quality conversion from unstructured text to structured knowledge.

CN121543593BActive Publication Date: 2026-06-09INNER MONGOLIA ELECTRIC POWER TRADING CENT CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INNER MONGOLIA ELECTRIC POWER TRADING CENT CO LTD
Filing Date
2025-11-21
Publication Date
2026-06-09

Smart Images

  • Figure CN121543593B_ABST
    Figure CN121543593B_ABST
Patent Text Reader

Abstract

The application discloses a power transaction knowledge extraction method based on semantic coding and feature enhancement, comprising the following steps: cleaning and term standardization on unstructured text in the power transaction field to obtain preprocessed text; using a pre-training language model based on an error correction mask mechanism to code semantic features of the preprocessed text to obtain a semantic coding sequence; according to the semantic coding sequence, sequentially performing bidirectional long-distance semantic dependence capture, dynamic attention weight distribution and local semantic detail fusion to obtain an enhanced feature sequence; based on a layered pointer network, performing entity and relation joint extraction on the enhanced feature sequence to obtain a triple composed of a head entity, a relation and a tail entity; and performing deduplication and completion processing on the triple to complete the knowledge extraction of the power transaction. The application realizes the goal of automatically and high-quality extracting structured knowledge of the power transaction from unstructured text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of natural language processing and knowledge graphs, and particularly relates to a method for extracting knowledge from electricity trading based on semantic encoding and feature enhancement. Background Technology

[0002] The power trading sector contains a large amount of heterogeneous data from multiple sources, including structured transaction data, unstructured policy texts, and semi-structured settlement details. Unstructured text, in particular, contains rich domain knowledge. However, traditional knowledge extraction methods face numerous challenges in processing such texts due to their often irregular formats, dense use of technical terminology, and complex semantic relationships. Examples include chain-like relationships between trading units, settlement results, and risk levels, as well as overlapping scenarios where the same entity participates in multiple types of relationships.

[0003] First, traditional methods have low accuracy in identifying specialized terms in the field of electricity trading. Terms in this field, such as day-ahead deviation and three-part settlement, have distinct professional characteristics, and general natural language processing models struggle to fully grasp their overall semantics, easily leading to errors in terminology boundary identification.

[0004] Secondly, traditional pipeline-style extraction methods typically employ a process of first identifying entities and then extracting relationships, which leads to error accumulation and makes it difficult to effectively handle overlapping scenarios where the same entity participates in multiple types of relationships, such as a power generation company participating in both medium- and long-term transactions and green certificate transactions.

[0005] Furthermore, policy texts commonly contain cross-sentence logical relationships, such as the connection between cause and measure, condition and result. Traditional sequence models are insufficient in capturing such long-distance semantic dependencies, which limits the completeness of relation extraction.

[0006] Existing pre-trained models typically employ a single-character special character masking strategy in Chinese processing, which can easily lead to semantic fragmentation. Furthermore, their sentence-level pre-training tasks have a weak ability to model logical coherence, resulting in insufficient adaptability in long text processing in the field of power trading.

[0007] Therefore, there is an urgent need for a knowledge extraction method optimized for the characteristics of the power trading field to solve the above-mentioned technical problems. Summary of the Invention

[0008] To address the aforementioned technical problems, this invention provides a method for extracting electricity trading knowledge based on semantic encoding and feature enhancement, comprising:

[0009] Cleaning and terminology standardization are performed on unstructured text in the power trading field to obtain preprocessed text;

[0010] The pre-trained language model based on error correction masking mechanism is used to encode semantic features of the preprocessed text to obtain a semantic encoding sequence;

[0011] Based on the semantic encoding sequence, an enhanced feature sequence is obtained through sequential bidirectional long-distance semantic dependency capture, dynamic attention weight allocation, and local semantic detail fusion.

[0012] The enhanced feature sequence is subjected to joint entity and relation extraction based on a stacked pointer network to obtain a triple consisting of a head entity, a relation, and a tail entity.

[0013] The triples are deduplicated and completed to extract knowledge about electricity trading.

[0014] Optionally, the step of cleaning and terminology standardization of unstructured text in the power trading field to obtain preprocessed text specifically includes:

[0015] Noise removal, format standardization, unified mapping of business terms, and unit and numerical standardization are performed on unstructured text in the power trading field to obtain preprocessed text.

[0016] Optionally, the step of using a pre-trained language model based on an error correction masking mechanism to encode semantic features of the preprocessed text to obtain a semantic encoding sequence specifically includes:

[0017] The preprocessed text is input into a pre-trained language model based on an error correction masking mechanism. The Chinese words are masked as a whole through a whole-word masking and synonym replacement strategy. The logical coherence between sentences is enhanced through a sentence order prediction task, and the semantic encoding sequence of the context is output.

[0018] Optionally, the step of obtaining an enhanced feature sequence based on the semantic encoding sequence through sequential bidirectional long-distance semantic dependency capture, dynamic attention weight allocation, and local semantic detail fusion specifically includes:

[0019] The semantic encoding sequence is input into the first-layer bidirectional long short-term memory network to capture long-distance semantic dependencies;

[0020] The output of the first-layer bidirectional long short-term memory network is input into the attention layer, and attention weights are dynamically allocated to highlight key information.

[0021] The output of the self-attention layer and the original semantic encoding sequence are input into the second layer of the bidirectional long short-term memory network, fused, and local semantic details are extracted to obtain the enhanced feature sequence.

[0022] Optionally, the first-layer bidirectional long short-term memory network includes a forward long short-term memory network and a backward long short-term memory network, which process the semantic encoding sequence in text order and reverse order respectively to capture bidirectional contextual dependencies.

[0023] Optionally, the step of performing joint entity and relation extraction on the enhanced feature sequence based on a stacked pointer network to obtain triples consisting of a head entity, a relation, and a tail entity specifically includes:

[0024] The head entity in the text is determined by identifying the start and end positions of the head entity using a binary classifier.

[0025] For each head entity, the system iterates through the preset power trading domain relationship types, integrates head entity features and semantic encoding, identifies the corresponding tail entity through a layered pointer network, and generates a triple consisting of the head entity, relationship, and tail entity.

[0026] This embodiment also provides a power trading knowledge extraction system based on semantic encoding and feature enhancement, used to implement the method, including:

[0027] The preprocessing module is used to clean and standardize the terminology of unstructured text in the field of power trading to obtain preprocessed text;

[0028] The semantic encoding module is used to encode the semantic features of the preprocessed text using a pre-trained language model based on an error correction masking mechanism to obtain a semantic encoding sequence.

[0029] The feature enhancement module is used to obtain an enhanced feature sequence based on the semantic encoding sequence through sequential bidirectional long-distance semantic dependency capture, dynamic attention weight allocation, and local semantic detail fusion.

[0030] The joint extraction module performs entity and relation joint extraction on the enhanced feature sequence based on a stacked pointer network to obtain triples consisting of head entity, relation and tail entity;

[0031] The knowledge processing module is used to perform deduplication and completion processing on the triples to complete the knowledge extraction for electricity transactions.

[0032] This embodiment also provides a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method.

[0033] This embodiment also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method.

[0034] This embodiment also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method.

[0035] Compared with the prior art, the present invention has the following advantages and technical effects:

[0036] This invention ensures input quality through data preprocessing; enhances semantic understanding of Chinese, especially power trading terminology, using an improved pre-trained language model; effectively captures long-distance dependencies and key information using a feature enhancement module combining bidirectional long short-term memory networks and self-attention; properly handles relational overlap issues through a joint extraction mechanism based on a cascaded pointer network; and finally improves the accuracy and completeness of output knowledge through knowledge fusion verification. The entire methodology effectively overcomes the shortcomings of traditional technologies in the power trading field, such as low accuracy in terminology recognition, weak relational overlap handling capabilities, and insufficient long-distance semantic dependency capture, achieving the goal of automatically and efficiently extracting structured knowledge from unstructured text. Attached Figure Description

[0037] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0038] Figure 1 This is a schematic diagram of the LSTM model according to an embodiment of the present invention;

[0039] Figure 2 This is a schematic diagram of the BiLSTM model according to an embodiment of the present invention;

[0040] Figure 3 This is a schematic diagram of the attention mechanism model according to an embodiment of the present invention;

[0041] Figure 4 This is a schematic diagram of the method flow according to an embodiment of the present invention;

[0042] Figure 5 This is a structural diagram of the joint extraction model according to an embodiment of the present invention. Detailed Implementation

[0043] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0044] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0045] Example 1

[0046] like Figure 4 As shown, this embodiment provides a method for extracting electricity trading knowledge based on semantic encoding and feature enhancement, including the following steps:

[0047] Cleaning and terminology standardization are performed on unstructured text in the power trading field to obtain preprocessed text;

[0048] The pre-trained language model based on error correction masking mechanism is used to encode semantic features of the preprocessed text to obtain a semantic encoding sequence;

[0049] Based on the semantic encoding sequence, an enhanced feature sequence is obtained through sequential bidirectional long-distance semantic dependency capture, dynamic attention weight allocation, and local semantic detail fusion.

[0050] The enhanced feature sequence is subjected to joint entity and relation extraction based on a stacked pointer network to obtain a triple consisting of a head entity, a relation, and a tail entity.

[0051] The triples are deduplicated and completed to extract knowledge about electricity trading.

[0052] As a feasible implementation method, the specific implementation process is as follows:

[0053] It is feasible to obtain a contextual semantic encoding sequence based on the preprocessing results of cleaning and terminology standardization of unstructured text in the power trading field. The specific process includes:

[0054] First, data preprocessing is performed. Policy documents and settlement rules from the electricity trading sector are selected as input data. Noise is removed from the text through a combination of regular expression matching and manual screening, including deleting meaningless characters, repeated paragraphs, and redundant content irrelevant to the business. Next, the text is formatted, uniformly removing typesetting marks and standardizing the use of line breaks and spaces. Then, based on a standardized terminology library for the electricity trading sector, synonymous but differently expressed business terms in the text are uniformly mapped; for example, "deviation electricity settlement" is standardized to "deviation electricity settlement rules." Simultaneously, the units of physical quantities involved in electricity trading are uniformly converted and standardized. Finally, the standardized preprocessed text is obtained.

[0055] Next, semantic feature encoding is performed. The preprocessed text is input into a pre-trained language model (MacBERT) based on an error-correcting masking mechanism. Before input, the input sequence needs to be constructed by truncating or padding the text to a fixed length and using special symbols to ensure uniform length. A Chinese word segmentation tool combined with a domain dictionary is used for word segmentation optimization to ensure the integrity of compound terms in power trading. During the pre-training process of this model, a full-word masking and N-gram masking strategy is implemented: a certain proportion of words in the text are randomly selected as masking objects, prioritizing core domain terms; the selected words are masked as a whole; synonyms are used instead of special characters to replace the masked parts; and consecutive words are masked to strengthen the contextual logical connection. At the same time, training is performed through a sentence order prediction task, using power trading text to construct positive and negative sample pairs to enhance the model's understanding of domain-specific logical structures. Finally, the model outputs an encoded sequence containing contextual semantic information.

[0056] Implementable, based on the context semantic encoding sequence, an enhanced feature sequence is obtained through sequential bidirectional long-distance semantic dependency capture, dynamic attention weight allocation, and local semantic detail fusion. The specific process includes:

[0057] The semantically encoded sequence is input into the feature enhancement module. This module first captures long-distance semantic dependencies through a first-layer bidirectional long short-term memory network, which consists of a forward long short-term memory network and a backward long short-term memory network. The network processes the sequence in text order and reverse order, respectively, and fuses the forward and backward information.

[0058] Subsequently, the output of the first-layer network is fed into a self-attention layer. By calculating the attention weights between the query, key, and value matrices, the weights are dynamically allocated to highlight key information in the sequence. Finally, the self-attention-weighted features are fused with the original semantic encoding and input into the second-layer bidirectional long short-term memory network to further extract and fuse local semantic details, ultimately outputting an enhanced feature sequence.

[0059] As a specific implementation method, this embodiment inputs the semantic encoding sequence output by MacBERT into the BAB feature enhancement module to obtain the enhanced feature sequence;

[0060] The BAB feature enhancement module includes a first layer BiLSTM, a Self-Attention layer and a second layer BiLSTM connected in sequence. The first layer BiLSTM captures long-distance semantic dependencies, the Self-Attention layer dynamically allocates attention weights to highlight key information, and the second layer BiLSTM fuses features and extracts local semantic details.

[0061] Furthermore, Long Short-Term Memory (LSTM) networks are an improvement on RNNs, addressing the gradient vanishing problem that occurs when RNNs handle long sequences. LSTMs consist of an input gate, a forget gate, and an output gate, as shown below. Figure 1 As shown.

[0062] The specific calculation process of the model is as follows:

[0063] ;

[0064] ;

[0065] ;

[0066] in, each subscript , , , These are the weight parameters between the input layer and the forget gate, the input gate, the candidate unit, and the output gate, respectively. and For different neural activation functions, The output of the previous time step The weight parameters of the hidden layer.

[0067] Furthermore, BiLSTM, or Bidirectional Long Short-Term Memory network, is fundamentally based on the fusion of the functions of both forward and backward LSTM layers, such as... Figure 2 As shown, the forward layer specifically captures important information at a certain moment in the input sequence and before, while the backward layer specifically captures the key content at that moment and after.

[0068] The feature information extracted from these two levels can be efficiently fused using various strategies such as addition or averaging. In this way, BiLSTM not only inherits the advantages of LSTM, but also solves its limitation of not being able to simultaneously take into account the context before and after the sequence, enabling it to comprehensively capture key feature information before and after the sequence, thereby providing more accurate and comprehensive analysis results.

[0069] Furthermore, such as Figure 3 As shown, this embodiment uses a self-attention mechanism to overcome the distance constraint of words and calculate dependencies:

[0070] ;

[0071] in, The result is the computational result after processing the self-attention mechanism. K The output results of BiLSTM are as follows The three matrices obtained by linear transformation For matrix Dimensions.

[0072] Implementable, based on the enhanced feature sequence, by identifying head entities and jointly identifying their corresponding relations and tail entities for each head entity, a triple consisting of head entities, relations, and tail entities is obtained. The specific process includes:

[0073] The enhanced feature sequence is input into the entity relation joint extraction module (CASREL) based on stacked pointer annotation. This module first performs head entity recognition: a binary classifier determines whether the character at each position in the sequence is the start or end position of a head entity, thereby locating and identifying all head entities in the text. Subsequently, it performs joint recognition of relations and tail entities: for each identified head entity, it traverses preset power trading domain relation types; for each relation, it fuses the feature representation of the current head entity with the original semantic encoding, and uses a relation-specific pointer network to identify the start and end positions of the tail entity corresponding to that head entity under the current relation. Through this process, multiple triples in the form of "head entity-relationship-tail entity" are generated.

[0074] The feasible process involves deduplication and completion of the triples to output structured knowledge. The specific steps include:

[0075] The triples obtained from the joint extraction module undergo post-processing. First, knowledge fusion verification is performed to check the accuracy of entity boundaries and whether the relationships conform to the business logic of power trading. Then, duplicate triples are deduplicated, and potentially missing associations are filled in. Finally, high-quality, structured power trading domain knowledge is output, which can be used to construct or enrich a power trading knowledge graph.

[0076] As a specific implementation method, the CASREL model mainly consists of three layers: a MacBERT encoding layer, a head entity recognition layer, and a joint relationship and tail entity recognition layer. The CASREL model is also known as a stacked pointer network, and its essence is a joint entity relationship extraction method based on parameter sharing.

[0077] Because CASREL breaks down the relation extraction task differently, the subtasks and the order in which they are solved also differ. The model formula is as follows:

[0078] ;

[0079] in, For overlapping entities, for China and Israel For entities, triples For triples In relation, To be the set of all relations in the training set, To remove China and Israel For all other relations of the entity, Indicates that except for those included in the triplet Apart from the relationship in the text, there are no other corresponding relationships.

[0080] The formula for determining whether each token is the start or end token of the header entity using a linear layer and a sigmoid activation function is as follows:

[0081] ;

[0082] ;

[0083] in, and Representing the first in the sequence The probability that each identifier is recognized as the start and end position of an entity. It is the sigmoid activation function. For training weights, For bias parameters, It is the first in the input sequence The encoded representation of each feature.

[0084] The tail entity (O) not only considers the hidden layer vector encoded by MacBERT, but also takes into account the features of the head entity (S), and its formula is as follows:

[0085] ;

[0086] ;

[0087] here For the first The encoded representation vector of each candidate head entity.

[0088] This embodiment ensures input quality through systematic data preprocessing; enhances semantic understanding of Chinese, especially power trading terminology, using an improved pre-trained language model (MacBERT); effectively captures long-distance dependencies and key information using a feature enhancement module (BAB) combining bidirectional long short-term memory networks and self-attention; properly handles relational overlap issues using a joint extraction mechanism based on stacked pointer networks (CASREL); and finally, improves the accuracy and completeness of output knowledge through knowledge fusion verification. The entire methodology effectively overcomes the shortcomings of traditional technologies in the power trading field, such as low accuracy in terminology recognition, weak relational overlap handling capabilities, and insufficient long-distance semantic dependency capture, achieving the goal of automatically and efficiently extracting structured knowledge from unstructured text.

[0089] Example 2

[0090] Figure 5 For the joint extraction model structure diagram, based on Figure 5 This embodiment selects policy documents and settlement rules in the field of power trading as input data to fully demonstrate the process of generating triples from raw text to structured knowledge.

[0091] Step 1: Specific implementation of data preprocessing:

[0092] Select policy documents and settlement rules in the field of electricity trading as input data, and perform data preprocessing operations, specifically including:

[0093] Remove noisy data, delete repetitive paragraphs such as disclaimers in policy documents, remove meaningless characters such as garbled symbols, and remove irrelevant annotations such as page numbers at the end of the text and organization names in headers and footers.

[0094] A unified mapping of business terminology is implemented. Based on a standardized terminology database for the power trading field, synonymous but differently expressed terms in the text are normalized. For example, the term "deviation electricity settlement" in the text is uniformly mapped to the standard term "deviation electricity settlement rule," and the power purchase and sale contract is uniformly mapped to "power sales transaction unit contract."

[0095] A training dataset was constructed through manual annotation. Based on the entity type definition in the power trading field, including market participants such as power generation companies and electricity sales companies, transaction elements such as trading units and settlement volume, and rules such as deviation settlement rules and market access conditions, professional annotation tools were used to mark entity boundaries and types in the preprocessed text. Simultaneously, for the annotated entities, the relationships between them were also annotated, such as the ownership relationship between power generation companies and electricity sales trading units, and the attribution relationship between settlement results and electricity revenue, providing supervisory data for subsequent model training.

[0096] Step 2: Specific implementation of semantic feature encoding:

[0097] Semantic feature encoding is performed on the preprocessed data, and the MacBERT model, fine-tuned based on data from the power trading domain, is used to encode the preprocessed text.

[0098] The input sequence is constructed by truncating or padding the preprocessed power transaction text to a fixed length of 512 characters. Texts that are not long enough are padded with special padding symbols to ensure that the length of the input sequence is uniform.

[0099] Chinese word segmentation optimization was implemented, employing a word segmentation tool consistent with MacBERT pre-training, combined with a dictionary for the power trading domain to process the text. For complex terms in the power trading domain, such as nodal marginal electricity price and three-part settlement, the integrity of the terms was forcibly preserved by loading a domain-specific dictionary, avoiding semantic fragmentation caused by word segmentation errors.

[0100] The masking process begins with selecting masking targets. 15% of the words in the text are randomly chosen as masking targets, prioritizing core terms in the electricity trading field such as deviation electricity volume and green certificate trading to enhance the model's semantic learning ability for specialized vocabulary. An N-gram masking strategy is then used to randomly mask 2-3 consecutive words, applying a comprehensive mask to terms such as medium- and long-term contract electricity volume. Synonyms, such as medium- and long-term contract electricity volume, are used to replace the masked portion, rather than the special characters used in traditional BERT.

[0101] Training samples are constructed by extracting paired sentences from electricity trading texts. Positive samples are sentence pairs in their original order, such as the combination of a cause sentence indicating excessive electricity consumption and a result sentence indicating settlement penalties. Negative samples are sentence pairs with reversed order, such as the combination of a result sentence indicating settlement penalties and a cause sentence indicating excessive electricity consumption. The model is trained using a sentence order prediction task, employing both positive and negative samples of policy clauses and implementation measures to enhance its understanding of logical order. Furthermore, labeled data from the electricity trading domain is used to fine-tune the sentence order prediction task, making the model more adaptable to the domain-specific textual logical structures, such as conditional clauses in trading rules. The final output is an encoded sequence containing contextual semantic information.

[0102] Step 3: Specific implementation of feature enhancement:

[0103] The encoded sequence is input into the BAB module for feature enhancement. This module consists of three parts: a bidirectional long short-term memory network, a self-attention mechanism, and a bidirectional long short-term memory network.

[0104] The first layer uses a bidirectional long short-term memory (LSTM) network. The forward LSM network processes the sequence in the order of settlement rules, deviation amount, and risk level, while the backward LSM network processes the sequence in reverse order, together capturing the bidirectional dependencies. The specific calculation process of the LSM network is as follows:

[0105] ;

[0106] ;

[0107] ;

[0108] In W, the subscripts f, i, c, and o represent the weight parameters between the input layer and the forget gate, the input gate, the candidate unit, and the output gate, respectively. σ and tanh are different neural activation functions, and U is the weight parameter between the output and the hidden layer at the previous time step.

[0109] Self-attention mechanisms are highly independent, relying on no external data. Instead, they determine the weights assigned based on the relationships between the input data—that is, they decide which data to focus on based on the input data itself. The advantage of self-attention mechanisms lies in their ability to capture global dependencies within a sequence, which is crucial for understanding contextual information.

[0110] This embodiment uses a self-attention mechanism to overcome the distance constraint of words and calculate the global dependencies within the sequence. The specific calculation formula is as follows:

[0111] ;

[0112] Where attention is the result calculated through the self-attention mechanism, and Q, K, and V are three matrices obtained by linear transformation of the output H of the bidirectional long short-term memory network. Let K be the dimension of the matrix. The attention layer dynamically calculates the attention weights between key elements such as the average settlement price and the deviation in electricity consumption, highlighting important features.

[0113] The second layer, a bidirectional long short-term memory network, fuses the self-attention-weighted features with the original encoding to further extract local semantic details and output an enhanced feature sequence.

[0114] Step 4: Specific implementation of joint entity and relation extraction:

[0115] The CASREL module performs the joint entity and relation extraction process:

[0116] In the head entity recognition stage, a binary classifier is used to identify the start and end positions of a power generation company in the text, thereby determining the boundary of the head entity.

[0117] In the joint identification phase of relationships and tail entities, for the identified head entity of a power generation company, the system traverses the preset relationship types in the power trading domain, such as those involving trading units. It integrates head entity features with MacBERT semantic encoding and identifies the corresponding tail entities through a pointer network. Specifically, it generates triples representing the power generation company's ownership of trading units and its electricity sales trading units. Simultaneously, it identifies the tail entities corresponding to the settlement participation relationships, generating triples representing the power generation company's participation in settlement and the settlement results on the generation side.

[0118] Step 5: Specific Implementation of Knowledge Fusion Verification

[0119] The extracted triples undergo post-processing to check the accuracy of entity boundaries and verify whether the electricity sales transaction unit completely includes information such as number and type. The rationality of relationships is also checked to confirm whether the ownership relationship between the power generation company and the transaction unit conforms to business logic, ensuring no false positives are identified. Finally, the extracted triples are deduplicated, removing duplicate relationships such as transaction unit participation in settlement, and high-quality structured knowledge is output for the storage and application of the electricity trading knowledge graph.

[0120] This embodiment demonstrates the complete implementation process of the present invention in the field of power trading through specific examples, proving that the method can effectively handle key technical challenges such as technical terminology recognition, overlapping relationships, and long-distance dependencies, and achieve high-quality conversion from unstructured text to structured knowledge.

[0121] Example 3

[0122] Based on the same general inventive concept, this invention also provides a power trading knowledge extraction system based on semantic encoding and feature enhancement. The system provided by this invention is described below, and the system described below can be referred to in correspondence with the method described above. The system includes:

[0123] The preprocessing module is used to clean and standardize the terminology of unstructured text in the field of power trading to obtain preprocessed text;

[0124] The semantic encoding module is used to encode the semantic features of the preprocessed text using a pre-trained language model based on an error correction masking mechanism to obtain a semantic encoding sequence.

[0125] The feature enhancement module is used to obtain an enhanced feature sequence based on the semantic encoding sequence through sequential bidirectional long-distance semantic dependency capture, dynamic attention weight allocation, and local semantic detail fusion.

[0126] The joint extraction module is used to perform joint entity and relation extraction on the enhanced feature sequence based on a stacked pointer network to obtain a triple consisting of a head entity, a relation, and a tail entity.

[0127] The knowledge processing module is used to perform deduplication and completion processing on the triples to complete the knowledge extraction for electricity transactions.

[0128] Example 4

[0129] This embodiment also discloses a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method described in Embodiment 1.

[0130] Example 5

[0131] This embodiment also discloses a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method described in Embodiment 1.

[0132] Example 6

[0133] This embodiment also discloses a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in Embodiment 1.

[0134] The above are merely preferred embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for extracting knowledge from electricity trading based on semantic encoding and feature enhancement, characterized in that, include: Cleaning and terminology standardization are performed on unstructured text in the power trading field to obtain preprocessed text; The pre-trained language model based on error correction masking mechanism is used to encode semantic features of the preprocessed text to obtain a semantic encoding sequence; Based on the semantic encoding sequence, an enhanced feature sequence is obtained through sequential bidirectional long-distance semantic dependency capture, dynamic attention weight allocation, and local semantic detail fusion. The enhanced feature sequence is subjected to joint entity and relation extraction based on a stacked pointer network to obtain a triple consisting of a head entity, a relation, and a tail entity. The triples are deduplicated and completed to extract knowledge about electricity trading. The step of using a pre-trained language model based on an error correction masking mechanism to encode semantic features of the preprocessed text to obtain a semantic encoding sequence specifically includes: The preprocessed text is input into a pre-trained language model based on an error correction masking mechanism. The Chinese words are masked as a whole through a whole-word masking and synonym replacement strategy. The logical coherence between sentences is enhanced through a sentence order prediction task, and the semantic encoding sequence of the context is output. The step of obtaining an enhanced feature sequence based on the semantic encoding sequence through sequential bidirectional long-distance semantic dependency capture, dynamic attention weight allocation, and local semantic detail fusion specifically includes: The semantic encoding sequence is input into the first-layer bidirectional long short-term memory network to capture long-distance semantic dependencies; The output of the first-layer bidirectional long short-term memory network is input into the attention layer, and attention weights are dynamically allocated to highlight key information. The output of the self-attention layer and the original semantic encoding sequence are input into the second layer of the bidirectional long short-term memory network, fused, and local semantic details are extracted to obtain the enhanced feature sequence. The first-layer bidirectional long short-term memory network includes a forward long short-term memory network and a backward long short-term memory network, which process semantic encoding sequences in text order and reverse order respectively to capture bidirectional contextual dependencies.

2. The method for extracting knowledge from electricity trading according to claim 1, characterized in that, The process of cleaning and terminology standardization of unstructured text in the power trading field to obtain preprocessed text specifically includes: Noise removal, format standardization, unified mapping of business terms, and unit and numerical standardization are performed on unstructured text in the power trading field to obtain preprocessed text.

3. The method for extracting knowledge from electricity trading according to claim 1, characterized in that, The method of extracting entities and relations from the enhanced feature sequence based on a stacked pointer network to obtain triples consisting of a head entity, a relation, and a tail entity specifically includes: The head entity in the text is determined by identifying the start and end positions of the head entity using a binary classifier. For each head entity, the system iterates through the preset power trading domain relationship types, integrates head entity features and semantic encoding, identifies the corresponding tail entity through a layered pointer network, and generates a triple consisting of the head entity, relationship, and tail entity.

4. A power trading knowledge extraction system based on semantic encoding and feature enhancement, characterized in that, For implementing the method according to any one of claims 1-3, comprising: The preprocessing module is used to clean and standardize the terminology of unstructured text in the field of power trading to obtain preprocessed text; The semantic encoding module is used to encode the semantic features of the preprocessed text using a pre-trained language model based on an error correction masking mechanism to obtain a semantic encoding sequence. The feature enhancement module is used to obtain an enhanced feature sequence based on the semantic encoding sequence through sequential bidirectional long-distance semantic dependency capture, dynamic attention weight allocation, and local semantic detail fusion. The joint extraction module is used to perform joint entity and relation extraction on the enhanced feature sequence based on a stacked pointer network to obtain a triple consisting of a head entity, a relation, and a tail entity. The knowledge processing module is used to perform deduplication and completion processing on the triples to complete the knowledge extraction of electricity transactions. The step of using a pre-trained language model based on an error correction masking mechanism to encode semantic features of the preprocessed text to obtain a semantic encoding sequence specifically includes: The preprocessed text is input into a pre-trained language model based on an error correction masking mechanism. The Chinese words are masked as a whole through a whole-word masking and synonym replacement strategy. The logical coherence between sentences is enhanced through a sentence order prediction task, and the semantic encoding sequence of the context is output. The step of obtaining an enhanced feature sequence based on the semantic encoding sequence through sequential bidirectional long-distance semantic dependency capture, dynamic attention weight allocation, and local semantic detail fusion specifically includes: The semantic encoding sequence is input into the first-layer bidirectional long short-term memory network to capture long-distance semantic dependencies; The output of the first-layer bidirectional long short-term memory network is input into the attention layer, and attention weights are dynamically allocated to highlight key information. The output of the self-attention layer and the original semantic encoding sequence are input into the second layer of the bidirectional long short-term memory network, fused, and local semantic details are extracted to obtain the enhanced feature sequence. The first-layer bidirectional long short-term memory network includes a forward long short-term memory network and a backward long short-term memory network, which process semantic encoding sequences in text order and reverse order respectively to capture bidirectional contextual dependencies.

5. A computer device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1-3.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1-3.

7. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1-3.