Power industry standard clause semantic similarity measurement method and system based on comparative learning, medium and equipment

By comparing the learning method and the RoBERTa model, the automated semantic similarity measurement of standard clauses in the electric power industry is realized, solving the problems of low search efficiency and standard file conflicts, improving work efficiency and safety, and promoting the standardization and intelligence of the electric power industry. .

CN118535984APending Publication Date: 2024-08-23STATE GRID JIANGSU ELECTRIC POWER CO LTD RESEARCH INSTITUTE +2

Patent Information

Application Number
CN202410749351.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

In the existing technology, the search efficiency of clauses in power industry standard documents is low, and due to the diverse expressions of clauses, it is difficult for engineers to accurately judge semantic similarities, which can easily lead to errors and omissions, and different standard documents may conflict or overlap, affecting practical applications.

Method used

Using a method based on contrastive learning, the RoBERTa model is used to perform data preprocessing, encoding and enhancement on the power industry standard clauses. The model parameters are optimized through contrastive loss calculation, the semantic similarity between the clauses is calculated, and an automated semantic similarity measurement system is provided.

Benefits of technology

It improves work efficiency, reduces security risks, solves the problem of data scarcity, promotes the standardization and intelligent development of the power industry, and reduces standard file conflicts and overlapping issues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535984A
    Figure CN118535984A
Patent Text Reader

Abstract

The invention discloses a power industry standard clause semantic similarity measurement method and system based on comparative learning, a medium and equipment in the technical field of computer application, and aims to solve the problem that the actual demand cannot be met in the prior art. Obtaining a to-be-compared power industry standard clause data pair; performing data preprocessing on the to-be-compared power industry standard clause data pair to obtain a processed to-be-compared power industry standard clause data pair; carrying out data coding based on the trained and optimized RoBERTa model to obtain a processed to-be-compared power industry standard term vector pair; calculating the similarity of the processed to-be-compared power industry standard clause vector pairs, and obtaining a similarity score; and according to the similarity score, measuring the semantic similarity between the power industry standard clause data to be compared. According to the method, the working efficiency can be improved, the safety risk is reduced, the problem of data scarcity is solved, standardized and intelligent development of the power industry is promoted, and the problems of standard file conflict and overlapping are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer application technology, and in particular to a method, system, medium and device for measuring semantic similarity of standard clauses in the electric power industry based on contrastive learning. Background Art

[0002] The power industry is a highly standardized industry, and various standard documents and technical specifications provide important guidance for engineering design, construction and acceptance. However, as the complexity and professionalism of power engineering continue to increase, the existing standard document system is also growing larger and larger. Currently, finding similar and different clauses in multiple standard documents mainly relies on manual search, which brings challenges to engineers in finding and applying relevant clauses.

[0003] First, manual search for relevant clauses is inefficient. There are a large number of power standard documents covering a wide range of areas, and engineers need to spend a lot of time and energy to find the required clauses. At the same time, due to the diverse expression of clauses, it is difficult to manually judge the semantic similarity between clauses, which is prone to errors and omissions.

[0004] Secondly, there may be conflicting or overlapping clauses between different standard documents, which brings confusion to practical application. Engineers need to have rich professional knowledge and experience to judge which clause is applicable to a specific engineering project.

[0005] In order to address the above challenges, it is urgent to develop methods to automatically detect and identify the similarity of semantic differences in electricity terms. In recent years, the rapid development of artificial intelligence and natural language processing technologies has provided new ideas for solving this problem. Summary of the invention

[0006] The purpose of the present invention is to overcome the deficiencies in the prior art and to provide a method, system, medium and device for measuring the semantic similarity of standard clauses in the power industry based on contrastive learning, which can improve work efficiency, reduce safety risks, solve the problem of data scarcity, promote the development of standardization and intelligence in the power industry, and solve the problems of conflicts and overlaps in standard documents.

[0007] In order to solve the above technical problems, the present invention is implemented by adopting the following technical solutions:

[0008] The present invention provides a method for measuring semantic similarity of power industry standard clauses based on contrastive learning, comprising:

[0009] Obtaining a pair of data on power industry standard clauses to be compared;

[0010] Performing data preprocessing on the electric power industry standard clause data pair to be compared to obtain processed electric power industry standard clause data pair to be compared;

[0011] According to the processed electric power industry standard clause data pairs to be compared, data encoding is performed based on the trained and optimized RoBERTa model to obtain processed electric power industry standard clause vector pairs to be compared;

[0012] Calculating the similarity between the pairs of power industry standard clause vectors to be compared after the processing, and obtaining a similarity score;

[0013] The semantic similarity between the electric power industry standard clause data to be compared is measured according to the similarity score.

