Policy document intelligent rule extraction and change comparison method for electricity charge verification

By performing structured analysis and intelligent rule extraction of electricity pricing policy documents, combined with a large language model, the problem of rule extraction and comparison in electricity pricing verification was solved, enabling efficient and accurate policy rule updates and change analysis for the power system.

CN120449861BActive Publication Date: 2025-10-17YANTAI HAIYI SOFTWARE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510953695.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-11
Publication Date
2025-10-17
Estimated Expiration
2045-07-11

AI Technical Summary

Technical Problem

In electricity bill verification, existing technologies struggle to quickly and accurately extract and compare electricity bill-related verification rules from complex policy documents, leading to rule omissions and logical loopholes, which reduces the intelligence and responsiveness of the power system.

Method used

This paper proposes an intelligent rule extraction and change comparison method for policy documents for electricity bill verification. By combining document structure parsing, core sentence recognition and rule extraction intelligent agent with a large language model, the method can realize the automatic extraction and comparison of policy rules.

Benefits of technology

It significantly improved the accuracy and processing efficiency of rule extraction, shortened the response cycle for rule implementation, enabled accurate identification and change analysis of old and new policies and rules, and enhanced the responsiveness of the power system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120449861B_ABST
    Figure CN120449861B_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of power file rule extraction and change comparison, and particularly relates to a policy file intelligent rule extraction and change comparison method for electricity charge verification, comprising: analyzing, reconstructing and optimizing the electricity-related policy files, and retaining the original context and logical level information; designing core sentence recognition Prompt templates and rule extraction conversion Prompt templates, constructing a policy rule extraction intelligent agent, guiding a large language model to recognize core sentences, extract rule element information and form standardized policy rule descriptions; searching for similar policy rules from a historical policy rule description knowledge base, constructing a policy rule comparison intelligent agent, and performing deep semantic comparison and change analysis on the current standardized policy rule description and the historical similar policy rule description, so as to realize the automatic identification of the added and modified contents of the current rule and the historical rule, and provide key technical support for the automation and intelligentization of electricity charge verification business rule generation.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of power file rule extraction and change comparison, and particularly relates to a policy file intelligent rule extraction and change comparison method for power charge verification. BACKGROUND

[0002] In key businesses such as power charge verification and preferential policy implementation in the power industry, policy files are important basis for formulating verification logic and implementation rules, and various verification rules must be defined for power-related policy files to check whether each link meets the requirements of the relevant policy files.

[0003] With the continuous updating of national and local government policies, it is necessary to continuously convert newly released policy provisions into executable business rules to ensure the rapid landing and system compliance of the policies. However, power-related policy files usually have characteristics such as strong professionalism, complex logic, and ambiguous provisions. In order to formulate relevant verification rules, it is necessary to rely on front-line business experts to interpret relevant policy files, extract key points, and write rule descriptions. In addition, it is necessary to compare and check with the verification rules in the original information system one by one to identify the impact range of the landing of policy files on power verification business. This process is time-consuming and laborious, and the process is complicated, and it is difficult to avoid problems such as rule omission and logic loopholes, which obviously lags behind in the landing response of policy files, reducing the intelligent degree of the power system and the response ability of the enterprise.

[0004] In recent years, with the rise of large language model technology, its technical advantages in natural language understanding and complex semantic extraction provide a new solution for automatic analysis and rule generation of policy files. However, power-related policy files generally have characteristics such as long length, strong domain professionalism, and multiple implied business logics. Directly using a general large model to analyze power-related policy files often lacks deep integration of business text understanding and business rule requirements, resulting in unsatisfactory results, such as inaccurate rule statement positioning, missing rule content information, and incorrect rule content understanding and extraction, which cannot be directly used in business systems. In addition, for automatic acquisition, identification, and semantic alignment between new and old rules, direct application of large models still lacks systematic technical links and capabilities, and also requires a lot of auditing and correction work, which is difficult to meet the high requirements of timely updating. SUMMARY

[0005] In order to overcome the problems in the prior art, the application provides a policy file intelligent rule extraction and change comparison method for power charge verification.

[0006] The technical solution of the application to solve the above technical problems is as follows:

[0007] The application provides a policy document intelligent rule extraction and change comparison method for electricity charge verification, including the following steps:

[0008] The electricity-related policy document is parsed, and the context level and logical structure information of the original electricity-related policy document are retained during the parsing process. The parsed content is optimized.

[0009] A core sentence recognition prompt template is designed, a policy rule extraction intelligent agent is constructed, core sentences are recognized from the optimized content, rule-related element information is extracted, the information is converted into a standardized policy rule description, and the description is output corresponding to the original content.

