A label rule identification method and system based on large model dynamic knowledge enhancement

By constructing a multi-source vector library and combining it with large-model dynamic knowledge enhancement technology, the problem of low efficiency in label rule recognition in power business has been solved, achieving high-precision and high-recall label rule recognition, and improving the accuracy and adaptability of power business.

CN123178602APending Publication Date: 2026-11-27STATE GRID JIANGSU ELECTRIC POWER CO LTD MARKETING SERVICE CENT
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611477367.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-22
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In existing technologies, tag rule recognition in the power industry mainly relies on manual programming and fixed rule templates, which leads to low efficiency and difficulty in adapting to complex changes in business needs.

Method used

A dynamic knowledge enhancement approach based on a large model is adopted to construct three types of vector libraries: business knowledge, database table information, and SQL examples. By fusion of multi-source knowledge and calculation of error rate indicators based on historical query requirements, dynamic quality assessment and automatic reconstruction of the vector libraries are achieved, eliminating redundancy and improving semantic consistency. During real-time recall, a high-precision enhanced knowledge set is constructed by dynamically adjusting similarity thresholds and confidence ranking mechanisms.

Benefits of technology

It achieves high-precision and high-recall power tag rule recognition, ensuring the continuous accuracy and adaptability of the knowledge base, and significantly improving the accuracy and robustness of recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178602A_ABST
    Figure CN123178602A_ABST
Patent Text Reader

Abstract

A label rule identification method and system based on large model dynamic knowledge enhancement, comprising: constructing a business knowledge vector library, a library table information vector library and a SQL example vector library; expanding samples to generate multiple query requirements after learning historical query requirements using big data; calculating the similarity of all keyword semantic vectors corresponding to all query requirements of each vector library and the semantic vectors of all knowledge units in the corresponding vector library; calculating the error rate index based on the size relationship of all similarities and the set minimum and maximum similarity indicators; obtaining real-time query requirements, calculating the similarity between the semantic vector of each keyword and the semantic vector converted from all knowledge units in each vector library, and screening candidate knowledge units, and then recalling the candidate knowledge units based on the similarity, the error rate index and the average similarity of all knowledge units in the vector library. The present application significantly improves the accuracy and robustness of power price label rule identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of rule recognition technology, and more specifically, relates to a label rule recognition method and system based on dynamic knowledge enhancement of a large model. Background Technology

[0002] In the power industry, to accurately implement customer service, risk management, and strategies, it is necessary to assign various business tags to different customer groups based on massive amounts of electricity consumption data, such as customers with abnormal electricity consumption behavior or potential customers suitable for electricity packages. Existing query or identification generation methods primarily involve business analysts or data engineers with SQL programming skills manually interpreting business requirement documents and then manually writing corresponding database query statements; or using rule engines based on fixed rule templates or finite decision trees, where business personnel configure simple conditions through a graphical interface. These methods are all human-centric, transforming business logic described in natural language into structured query rules that can be executed by machines. Summary of the Invention

[0003] To address the shortcomings of existing technologies, this invention provides a label rule recognition method and system based on large-scale model dynamic knowledge enhancement.

[0004] The present invention adopts the following technical solution.

[0005] The first aspect of this invention proposes a label rule recognition method based on large-model dynamic knowledge enhancement, comprising: The acquired electricity price rules document, table structure metadata and field descriptions of the electricity marketing vector library, historical SQL tag rules and corresponding natural language descriptions are structured and extracted to obtain multiple knowledge units. The different knowledge units are converted into semantic vectors through text recognition algorithms and then stored in the business knowledge vector library, the database table information vector library and the SQL sample vector library respectively. The system obtains historical query requirements for each vector library, and expands the sample to generate multiple query requirements after learning from historical query requirements using big data. All query requirements are segmented and keywords are extracted using a sequence labeling model, and the keywords are converted into semantic vectors. The similarity between the semantic vectors of all keywords corresponding to all query requirements in each vector library and the semantic vectors of all knowledge units in the corresponding vector library is calculated. The error rate is calculated based on the relationship between all similarities and the set minimum and maximum similarity indices. The system acquires real-time query requests, segments the data into words, extracts keywords for the real-time queries, and converts them into semantic vectors. It then calculates the similarity between the semantic vector of each keyword and the semantic vectors converted from all knowledge units in each vector library. If the similarity of a knowledge unit in a vector library exceeds a set maximum similarity threshold, the corresponding knowledge unit is considered a candidate knowledge unit. If no candidate knowledge units exist in any vector library, the maximum similarity threshold is lowered, and identification is performed again. If fewer than three vector libraries contain candidate knowledge units, all candidate knowledge units are concatenated and combined into an enhanced knowledge set for recall. If candidate knowledge units exist in all three vector libraries, the confidence level of each candidate knowledge unit is calculated based on similarity, the error rate index of the corresponding vector library, and the average similarity of all knowledge units in the corresponding vector library. These candidate knowledge units are then sorted according to their confidence levels, and the first set number of candidate knowledge units are concatenated to form an enhanced knowledge set for recall.