[0014] Optionally, the training and optimization steps of the RoBERTa model include:

[0015] Obtain the power industry standard clause dataset;

[0016] According to the electric power industry standard clause data set, data preprocessing is performed to obtain a processed electric power industry standard clause data set;

[0017] Performing data enhancement according to the processed electric power industry standard clause data set to obtain an enhanced electric power industry standard clause data set;

[0018] According to the processed electric power industry standard clause data set and the enhanced electric power industry standard clause data set, data encoding is performed based on the established RoBERTa model to obtain a processed electric power industry standard clause vector set and an enhanced electric power industry standard clause vector set;

[0019] Using average pooling to perform feature fusion on the processed electric power industry standard clause vector set and the enhanced electric power industry standard clause vector set to obtain a fused processed electric power industry standard clause vector set and a fused enhanced electric power industry standard clause vector set;

[0020] Performing comparative loss calculation on the fused electric power industry standard clause vector set and the fused enhanced electric power industry standard clause vector set to obtain a loss value;

[0021] The RoBERTa model is back-propagated according to the loss value, and the parameters of the RoBERTa model are optimized by minimizing the loss to obtain a trained and optimized RoBERTa model.

[0022] Optionally, the data preprocessing includes:

[0023] According to the electric power industry standard clause data set, extract text content, remove non-text elements and information irrelevant to electric power clauses in the text content, and unify the text format;

[0024] The text content is divided according to chapter titles and numbers to obtain the processed power industry standard clause dataset.

[0025] Optionally, the data enhancement includes:

[0026] Using the adversarial attack data enhancement strategy, some words in the power industry standard clause data set are randomly replaced with synonyms to obtain an enhanced power industry standard clause data set;

[0027] or,

[0028] Using a token-scrambled data enhancement strategy, randomly changing the order of some words in the electric power industry standard clause data set, to obtain an enhanced electric power industry standard clause data set;

[0029] or,

[0030] Using a truncated data enhancement strategy, randomly removing some words or features in the electric power industry standard clause data set to obtain an enhanced electric power industry standard clause data set;

[0031] or,

[0032] By using the discard data enhancement strategy, some elements in the electric power industry standard clause data set are randomly discarded to obtain an enhanced electric power industry standard clause data set.

[0033] Optionally, the data encoding includes:

[0034] Tokenizing the processed electric power industry standard clause data set and the enhanced electric power industry standard clause data set respectively, and dividing them by units to obtain a tokenized electric power industry standard clause data set and a tokenized enhanced electric power industry standard clause data set;

[0035] The tokenized electric power industry standard clause data set and the tokenized enhanced electric power industry standard clause data set are respectively input into the RoBERTa model for vector embedding to obtain a processed electric power industry standard clause vector set and an enhanced electric power industry standard clause vector set.

[0036] Optionally, the contrast loss calculation includes:

[0037] Merging the processed electric power industry standard clause vector set and the enhanced electric power industry standard clause vector set into a sample set;

[0038] Taking each of the fused processed electric power industry standard clause vectors in the sample set and its matched fused enhanced electric power industry standard clause vector as a positive sample pair, and calculating the similarity of all positive sample pairs;

[0039] Taking any two unmatched vectors in the sample set as a negative sample pair, and calculating the similarity of all negative sample pairs;

[0040] According to the similarity between the positive sample pair and the positive and negative sample pair, a normalized temperature scaled cross entropy loss function is used to calculate the final contrast loss to obtain a loss value.

[0041] Optionally, the contrast loss calculation is implemented by the following formula:

[0042]

[0043] in, represents the loss value, represents the power industry standard clause vector after fusion processing, Representation and Matching fusion enhanced power industry standard clause vector, represents the vector in the sample set, represents the cosine similarity function, Representation vector and vector The cosine similarity between represents the temperature parameter, represents the indicator function, when hour, is equal to 1, otherwise is equal to 0, Represents the total number of vectors in the sample set.

[0044] In a second aspect, the present invention provides a semantic similarity measurement system for power industry standard clauses based on contrastive learning, comprising:

[0045] The data acquisition module is used to: acquire the data pair of power industry standard clauses to be compared;

[0046] A data preprocessing module, used to: perform data preprocessing on the electric power industry standard clause data pair to be compared, to obtain the processed electric power industry standard clause data pair to be compared;

[0047] A data encoding module, used to: perform data encoding based on the trained and optimized RoBERTa model according to the processed electric power industry standard clause data pair to be compared, to obtain the processed electric power industry standard clause vector pair to be compared;

[0048] A similarity calculation module is used to calculate the similarity between the pairs of power industry standard clause vectors to be compared after the processing, and obtain a similarity score;