[0010] A historical policy rule description knowledge base is constructed, the standardized policy rule description and the original content are based on, a historical similar policy rule description is found from the historical policy rule description knowledge base, a policy rule comparison intelligent agent is constructed, the current standardized policy rule description and the historical similar policy rule description are deeply semantically compared and changed, new and modified policy provisions are identified, and a structured change detail is output.

[0011] Further, the electricity-related policy document is parsed, including:

[0012] The content of the electricity-related policy document is read, a file content and structure parsing method is designed, and the electricity-related policy document is parsed. The file content and structure parsing method includes:

[0013] For a Word format document, a parsing module based on python-docx is used to identify and disassemble the text content structure of the Word format document. The original title level and numbering structure in the Word format document are retained in the identification result, and different type identifiers are assigned to the text content. The reading result is stored as a set containing document style attributes and corresponding content in the original Word format document order;

[0014] For a PDF format document, the PaddleOCR tool is used for alignment recognition. The page elements are semantically segmented using layout analysis technology to obtain the spatial position, text content and text type of each page. The parsed content set is stored in the original PDF format document order.

[0015] Further, the parsed content is optimized, specifically including:

[0016] For each paragraph of the parsed content, the title content and type thereof are spliced into the paragraph to form a new paragraph, and the paragraph longer than a preset length is blocked according to the maximum blocking length.

[0017] Each paragraph block is cut by sentence, numbered and then merged into a paragraph text, i.e. numbered paragraph block.

[0018] Further, a core sentence recognition Prompt template is designed, including:

[0019] The core sentence recognition Prompt template is defined as P R , which is expressed as:

[0020] ;

[0021] In the above formula, G represents the set target description; represents the input paragraph text block with numbered identification; S represents the given recognition step prompt, guiding the large language model to think and judge; I represents the set important matters, i.e. the content that needs to be focused on; O R represents the output format of the core sentence recognition task, in the form of json, containing the numbered identification, judgment result and thinking process of each sentence.

[0022] Further, a policy rule extraction agent is constructed, including:

[0023] Based on the core sentence recognition Prompt template, a core sentence screening tool is created T :

[0024] ;

[0025] Based on the screened core sentences, a rule extraction and conversion Prompt template is designed P E :

[0026] ;

[0027] Combined with the core sentence screening tool, the rule extraction and conversion Prompt template and the large language model, a policy rule extraction agent is constructed A E :

[0028] ;

[0029] Among them, M represents the large language model; F represents the sentence filtering process; c f represents the paragraph text screened by the core sentence screening tool; OE an output format representing a rule extraction and conversion task; E X a rule extraction result example, provided for reference to a large language model.

[0030] Further, the element information related to the rule is extracted and converted into a standardized policy rule description, and the original text content is output, including:

[0031] The numbered paragraph blocks are input into a policy rule extraction agent, the core sentences with rule properties are identified based on a core sentence screening tool, and the specific rule elements are extracted from the core sentences by the agent, and the output is a standardized, element-specific policy rule expression and corresponding original text number;

[0032] According to the original text number, the original text content is obtained from the paragraph block text, the original text content corresponding to each policy rule description is obtained, and the mapping relationship between the rule and the original text is formed.

[0033] Further, a historical policy rule description knowledge base is constructed, and based on the standardized policy rule description and the original text content, a similar historical policy rule description is searched from the historical policy rule description knowledge base, including:

[0034] The description information and corresponding identifier id of the historical electric power verification rule are extracted from the table of the historical electric power verification rule to construct a historical rule description knowledge base;

[0035] Based on the policy rule description extracted from the policy file and the corresponding original text content, similar historical rule descriptions are retrieved and obtained from the knowledge base using a similarity retrieval method, taking into account the similarity differences of different expression methods.

[0036] Further, a policy rule comparison agent is constructed, including:

[0037] Based on the historical similar policy rule description, a policy rule comparison analysis Prompt template is designed P C :

[0038] ;

[0039] Based on the constructed policy rule comparison analysis Prompt template and a large language model, a policy rule comparison agent is constructed A C :

[0040] ;

[0041] wherein, G represents a set target description; SThe given identification step prompt indicates that the large language model should think and judge; I The important matters set are indicated; r The input current policy rule description is indicated, R S For r The similar historical policy rules retrieved are obtained; O C The output format of the policy rule comparison and analysis task is indicated, which includes the analysis description of the historical rules, the similarity judgment result of the historical rules, the judgment thinking process, and the change analysis result content; E C The result output example of the rule comparison and analysis is indicated.

[0042] Further, the added and modified policy provisions are identified, and the structured change details are output, and the process is represented as:

[0043] ;

[0044] ;

[0045] In the above formula, and respectively represent the policy rule description r i and a certain historical similar policy rule description, the policy change type and the change detail analysis result output by the policy rule comparison intelligent agent, the change type including modification and addition; CR The comparison and analysis results of all rules are indicated; R Si The similar historical policy rules retrieved from the current policy rule description are indicated.