[0006] Preferably, a business knowledge vector library is constructed, specifically as follows: Each rule in the electricity pricing rule document is segmented and keywords are extracted using a sequence labeling model to obtain the main entity, attribute name, attribute value, applicable conditions, and source of the rule as a first knowledge unit. The first knowledge units are then categorized according to their application domains. The similarity between any two first knowledge units in each category is calculated. Based on the main entity, attribute name, attribute value, and applicable conditions, redundancy and potential contradictions are determined between any two first knowledge units in each category. Different source priorities are assigned to different sources. If redundancy or potential contradictions exist between two first knowledge units, the one with the lower source priority is deleted. The remaining first knowledge units in the corresponding category are grouped into a second knowledge unit. All first knowledge units included in each second knowledge unit are considered to be in the same family. The semantic vectors derived from all first and second knowledge units are used to form a business knowledge vector library.

[0007] Preferably, a database table information vector library and an SQL sample vector library are constructed, specifically as follows: The table structure metadata and field descriptions of the power marketing vector library are segmented and keywords are extracted to generate third knowledge units. All third knowledge units are clustered into semantic vectors through multi-granularity clustering. All third knowledge units in each category form a fourth knowledge unit. All third knowledge units included in each fourth knowledge unit are knowledge units of the same family. The semantic vectors converted from all third knowledge units and fourth knowledge units are combined to form the table information vector library.

[0008] Preferably, an SQL sample vector library is constructed, specifically as follows: Historical SQL tag rules are mapped and paired with set natural language descriptions. Each pair is a sixth knowledge unit. The features of each sixth knowledge unit are extracted through an abstract syntax tree and used as a fifth knowledge unit. All sixth knowledge units included in each fifth knowledge unit are knowledge units of the same family. The semantic vectors transformed from all fifth and sixth knowledge units are used to form an SQL sample vector library.

[0009] Preferably, the redundancy between every two first knowledge units in each category is determined based on the main entity, attribute name, attribute value, and applicable conditions. Specifically: If the main entity, attribute name, and applicable conditions of two first knowledge units are the same, then the similarity of the semantic vectors transformed from the two first knowledge units is calculated. The similarity is cosine similarity. If the similarity of the semantic vectors of two first knowledge units exceeds the set maximum similarity threshold, then the corresponding two first knowledge units are redundant.

[0010] Preferably, the determination of whether there is a potential contradiction between every two first knowledge units in each category is based on the main entity, attribute name, attribute value, and applicable conditions, specifically as follows: If the subject entity and attribute name of two first knowledge units are the same, the subject-attribute alignment factor is 1; otherwise, it is 0. The applicable conditions of both first knowledge units are segmented into multiple atomic conditions using a sequence labeling algorithm. If an atomic condition is not a numerical condition, it is determined whether both first knowledge units contain the corresponding atomic condition. If so, the corresponding atomic condition is an overlapping condition. If an atomic condition is a numerical condition, it is determined whether the value ranges of the two numerical conditions have an intersection. If the intersection is not empty, the corresponding atomic condition is an overlapping condition. The sum of the total number of atomic conditions of the two first knowledge units is subtracted from the total number of overlapping conditions to obtain the total number of union conditions of the two first knowledge units. The total number of overlapping conditions is divided by the total number of union conditions to obtain the condition overlap degree. If the condition sets of both first knowledge units are empty, the condition overlap degree is 1. When both attribute values ​​are point values, the relative deviation between the two attribute values ​​is calculated and divided by the set tolerance. If the division result is greater than 1, the value contradiction factor is 1; otherwise, the value contradiction factor is the division result. When both attribute values ​​are intervals, if the two intervals intersect and the relative deviation of the interval center values ​​is less than the set tolerance, the value contradiction factor is 1. If the two intervals intersect and the relative deviation of the interval center values ​​is greater than or equal to the set tolerance, the value contradiction factor is the set incompatibility factor, which is less than 1. If the two intervals do not intersect, the distance between the two nearest endpoints of the intervals is calculated, and the distance between the nearest endpoints is divided by the maximum of the two interval widths. If the division result is greater than 1, the value contradiction factor is 1; if the division result is less than the set incompatibility factor, the value contradiction factor is the set incompatibility factor. If the division result is greater than or equal to the set incompatibility factor and less than or equal to 1, the value contradiction factor is the division result. Multiply the subject-attribute alignment factor, condition overlap, and value contradiction factor. If the result of the multiplication is greater than the set conflict threshold, then the two first knowledge units are considered to have a potential contradiction.

[0011] Preferably, the calculation of the error rate index based on the relationship between all similarities and the set minimum and maximum similarity indices specifically involves: If the similarity between the semantic vectors of all keywords corresponding to a query and the semantic vectors of all knowledge units contained in the corresponding vector library is less than the set minimum similarity threshold, then the query is considered to be an uncovered query; the similarity is cosine similarity. If more than n similarity scores between the semantic vector of a keyword and the semantic vectors of all knowledge units contained in the corresponding vector library are greater than or equal to the set maximum similarity threshold (where n is a fixed value), then the query requirement corresponding to the keyword is a fuzzy query requirement, and the knowledge units with similarity scores greater than or equal to the set maximum similarity threshold are set as similar knowledge units. If there is a similar knowledge unit that is not a member of the same family as any other similar unit and has no mapping relationship with any other similar unit, then the similar knowledge unit is an irrelevant knowledge unit. The error rate metric for the corresponding vector library is calculated by summing the number of requirements not covered by the vector library and the ratio of the number of irrelevant knowledge units to the number of similar knowledge units corresponding to all fuzzy query requirements, and then dividing by the total number of all query requirements related to the corresponding vector library. If the error rate metric of a vector library exceeds the set error rate threshold, the vector library is rebuilt.