[0049] The similarity measurement module is used to measure the semantic similarity between the power industry standard clause data to be compared according to the similarity score.

[0050] Optionally, the training and optimization steps of the RoBERTa model include:

[0051] Obtain the power industry standard clause dataset;

[0052] According to the electric power industry standard clause data set, data preprocessing is performed to obtain a processed electric power industry standard clause data set;

[0053] Performing data enhancement according to the processed electric power industry standard clause data set to obtain an enhanced electric power industry standard clause data set;

[0054] According to the processed electric power industry standard clause data set and the enhanced electric power industry standard clause data set, data encoding is performed based on the established RoBERTa model to obtain a processed electric power industry standard clause vector set and an enhanced electric power industry standard clause vector set;

[0055] Using average pooling to perform feature fusion on the processed electric power industry standard clause vector set and the enhanced electric power industry standard clause vector set to obtain a fused processed electric power industry standard clause vector set and a fused enhanced electric power industry standard clause vector set;

[0056] Performing comparative loss calculation on the fused electric power industry standard clause vector set and the fused enhanced electric power industry standard clause vector set to obtain a loss value;

[0057] The RoBERTa model is back-propagated according to the loss value, and the parameters of the RoBERTa model are optimized by minimizing the loss to obtain a trained and optimized RoBERTa model.

[0058] In a third aspect, the present invention provides a computer-readable storage medium having a computer program / instruction stored thereon. When the computer program / instruction is executed by a processor, the steps of the method for measuring semantic similarity of standard clauses in the electric power industry based on contrastive learning are implemented as described in any one of the first aspects.

[0059] In a fourth aspect, the present invention provides a computer device / equipment / system, comprising:

[0060] Memory, for storing computer programs / instructions;

[0061] A processor is used to execute the computer program / instructions to implement the steps of the method for measuring semantic similarity of power industry standard clauses based on contrastive learning as described in any one of the first aspects.

[0062] In a fifth aspect, the present invention provides a computer program product, comprising a computer program / instruction, characterized in that when the computer program / instruction is executed by a processor, the steps of the method for measuring semantic similarity of standard clauses in the electric power industry based on contrastive learning as described in any one of the first aspects are implemented.

[0063] Compared with the prior art, the present invention has the following beneficial effects:

[0064] 1. The semantic similarity measurement method of standard clauses in the power industry based on contrastive learning provided by the present invention obtains and decomposes clause data from relevant standard specification documents in the power industry; uses the RoBERTa pre-training model for sentence encoding to solve the problem of sentence semantic information extraction; uses the NT-Xent loss function to optimize the vector representation of clauses, and achieves accurate and robust representation of power clauses; finally, uses cosine similarity calculation to measure the similarity of representation vectors between different clauses; can improve work efficiency, reduce safety risks, solve data scarcity problems, promote the development of standardization and intelligence in the power industry, and solve conflicts and overlaps in standard documents

[0065] 2. The semantic similarity measurement system of power industry standard clauses based on contrastive learning provided by the present invention is provided with a data acquisition module, a data preprocessing module, a data encoding module, a similarity calculation module and

[0066] The similarity measurement module jointly realizes the semantic similarity measurement of standard clauses in the power industry, which has practical significance and good application prospects;

[0067] 3. The computer-readable storage medium, computer device / equipment / system and computer program product provided by the present invention can execute the steps of the method for measuring semantic similarity of power industry standard clauses based on contrastive learning provided by the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] Figure 1 A flow chart of a method for measuring semantic similarity of power industry standard clauses based on contrastive learning according to an embodiment of the present invention;

[0069] Figure 2 The present invention provides a flowchart of training and optimizing the RoBERTa model according to an embodiment of the present invention. DETAILED DESCRIPTION

[0070] The technical solution of the present invention is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present application and the specific features in the embodiments are detailed descriptions of the technical solution of the present application, rather than limitations on the technical solution of the present application. In the absence of conflict, the embodiments of the present application and the technical features in the embodiments can be combined with each other.

[0071] It should be noted that the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0072] Embodiment 1:

[0073] The embodiment of the present invention discloses a semantic similarity measurement method of power industry standard clauses based on contrastive learning, referring to Figure 1 As shown, the specific steps include:

[0074] Obtaining a pair of data on power industry standard clauses to be compared;

[0075] Performing data preprocessing on the electric power industry standard clause data pair to be compared to obtain processed electric power industry standard clause data pair to be compared;

[0076] According to the processed electric power industry standard clause data pairs to be compared, data encoding is performed based on the trained and optimized RoBERTa model to obtain processed electric power industry standard clause vector pairs to be compared;

[0077] Calculating the similarity between the pairs of power industry standard clause vectors to be compared after the processing, and obtaining a similarity score;