[0046] Compared with the prior art, the present application has the following technical effects:

[0047] (1) The present application designs a document content structured analysis method for electricity fee verification policy rule extraction, which can read, analyze and structure the policy files in Word format and PDF format, effectively retains the original context and logical level information, enhances the hierarchical structure representation method, and improves the understanding ability of the large language model to the document semantics and structure logic; At the same time, the analysis result is subjected to block merging and other optimization processing operations to avoid model misjudgment caused by context truncation or redundant content, thereby laying a corpus foundation for subsequent rule extraction and rule comparison.

[0048] (2) This paper designs a core statement recognition prompt template and a rule extraction and conversion prompt template, and constructs a policy rule extraction agent based on a large language model. It identifies core rule statements from the parsed input paragraph text, extracts rule elements, and converts them into structured policy rule descriptions, thus achieving intelligent conversion from policy documents to structured rules. This method significantly reduces the cost of manual intervention and effectively improves the accuracy and processing efficiency of rule extraction.

[0049] (3) The present invention introduces a collaborative mechanism based on vector semantic retrieval and policy comparison agent, which can automatically match historical similar policy rules after the new policy rules are generated; by designing a comparison analysis prompt template and constructing a policy rule comparison agent, it can analyze and compare the similarities and differences in the content between the new and old policy rules, accurately identify the change types such as additions and modifications and the change details, realize the effective inheritance and evolution between the new and old policy rules, and significantly improve the response efficiency of rule updates. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0051] Figure 1 It is a schematic diagram of the process of the present invention;

[0052] Figure 2 This is a diagram showing the results of parsing electricity price-related policy documents in the experiment of the present invention;

[0053] Figure 3 This is the result diagram of the core sentence recognition in the experiment of the present invention;

[0054] Figure 4 This is the result diagram of policy rule extraction in the experiment of the present invention;

[0055] Figure 5 This is a comparison diagram of the method of the present invention and a general large language model;

[0056] Figure 6 This is a graph showing the results of the historical policy comparison and analysis in the experiment of the present invention;

[0057] Figure 7 Shows the specific content of the core statement recognition prompt template;

[0058] Figure 8 Shows the specific content of the rule extraction conversion prompt template;

[0059] Figure 9 The specific content of the policy rule comparison analysis Prompt is shown. DETAILED DESCRIPTION

[0060] In order to further clarify the technical means and effects taken by the present application to achieve the predetermined object of the present application, the specific embodiments, structures, features and effects of the technical solutions proposed according to the present application are described in detail below in combination with the drawings and preferred embodiments. The specific features, structures or characteristics in one or more embodiments can be combined in any suitable form. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as understood by those skilled in the art to which the present application belongs.

[0061] The present application proposes a policy file intelligent rule extraction and change comparison method for electricity fee verification. The method adopts a multi-stage processing strategy, integrates historical policy rule description knowledge resources, designs a file parsing method, constructs a policy rule extraction intelligent agent and a policy rule comparison intelligent agent, forms a policy interpretation and rule extraction link of "file parsing-rule extraction-rule comparison", and realizes intelligent conversion from unstructured text to rule extraction and change identification, improves the accuracy of policy rule interpretation, and shortens the response cycle of rule landing.

[0062] In one embodiment of the present application, with reference to Figure 1 A policy file intelligent rule extraction and change comparison method for electricity fee verification, comprising the following steps:

[0063] Step 100: parsing the electricity fee related policy file, retaining the context level and logical structure information of the original electricity fee related policy file during the parsing process, and optimizing the parsed content;

[0064] Step 200: design a core sentence recognition Prompt template, construct a policy rule extraction intelligent agent, identify core sentences from the optimized content, extract rule-related element information, convert it into a standardized policy rule description, and output it corresponding to the original text content;

[0065] Step 300: construct a historical policy rule description knowledge base, based on the standardized policy rule description and the original text content, find similar historical policy rule descriptions from the historical policy rule description knowledge base, and then construct a policy rule comparison intelligent agent, perform deep semantic comparison and change analysis on the current standardized policy rule description and the similar historical policy rule description, identify the newly added and modified policy provisions, and output the structured change details.

[0066] The above steps are described in detail as follows:

[0067] Step 100: Analyze the electricity-related policy documents, and retain the context level and logical structure information of the original electricity-related policy documents during the analysis process. Optimize the content after analysis.

[0068] Unlike conventional large language models that perform fixed-length segmentation on input text, the present application designs an electricity-related policy document content and structure analysis method, which can analyze different types of electricity-related policy document content. During the analysis process, the context level and logical structure information of the original electricity-related policy documents are retained, and the results after analysis are processed to make the final text block content have good readability and structural integrity, so that the large language model can accurately and completely understand its content. The specific steps are as follows:

[0069] Step 110: Read the content of the electricity-related policy documents, design a file content and structure analysis method, and analyze the electricity-related policy documents. During the analysis process, the context level and logical structure information of the original electricity-related policy documents are retained.

[0070] Electricity-related policy documents are usually stored in Word or PDF format. This embodiment designs a differentiated analysis scheme for these two formats to ensure that electricity-related policy documents can be accurately read and structured, laying the foundation for subsequent content analysis and rule extraction based on intelligent agents.

[0071] For Word format documents, a parsing module based on python-docx is used to identify and disassemble the text content structure of the Word format document by analyzing the style attributes of the Word format document, such as Heading level, paragraph indentation, body content, numbered list, etc. The original title level and numbering structure in the Word format document are retained in the identification results, and different type identifiers are assigned to the title, body paragraph, numbering structure, etc. The read results are stored in the original Word format document order, and the results are represented as:

[0072] ;

[0073] In the above formula, represents all the content parsed in the Word format document, type m represents the mth type of identifier, text m represents the text content of the mth type. m

[0074] ​For PDF format documents, due to the lack of semantic tags when directly reading the layout of PDF format documents, and the existence of PDF content in the form of pictures, the present application uses the PaddleOCR tool to recognize alignment, uses layout analysis technology to perform semantic segmentation on the page elements of each page, obtains the spatial position, text content and text type of each page, such as the main text, title, table, etc., and finally obtains the recognition result of the entire PDF format document and stores it in the order of the original PDF format document, which is represented as:

[0075] ;

[0076] ;

[0077] In the above formula, C p represents all the content parsed in the PDF format document, p n represents the parsed content of the n page, region m represents the position of the text content of the mth type in the page.

[0078] Step 120: Optimize the parsed content, which includes title splicing, block merging, and numbering marking, to obtain the optimized content, i.e., the numbered paragraph block.

[0079] In order to ensure that the large language model can efficiently and accurately understand the content when analyzing electricity-related policy documents, while avoiding the influence of context window limitations or redundant information interference on extraction and generation effects, the present application processes and optimizes the document content parsed in step 110.

[0080] Firstly, for each main text paragraph in C p or C w , the title content and type belonging to the main text paragraph are spliced into the main text paragraph, such as "first-level title: xx <main text paragraph content>", to form a new main text paragraph, so as to enhance the theme information of the main text paragraph.

[0081] Secondly, the original electricity-related policy document is divided according to the new main text paragraph, and the length of each paragraph is judged. If the lengths of adjacent paragraphs are both less than a preset threshold, it is judged whether the length of the merged adjacent paragraphs is lower than a set maximum block length threshold (set to 512 characters in the present application). If the length of the merged adjacent paragraphs is still lower than the set maximum block length threshold, the adjacent paragraphs are merged to reduce the number of requests during model processing, and to avoid understanding bias caused by information fragmentation.

[0082] Wherein, the result after the division and the combination C is represented as:

[0083] ;

[0084] In the above formula, c l represents the combination of the first l paragraph block.

[0085] Finally, each paragraph block is divided into sentences, numbered and combined into a paragraph text, i.e. the numbered paragraph block, so as to identify the core rule sentence. The set of numbered paragraph block texts is represented as:

[0086] ;

[0087] In the above formula, c l ' represents the combination of the first l paragraph block.

[0088] Step 200: Design a core sentence recognition Prompt template, build a policy rule extraction agent, identify core sentences from the optimized content, extract rule-related element information, convert it into a standardized policy rule description, and output it with the original content.

[0089] After analyzing and optimizing the content of the electricity-related policy documents, the application designs a core sentence recognition Prompt template and a rule extraction and conversion Prompt template, and builds a policy rule extraction agent. Combined with semantic analysis and rule expression characteristics, the large model is guided to understand and filter the content of the paragraph block sentence by sentence, identify the core sentence, ensure the accuracy and purity of rule extraction, and further guide the large language model to extract the rule-related element information from the identified core sentence, and further convert it into a standardized and readable policy rule description. Based on the sentence number, the original text is obtained, and the mapping of the rule and the original text is formed. The specific steps are as follows:

[0090] Step 210: Design a core sentence recognition Prompt template, set the task target, important matters and output format, and guide the large language model to accurately identify the core sentence with rule properties in the paragraph block.

[0091] The large amount of descriptive and background content in the electricity-related policy documents will affect the accuracy of model extraction, so a special core sentence recognition Prompt needs to be designed to guide and constrain the large language model to accurately identify the core sentences with regular properties. By setting guide steps and related reminders in the core sentence recognition Prompt, the large language model can quickly lock in key information and analyze each sentence one by one to determine whether it contains the core content of the policy rules and exclude irrelevant sentences.

[0092] The core sentence recognition Prompt template is defined as P R , which is represented as:

[0093] ;

