Method and device for dynamically updating policy atlas
By updating the policy knowledge graph using keyword rules and semantic vector similarity calculations, the policy knowledge graph is dynamically updated. This solves the problems of poor timeliness of static graphs and decreased accuracy of semantic models caused by frequent policy changes, and achieves efficient, accurate policy graph updates and long-term stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-31
- Publication Date
- 2026-04-10
AI Technical Summary
Existing policy knowledge graph systems cannot achieve continuous, accurate, and efficient dynamic updates, cannot adapt to frequent and dynamic policy changes, and static semantic models cannot learn new terms and semantics, resulting in poor timeliness of graph content and reduced processing accuracy.
By acquiring policy documents, using a pre-defined rule base for updating keywords and semantic vector similarity calculations to determine document updates, accumulating vocabulary or semantic changes, incrementally training a semantic model, and automatically updating the historical policy graph, combined with conflict resolution rules and version chain management, dynamic updates of the graph are achieved.
It enables continuous and efficient updating of the policy knowledge graph, reduces the maintenance cost throughout the entire lifecycle, enhances the system's adaptability to the dynamic policy environment and its long-term operational stability, and ensures the logical consistency of the graph and the complete historical context of policy evolution.
Smart Images

Figure CN121833971A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing and artificial intelligence, and particularly relates to a policy graph dynamic updating method and device. BACKGROUND
[0002] The number of policy documents published by governments and various institutions is huge and updated frequently, and there are complex association relationships such as reference, replacement and supplement between the documents. How to efficiently and accurately extract structured knowledge from massive and dynamic policy texts, and systematically analyze the policy system, has become an important demand in public management, industrial research and enterprise strategic decision-making.
[0003] In the traditional method, the arrangement and analysis of policy information mainly rely on manual completion, which is low in efficiency and difficult to ensure comprehensiveness and timeliness. In recent years, with the development of natural language processing (NLP) and knowledge graph technology, there appears a scheme of constructing a policy knowledge graph by using automatic technology. This kind of scheme usually identifies entities (such as policy name, issuing agency, theme) and relationships (such as publishing, about, reference) from policy texts through information extraction technology, and stores and displays them in a graph structure, thereby supporting policy query, association analysis and impact assessment.
[0004] However, the existing policy knowledge graph system faces significant challenges in practical application. First, the policy environment is dynamic, with new policies being published and old policies being revised or abolished. However, the existing knowledge graph is mostly constructed statically, i.e., based on a policy snapshot at a certain time point, lacking an effective incremental updating mechanism. When new policies are introduced, technical personnel often need to manually collect data, adjust information extraction rules or models, and trigger a time-consuming and lengthy full graph reconstruction process, which results in a serious lag of graph content from reality, failing to meet the requirements of high timeliness in policy application scenarios.
[0005] Secondly, the semantic models supporting knowledge graph construction (such as models for entity recognition, relationship extraction and text vectorization) are usually fixed after one-time training and deployment. New professional terms (such as "new quality productivity" and "data elements") emerge in the policy field, and the connotation of policy language may also evolve over time. Static semantic models cannot adapt to such changes, resulting in a decrease in the accuracy of understanding and extraction of new policy texts, and further affecting the quality of incremental updates.
[0006] In summary, the existing technology cannot realize the continuous, accurate and efficient dynamic updating of policy knowledge graph, which is the main bottleneck restricting its greater value in practical application. SUMMARY
[0007] In order to overcome the defects in the prior art, the first object of the present application is to provide a policy graph dynamic updating method to solve the problem that the existing static graph construction method cannot adapt to the frequent and dynamic changes of policies, resulting in poor timeliness of graph content, and the problem of decline in processing accuracy caused by the semantic model supporting graph construction failing to learn new terms and new semantics. The second object of the present application is to provide a policy graph dynamic updating device for implementing the above method, so as to reduce the maintenance cost of the whole life cycle of the policy knowledge graph and improve the self-adaptive ability of the system to the dynamic environment and the stability of long-term operation.
[0008] In order to achieve the above object, the technical solution adopted by the present application is:
[0009] The first aspect: a policy graph dynamic updating method, comprising:
[0010] Obtaining a policy document, obtaining a historical associated document according to the obtained policy document, judging whether the policy document constitutes an update document of the historical associated document based on the matching of a preset update keyword rule library and / or the similarity calculation of semantic vectors;
[0011] If it is determined to constitute an update document, extracting second knowledge of the update document through a preset first semantic model, collecting the update document, and accumulating the amount of vocabulary or semantic changes based on the update document;
[0012] When the accumulated amount of vocabulary or semantic changes meets a preset model training trigger condition, incrementally training the first semantic model based on the collected update document and the historical document, obtaining a second semantic model and replacing the first semantic model;
[0013] Updating the historical policy graph based on the second knowledge to generate a target policy graph, and replacing the historical policy graph with the target policy graph.
[0014] Optionally, the matching based on the preset update keyword rule comprises:
[0015] Extracting the text content of the policy document;
[0016] Matching the text content with a preset update keyword rule; wherein the update keyword rule contains a preset sentence pattern or keyword for indicating policy replacement, revision or abolition, and if the matching is successful, it is determined that the policy document constitutes an update document.
[0017] Optionally, the similarity calculation based on semantic vectors comprises:
[0018] Generating a first semantic vector of the policy document and a second semantic vector of the historical document using an encoding model;
[0019] calculating a similarity between the first semantic vector and the second semantic vector;
[0020] if the similarity is lower than a preset threshold, determining that the policy document constitutes an update document.
[0021] Optionally, the accumulated lexical or semantic change amount satisfies a preset model training triggering condition, including at least one of the following:
[0022] counting a number of occurrences of a new term appearing in the collected update documents and not contained in a preset domain dictionary, and if the number of occurrences exceeds a first threshold, determining that the model training triggering condition is satisfied;
[0023] or, selecting a core term from the collected update documents, calculating a distance between a first term vector of the core term in the collected update documents and a second term vector of the core term in historical documents, and if the distance exceeds a second threshold, determining that the model training triggering condition is satisfied.
[0024] Optionally, the first semantic model is incrementally trained based on the collected update documents and the historical documents to obtain a second semantic model, including:
[0025] based on the collected update documents and sample documents extracted from the historical documents, constructing a training data set;
[0026] freezing the remaining model parameters of the first semantic model except for a top network layer and a word embedding layer;
[0027] updating the parameters of the top network layer and the word embedding layer using the training data set to obtain the second semantic model.
[0028] Optionally, the method further includes:
[0029] after obtaining the second semantic model, respectively running the first semantic model and the second semantic model on a preset evaluation data set;
[0030] based on the running results, respectively calculating a first evaluation value corresponding to the first semantic model and a second evaluation value corresponding to the second semantic model; wherein the first evaluation value and the second evaluation value are calculated based on the same at least one preset evaluation index;
[0031] if the second evaluation value is better than the first evaluation value and exceeds a preset evaluation threshold, determining that the performance evaluation is passed, and replacing the first semantic model with the second semantic model.
[0032] Optionally, the second knowledge is used to update a historical policy graph to generate a target policy graph, including:
[0033] aligning a second entity and a second relationship included in the second knowledge with a first entity in the historical policy graph;
[0034] adding, based on the alignment result, the second entity and the second relationship that do not exist in the historical policy graph to the historical policy graph.
[0035] Optionally, in the process of updating the historical policy graph to generate the target policy graph, conflicts are handled according to preset conflict resolution rules, including:
[0036] when the second relationship to be added and the first relationship in the historical policy graph constitute a logical conflict between the same entity pairs, performing conflict resolution;
[0037] The conflict resolution includes: obtaining attribute information of the source policies corresponding to the relationships on both sides of the conflict, and determining the relationship that should be finally retained according to the attribute information and according to a preset priority rule;
[0038] The attribute information includes the effective time and the publishing agency level of the policy, and the priority rule includes: the priority of the policy with a later effective time is higher, and / or the priority of the policy with a higher publishing agency level is higher.
[0039] Optionally, after the relationship that should be finally retained is determined according to the preset priority rule, the method further includes:
[0040] adding a historical state identifier to the first relationship that is replaced or covered in the historical policy graph, and establishing a version link from the relationship that should be finally retained to the first relationship.
[0041] Optionally, after the historical policy graph is replaced by the target policy graph, the method further includes:
[0042] performing a graph query for checking isolated nodes and / or contradictory relationships on the target policy graph to perform consistency checking.
[0043] In a second aspect, a policy graph dynamic updating apparatus includes:
[0044] The comparison unit is configured to obtain policy documents, obtain historical associated documents according to the obtained policy documents, and determine whether the policy documents constitute update documents of the historical associated documents based on matching of a preset update keyword rule library and / or based on similarity calculation of semantic vectors.
[0045] The processing and accumulation unit is configured to, if it is determined that the policy documents constitute update documents, extract second knowledge of the update documents by using a preset first semantic model, aggregate the update documents, and accumulate a lexical or semantic change amount based on the update documents.
[0046] The model training unit is used to incrementally train the first semantic model based on the collected updated documents and historical documents to obtain the second semantic model when the accumulated vocabulary or semantic changes meet the preset model training trigger conditions.
[0047] The updating unit is configured to update the historical policy graph based on the second knowledge to generate a target policy graph, replace the historical policy graph with the target policy graph, and replace the first semantic model with the second semantic model.
[0048] Thirdly, an electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the aforementioned policy map dynamic update method.
[0049] Fourthly, a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the aforementioned method for dynamically updating the policy map.
[0050] Due to the application of the above technical solution, the present invention has the following advantages compared with the prior art:
[0051] 1. This application constructs a complete automated process from data perception, knowledge extraction, model self-evolution to knowledge fusion and services. Through a collaborative mechanism of "data addition - model fine-tuning - graph update", the system can automatically complete the synchronous evolution from underlying semantic understanding to upper-level knowledge structure after detecting policy changes, significantly reducing the manual intervention and full reconstruction costs required in traditional methods, enabling the policy knowledge graph to continuously and efficiently track the dynamic changes in the real world.
[0052] 2. By combining matching based on preset update keyword rules and similarity calculation based on semantic vectors, the system establishes a multi-layered update document recognition mechanism. This method can not only quickly and accurately capture explicitly declared "explicit updates" (such as repeals and revisions) in policy texts, but also sensitively discover "implicit updates" (i.e., substantive revisions) without explicit declarations through deep semantic comparison. This overcomes the problem of missed detections that may be caused by relying solely on metadata or simple text comparison, providing more reliable data input for subsequent processing.
[0053] 3. By setting model training trigger conditions based on the frequency of new terminology occurrences or semantic drift of core terms, and employing a sliding window dataset incorporating historical documents for efficient parameter fine-tuning, the first semantic model can continuously learn new knowledge and semantics in the policy domain at a relatively low cost. This enables the second semantic model to better retain existing knowledge while absorbing new information, mitigating the problem of catastrophic forgetting, thereby ensuring the system's long-term and accurate understanding and extraction capabilities for emerging new policy terms and evolving semantics.
[0054] 4. When integrating second knowledge into the historical policy graph, knowledge conflicts are automatically handled through preset conflict resolution rules (such as priority rulings based on effective time and issuing agency level), and the historical state and evolution path of the replacement relationship are preserved through version chain management. This not only ensures the consistency of the internal logic of the graph after dynamic updates, but also maintains the complete historical context of policy evolution, enhancing the authority and credibility of the knowledge graph.
[0055] 5. By independently and timely deploying the updated target policy map and the evaluated second semantic model to the online service environment, the system can provide the latest policy knowledge content in near real-time and offer more accurate analytical capabilities using continuously optimized models. Combined with maintenance processes such as consistency verification and multi-storage synchronization after replacement, an operation and maintenance system that balances immediate incremental updates with regular in-depth maintenance is formed, thereby improving the timeliness, accuracy, and long-term operational stability of the system's external services as a whole.
[0056] To make the above and other objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0057] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0058] Figure 1 This is a flowchart of the policy map dynamic update method in an embodiment of the present invention. Detailed Implementation
[0059] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0060] Example 1: See Figure 1 As shown, a method for dynamically updating a policy map includes:
[0061] S1. Obtain policy documents, obtain historical related documents based on the obtained policy documents, and determine whether the policy documents constitute updated documents of historical related documents based on matching of preset update keyword rule base and / or similarity calculation based on semantic vectors.
[0062] Specifically, the system retrieves the latest policy documents from pre-configured policy data sources (such as official websites of government departments at all levels and designated information release platforms) periodically or in an event-driven manner by deploying web crawlers or calling application programming interfaces (APIs). For a newly retrieved policy document, the system first searches for a previously retrieved and stored version in a persistent document repository, which can be deployed on a local server or in the cloud, based on information such as Uniform Resource Locator (URL), policy document number, or title similarity. This version is denoted as a "historical associated document." If no corresponding historical associated document is found, the system directly determines that the policy document is a new document and treats it as a special type of updated document. If a corresponding historical associated document is found, the system initiates subsequent processes to determine whether the policy document constitutes an update to that historical associated document.
[0063] In one optional implementation, the judgment process includes at least one of the following methods: matching based on a preset updated keyword rule base, and / or similarity calculation based on semantic vectors. More preferably, the system firstly uses matching based on the preset updated keyword rule base, and if the matching fails, it further uses similarity calculation based on semantic vectors for judgment.
[0064] The matching based on preset keyword update rules includes:
[0065] S101. Extract the main text of the policy document.
[0066] Specifically, the system needs to extract the main text for comparison from the acquired policy documents. Since policy documents may have various formats (e.g., HTML web pages, PDF files, or scanned images), the extraction process typically includes necessary preprocessing steps.
[0067] In an optional implementation, the preprocessing operation may include:
[0068] 1. Format Conversion and Text Conversion: For documents that are not plain text, the system first converts them into a processable text format. For example, for HTML web pages, the text is obtained by parsing the Document Object Model (DOM) tree structure and removing non-content tags such as scripts and style sheets; for PDFs or scanned documents, the text images are converted into machine-readable text sequences using Optical Character Recognition (OCR) technology.
[0069] 2. Content Cleaning and Noise Removal: After obtaining the initial text, the system further removes noise content unrelated to the core semantics of the policy text. This noise may include webpage headers, footers, navigation bars, advertising information, irrelevant annotations, or watermark text. Through rule-based location filtering, tag recognition, or machine learning model classification, the system can filter out the core text that represents the policy clauses, regulations, and explanations.
[0070] After the above preprocessing, the system finally obtains the clean text content of the policy document for subsequent comparison. The text content mainly includes policy clauses, regulations, explanations, and other textual information that constitutes the semantic body of the policy.
[0071] S102. Match the main text content with the preset update keyword rules. If the match is successful, determine that the policy document constitutes an update document to be processed.
[0072] Specifically, the main text content is matched against a pre-built update keyword rule base. The construction of this update keyword rule base can be achieved through a combination of domain knowledge induction and automated extraction. On one hand, domain experts summarize and input a series of keywords and sentence patterns with clear change semantics based on common legal and administrative expressions used in policy releases and revisions, such as "repealed," "replaced," "revised to," "effective from...the original...is repealed simultaneously," etc., and these patterns can be converted into regular expression templates. On the other hand, the system can analyze known "revision-revised" or "replacement-replaced" document pairs in historical policy documents, and automatically learn and supplement frequently occurring, distinctive change instruction text patterns using natural language processing techniques (such as sequence alignment and pattern mining), thereby enriching the rule base.
[0073] The update keyword rules include a series of preset sentence templates or keyword sets used to indicate policy changes such as replacement, revision, or repeal. For example, they may include regular expression rules matching phrases such as "Effective from...; the original '...' is simultaneously repealed," or "The following amendments are made to '...'," or rules containing keywords such as "repealed," "revised," or "replaced by." If any update keyword rule is successfully matched in the text, the system determines that the policy document constitutes an update document to be processed. This type of update can be classified as an explicit update, and its determination is directly based on the explicit declaration of the intention to change contained in the policy text. In this way, the system can quickly identify explicitly declared changes in the policy text.
[0074] If no updated keyword rule is matched in the main text, or if the confidence level of the matched rule is below a certain threshold, the system determines that the rule-based matching has failed. For policy documents that do not contain such explicit declarations but whose content may have undergone substantial modifications, the system further determines the issue through semantic vector-based similarity calculations as described below. Semantic vector-based similarity calculations analyze the policy content from an overall semantic perspective, specifically including the following steps:
[0075] S103. Using the coding model, generate the first semantic vector of the policy document and the second semantic vector of the historical associated document respectively.
[0076] The system invokes a pre-trained encoding model. This encoding model is a deep learning model trained on a large amount of text data. Its core function is to transform (or "encode") an input text of arbitrary length (such as a policy document) into a fixed-length, high-dimensional numerical array, which is the semantic vector, also known as the text embedding vector. The position of this vector in the mathematical space represents the deep semantic features of the input text. Texts with similar semantics have vectors that are closer in distance in this space. In an optional implementation, the encoding model can be a model pre-trained on a large-scale general corpus and further fine-tuned on policy domain texts, such as the BERT model based on the Transformer architecture or its variants.
[0077] In practice, the system inputs the clean text of the policy document obtained after preprocessing in step S101 into the encoding model. The encoding model then uses a multi-layered neural network to calculate and output a first semantic vector representing the overall semantics of the document. Simultaneously, the clean text of related historical documents is input into the same encoding model, and a second semantic vector representing the semantics of the historical versions is output.
[0078] S104. Calculate the similarity between the first semantic vector and the second semantic vector.
[0079] In an optional implementation, the system employs a numerical calculation method to quantify the proximity between the first semantic vector and the second semantic vector; this numerical value is called similarity.
[0080] In one optional implementation, cosine similarity is used as the calculation method. Cosine similarity is calculated based on the cosine of the angle between two vectors in vector space. It focuses on the difference in direction between two vectors, and the result is a scalar value between -1 and 1. When two vectors are in the same direction, the cosine similarity is 1; when they are in opposite directions, it is -1; and when they are independent or orthogonal, it is close to 0. In text semantic comparison scenarios, the closer the value is to 1, the more semantically similar the two texts are generally. Those skilled in the art can also choose other applicable vector distance or similarity measurement algorithms, such as Euclidean distance, according to actual needs.
[0081] S105. If the similarity is lower than a preset threshold, then the policy document is determined to be an update document to be processed.
[0082] The system compares the similarity score with a pre-set threshold. The pre-set threshold is a value determined through experiments or experience, such as 0.95 or 0.98, and it defines the semantic boundary between the system's judgment that "the content has not changed substantially" and "the content has changed substantially".
[0083] If the calculated similarity is below the preset threshold, it indicates that although the policy document may not contain explicit formal changes such as "repeal" or "revision," its core semantic information has undergone significant and quantifiable differences from its historical versions. In simpler terms, the policy content has undergone a substantial change in "meaning." At this point, the system determines that the policy document constitutes an update document to be processed. This type of update can be categorized as an implicit update, and the judgment is based on a quantitative comparison of the overall semantics of the policy text.
[0084] Conversely, if the calculated similarity is higher than or equal to the preset threshold, the system considers that the current policy document is highly consistent with its historical versions in terms of core semantics and no substantive content changes that need to trigger the subsequent knowledge update process have been detected.
[0085] By combining matching based on preset update keyword rules and similarity calculation based on semantic vectors, the system constructs a multi-layered updated document recognition mechanism. This mechanism can efficiently capture explicit format changes as well as deeply perceive implicit semantic content revisions, thereby ensuring a comprehensive and accurate perception of policy dynamics and providing reliable data input for subsequent incremental updates of the knowledge graph.
[0086] S21. If it is determined that an updated document is constituted, the second knowledge of the updated document is extracted through a preset first semantic model, the updated documents are collected, and the amount of lexical or semantic changes is accumulated based on the updated documents.
[0087] Once a policy document is determined to constitute an updated document (including newly added documents, explicit updated documents, or implicit updated documents), the system will initiate a structured information extraction process for that updated document. This step utilizes the first semantic model deployed by the current online service to automatically extract structured second knowledge from the text of the updated document. Simultaneously, the system aggregates the updated document itself (including its metadata and text content), persistently storing it in a specific storage area or database. This area can be called an aggregated updated document pool or a similar logical set. The purpose of aggregation is not only for storage but also to accumulate data raw materials for training trigger conditions for subsequent monitoring models. Through continuous aggregation, the system can accumulate lexical or semantic changes based on the updated documents. Specifically, the system analyzes the content of the aggregated documents to accumulate the number of new terms appearing that are not included in a preset domain dictionary, or calculates the semantic vector distance of core terms in the aggregated documents and historical documents, thereby quantifying the degree of lexical or semantic change.
[0088] Specifically, the system first inputs the text content of the updated document, processed in step S1 (including text extraction and cleaning), into the first semantic model for processing. The first semantic model is one or more trained machine learning models whose core function is to understand natural language text and identify predefined categories of entities and the semantic relationships between them, thereby extracting structured second knowledge. For clarity, in an optional implementation, the first semantic model can be composed of complementary sub-models. For example, it can include a deep learning model for named entity recognition (such as a model based on a bidirectional long short-term memory network combined with a conditional random field architecture, i.e., a BiLSTM-CRF model) and a deep learning model for relation extraction (such as a classifier fine-tuned from a pre-trained language model based on a Transformer architecture). The named entity recognition model is responsible for scanning the text, identifying and classifying phrases with specific meanings, and labeling them as predefined entity types, such as "policy name," "issuing agency," and "release time." The relation extraction model is responsible for analyzing the contextual semantics between identified entities in the text, determining and classifying the predefined relation types between them, such as "publish" (an organization publishes a policy), "cite" (a policy cites another policy), and "substitute" (a policy substitutes for another policy). These sub-models can work in series or in parallel to jointly complete the transformation from unstructured text to structured knowledge.
[0089] Through processing using the first semantic model, the system extracts structured information from the current updated document. This information is collectively referred to as the second knowledge corresponding to the updated document. Second knowledge is typically organized and represented in the form of (entity, relation, entity) triples, or as a set consisting of a list of entities with type labels and their interrelationships. For example, the following second knowledge might be extracted from an updated document: "(National Development and Reform Commission, issued, Guiding Opinions on Promoting High-Quality Development)" and "(Guiding Opinions on Promoting High-Quality Development, replacing, Several Opinions on Promoting Industrial Upgrading)". In this way, unstructured policy text is transformed into machine-understandable and processable structured knowledge with entities and relations as its core elements.
[0090] At this point, the system has completed the real-time extraction and aggregation of secondary knowledge for a single updated document, providing a data foundation for accumulating vocabulary or semantic changes. The extracted secondary knowledge will then be incorporated into the subsequent graph update process.
[0091] S22. When the cumulative amount of vocabulary or semantic changes meets the preset model training trigger condition, the first semantic model is incrementally trained based on the collected updated documents and historical documents to obtain the second semantic model and replace the first semantic model.
[0092] During the continuous execution of step S21 (i.e., extracting second knowledge and aggregating updated documents to accumulate lexical or semantic changes), the system monitors the accumulated lexical or semantic changes in parallel. The purpose of this step is to optimize the current first semantic model using the newly accumulated data at an appropriate time, thereby obtaining a more powerful second semantic model that is better adapted to the latest developments in the policy domain. This process is not initiated based on a fixed time period, but is driven by one or more intelligent, pre-defined model training triggers. These triggers are directly based on the accumulated lexical or semantic changes to ensure the necessity and efficiency of model evolution.
[0093] Specifically, the system checks whether preset model training trigger conditions are met periodically (e.g., hourly or daily) or after each new document is added to the aggregated updated document pool by running a background monitoring program. In one optional implementation, the trigger conditions include, but are not limited to, at least one of the following:
[0094] Condition 1: Triggering based on the frequency of new term occurrences. The system analyzes the content of all documents in the aggregated updated document pool, using new word discovery algorithms (e.g., based on statistical mutual information and adjacency entropy calculations) to identify words or phrases that appear repeatedly but are not included in the pre-defined domain dictionary used by the current system. These can be referred to as "new terms." The pre-defined domain dictionary is a vocabulary set specifically built for the policy domain, including policy names, institution names, professional terms, etc. The system counts the frequency of each new term in the entire aggregated updated document pool. If the frequency of a certain new term or a category of new terms exceeds a pre-set first threshold (e.g., appearing in more than 50 different updated documents), it indicates that the term has become prevalent and important in recent policy practice. At this point, the system determines that the cumulative amount of vocabulary change meets the model training trigger condition, because the first semantic model needs to learn the semantics of these new terms to improve its recognition and understanding ability in future documents.
[0095] Condition 2: Triggering based on semantic drift of core terms. The system selects several core terms (e.g., "regulation," "innovation," "development," etc.) that are fundamental or representative in the policy field from the aggregated updated documents. For each selected core term, the system performs the following operations: First, using the encoding model, it generates the average semantic vector of the term in the context of the aggregated updated documents (referred to as the first term vector) and the average semantic vector of the term in the context of the entire historical document library (referred to as the second term vector). Then, it calculates the cosine distance or other vector distance between the first term vector and the second term vector. If the calculated distance exceeds a pre-set second threshold (e.g., the cosine distance is greater than 0.3), it indicates that the usage context and semantic connotation of the core term in recent policy texts have changed significantly compared with its historical usage, i.e., "semantic drift" has occurred. At this time, the system also determines that the cumulative amount of semantic change meets the model training trigger condition, because the first semantic model needs to update its semantic representation of the term to accurately capture this evolution.
[0096] When any of the above triggering conditions is met, the system automatically initiates the incremental training process for the first semantic model. Incremental training refers to updating and adjusting some parameters of an existing model using new data without starting training from scratch (i.e., without performing "full training"), so that the model can absorb new knowledge while retaining as much of the original knowledge as possible.
[0097] In an optional implementation, the incremental training of the first semantic model based on the collected updated and historical documents to obtain the second semantic model includes:
[0098] S221. Construct the training dataset.
[0099] The system uses a combination of updated documents and sample documents extracted from a historical document repository to form the training dataset. Specifically, the system includes all documents in the currently collected updated document pool as new knowledge samples. Simultaneously, to prevent the model from completely forgetting old knowledge after learning new knowledge (a phenomenon known as "catastrophic forgetting" in machine learning), the system selects a representative portion of documents from the vast historical document repository according to a certain strategy (such as random sampling) and adds them to the training set. This is equivalent to constructing a "sliding window" dataset containing both new and old knowledge.
[0100] S222, Efficient fine-tuning of execution parameters.
[0101] The system loads the first semantic model of the currently online service. Subsequently, instead of updating all millions or even billions of parameters of this first semantic model, it employs an efficient parameter fine-tuning method. Specifically, it freezes (i.e., keeps fixed) all model parameters in the first semantic model except for the top-level network layers and word embedding layers. The top-level network layers refer to the last few layers in the neural network of the first semantic model, which are responsible for integrating high-level semantic features; the word embedding layer is the first layer of the first semantic model that maps input words to initial vectors, directly related to the representation of words. In simpler terms, it only "unlocks" and updates a small subset of parameters that are most directly related to the final task output and word semantics, while keeping the model's "main skeleton" unchanged.
[0102] S223. Train the model and obtain the second semantic model.
[0103] The system uses the training dataset constructed in step S221 to perform multiple rounds of iterative optimization and updates on the parameters of the top-level network layer and word embedding layer, which were unfrozen in step S222, with a relatively low learning rate. This process is automatically completed using the backpropagation algorithm and an optimizer (such as AdamW). After training, a new model with partially updated parameters is obtained; this new model is the second semantic model. It inherits most of the capabilities of the first semantic model while also performing targeted optimizations for the new terms and semantic evolution reflected in the collected updated documents.
[0104] In an optional implementation, after obtaining the second semantic model, the system executes an evaluation process and replaces the first semantic model with the second semantic model after the evaluation is passed. Specifically, this includes: running the first semantic model and the second semantic model on a preset evaluation dataset respectively; calculating the first evaluation value corresponding to the first semantic model and the second evaluation value corresponding to the second semantic model based on the running results; if the second evaluation value is better than the first evaluation value and exceeds a preset evaluation threshold, the performance evaluation is determined to be passed, and then the replacement operation is performed.
[0105] In an optional implementation, the process of running the first semantic model and the second semantic model on a preset evaluation dataset and calculating the evaluation value specifically includes:
[0106] The evaluation dataset is composed of a standardized test set that is independent of the training data and pre-constructed and labeled by domain experts. This dataset aims to comprehensively evaluate the core capabilities of the semantic model in the policy domain and typically includes samples from various tasks, such as: policy text similarity pairs for evaluating the model's semantic understanding depth, where each document pair is accompanied by a similarity score labeled by experts based on semantic relevance; policy entity recognition samples for evaluating the model's information extraction accuracy, where the boundaries and types of entities such as policy names, issuing agencies, and release dates are precisely labeled; and policy relationship classification samples for evaluating the model's relationship understanding capabilities, containing sentences or fragments of two policy entities and their semantic relationship types labeled by experts, such as "released," "cited," and "substituted."
[0107] Evaluation Metrics and Calculations: The system quantitatively evaluates the model's performance based on the evaluation dataset. For the policy text similarity judgment task, the system uses the Pearson correlation coefficient or Spearman's rank correlation coefficient as evaluation metrics to calculate the statistical correlation between the similarity score predicted by the model and the standard score labeled by experts. A higher correlation coefficient indicates that the model's judgment on policy semantic similarity is more consistent with human experts. For the policy entity recognition task and the policy relationship classification task, the system uses precision, recall, and F1 score as core evaluation metrics. Precision measures the proportion of correct results identified by the model, recall measures the model's ability to find all labeled targets, and the F1 score is the harmonic mean of precision and recall, serving as a comprehensive indicator of overall performance.
[0108] Generation of the first and second evaluation values: The system processes the entire evaluation dataset using both the first and second semantic models, respectively, and calculates the specific values for each of the aforementioned evaluation indicators. Subsequently, the system combines these indicator scores obtained from different evaluation tasks into a single, comprehensive score value through weighted averaging or according to a preset comprehensive scoring formula. This comprehensive score value is the first evaluation value corresponding to the first semantic model and the second evaluation value corresponding to the second semantic model. The weights of the weighted average or the comprehensive scoring formula can be preset based on the relative importance of different evaluation tasks in practical applications.
[0109] By employing a comprehensive evaluation approach that encompasses multiple tasks and indicators, the system can comprehensively and objectively quantify and compare the performance differences between the first and second semantic models from multiple dimensions, including semantic understanding, entity recognition, and relation extraction, thereby providing a reliable quantitative basis for model replacement decisions.
[0110] Through step S22, the system achieves intelligent and event-driven self-updating of the underlying semantic model, ensuring that the information extraction tool can keep pace with the times and laying a solid technical foundation for generating high-quality and timely policy knowledge graphs.
[0111] S3. Based on the second knowledge, update the historical policy map to generate the target policy map.
[0112] After completing the knowledge extraction in step S21, the system enters the core knowledge integration phase. The goal of this step is to systematically integrate the scattered secondary knowledge extracted from various updated documents into the existing historical policy graph currently maintained by the system. The historical policy graph is a knowledge base stored in a graph structure, containing primary entities as nodes (such as specific policies, issuing agencies, etc.) and primary relationships as edges (such as issuance, citation, substitution, etc.). These entities and relationships together constitute the existing primary knowledge in the graph. The update process is not a simple addition, but a complex process involving intelligent matching, conflict detection, and automated adjudication, designed to ensure that new knowledge is accurately and consistently incorporated, thereby generating an updated target policy graph.
[0113] Specifically, updating the historical policy graph based on the second knowledge to generate the target policy graph includes the following sub-steps:
[0114] S301, Entity Alignment.
[0115] The system first needs to determine whether a newly emerging second entity (such as a new policy name or an abbreviation of an organization) already has a corresponding node in the historical policy graph. This process is called entity alignment. The system compares each extracted second entity (represented by its textual name) with all first entity nodes in the historical policy graph. The comparison method can combine various strategies: first, perform precise string matching; if that fails, perform fuzzy string matching (such as edit distance calculation) to handle abbreviations, aliases, or subtle differences in expression; further, it can calculate the similarity between the second entity's name and the first entity's name in the semantic vector space. By synthesizing these comparison results, the system finds the first entity in the historical policy graph that is most likely to point to the same real-world entity for each second entity and establishes a mapping relationship. If a second entity cannot be successfully aligned with any existing first entity, the system determines that it is a completely new entity and needs to create a corresponding new node in the graph.
[0116] S302, Relationship Addition and Conflict Detection.
[0117] After completing entity alignment, the system begins processing the second relations in the second knowledge. For each second relation (usually represented as `R(second entity A, second entity B)`, where R is the relation type), the system associates the actual entities involved (which may be existing first entities or newly created nodes) according to the alignment result of S301, and attempts to add this relation as a new edge to the graph.
[0118] During this process, the system performs conflict detection: checking whether one or more first relations already exist between the same two entity nodes. More importantly, the system needs to determine whether the second relation to be added logically conflicts with the existing first relations. Logical conflict usually refers to two relations being semantically mutually exclusive or contradictory. For example, one relation states "Policy A replaces Policy B," while another (possibly from an earlier analysis or a different source) states "Policy A supplements Policy B." The system uses a predefined conflict relation rule table to determine whether two relation types are mutually exclusive.
[0119] S303, Conflict Resolution.
[0120] When a conflict is detected (i.e., the second relationship to be added and the first relationship in the historical policy graph constitute a logical conflict between the same entity pairs), the system will not blindly add a new relationship or overwrite an old one. Instead, it will initiate an automated conflict resolution process. This process makes decisions based on a series of preset conflict resolution rules, aiming to arrive at the most likely correct conclusion based on objective evidence.
[0121] In one optional implementation, the conflict resolution includes the following steps:
[0122] 1. Evidence Collection: The system acquires attribute information of the source policies corresponding to the relationships between the conflicting parties (i.e., the second relationship to be added and the first relationship that conflicts with it). This attribute information is crucial factual evidence and mainly includes:
[0123] Effective date: This refers to the official effective date clearly stipulated in the policy document. This is the core basis for judging the timeliness of a policy.
[0124] Issuing agency level: This refers to the level of the administrative or legislative body that issued the policy (e.g., national, provincial / ministerial, municipal, etc.). This reflects the policy's authority and scope of effectiveness.
[0125] 2. Rule-based decision-making: The system automatically makes decisions based on the collected attribute information and according to preset priority rules. These priority rules are predefined decision logic, and in one optional implementation, include:
[0126] The later the effective date, the higher the priority: This is the most fundamental principle for handling policy update conflicts. If one party to the conflict is a policy with a later effective date, then the state reflected in that policy (such as replacement or repeal) is considered to represent the latest, legally binding reality.
[0127] Higher-level issuing agencies have higher priority: When the effective dates are the same or cannot be clearly compared (e.g., neither policy explicitly repeals the other), the decision is made based on the issuing agency's level. Policies issued by higher-level agencies generally have greater authority and broader applicability.
[0128] The system applies these rules to compare the conflicting parties and thus determine the relationship that should ultimately be retained.
[0129] S304, Version Chain Management.
[0130] After determining the relationships to be retained based on preset priority rules, the system does not simply delete those deemed invalid or of low priority. To preserve a complete and traceable history of policy evolution, the system performs version chain management.
[0131] Specifically, in the historical policy graph, the system adds a historical status identifier to the first relationship that is replaced or overwritten (e.g., marking the "status" field in its attributes as "invalid" or "replaced"). Simultaneously, the system establishes a version link between the ultimately retained relationship (which could be a new second relationship or an original first relationship) and the old relationship marked as historical, pointing from the former to the latter. This link can be a special type of relationship edge, such as named "replacement" or "previous version." In this way, the graph not only records the currently valid state of knowledge but also clearly maintains the context of how knowledge evolves over time.
[0132] S305, Generate a target policy map.
[0133] After traversing and processing all the second knowledge to be updated, and completing all necessary entity alignment, relationship addition, conflict resolution, and version chain management operations, the content of the historical policy graph has been updated. At this point, the updated graph maintained internally by the system is defined as the target policy graph. The target policy graph contains the original, unaffected first knowledge, as well as the successfully integrated, conflict-resolved second knowledge, and also includes version information reflecting the evolution of knowledge, forming a new version knowledge base that is more comprehensive in content and more consistent in logic.
[0134] S306. Replace the historical policy map with the target policy map.
[0135] After generating the target policy graph, the system performs a replacement operation and deploys it to the online service environment. In an optional implementation, since knowledge graph storage is typically based on graph databases, replacement can be achieved by switching database connections to point to the new version of the graph, or by switching the main view within the same database using version tags, ensuring that online query requests immediately access the latest target policy graph.
[0136] S307. Perform the maintenance process after replacement.
[0137] After the replacement is complete, the system will initiate necessary maintenance procedures to ensure the data quality and service stability of the new map. In one optional implementation, this includes:
[0138] Consistency Verification: The system performs graph queries on the target policy graph to check for isolated nodes (i.e., nodes without any relational edges) and / or contradictory relationships (i.e., relationships that violate preset logical constraints). For example, it queries whether there are policy nodes in the "already replaced" state that still have valid "referenced" relationships pointing to them. When such inconsistencies are found, the system may attempt to automatically repair them according to rules or log an alarm.
[0139] Multi-storage synchronization: Policy knowledge systems typically include multiple storage components, such as a graph database (storing the graph), a document database (storing the original text), and a search engine (supporting full-text search). After the target policy graph is replaced, the system triggers a background synchronization task to ensure that updates to entities and relationships in the graph are promptly reflected in the search engine's index and the associated metadata in the document database, thus guaranteeing the consistency of the entire data ecosystem.
[0140] Scheduled full maintenance: In addition to instant replacement and verification triggered by incremental updates, the system can also be configured to perform full maintenance tasks periodically (such as at midnight every day) to conduct more comprehensive health checks, index optimization and historical data archiving of the map, forming a complete operation and maintenance mechanism.
[0141] Through the S3 steps, the system achieves intelligent and robust integration of new knowledge with the existing knowledge system, and completes the deployment and maintenance of the knowledge graph, thus ultimately completing a full closed loop from data perception and knowledge integration to service upgrade. The successful replacement of the target policy graph signifies that the system has absorbed the latest policy dynamics, enabling it to provide users with more accurate, comprehensive, and timely policy knowledge services. The entire methodology, through the close integration and automated execution of each step, effectively overcomes the shortcomings of traditional static knowledge graph systems in terms of timeliness, adaptability, and maintenance costs.
[0142] Secondly, this embodiment also discloses a policy map dynamic update device, including:
[0143] The comparison unit is used to obtain policy documents, obtain historical related documents based on the obtained policy documents, and determine whether the policy documents constitute updated documents of historical related documents based on matching of a preset update keyword rule base and / or similarity calculation based on semantic vectors.
[0144] The processing and accumulation unit is used to extract second knowledge of the updated document through a preset first semantic model if it is determined that the updated document is constituted, to collect the updated document, and to accumulate the amount of lexical or semantic change based on the updated document.
[0145] The model training unit is used to incrementally train the first semantic model based on the collected updated documents and historical documents to obtain the second semantic model when the accumulated vocabulary or semantic changes meet the preset model training trigger conditions.
[0146] The updating unit is configured to update the historical policy graph based on the second knowledge to generate a target policy graph, replace the historical policy graph with the target policy graph, and replace the first semantic model with the second semantic model.
[0147] Thirdly, this embodiment also discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-mentioned policy map dynamic update method.
[0148] Fourthly, this embodiment also discloses a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for dynamically updating the policy map.
[0149] Specific embodiments have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.
Claims
1. A method for dynamically updating a policy map, characterized in that, include: Obtain policy documents, obtain historical related documents based on the obtained policy documents, and determine whether the policy documents constitute updated documents of historical related documents based on matching of a preset update keyword rule base and / or similarity calculation based on semantic vectors. If it is determined that an updated document is constituted, the second knowledge of the updated document is extracted through a preset first semantic model, the updated documents are collected, and the amount of lexical or semantic changes is accumulated based on the updated documents; When the cumulative amount of vocabulary or semantic changes meets the preset model training triggering conditions, the first semantic model is incrementally trained based on the collected updated documents and historical documents to obtain the second semantic model and replace the first semantic model. Based on the second knowledge, the historical policy map is updated to generate the target policy map, and the historical policy map is replaced with the target policy map.
2. The method according to claim 1, characterized in that, The matching based on preset updated keyword rules includes: Extract the main text of the policy document; The text content is matched with preset update keyword rules; wherein the update keyword rules contain preset sentence structures or keywords for indicating policy replacement, revision or repeal. If the match is successful, the policy document is determined to constitute an updated document.
3. The method according to claim 1, characterized in that, The semantic vector-based similarity calculation includes: The first semantic vector of the policy document and the second semantic vector of the historical document are generated using an encoding model. Calculate the similarity between the first semantic vector and the second semantic vector; If the similarity is lower than a preset threshold, then the policy document is determined to be an updated document.
4. The method according to claim 1, characterized in that, The cumulative vocabulary or semantic change amount satisfies a preset model training trigger condition, including at least one of the following: The number of occurrences of new terms not included in the preset domain dictionary in the collected updated documents is counted. If the number of occurrences exceeds a first threshold, the model training trigger condition is determined to be met. Alternatively, select core terms from the aggregated updated documents, calculate the distance between the first term vector of the core term in the aggregated updated documents and its second term vector in the historical documents, and if the distance exceeds a second threshold, determine that the model training trigger condition is met.
5. The method according to claim 1 or 4, characterized in that, The second semantic model is obtained by incrementally training the first semantic model based on the collected updated and historical documents, including: The training dataset is composed of the aggregated updated documents and the sample documents extracted from the historical documents. Freeze the remaining model parameters in the first semantic model, except for the top network layer and the word embedding layer; Using the training dataset, the parameters of the top-level network layer and the word embedding layer are updated to obtain the second semantic model.
6. The method according to claim 1, characterized in that, Also includes: After obtaining the second semantic model, the first semantic model and the second semantic model are run on a preset evaluation dataset respectively; Based on the running results, a first evaluation value corresponding to the first semantic model and a second evaluation value corresponding to the second semantic model are calculated respectively; wherein, the first evaluation value and the second evaluation value are calculated based on the same at least one preset evaluation index; If the second evaluation value is better than the first evaluation value and exceeds the preset evaluation threshold, the performance evaluation is deemed to have passed, and the first semantic model is replaced by the second semantic model.
7. The method according to claim 1, characterized in that, The step of updating the historical policy graph based on the second knowledge to generate the target policy graph includes: Align the second entity and second relationship contained in the second knowledge with the first entity in the historical policy graph; Based on the alignment results, second entities and second relations that do not exist in the historical policy graph are added to the historical policy graph.
8. The method according to claim 7, characterized in that, In the process of updating the historical policy map to generate the target policy map, conflicts are handled according to preset conflict resolution rules, including: When the second relationship to be added and the first relationship in the historical policy graph constitute a logical conflict between the same entity pairs, conflict resolution is performed. The conflict resolution includes: obtaining attribute information of the source policies corresponding to the relationship between the conflicting parties, and determining the relationship to be retained in the end based on the attribute information and according to the preset priority rules; The attribute information includes the policy's effective date and the issuing agency's level, and the priority rules include: policies with later effective dates have higher priority, and / or policies with higher issuing agency levels have higher priority.
9. The method according to claim 8, characterized in that, After determining the relationships to be retained based on preset priority rules, the process also includes: In the historical policy graph, a historical status identifier is added to the first relationship that is replaced or overwritten, and a version link is established from the relationship that should ultimately be retained to the first relationship.
10. The method according to claim 1, characterized in that, After replacing the historical policy map with the target policy map, the method further includes: Perform a graph query on the target policy graph to check for isolated nodes and / or contradictory relationships for consistency verification.
11. A policy map dynamic updating device, characterized in that, include: The comparison unit is used to obtain policy documents, obtain historical related documents based on the obtained policy documents, and determine whether the policy documents constitute updated documents of historical related documents based on matching of a preset update keyword rule base and / or similarity calculation based on semantic vectors. The processing and accumulation unit is used to extract second knowledge of the updated document through a preset first semantic model if it is determined that the updated document is constituted, to collect the updated document, and to accumulate the amount of lexical or semantic change based on the updated document. The model training unit is used to incrementally train the first semantic model based on the collected updated documents and historical documents to obtain the second semantic model when the accumulated vocabulary or semantic changes meet the preset model training trigger conditions. The updating unit is configured to update the historical policy graph based on the second knowledge to generate a target policy graph, replace the historical policy graph with the target policy graph, and replace the first semantic model with the second semantic model.