[0078] The semantic similarity between the electric power industry standard clause data to be compared is measured according to the similarity score.

[0079] Specifically,

[0080] refer to Figure 2 As shown, the training and optimization steps of the RoBERTa model include:

[0081] S1, obtain the power industry standard clause dataset;

[0082] S2, performing data preprocessing according to the electric power industry standard clause data set to obtain a processed electric power industry standard clause data set;

[0083] S3, performing data enhancement according to the processed electric power industry standard clause data set to obtain an enhanced electric power industry standard clause data set;

[0084] S4, according to the processed electric power industry standard clause data set and the enhanced electric power industry standard clause data set, data encoding is performed based on the established RoBERTa model to obtain a processed electric power industry standard clause vector set and an enhanced electric power industry standard clause vector set;

[0085] S5, using average pooling to perform feature fusion on the processed electric power industry standard clause vector set and the enhanced electric power industry standard clause vector set to obtain a fused processed electric power industry standard clause vector set and a fused enhanced electric power industry standard clause vector set;

[0086] S6, performing comparative loss calculation on the fused electric power industry standard clause vector set and the fused enhanced electric power industry standard clause vector set to obtain a loss value;

[0087] S7, performing back propagation of the RoBERTa model according to the loss value, and optimizing the parameters of the RoBERTa model by minimizing the loss, to obtain a trained and optimized RoBERTa model.

[0088] Contrastive learning is an unsupervised learning method that generates positive and negative sample pairs through data enhancement and trains the model to make data of the same type similar and data of different types dissimilar. The semantic difference similarity measurement method of power clauses based on contrastive learning proposed in this embodiment includes steps such as data preprocessing, data enhancement, sentence encoding, average pooling, contrast loss and similarity measurement. Through this method, power clauses can be automatically searched and compared, and support can be provided for the analysis, use and execution of clauses, thereby improving work efficiency, reducing errors and safety risks, and promoting the standardization and intelligent development of the power industry.

[0089] In step S1, the relevant standard and specification documents of the power industry include "State Grid Corporation of China Power Transmission and Transformation Equipment Condition Inspection and Test Procedure", "Power Transmission and Transformation Equipment Condition Inspection and Test Procedure", etc. The power industry standard clause data can exist in multiple formats, such as PDF, Word document or web page text.

[0090] In step S2, the data preprocessing includes:

[0091] According to the file type of the power industry standard clause data set, appropriate parsing tools and techniques are used to extract text content from it, and to remove non-text elements and information irrelevant to power clauses in the text content, including images, charts, special symbols, headers, footers and page numbers;

[0092] Adjust the text format to make it uniform (for example, unify line breaks, spaces, and tabs);

[0093] The power clause file may contain multiple independent clauses. The text content needs to be divided according to the chapter title and number to obtain the processed power industry standard clause data set.

[0094] If the electric power industry standard clause dataset is a scanned PDF file, the text content may be extracted using OCR (Optical Character Recognition) technology.

[0095] In step S3, for each clause, data enhancement is required to generate similar sentences, and the data enhancement includes:

[0096] Using the adversarial attack data enhancement strategy, some words in the power industry standard clause data set are randomly replaced with synonyms to obtain an enhanced power industry standard clause data set;

[0097] or,

[0098] Using a token-scrambled data enhancement strategy, randomly changing the order of some words in the electric power industry standard clause data set, to obtain an enhanced electric power industry standard clause data set;

[0099] or,

[0100] Using a truncated data enhancement strategy, randomly removing some words or features in the electric power industry standard clause data set to obtain an enhanced electric power industry standard clause data set;

[0101] or,

[0102] By using the discard data enhancement strategy, some elements in the electric power industry standard clause data set are randomly discarded to obtain an enhanced electric power industry standard clause data set.

[0103] In the specific implementation, first, you need to decide which data augmentation strategy to use, such as adversarial attacks, token shuffling, truncation (tokens and features), and dropout; these strategies change the original sentences to varying degrees to generate sentences that are semantically similar but different in surface form.

[0104] After determining the data enhancement strategy, apply it:

[0105] Adversarial attack: Producing slightly different sentence representations by slightly modifying the vocabulary of the input sentence, for example, replacing a word in the sentence with another word that is semantically close;

[0106] Token scrambling: changing the order of words in a sentence;

[0107] Truncation: removing certain words (token truncation) or certain features (feature truncation) from a sentence, for example, removing certain keywords to make the sentence incomplete;

[0108] Dropout: Randomly discard certain elements in a sentence, similar to the dropout operation in neural network training. For example, the positions of "current transformer" and "within 1-2 years" in the original sentence can be swapped to generate a new sentence: "For newly commissioned current transformers with voltage levels of 220kV and above within 1-2 years, oil samples should be taken for oil chromatography and micro-water analysis; for products that the manufacturer explicitly requires that oil sampling is not required, sampling or oil replenishment should be carried out by the manufacturer if it is necessary."