[0012] Preferably, the confidence score of each candidate knowledge unit is calculated based on similarity, the error rate index of the corresponding vector library, and the average similarity of all knowledge units in the corresponding vector library, specifically as follows: The square of the error rate index of the corresponding vector library is multiplied by the set decay coefficient to obtain the exponent. The natural base e is used as the base to perform the exponentiation operation, and the result of the exponentiation operation is used as the library quality decay factor. The average similarity of all knowledge units in the corresponding vector library is multiplied by a set adjustment coefficient and then 1 is added. The ln function of the sum is used as the cohesion gain factor. The confidence level of the corresponding candidate knowledge unit is obtained by multiplying the similarity, the library quality decay factor, and the cohesion gain factor.

[0013] The second aspect of this invention proposes a tag rule recognition system based on large-model dynamic knowledge enhancement, using the method described in the first aspect of this invention. The system includes a vector library construction module, an error rate calculation module, and a recall module, specifically: Vector library construction module: The module extracts multiple knowledge units from the acquired electricity price rule documents, table structure metadata and field descriptions of the electricity marketing vector library, historical SQL tag rules and corresponding natural language descriptions. The different knowledge units are then converted into semantic vectors through text recognition algorithms and stored in the business knowledge vector library, the table information vector library and the SQL sample vector library respectively. Error rate calculation module: This module is used to obtain historical query requirements for each vector library, and expand the sample to generate multiple query requirements after learning from historical query requirements using big data; it performs word segmentation and keyword extraction on all query requirements through a sequence labeling model, and converts the keywords into semantic vectors; it calculates the similarity between the semantic vectors of all keywords corresponding to all query requirements in each vector library and the semantic vectors of all knowledge units in the corresponding vector library; and it calculates the error rate metric based on the relationship between all similarities and the set minimum and maximum similarity metrics. The recall module acquires real-time query requests, extracts keywords from the real-time queries after word segmentation, and converts them into semantic vectors. It calculates the similarity between the semantic vector of each keyword and the semantic vectors converted from all knowledge units in each vector library. If the similarity of a knowledge unit in a vector library exceeds a set maximum similarity threshold, the corresponding knowledge unit is considered a candidate knowledge unit. If no candidate knowledge units exist in any vector library, the maximum similarity threshold is lowered, and identification is performed again. If fewer than three vector libraries contain candidate knowledge units, all candidate knowledge units are concatenated and combined into an enhanced knowledge set for recall. If candidate knowledge units exist in all three vector libraries, the confidence level of each candidate knowledge unit is calculated based on similarity, the error rate index of the corresponding vector library, and the average similarity of all knowledge units in the corresponding vector library. The candidates are then sorted according to their confidence levels, and the first set number of candidate knowledge units are concatenated to form an enhanced knowledge set for recall.

[0014] A third aspect of the invention provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor performing steps using the label rule recognition method based on large model dynamic knowledge enhancement as described in the first aspect of the invention.

[0015] A fourth aspect of the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, uses the steps of the label rule recognition method based on large model dynamic knowledge enhancement described in the first aspect of the present invention.

[0016] The beneficial effects of this invention are as follows: Compared with the prior art, this invention achieves multi-source knowledge fusion by constructing three types of vector libraries: business knowledge, database table information, and SQL examples. It also uses historical query requirements to calculate error rate indicators for dynamic quality assessment and automatic reconstruction of the vector libraries, ensuring the continuous accuracy and adaptability of the knowledge base. Simultaneously, it employs a clustering and compression strategy for knowledge units of the same family to eliminate redundancy and detect potential contradictions, significantly reducing knowledge redundancy and improving semantic consistency. During real-time recall, it achieves high-precision, high-recall enhanced knowledge set construction through dynamic adjustment of similarity thresholds, multi-level candidate knowledge unit screening, and a confidence ranking mechanism combining similarity, database quality decay factors, and cohesion gain factors, significantly improving the accuracy and robustness of power tag rule recognition. Attached Figure Description

[0017] Figure 1 This is a flowchart of the label rule recognition method based on large model dynamic knowledge enhancement according to the present invention. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of this invention. The embodiments described in this application are merely some embodiments of this invention, and not all embodiments. Based on the spirit of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of this invention.

[0019] like Figure 1 As shown, Embodiment 1 of the present invention proposes a label rule recognition method based on large model dynamic knowledge enhancement, including: S1. The obtained electricity price rule document, table structure metadata and field descriptions of the electricity marketing vector library, historical SQL tag rules and corresponding natural language descriptions are extracted in a structured manner to obtain multiple knowledge units. The different knowledge units are converted into semantic vectors through text recognition algorithms and then stored in the business knowledge vector library, the database table information vector library and the SQL sample vector library respectively. It should be noted that the acquired electricity pricing rules document, table structure metadata and field descriptions of the electricity marketing vector library, historical SQL tag rules and corresponding natural language descriptions are multi-source heterogeneous knowledge, obtained from corresponding business systems, document libraries, and data platforms. The electricity pricing rules document contains content such as tiered pricing, peak-valley time-of-use pricing, and clean energy subsidy rules. Electricity billing terminology, including power regulation fees, basic fees, and meter readings, is collected from industry standard internal knowledge bases or historical work orders. The table structure metadata and field descriptions of the electricity marketing vector library, describing the field names, types, meanings, and relationships of core tables such as customers, meters, and bills, are obtained through a test vector library. Historically written SQL tag rules and corresponding natural language descriptions, such as rule codes and descriptions used to filter high-energy-consuming customers or suspected electricity thieves, are also included. The above knowledge forms the foundation for the knowledge enhancement of this invention. Its acquisition process is mainly completed through automated scripts accessing relevant vector libraries, file servers, and API interfaces to ensure the timeliness and completeness of the data.