[0094] In the above formula, G represents the set target description; represents the input paragraph text block with numbered identification; S represents the given recognition step prompt to guide the large language model to think and judge; I represents the set important matters, i.e. the content that needs to be focused on; O R represents the output format of the core sentence recognition task, which is in json format, containing the numbered identification of each sentence, the judgment result and the thinking process. The specific core sentence recognition Prompt template is shown in Figure 7 .

[0095] Step 220: Based on the core sentence recognition Prompt template, create a core sentence screening tool.

[0096] Based on the core sentence recognition Prompt template constructed in step 210, a core sentence screening tool is further constructed to realize the automatic filtering of non-regular sentences in the paragraph block and the accurate extraction of regular sentences. The core sentence screening tool is based on the output results of the large language model, extracts the judgment results corresponding to each numbered identification, and then filters out the sentences judged as non-core, only keeping the content marked as key core sentences. This ensures that the text entering the subsequent extraction process is closely related to the policy content and clearly expressed, thereby ensuring the quality of the text in the rule extraction process.

[0097] The structure of the core sentence screening tool T can be represented as:

[0098] ;

[0099] Among them, P R represents the core sentence recognition Prompt template constructed in step 210, Mrepresents a large language model, F represents a sentence filtering process.

[0100] Step 230: Based on the screened core sentences, design a rule extraction and conversion Prompt template.

[0101] To accurately extract rule content from core sentences, a rule extraction and conversion Prompt template is designed to guide the large language model to extract and convert the identified core sentences into standardized and clearly defined policy rule expressions. The rule extraction and conversion Prompt template combines the language characteristics and rule expression habits of electricity-related policy documents, and focuses on the structure of rule content to guide the task. Through three stages of guidance steps: element extraction, logic reconstruction, and standardized output, the large language model is guided to extract complete rule content and output clear and structured rules. At the same time, the original electricity-related policy document sentence number corresponding to the rule is output to facilitate the comparison and review of the original policy document content.

[0102] The rule extraction and conversion Prompt template is defined as P E , which is represented as:

[0103] ;

[0104] wherein, G , S , I has the same meaning as the core sentence recognition Prompt template in step 210, c f is the paragraph text filtered by the tool constructed in step 220, O E represents the output format of the rule extraction and conversion task, which contains the rule source, i.e. the original text number identifier of the rule, the rule name, and the rule conversion result content; E X is a rule extraction result example, which is provided to the large language model for reference. The rule extraction and conversion Prompt template is specifically shown in Figure 8 .

[0105] Step 240: Combine the core sentence filtering tool, rule extraction and conversion Prompt template, and large language model to construct a policy rule extraction intelligent agent.

[0106] The rule extraction and conversion Prompt template constructed in step 230 P E , the tool constructed in step 220 T , and the large language model M , construct a policy rule extraction intelligent agent to realize the automation of the rule extraction process. The policy rule extraction intelligent agentA E The structure is represented as:

[0107] ;

[0108] wherein, denotes the passage text block with numbered identification input into the policy rule extraction agent.

[0109] The policy rule extraction agent guides and calls the core sentence screening tool through rule extraction conversion Prompt template T , uses large language model M to complete the screening of core sentences, rule element extraction and standardized expression, and forms easy-to-understand rule expressions.

[0110] Step 250: Based on the numbered passage block, extract the element information related to the policy rule, convert it into a standardized policy rule description, and obtain the corresponding original text content, forming a rule and original text mapping relationship.

[0111] First, for the set of numbered passage blocks in step 120 , the numbered passage block c i ' is input into the policy rule extraction agent in turn, and the standardized rule description and original text number set formed by extraction and conversion from the numbered passage block c i ' is obtained, denoted as:

[0112] ;

[0113] ;

[0114] In the above formula, denotes the rule description and the set of original text numbers obtained after the numbered passage block is input into the policy rule extraction agent; denotes the k th rule description extracted from the numbered passage block; denotes the k th rule description corresponding to the original text number, since a rule description may come from multiple sentences, therefore is denoted as a set, which may contain one or more numbers.

[0115] Then, according to the original text number, the original text content is obtained from the passage block text, and the text corresponding to each rule description is obtained, such as for the original text number , denoted as:

[0116] ;

[0117] ;

[0118] In the above formula, represents the policy rule description corresponding to the numbered paragraph block c i ' The complete text obtained from the numbered paragraph block is spliced by the corresponding text content of each numbered ;

[0119] Finally, the results of integrating all paragraph block texts are output, and then the policy rule and original text mapping set extracted from the entire electricity-related policy file is obtained R is represented as:

[0120] ;

[0121] In the above formula, rq represents the q th policy rule description in the entire electricity-related policy file, tq represents the original text content corresponding to the q th rule in the entire electricity-related policy file.

[0122] For example, the i th rule ri content is:

[0123] “Industrial and commercial user electricity price = on-grid electricity price + on-grid link line loss fee + transmission and distribution price + …”.

[0124] The original text content of the i th rule ti is:

[0125] “Industrial and commercial user electricity price = on-grid electricity price + on-grid link line loss fee + transmission and distribution price + system operation fee…”.

[0126] Step 300: Construct a historical policy rule description knowledge base, based on the standardized policy rule description and original text content, use a similarity retrieval method to find historical similar policy rule descriptions from the historical policy rule description knowledge base, and then use a policy rule comparison intelligent agent to perform deep semantic comparison and change analysis on the current standardized policy rule description and the historical similar policy rule description, identify the newly added and modified policy provisions, and output a structured change detail.

[0127] The electricity charge verification work is carried out according to relevant electricity charge policy documents, and the relevant electricity charge policy documents are constantly evolving and updating. If the differences between the new and old policy documents cannot be identified in time and the rules are updated, it will directly affect the development of the electricity charge verification work. In order to realize the effective inheritance and change analysis between the new and old policy rules, the application first establishes a historical policy rule description knowledge base, obtains historical similar policy rule descriptions based on semantic similarity retrieval, constructs a policy rule comparison intelligent agent to realize intelligent matching and change identification between the current rules and the historical rules, and outputs a structured policy change comparison analysis result as an important basis for updating the verification rules.

[0128] Step 310: Constructing a historical policy rule description knowledge base.

[0129] As an example, the step 310 can include:

[0130] Step 311: Extracting the description information and the corresponding identifier of the historical electricity charge verification rule from the table of the historical electricity charge verification rule in the electricity business database, to obtain a historical policy rule record set.

[0131] From the table of the historical electricity charge verification rule specially stored in the electricity business database, the description information and the corresponding unique identifier of the historical electricity charge verification rule are extracted id to form a complete historical policy rule record set R t , which is expressed as:

[0132] ;

[0133] Among them, desc i represents the text description content of the i th historical policy rule.

[0134] In order to improve the semantic consistency and text processing efficiency, all description information will be uniformly standardized, including removing redundant punctuation, removing leading and trailing white space characters, etc.

[0135] Step 312: Using a pre-trained vector embedding model to perform semantic coding on the historical policy rule record set to obtain historical policy rule description vectors, which are stored in the historical policy rule description knowledge base.

[0136] The pre-trained vector embedding model is used to perform semantic coding on the historical policy rule record set. Specifically, the text description content of each historical policy rule is desc i input into the pre-trained vector embedding model, which is expressed as:

[0137] ;

[0138] In the above formula,V i a history policy rule description vector, BGE a pre-trained model used.

[0139] In this way, the text description of all the history policy rules is converted into a multi-dimensional policy rule description vector, which can be used for text retrieval. Then, the policy rule description vector is stored in a vector database (such as FAISS, ChromaDB) and indexed to support subsequent similarity retrieval.

[0140] Step 320: Based on the standardized policy rule description and the original text content, a similarity retrieval method is used to find a history similar policy rule description from the history policy rule description knowledge base respectively.

[0141] In order to improve the accuracy and semantic coverage of the history similar policy rule retrieval, the application retrieves the history policy rule description according to the extracted policy rule description and the corresponding original text, so as to take into account the similarity calculation difference caused by different expression methods.

[0142] Specifically, for any rule and original text content in the policy rule and original text mapping set R obtained in step 250, first, it is converted into a vector form in the same way as step 312, represented as:

[0143] ;

[0144] ;

[0145] wherein, the embedding vector of the original text content t i the embedding vector of the policy rule description r i .

[0146] Secondly, the cosine similarity is calculated respectively between , and each history policy rule description vector in the history policy rule description knowledge base stored in step 312, and according to the similarity score, the K most similar vectors to and are extracted.

[0147] Finally, the history rule text corresponding to the similar vector of and is obtained, and is uniformly regarded as the history rule similar to the policy rule description r i , represented as:

[0148] ​ ;

[0149] wherein, represents the policy rule description r i retrieved most similar historical rules, represents the policy rule description r i retrieved most similar historical rules, represents the policy rule description r i a set of similar historical rules.

[0150] Step 330: Design a policy rule comparison analysis Prompt template based on historical similar policy rules.

[0151] To achieve the difference identification and change classification between the current policy rule and the historical similar policy rule, a policy rule comparison analysis Prompt template is designed to guide the large language model to compare and analyze the input similar historical policy rule item by item based on the understanding of the rule semantics, identify the change situation and output the structured comparison result, in which three similarity judgment results are designed, including complete consistency, high similarity and dissimilarity, corresponding to three rule change types, namely no change, modification and addition, and the specific conditions or contents of the modification are analyzed. The policy rule comparison analysis Prompt template is defined as P C , which is represented as:

[0152] ;