[0109] These data augmentation strategies change the original sentences to varying degrees to generate sentences that are semantically similar but different in surface form. Through the above strategies, each input sentence generates two enhanced versions. The two versions are semantically consistent but different in structure or vocabulary. This step is critical because it directly determines the effect of subsequent contrastive learning. During the data augmentation process, it is necessary to ensure that the newly generated sentences are semantically consistent with the original sentences. In the power industry, this can be done by replacing synonyms, reorganizing sentence structures, or using different variants of professional terms to enhance the model's understanding of different expressions.

[0110] In step S4, the data encoding includes:

[0111] Tokenizing the processed electric power industry standard clause dataset and the enhanced electric power industry standard clause dataset respectively, and dividing them into smaller units, such as "current", "transformer", "new commissioning", etc., to obtain a tokenized electric power industry standard clause dataset and a tokenized enhanced electric power industry standard clause dataset;

[0112] The tokenized electric power industry standard clause dataset and the tokenized enhanced electric power industry standard clause dataset are respectively input into the RoBERTa model for vector embedding, and each token is converted into an embedding. The embedding is a vector of a fixed length, which converts text data into a numerical form to obtain a processed electric power industry standard clause vector set and an enhanced electric power industry standard clause vector set. In this step, each token (or word) is mapped to a point in a high-dimensional space. The RoBERTa model has a built-in pre-trained embedding layer to complete this conversion.

[0113] Since RoBERTa is a Transformer-based model, it not only produces static embeddings, but also further adjusts the embedding of each token based on the context, which means that the same word may have different embeddings in different sentences. This is achieved through the model's self-attention mechanism. This step enhances the semantic expressiveness of the embedding and enables the model to capture more detailed semantic information.

[0114] These encoded sentence representations (vectors) will be used in the subsequent contrastive learning process. The sentence encoding process is a crucial part of contrastive learning. It mainly involves converting text into vectors in numerical form so that computers can process and analyze it. Each input sentence (whether it is an original sentence or a sentence that has been processed with data enhancement) is converted into a point in a high-dimensional space, that is, a vector representation. These vector representations are key in subsequent contrastive learning. They enable the model to quantitatively compare the similarities and differences between different sentences.

[0115] In step S5, in order to obtain a single sentence-level representation from the word embedding, the vector with semantic encoding obtained in the previous step needs to be average pooled; average pooling replaces a set of values ​​by calculating the average value of the set of values. In this context, it can be used to reduce the dimension of the semantic encoding vector so that the encoding of each word has an equivalent weight; it can help the model understand and capture the semantic information of the sentence from different perspectives, thereby improving the performance of the model, and then perform feature fusion, which helps capture the overall semantic information of the sentence.

[0116] In the RoBERTa model, the representation of the entire sentence is obtained by summarizing the embeddings of individual tokens, which is usually achieved by taking the average of all token embeddings or using the embedding of a specific tag (such as [CLS]). This representation captures the comprehensive semantic information of the entire sentence;

[0117] In simple terms, average pooling is to calculate the arithmetic mean of all word embeddings. In this way, the model ignores the specific position of the word in the sentence, but integrates the information of the entire sentence into a vector of fixed size; this vector can be regarded as the "average" representation of the sentence, which contains the information of all words in the sentence; this step is particularly effective for processing sentences of different lengths, because no matter how long the sentence is, their representation will be compressed into a vector of the same length; since average pooling ignores the order of words in the sentence to a certain extent, it is particularly suitable for applications that focus more on the overall meaning rather than a specific sequence structure.

[0118] In step S6, the calculation of contrast loss is a crucial step because it directly affects the model's optimization of sentence representation. The core of this calculation process is to adjust the model parameters to improve the similarity of positive sample pairs and reduce the similarity with negative sample pairs, so that the model can effectively distinguish different sentences in the embedding space and accurately capture the subtle differences in semantics. By optimizing the contrast loss, the model can generate more accurate and robust sentence representations, providing powerful semantic understanding capabilities for downstream tasks. The contrast loss calculation includes:

[0119] Merging the processed electric power industry standard clause vector set and the enhanced electric power industry standard clause vector set into a sample set;

[0120] Taking each of the fused processed electric power industry standard clause vectors in the sample set and its matched fused enhanced electric power industry standard clause vector as a positive sample pair, and calculating the similarity of all positive sample pairs;

[0121] Taking any two unmatched vectors in the sample set as a negative sample pair, and calculating the similarity of all negative sample pairs;