[0020] S1.1 Construct a business knowledge vector library, specifically as follows: Each rule in the electricity pricing rule document is segmented and keywords are extracted using a sequence labeling model to obtain the main entity, attribute name, attribute value, applicable conditions, and source of the rule as a first knowledge unit; The first knowledge unit is a standardized five-tuple structure. ; The attribute name represents the entity attribute described by this knowledge unit, such as the power limit, electricity price, billing method, definition, etc., which is obtained by matching the predefined attribute dictionary with the sentence template; For attribute values, three types are distinguished and processed separately: numeric values ​​(including units) are extracted into numeric ranges. The point value is ; Classification and normalization into a standard tag set; Descriptive tags retain short text; This is a set of applicable conditions, representing the preconditions for the knowledge unit to take effect. It is a conjunction of logical conditions stored in the form of user type = resident, time period = peak time, region = Beijing, etc. To identify the source, record the document ID, paragraph number, and version number of this knowledge unit.

[0021] Classified according to the application areas of the first knowledge unit; It should be noted that the application domain L = {electricity price category, customer credit category, electricity consumption behavior category, electricity channel category}, and the classification can be directly based on manual annotation or by calculating the confidence score between each first knowledge unit and the category. :

[0022] in: This refers to the content obtained by concatenating all the text content of the first knowledge unit. The word set after Chinese word segmentation, for semantic vectors, For the set category l The set of domain feature words, This is a weighting coefficient, ranging from 0.6 to 0.8, emphasizing keyword matching to improve the interpretability and stability of the classification. The highest score among all categories is taken as the [weighting factor]. The category attribution; if the highest score is lower than the preset classification confidence threshold. If the result is not specified, it will be marked as "uncategorized" and transferred to the manual processing queue.

[0023] Calculate the similarity between any two first knowledge units in each category. Based on the main entity, attribute name, attribute value, and applicable conditions, determine whether there is redundancy or potential contradiction between any two first knowledge units in each category. Set different source priorities for different sources. If there is redundancy or potential contradiction between two first knowledge units, delete the one with the lower source priority. Combine the remaining first knowledge units in the corresponding category into a second knowledge unit. All first knowledge units included in each second knowledge unit are knowledge units of the same family. Combine the semantic vectors converted from all first knowledge units and second knowledge units into a business knowledge vector library.

[0024] In this preferred embodiment, the redundancy between every two first knowledge units in each category is determined based on the main entity, attribute name, attribute value, and applicable conditions. Specifically: If the main entity, attribute name, and applicable conditions of two first knowledge units are the same, that is =1;

[0025] in, i , j These are the indices of two knowledge units; the similarity between the semantic vectors derived from the two first knowledge units is calculated. The similarity is cosine similarity. If the similarity between the semantic vectors of two first knowledge units exceeds the set maximum similarity threshold, then the two corresponding first knowledge units are redundant. In this embodiment, the maximum similarity threshold is set between 0.9 and 0.95.

[0026] In this preferred embodiment, the determination of whether there is a potential contradiction between every two first knowledge units in each category is based on the main entity, attribute name, attribute value, and applicable conditions. Specifically: If the subject entity and attribute name of two first knowledge units are the same, the subject-attribute alignment factor is 1; otherwise, it is 0. The applicable conditions of two first knowledge units are segmented into multiple atomic conditions using a sequence labeling algorithm. For example, the condition "the type is residential electricity consumption > 200" is segmented into two atomic conditions: "the type is residential" and "electricity consumption > 200". If an atomic condition is not a numerical condition, it is determined whether both first knowledge units contain the corresponding atomic condition. If so, the corresponding atomic condition is an overlapping condition. If an atomic condition is a numerical condition, it is determined whether the value ranges of the two numerical conditions have an intersection. If the intersection is not empty, the corresponding atomic condition is an overlapping condition. The sum of the total number of atomic conditions of the two first knowledge units is subtracted from the total number of overlapping conditions to obtain the total number of conditions in the union of the two first knowledge units. The total number of overlapping conditions is divided by the total number of conditions in the union to obtain the condition overlap degree. If the condition sets of both first knowledge units are empty, the condition overlap degree is 1. Conditional overlap for:

[0027] in, This indicates the total number of overlapping conditions. Indicates the total number of union conditions; , Indicates the first i The, the j The conditions of each first knowledge unit are divided into an atomic condition set.

[0028] When both attribute values ​​are point values, the relative deviation between the two attribute values ​​is calculated and divided by the set tolerance. If the division result is greater than 1, the value contradiction factor is 1; otherwise, the value contradiction factor is the division result. When both attribute values ​​are intervals, if the two intervals intersect and the relative deviation of the interval center values ​​is less than the set tolerance, the value conflict factor is 1; if the two intervals intersect and the relative deviation of the interval center values ​​is greater than or equal to the set tolerance, the value conflict factor is the set incompatibility factor, which is less than 1. If the two intervals do not intersect, the distance between the two nearest endpoints of the intervals is calculated, and the distance between the nearest endpoints is divided by the maximum of the widths of the two intervals. If the result of the division is greater than 1, the value conflict factor is 1.