[0153] wherein, G , S , I have the same meaning as the Prompt template in step 230, r represents the input current policy rule description, R S r retrieved similar historical policy rules; O C represents the output format of the policy rule comparison analysis task, which includes the analysis explanation of the historical rule, the similarity judgment result of the historical rule, the judgment thinking process, the change analysis result and other contents; E C represents the result output example of the rule comparison analysis. The policy rule comparison analysis Prompt is specifically shown in Figure 9 .

[0154] Step 340: Construct a policy rule comparison intelligent agent combining the policy rule comparison analysis Prompt template and the large language model. ​

[0155] Policy rule comparison analysis Prompt template constructed in conjunction with step 330 P C and large language models M , a policy rule comparison agent is constructed to realize the automatic process of rule comparison and analysis. The structure of the policy rule comparison agent A C is represented as:

[0156] ;

[0157] wherein, r and R S have the same meanings as described in step 330.

[0158] Step 350: input the historical similar policy rule descriptions into the policy rule comparison agent to obtain deep semantic comparison and change analysis with similar historical rules, identify the newly added and modified policy provisions, and output the structured change details.

[0159] For the policy rule and original text mapping set R obtained in step 250, each standardized policy rule description and original text content is applied to the method described in step 320 to obtain similar historical policy rules, and is sequentially input into the policy rule comparison agent to obtain the comparison and analysis results between the historical policies, and finally obtain the change type and change detail results of all policy rules, the process is represented as:

[0160] ;

[0161] ;

[0162] In the above formula, and respectively represent the policy change type and change detail analysis results output by the policy rule comparison agent for the policy rule description r i and a certain historical similar policy rule description, wherein the change type includes modification and addition; CR represents the comparison and analysis results of all rules in the policy file. For example, the output is 2, which represents that the rule is a modification of the historical rule, contains its specific differences, such as the rule adding “xx” condition or modifying “xx” condition to “yy” condition.

[0163] Method effect display:

[0164] The effect of the present application is demonstrated by taking part of the content of a policy document related to the implementation of the power transmission and distribution price and the power grid enterprise agent electricity purchase work in a certain region as an example.

[0165] The result after analyzing the policy document through step 100 is shown in Figure 2 As can be seen, after analysis, the original policy document is divided into paragraphs with appropriate length, and title information and sentence number information are added, and the original hierarchical structure is retained.

[0166] Figure 3 The recognition result of the core sentence recognition can be seen. Based on the prompt of the core sentence recognition Prompt, the large language model identifies the input paragraph text, judges that the second sentence in the input is irrelevant, and only retains the sentence content related to the policy rules after identification.

[0167] Figure 4 The result of policy rule extraction can be seen. For the input filtered text, after the policy rule comparison analysis Prompt prompt, two policy rules are successfully extracted, and the original text statement is converted into a standardized and easy-to-understand rule description.

[0168] Figure 5 The effect of the rule extraction method of the present application and the direct use of a general large language model is compared, that is, the original document is directly input into the large language model, and the large language model is directly prompted to extract rules from the data, and the extracted rule content is output. Figure 5 As can be seen from the comparison, within the same input range, the rules extracted directly using the general large language model are more generalized, basically a repetition of the original text content, and some conditions are missing or inaccurate, while the results of the present application are relatively detailed and more accurate.

[0169] Figure 6 The results of the comparison and analysis of the historical policy rules are shown, including the input current policy rule, the retrieved set of similar historical policy rules, and the output result of the large language model. As can be seen, through the comparison and analysis method of the present application, it is successfully judged that this rule has been modified from the historical rule, and the new rule supplements the related description of "electricity capacity range and optional electricity price system".

[0170] The above examples are only used to illustrate the technical solutions of the present application, and are not intended to limit the present application; although the present application has been described in detail with reference to the foregoing examples, those skilled in the art should understand that the technical solutions recorded in the foregoing examples can be modified, or some technical features can be replaced by equivalent features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A method for extracting intelligent rules and comparing changes in policy documents for electricity fee verification, characterized by: The following steps are involved: Parse electricity fee-related policy documents, retain the contextual hierarchy and logical structure information of the original electricity fee-related policy documents during the parsing process, and optimize the parsed content; Design a core sentence recognition prompt template and build a policy rule extraction agent to identify core sentences from the optimized content, extract rule-related elements, convert them into standardized policy rule descriptions, and output them in correspondence with the original content. Build a historical policy rule description knowledge base. Based on the standardized policy rule description and the original content, search for similar historical policy rule descriptions from the historical policy rule description knowledge base. Then, build a policy rule comparison agent to perform in-depth semantic comparison and change analysis on the current standardized policy rule description and similar historical policy rule descriptions, identify new and modified policy clauses, and output structured change details. Among them, the design of the core statement recognition prompt template includes: The core statement recognition prompt template is defined as P R , expressed as: ; In the above formula, G Indicates the description of the set goal; Represents a numbered block of paragraph text entered; S Indicates the recognition step prompts given to guide the large language model to think and judge; I Indicates important matters that need to be paid special attention to; O R The output format of the core sentence recognition task is in JSON format, including the number of each sentence, the judgment result, and the thinking process. Build a policy rule extraction agent, including: Create a core statement screening tool based on the core statement identification prompt template T : ; Based on the filtered core statements, design rule extraction and conversion prompt template P E : ; Combining core sentence screening tools, rule extraction conversion prompt templates and large language models to build a policy rule extraction agent A E : ; in, M Represents a large language model; F Represents the sentence filtering process; c f Indicates the paragraph text after being filtered by the core sentence filtering tool; O E Indicates the output format of the rule extraction and transformation task; E X Indicates an example of rule extraction results, which is provided to the large language model for reference.