[0122] According to the similarity between the positive sample pair and the positive and negative sample pair, the normalized temperature scaled cross entropy loss function (NT-Xent) is used to calculate the final contrast loss to obtain the loss value.

[0123] The contrast loss calculation is implemented by the following formula:

[0124]

[0125] in, represents the loss value, , and They all represent vectors in the sample set, represents the power industry standard clause vector after fusion processing, Representation and Matching fusion enhanced power industry standard clause vector, represents the cosine similarity function, Representation vector and vector The cosine similarity between represents the temperature parameter, which helps control the smoothness of the distribution, represents the indicator function, when hour, is equal to 1, otherwise Equal to 0 ensures that no representation similarity to itself is included in the denominator, Represents the total number of vectors in the sample set.

[0126] Contrastive loss calculation, by constructing positive and negative sample pairs, applying NT-Xent loss, and adjusting model parameters, improves the similarity of positive sample pairs and reduces the similarity with negative sample pairs, generating more accurate and robust sentence representations, providing powerful semantic understanding capabilities for downstream tasks.

[0127] After the model has completed the above-mentioned contrastive learning, the model can be used to measure the similarity of power clauses. The similarity is calculated by comparing the vector representations of two or more clauses. These vector representations capture the semantic information of the clauses. Therefore, if the vector representations of two clauses are similar, then the two clauses can be considered to be semantically similar. For the clause pairs that need to be compared, the similarity between their embedded vectors is first calculated. A score is given based on the calculated similarity, and the score range is usually between 0 and 1. A score close to 1 indicates high similarity, and a score close to 0 indicates the opposite. A similarity threshold is then set to determine whether the clauses are similar. The setting of the threshold may be based on specific business needs or previous experience data. For example, another power clause related to current transformers can be compared with the original sentence to calculate their similarity, and then a score is given based on the similarity to determine whether there are repeated or conflicting clauses.

[0128] Embodiment 2:

[0129] Based on the same inventive concept as the first embodiment, the embodiment of the present invention discloses a semantic similarity measurement system for power industry standard clauses based on contrastive learning, including:

[0130] The data acquisition module is used to: acquire the data pair of power industry standard clauses to be compared;

[0131] A data preprocessing module, used to: perform data preprocessing on the electric power industry standard clause data pair to be compared, to obtain the processed electric power industry standard clause data pair to be compared;

[0132] A data encoding module, used to: perform data encoding based on the trained and optimized RoBERTa model according to the processed electric power industry standard clause data pair to be compared, to obtain the processed electric power industry standard clause vector pair to be compared;

[0133] A similarity calculation module is used to calculate the similarity between the pairs of power industry standard clause vectors to be compared after the processing, and obtain a similarity score;

[0134] The similarity measurement module is used to measure the semantic similarity between the power industry standard clause data to be compared according to the similarity score.

[0135] Specifically,

[0136] The training and optimization steps of the RoBERTa model include:

[0137] Obtain the power industry standard clause dataset;

[0138] According to the electric power industry standard clause data set, data preprocessing is performed to obtain a processed electric power industry standard clause data set;

[0139] Performing data enhancement according to the processed electric power industry standard clause data set to obtain an enhanced electric power industry standard clause data set;

[0140] According to the processed electric power industry standard clause data set and the enhanced electric power industry standard clause data set, data encoding is performed based on the established RoBERTa model to obtain a processed electric power industry standard clause vector set and an enhanced electric power industry standard clause vector set;

[0141] Using average pooling to perform feature fusion on the processed electric power industry standard clause vector set and the enhanced electric power industry standard clause vector set to obtain a fused processed electric power industry standard clause vector set and a fused enhanced electric power industry standard clause vector set;

[0142] Performing comparative loss calculation on the fused electric power industry standard clause vector set and the fused enhanced electric power industry standard clause vector set to obtain a loss value;

[0143] The RoBERTa model is back-propagated according to the loss value, and the parameters of the RoBERTa model are optimized by minimizing the loss to obtain a trained and optimized RoBERTa model.

[0144] The specific functional implementation of each of the above modules can be found in the relevant content of the method in Example 1 and will not be elaborated here.

[0145] Embodiment three:

[0146] This embodiment provides a computer-readable storage medium having a computer program / instruction stored thereon. When the computer program / instruction is executed by a processor, the steps of the method for measuring semantic similarity of power industry standard clauses based on contrastive learning as described in any one of the first embodiments are implemented.

[0147] Embodiment 4:

[0148] This embodiment provides a computer device / equipment / system, including:

[0149] Memory, for storing computer programs / instructions;

[0150] A processor is used to execute the computer program / instructions to implement the steps of the method for measuring semantic similarity of power industry standard clauses based on contrastive learning as described in any one of the first aspects.