[0029] in: The distance between the nearest endpoints of the two intervals is denoted as . Interval width; If the division result is less than the set incompatibility, the value contradiction factor is the set incompatibility; if the division result is greater than or equal to the set incompatibility and less than or equal to 1, the value contradiction factor is the division result; the set incompatibility is 0.05.

[0030] It should be noted that the attribute values ​​used in this embodiment are represented as values ​​or ranges of electrical parameters; if the attribute values ​​are other cases, such as classification values ​​or descriptive values, a lightweight natural language inference model can be directly trained to calculate the probability of contradiction between two descriptive texts.

[0031] The subject-attribute alignment factor, conditional overlap, and value contradiction factor are multiplied together. If the result of the multiplication is greater than a set conflict threshold, then the two first knowledge units are considered to have a potential contradiction. In this embodiment, the conflict threshold is set between 0.80 and 0.85.

[0032] Knowledge units with higher authority levels are prioritized for retention. If the authority levels are the same, the version with the updated timestamp is retained. Deleted knowledge units are stored in the conflict history log for experts to review regularly in order to continuously optimize rule templates and threshold parameters.

[0033] S1.2 Constructs a vector library of table information and a vector library of SQL samples, specifically as follows: The table structure metadata and field descriptions of the power marketing vector library are segmented and keywords are extracted to generate third knowledge units. All third knowledge units are clustered into semantic vectors through multi-granularity clustering. All third knowledge units in each category form a fourth knowledge unit. All third knowledge units included in each fourth knowledge unit are knowledge units of the same family. The semantic vectors converted from all third knowledge units and fourth knowledge units are combined to form the table information vector library.

[0034] S1.3, Construct a SQL sample vector library, specifically as follows: Historical SQL tag rules are mapped and paired with set natural language descriptions. Each pair is a sixth knowledge unit. The features of each sixth knowledge unit are extracted through an abstract syntax tree and used as a fifth knowledge unit. All sixth knowledge units included in each fifth knowledge unit are knowledge units of the same family. The semantic vectors transformed from all fifth and sixth knowledge units are used to form an SQL sample vector library.

[0035] The process of extracting features for each sixth knowledge unit using an abstract syntax tree (AST) involves: using an SQL parser to convert SQL statements into an AST, extracting key features from the AST, including: query type, involved main and related tables, fields and operators in the WHERE clause, GROUP BY and ORDER BY clauses, aggregate functions, etc. These features are then organized into a structured text description, which constitutes the sixth knowledge unit. This process strips away specific values ​​and highlights the query pattern.

[0036] S2. Obtain the historical query requirements corresponding to each vector library, and expand the sample to generate multiple query requirements after learning the historical query requirements using big data; perform word segmentation and keyword extraction on all query requirements through a sequence labeling model, and convert the keywords into semantic vectors; calculate the similarity between the semantic vectors of all keywords corresponding to all query requirements in each vector library and the semantic vectors of all knowledge units in the corresponding vector library; calculate the error rate index based on the relationship between all similarities and the set minimum and maximum similarity indices. The query requirements refer to the information input needs of power system business personnel. These requirements include querying electricity customers' electricity usage behavior, credit rating, electricity charges, and SQL tag rules. Power system business personnel can then use this information to determine whether a customer meets the conditions of a specific electricity price rule or preferential package. For example, a query for electricity charges related to the business knowledge vector library could be: "Query the billing standard for the second tier of the residential tiered electricity price"; a query for customer credit ratings related to the database table information vector library could be: "Query the table where the customer's outstanding amount is stored". In this preferred embodiment, the calculation of the error rate index based on the relationship between all similarities and the set minimum and maximum similarity indices specifically involves: If the similarity between the semantic vectors of all keywords corresponding to a query and the semantic vectors of all knowledge units contained in the corresponding vector library is less than the set minimum similarity threshold, then the query is considered to be an uncovered query; the similarity is cosine similarity. If more than n similarity scores between the semantic vector of a keyword and the semantic vectors of all knowledge units contained in the corresponding vector library are greater than or equal to the set maximum similarity threshold (where n is a fixed value), then the query requirement corresponding to the keyword is a fuzzy query requirement, and the knowledge units with similarity scores greater than or equal to the set maximum similarity threshold are set as similar knowledge units. If there is a similar knowledge unit that is not a member of the same family as any other similar unit and has no mapping relationship with any other similar unit, then the similar knowledge unit is an irrelevant knowledge unit. It should be noted that the maximum similarity threshold here is not the maximum value that the similarity can reach (the maximum value that can be reached is 1), but rather that if the similarity exceeds this value, the text corresponding to the two vectors is considered to be synonymous; and different vector libraries can set different minimum similarity thresholds and maximum similarity thresholds.

[0037] The error rate metric for the corresponding vector library is calculated by summing the number of requirements not covered by the vector library and the ratio of the number of irrelevant knowledge units to the number of similar knowledge units corresponding to all fuzzy query requirements, and then dividing by the total number of all query requirements related to the corresponding vector library. If the error rate metric of a vector library exceeds the set error rate threshold, the vector library is rebuilt.