2. The method for extracting and comparing policy documents for electricity fee verification according to claim 1 is characterized in that: Parse electricity fee-related policy documents, including: Read the content of the electricity fee-related policy document, design a document content and structure parsing method, and parse the electricity fee-related policy document; wherein the design document content and structure parsing method includes: For Word documents, we use a parsing module based on python-docx to identify and decompose the text content structure of Word documents. The recognition results retain the original heading level and numbering structure of the Word documents, assign different type identifiers to the text content, and store the reading results in the order of the original Word documents as a collection containing document style attributes and corresponding content. For PDF documents, the PaddleOCR tool is used for alignment and recognition, and the page elements are semantically segmented using layout analysis technology to obtain the spatial position, text content and text type of each page's text blocks, and stored as a parsed content collection in the order of the original PDF document.

3. The method for extracting and comparing policy documents for electricity fee verification according to claim 1 is characterized in that: Optimize the parsed content, including: For each body paragraph in the parsed content, its title content and type are spliced ​​into the body paragraph to form a new body paragraph. Paragraphs longer than the preset length are divided into blocks according to the maximum block length; Each paragraph block is divided into sentences, and each sentence is numbered and then merged into paragraph text, that is, the numbered paragraph blocks.

4. The method for extracting and comparing policy documents for electricity fee verification according to claim 1 is characterized in that: Extract rule-related element information, convert it into a standardized policy rule description, and output it in correspondence with the original content, including: The numbered paragraph blocks are input into the policy rule extraction agent. The core sentence screening tool is used to identify the core sentences with rule characteristics. The agent is then used to extract specific rule elements from the core sentences and output them as standardized, element-clear policy rule expressions and corresponding original text numbers. The original text content is obtained from the paragraph block text according to the original text number, and the original text content corresponding to each policy rule description is obtained to form a mapping relationship between the rule and the original text.

5. The method for extracting and comparing policy documents with intelligent rules for electricity fee verification according to claim 1 is characterized in that: Construct a historical policy rule description knowledge base, and search for similar historical policy rule descriptions from the historical policy rule description knowledge base based on the standardized policy rule descriptions and the original content, including: Extract the description information and corresponding identifier of the historical power verification rules from the table of historical power verification rules id ,construct a knowledge base describing historical policy rules; Based on the policy rule descriptions extracted from policy documents and the corresponding original content, the similarity retrieval method is used to retrieve and obtain similar historical rule descriptions from the knowledge base, taking into account the similarity differences of different expressions.

6. The method for extracting and comparing changes in policy documents for electricity fee verification according to claim 5 is characterized in that: Constructing a policy rule comparison agent, including: Design a policy rule comparison and analysis prompt template based on historical similar policy rule descriptions P C : ; Build a policy rule comparison agent based on the constructed policy rule comparison analysis prompt template and large language model A C : ; in, G Indicates the description of the set goal; S Indicates the recognition step prompts given to guide the large language model to think and judge; I Indicates important matters in the settings; r Represents the current policy rule description of the input, R S for r Retrieve similar historical policy rules; O C Indicates the output format of the policy rule comparison analysis task, which includes the analysis description of historical rules, the similarity judgment results of historical rules, the judgment thinking process, and the content of the change analysis results; E C This shows an example output of rule comparison analysis results.

7. The method for extracting and comparing policy documents for electricity fee verification according to claim 6 is characterized in that: Identify new and modified policy clauses and output structured change details. The process is as follows: ; ; In the above formula, and Respectively represent the description of policy rules r i The policy rule description is similar to a historical one. The policy rule comparison agent outputs the policy change type and change details analysis results. Change types include modification and addition. CR Indicates the comparison and analysis results of all rules; R Si Indicates that the current policy rule description retrieves similar historical policy rules.

Citation Information

Patent Citations

  • Statistical method for key policies of electricity price

    CN112182248A

  • Policy text denoising and associated item extraction method and system based on large model

    CN118820403A