[0151] Embodiment five:

[0152] This embodiment provides a computer program product, including a computer program / instruction, characterized in that when the computer program / instruction is executed by a processor, the steps of the method for measuring semantic similarity of power industry standard clauses based on contrastive learning as described in any one of the first embodiments are implemented.

[0153] In summary, the method, system, medium and device for measuring semantic similarity of power industry standard clauses based on contrastive learning provided by the present invention have the following beneficial effects:

[0154] 1. A semantic difference similarity measurement method for electricity terms based on contrastive learning is proposed, which shows excellent performance in semantic text similarity tasks;

[0155] 2. It does not require a large amount of manually labeled data. It can use unlabeled power clause data for self-supervised learning and encode it into high-quality vector representations, effectively capturing sentence semantic information. It can also show good performance when data is scarce, and is suitable for situations where professional data sets in the power field are relatively small.

[0156] 3. It can help engineers find and apply relevant standards more efficiently and accurately, improve work efficiency, and reduce errors and safety risks;

[0157] 4. It can promote the standardization and intelligent development of the power industry and promote the application of artificial intelligence and natural language processing technologies in the power field.

[0158] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0159] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0160] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0161] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0162] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present invention and the claims, which all fall within the protection of the present invention.

Claims

1. A semantic similarity measurement method for power industry standard clauses based on contrastive learning, characterized in that: include: Obtaining a pair of power industry standard clause data to be compared; Performing data preprocessing on the electric power industry standard clause data pair to be compared to obtain processed electric power industry standard clause data pair to be compared; According to the processed electric power industry standard clause data pairs to be compared, data encoding is performed based on the trained and optimized RoBERTa model to obtain processed electric power industry standard clause vector pairs to be compared; Calculating the similarity between the pairs of power industry standard clause vectors to be compared after the processing, and obtaining a similarity score; The semantic similarity between the electric power industry standard clause data to be compared is measured according to the similarity score.

2. According to claim 1, the semantic similarity measurement method of power industry standard clauses based on contrastive learning is characterized in that: The training and optimization steps of the RoBERTa model include: Obtain the power industry standard clause dataset; According to the electric power industry standard clause data set, data preprocessing is performed to obtain a processed electric power industry standard clause data set; Performing data enhancement according to the processed electric power industry standard clause data set to obtain an enhanced electric power industry standard clause data set; According to the processed electric power industry standard clause data set and the enhanced electric power industry standard clause data set, data encoding is performed based on the established RoBERTa model to obtain a processed electric power industry standard clause vector set and an enhanced electric power industry standard clause vector set; Using average pooling to perform feature fusion on the processed electric power industry standard clause vector set and the enhanced electric power industry standard clause vector set to obtain a fused processed electric power industry standard clause vector set and a fused enhanced electric power industry standard clause vector set; Performing comparative loss calculation on the fused electric power industry standard clause vector set and the fused enhanced electric power industry standard clause vector set to obtain a loss value; The RoBERTa model is back-propagated according to the loss value, and the parameters of the RoBERTa model are optimized by minimizing the loss to obtain a trained and optimized RoBERTa model.

3. The semantic similarity measurement method of power industry standard clauses based on contrastive learning according to claim 1 is characterized in that: The data preprocessing includes: According to the electric power industry standard clause data set, extract text content, remove non-text elements and information irrelevant to electric power clauses in the text content, and unify the text format; The text content is divided according to chapter titles and numbers to obtain the processed power industry standard clause dataset.

4. The method for measuring semantic similarity of power industry standard clauses based on contrastive learning according to claim 2 is characterized in that: The data enhancement includes: Using the adversarial attack data enhancement strategy, some words in the power industry standard clause data set are randomly replaced with synonyms to obtain an enhanced power industry standard clause data set; or, Using a token-scrambled data enhancement strategy, randomly changing the order of some words in the electric power industry standard clause data set, to obtain an enhanced electric power industry standard clause data set; or, Using a truncated data enhancement strategy, randomly removing some words or features in the electric power industry standard clause data set to obtain an enhanced electric power industry standard clause data set; or, By using the discard data enhancement strategy, some elements in the electric power industry standard clause data set are randomly discarded to obtain an enhanced electric power industry standard clause data set.

5. The semantic similarity measurement method of power industry standard clauses based on contrastive learning according to claim 1 is characterized in that: The data encoding includes: Tokenizing the processed electric power industry standard clause data set and the enhanced electric power industry standard clause data set respectively, and dividing them by units to obtain a tokenized electric power industry standard clause data set and a tokenized enhanced electric power industry standard clause data set; The tokenized electric power industry standard clause data set and the tokenized enhanced electric power industry standard clause data set are respectively input into the RoBERTa model for vector embedding to obtain a processed electric power industry standard clause vector set and an enhanced electric power industry standard clause vector set.