[0038] S3. Obtain real-time query requests (entered by relevant personnel through the interactive interface provided by the system), extract keywords from the real-time query after word segmentation, and convert them into semantic vectors. Calculate the similarity between the semantic vector of each keyword and the semantic vectors converted from all knowledge units in each vector library. If the similarity of a knowledge unit in a vector library exceeds the set maximum similarity threshold, the corresponding knowledge unit is a candidate knowledge unit. If no candidate knowledge units exist in any vector library, lower the maximum similarity threshold and re-identify. If fewer than three vector libraries contain candidate knowledge units, concatenate all candidate knowledge units to form an enhanced knowledge set for recall. If candidate knowledge units exist in all three vector libraries, calculate the confidence of each candidate knowledge unit based on similarity, the error rate index of the corresponding vector library, and the average similarity of all knowledge units in the corresponding vector library. Sort the candidates according to their confidence and concatenate the first set number of candidate knowledge units to form an enhanced knowledge set for recall.

[0039] In this preferred embodiment, the confidence score of each candidate knowledge unit is calculated based on similarity, the error rate index of the corresponding vector library, and the average similarity of all knowledge units in the corresponding vector library. Specifically: The square of the error rate index of the corresponding vector library is multiplied by the set decay coefficient to obtain the exponent. The natural base e is used as the base to perform the exponentiation operation, and the result of the exponentiation operation is used as the library quality decay factor. The average similarity of all knowledge units in the corresponding vector library is multiplied by a set adjustment coefficient and then 1 is added. The ln function of the sum is used as the cohesion gain factor. The confidence level of the corresponding candidate knowledge unit is obtained by multiplying the similarity, the library quality decay factor, and the cohesion gain factor.

[0040] The formula is:

[0041] in, The similarity between the semantic vectors of the i-th candidate knowledge unit and the keyword; This refers to the error rate metric for the corresponding vector library. The attenuation coefficient, ranging from 2 to 4, amplifies the penalty for high-error-rate knowledge bases. This causes the confidence of recall results to decrease exponentially when the error rate exceeds a certain level, significantly suppressing even high similarity. This non-linear penalty mechanism ensures automatic weight reduction for low-quality knowledge bases. This represents the average similarity between the semantic vectors of all knowledge units and their corresponding keywords in the vector library. The adjustment coefficient (ranging from 0.5 to 1.0) is obtained through natural logarithmic transformation. Converting cohesion into gain avoids numerical overflow and reflects diminishing marginal returns. (Exponential) By setting the value to 1.5 to 2.5, the effect of this gain is made slightly superlinear, highlighting the importance of consistency.

[0042] Embodiment 2 of the present invention proposes a label rule recognition system based on large model dynamic knowledge enhancement, which is based on the method described in Embodiment 1 of the present invention. The system includes a vector library construction module, an error rate calculation module, and a recall module, specifically: Vector library construction module: The module extracts multiple knowledge units from the acquired electricity price rule documents, table structure metadata and field descriptions of the electricity marketing vector library, historical SQL tag rules and corresponding natural language descriptions. The different knowledge units are then converted into semantic vectors through text recognition algorithms and stored in the business knowledge vector library, the table information vector library and the SQL sample vector library respectively. Error rate calculation module: This module is used to obtain historical query requirements for each vector library, and expand the sample to generate multiple query requirements after learning from historical query requirements using big data; it performs word segmentation and keyword extraction on all query requirements through a sequence labeling model, and converts the keywords into semantic vectors; it calculates the similarity between the semantic vectors of all keywords corresponding to all query requirements in each vector library and the semantic vectors of all knowledge units in the corresponding vector library; and it calculates the error rate metric based on the relationship between all similarities and the set minimum and maximum similarity metrics. The recall module acquires real-time query requests, extracts keywords from the real-time queries after word segmentation, and converts them into semantic vectors. It calculates the similarity between the semantic vector of each keyword and the semantic vectors converted from all knowledge units in each vector library. If the similarity of a knowledge unit in a vector library exceeds a set maximum similarity threshold, the corresponding knowledge unit is considered a candidate knowledge unit. If no candidate knowledge units exist in any vector library, the maximum similarity threshold is lowered, and identification is performed again. If fewer than three vector libraries contain candidate knowledge units, all candidate knowledge units are concatenated and combined into an enhanced knowledge set for recall. If candidate knowledge units exist in all three vector libraries, the confidence level of each candidate knowledge unit is calculated based on similarity, the error rate index of the corresponding vector library, and the average similarity of all knowledge units in the corresponding vector library. The candidates are then sorted according to their confidence levels, and the first set number of candidate knowledge units are concatenated to form an enhanced knowledge set for recall.

[0043] Embodiment 3 of the present invention proposes an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor performs the steps of the label rule recognition method based on large model dynamic knowledge enhancement described in Embodiment 1 of the present invention.

[0044] Embodiment 4 of the present invention proposes a computer-readable storage medium storing a computer program, which, when executed by a processor, uses the steps of the label rule recognition method based on large model dynamic knowledge enhancement described in Embodiment 1 of the present invention.

[0045] This disclosure can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of this disclosure.

[0046] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.

[0047] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.

[0048] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.

[0049] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the protection scope of the claims of the present invention.

Claims