6. The semantic similarity measurement method of power industry standard clauses based on contrastive learning according to claim 1 is characterized in that: The contrast loss calculation includes: Merging the processed electric power industry standard clause vector set and the enhanced electric power industry standard clause vector set into a sample set; Taking each of the fused processed electric power industry standard clause vectors in the sample set and its matched fused enhanced electric power industry standard clause vector as a positive sample pair, and calculating the similarity of all positive sample pairs; Taking any two unmatched vectors in the sample set as a negative sample pair, and calculating the similarity of all negative sample pairs; According to the similarity between the positive sample pair and the positive and negative sample pair, a normalized temperature scaled cross entropy loss function is used to calculate the final contrast loss to obtain a loss value.

7. The method for measuring semantic similarity of power industry standard clauses based on contrastive learning according to claim 6 is characterized in that: The contrast loss calculation is implemented by the following formula: in, represents the loss value, represents the power industry standard clause vector after fusion processing, Representation and Matching fusion enhanced power industry standard clause vector, represents the vector in the sample set, represents the cosine similarity function, Representation vector and vector The cosine similarity between represents the temperature parameter, represents the indicator function, when hour, is equal to 1, otherwise is equal to 0, Represents the total number of vectors in the sample set.

8. A semantic similarity measurement system for power industry standard clauses based on contrastive learning, characterized in that: include: The data acquisition module is used to: acquire the data pair of power industry standard clauses to be compared; A data preprocessing module, used to: perform data preprocessing on the electric power industry standard clause data pair to be compared, to obtain the processed electric power industry standard clause data pair to be compared; A data encoding module, used to: perform data encoding based on the trained and optimized RoBERTa model according to the processed electric power industry standard clause data pair to be compared, to obtain the processed electric power industry standard clause vector pair to be compared; A similarity calculation module is used to calculate the similarity between the power industry standard clause vector pairs to be compared after the processing, and obtain a similarity score; The similarity measurement module is used to measure the semantic similarity between the power industry standard clause data to be compared according to the similarity score.

9. The semantic similarity measurement system of power industry standard clauses based on contrastive learning according to claim 8 is characterized in that: The training and optimization steps of the RoBERTa model include: Obtain the power industry standard clause dataset; According to the electric power industry standard clause data set, data preprocessing is performed to obtain a processed electric power industry standard clause data set; Performing data enhancement according to the processed electric power industry standard clause data set to obtain an enhanced electric power industry standard clause data set; According to the processed electric power industry standard clause data set and the enhanced electric power industry standard clause data set, data encoding is performed based on the established RoBERTa model to obtain a processed electric power industry standard clause vector set and an enhanced electric power industry standard clause vector set; Using average pooling to perform feature fusion on the processed electric power industry standard clause vector set and the enhanced electric power industry standard clause vector set to obtain a fused processed electric power industry standard clause vector set and a fused enhanced electric power industry standard clause vector set; Performing comparative loss calculation on the fused electric power industry standard clause vector set and the fused enhanced electric power industry standard clause vector set to obtain a loss value; The RoBERTa model is back-propagated according to the loss value, and the parameters of the RoBERTa model are optimized by minimizing the loss to obtain a trained and optimized RoBERTa model.

10. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instruction is executed by a processor, the steps of the method for measuring semantic similarity of power industry standard clauses based on contrastive learning described in any one of claims 1-7 are implemented.

11. A computer device / equipment / system, characterized in that: include: Memory, for storing computer programs / instructions; A processor is used to execute the computer program / instructions to implement the steps of the method for measuring semantic similarity of power industry standard clauses based on contrastive learning as described in any one of claims 1-7.

12. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps of the method for measuring semantic similarity of power industry standard clauses based on contrastive learning described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Power equipment technical standard document sorting method and device, electronic equipment and medium

    CN113515620A

  • Long text semantic similarity calculation method based on RoBERTa model

    CN114398900A

  • Electric power technology standard difference term identification method and system, and readable storage medium

    CN116383341A

  • Unsupervised sentence representation method and device, computer equipment and storage medium

    CN117272979A

  • Medical term standardization method based on fusion multi-strategy comparative learning

    CN117633148A

Cited By

  • Identity encryption method and system based on large language model

    CN118916904A

  • Data verification method and device, computer equipment and storage medium

    CN119444439A

  • Contract risk clause identification method based on natural language processing

    CN120372460A

  • Research and development service intelligent question and answer method based on industry evidence and standard anchor point

    CN122412474A

  • An intelligent question and answer method for research and development services based on industry evidence and standard anchor points

    CN122412474B