1. A label rule recognition method based on large-scale model dynamic knowledge enhancement, characterized in that, include: The acquired electricity price rules document, table structure metadata and field descriptions of the electricity marketing vector library, historical SQL tag rules and corresponding natural language descriptions are structured and extracted to obtain multiple knowledge units. The different knowledge units are converted into semantic vectors through text recognition algorithms and then stored in the business knowledge vector library, the database table information vector library and the SQL sample vector library respectively. The system obtains historical query requirements for each vector library, and expands the sample to generate multiple query requirements after learning from historical query requirements using big data. All query requirements are segmented and keywords are extracted using a sequence labeling model, and the keywords are converted into semantic vectors. The similarity between the semantic vectors of all keywords corresponding to all query requirements in each vector library and the semantic vectors of all knowledge units in the corresponding vector library is calculated. The error rate is calculated based on the relationship between all similarities and the set minimum and maximum similarity indices. Get real-time query requirements, extract keywords for real-time queries after word segmentation and convert them into semantic vectors. Calculate the similarity between the semantic vector of each keyword and the semantic vectors converted from all knowledge units in each vector library. If the similarity of knowledge units in a vector library exceeds the set maximum similarity threshold, the corresponding knowledge unit is a candidate knowledge unit. If no candidate knowledge units are found in any of the vector libraries, the maximum similarity threshold is lowered and identification is performed again. If fewer than three vector libraries contain candidate knowledge units, all candidate knowledge units are concatenated and combined into an enhanced knowledge set for recall. If all three vector libraries contain candidate knowledge units, the confidence level of each candidate knowledge unit is calculated based on similarity, the error rate index of the corresponding vector library, and the average similarity of all knowledge units in the corresponding vector library. The candidates are then sorted according to their confidence levels, and the first set number of candidate knowledge units are concatenated to form an enhanced knowledge set for recall.

2. The label rule recognition method based on large model dynamic knowledge enhancement according to claim 1, characterized in that: The business knowledge vector library is constructed as follows: Each rule in the electricity pricing rule document is segmented and keywords are extracted using a sequence labeling model to obtain the main entity, attribute name, attribute value, applicable conditions, and source of the rule as a first knowledge unit. The first knowledge units are then categorized according to their application domains. The similarity between any two first knowledge units in each category is calculated. Based on the main entity, attribute name, attribute value, and applicable conditions, redundancy and potential contradictions are determined between any two first knowledge units in each category. Different source priorities are assigned to different sources. If redundancy or potential contradictions exist between two first knowledge units, the one with the lower source priority is deleted. The remaining first knowledge units in the corresponding category are grouped into a second knowledge unit. All first knowledge units included in each second knowledge unit are considered to be in the same family. The semantic vectors derived from all first and second knowledge units are used to form a business knowledge vector library.

3. The label rule recognition method based on large model dynamic knowledge enhancement according to claim 2, characterized in that: Construct a vector library of database table information and a vector library of SQL samples, specifically as follows: The table structure metadata and field descriptions of the power marketing vector library are segmented and keywords are extracted to generate third knowledge units. All third knowledge units are clustered into semantic vectors through multi-granularity clustering. All third knowledge units in each category form a fourth knowledge unit. All third knowledge units included in each fourth knowledge unit are knowledge units of the same family. The semantic vectors converted from all third knowledge units and fourth knowledge units are combined to form the table information vector library.

4. The label rule recognition method based on large model dynamic knowledge enhancement according to claim 3, characterized in that: The SQL sample vector library is constructed as follows: Historical SQL tag rules are mapped and paired with set natural language descriptions. Each pair is a sixth knowledge unit. The features of each sixth knowledge unit are extracted through an abstract syntax tree and used as a fifth knowledge unit. All sixth knowledge units included in each fifth knowledge unit are knowledge units of the same family. The semantic vectors transformed from all fifth and sixth knowledge units are used to form an SQL sample vector library.

5. The label rule recognition method based on large model dynamic knowledge enhancement according to claim 4, characterized in that: Based on the main entity, attribute name, attribute value, and applicable conditions, determine whether there is redundancy between every two first knowledge units in each category, specifically as follows: If the main entity, attribute name, and applicable conditions of two first knowledge units are the same, then the similarity of the semantic vectors transformed from the two first knowledge units is calculated. The similarity is cosine similarity. If the similarity of the semantic vectors of two first knowledge units exceeds the set maximum similarity threshold, then the corresponding two first knowledge units are redundant.

6. The label rule recognition method based on large model dynamic knowledge enhancement according to claim 4, characterized in that: Based on the main entity, attribute name, attribute value, and applicable conditions, determine whether there is a potential contradiction between every two first knowledge units in each category, specifically as follows: If the subject entity and attribute name of two first knowledge units are the same, the subject-attribute alignment factor is 1; otherwise, it is 0. The applicable conditions of the two first knowledge units are segmented into multiple atomic conditions using the sequence labeling algorithm. If an atomic condition is not a numerical condition, it is determined whether both first knowledge units contain the corresponding atomic condition. If so, the corresponding atomic condition is an overlapping condition. If an atomic condition is a numerical condition, it is determined whether the value ranges of the two numerical conditions have an intersection. If the intersection is not empty, the corresponding atomic condition is an overlapping condition. The sum of the total number of atomic conditions of the two first knowledge units minus the total number of overlapping conditions yields the total number of union conditions of the two first knowledge units. The degree of condition overlap is calculated by dividing the total number of overlapping conditions by the total number of conditions in the union. If the condition sets of both first knowledge units are empty, the condition overlap is 1; When both attribute values ​​are point values, the relative deviation between the two attribute values ​​is calculated and divided by the set tolerance. If the division result is greater than 1, the value contradiction factor is 1; otherwise, the value contradiction factor is the division result. When both attribute values ​​are intervals, if the two intervals intersect and the relative deviation of the interval center values ​​is less than the set tolerance, the value contradiction factor is 1. If the two intervals intersect and the relative deviation of the interval center values ​​is greater than or equal to the set tolerance, the value contradiction factor is the set incompatibility factor, which is less than 1. If the two intervals do not intersect, the distance between the two nearest endpoints of the intervals is calculated, and the distance between the nearest endpoints is divided by the maximum of the two interval widths. If the division result is greater than 1, the value contradiction factor is 1; if the division result is less than the set incompatibility factor, the value contradiction factor is the set incompatibility factor. If the division result is greater than or equal to the set incompatibility factor and less than or equal to 1, the value contradiction factor is the division result. Multiply the subject-attribute alignment factor, condition overlap, and value contradiction factor. If the result of the multiplication is greater than the set conflict threshold, then the two first knowledge units are considered to have a potential contradiction.

7. The label rule recognition method based on large model dynamic knowledge enhancement according to claim 4, characterized in that: The error rate metric is calculated based on the relationship between all similarities and the set minimum and maximum similarity indices, specifically as follows: If the similarity between the semantic vectors of all keywords corresponding to a query and the semantic vectors of all knowledge units contained in the corresponding vector library is less than the set minimum similarity threshold, then the query is considered to be an uncovered query; the similarity is cosine similarity. If more than n similarity scores between the semantic vector of a keyword and the semantic vectors of all knowledge units contained in the corresponding vector library are greater than or equal to the set maximum similarity threshold, where n is a fixed value, then the query requirement corresponding to the keyword is a fuzzy query requirement, and the knowledge units with similarity scores greater than or equal to the set maximum similarity threshold are set as similar knowledge units. If a similar knowledge unit is not a family of similar units with any other similar units and there is no mapping relationship between them, then the similar knowledge unit is an unrelated knowledge unit. The error rate metric for the corresponding vector library is calculated by summing the number of requirements not covered by the vector library and the ratio of the number of irrelevant knowledge units to the number of similar knowledge units corresponding to all fuzzy query requirements, and then dividing by the total number of all query requirements related to the corresponding vector library. If the error rate metric of a vector library exceeds the set error rate threshold, the vector library is rebuilt.

8. The label rule recognition method based on large model dynamic knowledge enhancement according to claim 4, characterized in that: The confidence score of each candidate knowledge unit is calculated based on similarity, the error rate metric of the corresponding vector library, and the average similarity of all knowledge units in the corresponding vector library. Specifically: The square of the error rate index of the corresponding vector library is multiplied by the set decay coefficient to obtain the exponent. The natural base e is used as the base to perform the exponentiation operation, and the result of the exponentiation operation is used as the library quality decay factor. The average similarity of all knowledge units in the corresponding vector library is multiplied by a set adjustment coefficient and then 1 is added. The ln function of the sum is used as the cohesion gain factor. The confidence level of the corresponding candidate knowledge unit is obtained by multiplying the similarity, the library quality decay factor, and the cohesion gain factor.

9. A label rule recognition system based on large-model dynamic knowledge enhancement according to the method of any one of claims 1-8, comprising a vector library construction module, an error rate index calculation module, and a recall module, characterized in that: Vector library construction module: The module extracts multiple knowledge units from the acquired electricity price rule documents, table structure metadata and field descriptions of the electricity marketing vector library, historical SQL tag rules and corresponding natural language descriptions. The different knowledge units are then converted into semantic vectors through text recognition algorithms and stored in the business knowledge vector library, the table information vector library and the SQL sample vector library respectively. Error rate calculation module: This module is used to obtain historical query requirements for each vector library, and expand the sample to generate multiple query requirements after learning from historical query requirements using big data; it performs word segmentation and keyword extraction on all query requirements through a sequence labeling model, and converts the keywords into semantic vectors; it calculates the similarity between the semantic vectors of all keywords corresponding to all query requirements in each vector library and the semantic vectors of all knowledge units in the corresponding vector library; and it calculates the error rate metric based on the relationship between all similarities and the set minimum and maximum similarity metrics. Recall module: Get real-time query requirements, extract keywords of real-time queries after word segmentation and convert them into semantic vectors, calculate the similarity between the semantic vector of each keyword and the semantic vectors converted from all knowledge units in each vector library. If the similarity of knowledge units in a vector library exceeds the set maximum similarity threshold, the corresponding knowledge unit is a candidate knowledge unit. If no candidate knowledge units are found in any of the vector libraries, the maximum similarity threshold is lowered and identification is performed again. If fewer than three vector libraries contain candidate knowledge units, all candidate knowledge units are concatenated and combined into an enhanced knowledge set for recall. If all three vector libraries contain candidate knowledge units, the confidence level of each candidate knowledge unit is calculated based on similarity, the error rate index of the corresponding vector library, and the average similarity of all knowledge units in the corresponding vector library. The candidates are then sorted according to their confidence levels, and the first set number of candidate knowledge units are concatenated to form an enhanced knowledge set for recall.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor performs the steps of the label rule recognition method based on large model dynamic knowledge enhancement as described in any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, uses the steps of the label rule recognition method based on large model dynamic knowledge enhancement as described in any one of claims 1 to 8.