Government affair processing method of big language model based on knowledge graph and electronic equipment
By applying a large language model based on knowledge graph in the government affairs field, information extraction and community testing are carried out, and combined with the hybrid search generation method, the problems of incomplete extraction of government text information and low search recall are solved, and high-quality government text generation is achieved.
Patent Information
- Application Number
- CN202411736961.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-04-08
AI Technical Summary
In the field of government affairs, existing large language models have problems of data confidentiality and data silos in knowledge injection and data use, and the search enhancement generation method has problems of noise and information loss in document chunking and information retrieval.
A large language model based on knowledge graph is adopted, information extraction and named entities and relationship extraction are performed through a large language model, community detection is performed in combination with Leiden graph calculation method, and hybrid search generation method is used to improve the interpretability and comprehensiveness of the generated content.
It improves the integrity and interpretability of government text information, improves the quality of generated content of large language models in the government affairs field, and solves the problems of incomplete information extraction and low retrieval recall in traditional methods.
Smart Images

Figure CN119782545A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of large models, and in particular to a government affairs processing method and electronic equipment based on a large language model of a knowledge graph. Background Art
[0002] Large language models, especially pre-trained language models based on deep learning, have made breakthrough progress in the field of natural language processing, which has a profound impact on economic development, social governance and people's lives. Recently, in order to solve the challenge of knowledge injection into large models, retrieval-enhanced generation methods have become a hot topic of research. Retrieval-enhanced generation algorithms combine the advantages of information retrieval and generation models, and integrate the required information into the context by recalling it from multiple retrieval sources before generation, so that large models can master domain knowledge and perceive real-time information.
[0003] The government sector is the focus of big model applications, but it faces problems of data confidentiality and data silos, which limit the use of domain data in big model pre-training. In addition, after the release of policy documents, relevant knowledge needs to be updated quickly, and the generated content must be highly interpretable and traceable, and can provide the basis for policies, laws, regulations and standard documents.
[0004] With the widespread application of retrieval enhancement methods in practice, their shortcomings have gradually become apparent. They mainly include the following aspects: Document segmentation problem: Using a longer segmentation method may introduce more noise, while using a shorter segmentation method may lead to truncation and loss of text information. In emergency management plans, the responsibilities of various departments are usually presented in large texts, and it is difficult to determine the appropriate segmentation length threshold for a fixed-length segmentation scheme. Retrieval method problem: In traditional retrieval enhancement generation methods, vectorization is usually used to retrieve the most fine-grained original text content. This method has a low recall rate, especially when dealing with summary issues, and it is impossible to retrieve enough content. When generating government texts, it is required to be comprehensive, and the most fine-grained retrieval method cannot meet this requirement.
[0005] In recent years, knowledge graphs, as a structured data model for representing entities and their relationships, have been widely used in the fields of artificial intelligence and information retrieval. In the field of government affairs, the construction of traditional knowledge graphs often requires high labor costs and faces the following challenges: Entity and relationship extraction problems: Traditional methods rely on rule-based or named entity recognition-related models for extraction, which requires high data annotation costs and is difficult to handle long-tail data. Entity disambiguation problem: Existing knowledge graph construction methods may mistakenly construct an entity as multiple ambiguous entities, which will lead to error propagation in downstream tasks. In the expression habits of official documents, pronouns and abbreviations are used extensively. This shortcoming will be magnified when using large-scale official documents to construct knowledge graphs, resulting in a large number of erroneous entity relationships. Summary of the invention
[0006] The main purpose of the present invention is to overcome the above-mentioned defects in the prior art, and to propose a government affairs processing method and electronic device based on a large language model of a knowledge graph. The information extraction technology based on the large language model is introduced into the construction process of the knowledge graph, and the large language model is used for information extraction to make the constructed knowledge graph information more complete. The knowledge graph is combined with a retrieval enhancement generation method to improve the interpretability and comprehensiveness of the content generated by the large language model in the government affairs field.
[0007] The present invention adopts the following technical solution:
[0008] A government affairs processing method based on a large language model of a knowledge graph, comprising:
[0009] Use a large language model to extract named entities and relations from government-related texts;
[0010] Performing named entity classification and entity disambiguation on the named entities and relations, and constructing a knowledge graph;
[0011] Performing community detection on the constructed knowledge graph using a Leiden graph calculation method to generate a hierarchical community structure, and generating a community summary from the bottom up using the large language model;
[0012] The large language model is used to extract entities from the government affairs questions input by the user, and the entities are hybrid searched using the constructed knowledge graph and retrieval model to obtain retrieval results related to the entities, and the retrieval results are enhanced using the large language model to generate result answers.
[0013] Use the large language model to extract named entities and relations from government-related texts, including the following:
[0014] Pre-build government-related prompt words for large language model extraction and sample libraries for entity and relationship extraction;
[0015] The government-related text is segmented to obtain text segments of a set length, and then the large speech module is used to perform preliminary extraction of named entities and relationships; a text embedding model is used to calculate the similarity between the text segment and the samples in the sample library, and a number of samples corresponding to the named entity and relationship extraction are extracted from the sample library according to the similarity, and the named entities and triple prompt words are assembled.
[0016] When using a large language model to extract named entities and relations from government-related texts, it also includes the reflection-enhanced extraction of named entities and relations, specifically:
[0017] A plurality of adjacent text segments are merged to form a long text segment of a set length, and named entities and relations extracted from the plurality of text segments are removed for duplication and added to the triple prompt word.
[0018] When using a large language model to extract named entities and relationships from government-related texts, it also includes parsing the named entities and relationships output by the large language model, specifically:
[0019] The named entities and relations output by the large language model are deduplicated, and the text segment positions and metadata information of the source text when the named entities and relations are extracted are recorded in attributes.
[0020] Performing named entity classification and entity disambiguation on the named entities and relations, specifically including the following:
[0021] Preset entity disambiguation prompt words, maintain a named entity classification list, the named entity classification list initially contains the types in the entity disambiguation prompt words;
[0022] Traversing all entities extracted by the large language model, classifying these entities using prompt words in the large language model, and matching the obtained entity classifications with corresponding entity disambiguation prompt words to obtain standardized entity names;
[0023] The obtained standardized entities are fully merged to generate entity descriptions and entity relationship descriptions.
[0024] It also includes a pre-set evaluation data set, which is used to calculate the recall rate of named entities and relationships as an indicator to measure the accuracy of named entity and relationship extraction and entity disambiguation, and the parameters of the large language model and the knowledge graph are adjusted and iterated according to the indicator.
[0025] The entity is searched using the constructed knowledge graph to obtain search results related to the entity, specifically:
[0026] Retrieving a number of results most relevant to the entity from the constructed vector database of the knowledge graph as the identified entity;
[0027] Finding the community summary with the largest number of occurrences of the identified entity from the constructed knowledge graph, and extracting a plurality of community summaries therefrom;
[0028] The most closely connected relationship edges between the identified entities are searched from the constructed knowledge graph, sorted according to the number of source texts of each relationship variable, and a number of results are extracted therefrom to obtain descriptions of the entities and descriptions of the entity relationships.
[0029] The entity is searched using the search model to obtain search results related to the entity, specifically:
[0030] Using a dense retrieval model to calculate the text vector of the user input, and recalling a number of text segments that are most relevant to the text vector similarity from the constructed vector database of the knowledge graph;
[0031] Retrieving text segments related to the user input text from a keyword search engine using the BM25 algorithm, and recalling a number of the text segments;
[0032] The plurality of text segments recalled in the above step are deduplicated, and then reordered using a reordering model, and the first plurality of text blocks are taken therefrom.
[0033] The retrieval results are enhanced using the large language model to generate result answers, specifically: the identified entities and their descriptions, entity relationships and their descriptions, several community summaries and several text blocks obtained by retrieval are used as contexts, and the large speech model is used to enhance the generation of result answers.
[0034] An electronic device, characterized in that it includes: a processor and a memory, wherein the memory stores a computer program that can be called by the processor; the processor executes the government affairs processing method based on the large language model of the knowledge graph by calling the computer program stored in the memory.
[0035] It can be seen from the above description of the present invention that, compared with the prior art, the present invention has the following beneficial effects:
[0036] The present invention uses a large language model for information extraction, and adopts a triple sample guidance method rather than the traditional method of specifying entity relationship categories. This method can maximize the ability of the large model and extract as many named entities and their relationships as possible. It improves the situation where the manually specified entity types cannot be fully covered due to the wide coverage of government texts, resulting in missing information extraction. Compared with traditional methods and other common methods of using large models for graph construction, this solution has significantly improved the effect.
[0037] In government texts, the use of abbreviations is very common. For example, abbreviations are often used when the names of official documents are long, and abbreviations are also often used when the names of government agencies are too long. In different articles, these abbreviations are often similar. Using traditional extraction methods may result in the same entities, thereby constructing incorrectly connected knowledge graphs and causing information dissemination errors. The solution of the present invention customizes the entity name disambiguation method for different entity types, and restores the standardized entity name by combining context and external knowledge supplements.
[0038] Traditional information retrieval methods can usually only retrieve the most fine-grained document information. The solution of the present invention uses the method of community summarization to generate a macro-level understanding of knowledge based on fine-grained information, integrate the scattered knowledge scattered in multiple documents, and form higher-dimensional summary knowledge. When a summary answer is required, this solution can output high-level suggestions. The content generated by the large model presents the high-level and comprehensive characteristics of the domain text. Through hybrid retrieval generation, the solution can still maintain excellent performance in answering fine-grained factual questions. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is the main flow chart of the present invention.
[0040] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. DETAILED DESCRIPTION
[0041] The present invention is further described below through specific implementation modes.
[0042] See also Figure 1 , a government affairs processing method based on a large language model of a knowledge graph, comprising:
[0043] S1 uses a large language model to extract named entities and relations from government-related texts.
[0044] This step is used to extract key information from a large amount of text, convert this information into structured named entities and relationships, and present this information in the form of RDF triples for further analysis and knowledge graph construction. The extracted entities and relationships must be accurate, and the output format must meet user requirements to ensure the readability and usability of the information. Entities are presented in the form of lists and relationships are presented in the form of triples to ensure consistency and clarity of the format.
[0045] Specifically, a set of government-related prompt words P is pre-built for large language model extraction. type And the sample library FS for entity and relationship extraction. i ={initial extraction of entities and relations, reflection enhancement of named entities and relations, named entity classification, entity name disambiguation, entity and relationship summary, community report generation}. For example: in the extraction of emergency management documents, the preset type = {"name", "organization", "administrative division", "company", "date", "event", "book", "position", "policy document", "policy field", "a certain institution", "slogan", "measures", "guidance", "platform", "natural disaster", "weather", "materials"}.
[0046] S1.1 Segment the government-related text to obtain text segments of a set length. First, segment the input text by sentence and calculate the token length of each sentence. According to the input limit of the model, use the preset segmentation window length Length chunk The parameter splits the text into chunks. Typically Length chunk The value is 600, which means that consecutive sentences with no more than 600 tokens are put into a text block. chunk The choice of should consider the input and output length limitations of the model.
[0047] S1.2 Use the big speech module to perform preliminary extraction of named entities and relations; use the text embedding model to calculate the similarity between the text segment and the samples in the sample library, and extract several samples with the highest similarity (such as TopK 22 ) samples corresponding to the named entity and relation extraction, and assemble the named entity and triple prompt words P_{entity and relation preliminary extraction}.
[0048] Examples of prompt words mentioned in this step are as follows:
[0049] (1) Preliminary extraction of prompt words for entities and relationships
[0050] -Role: Text analysis expert and knowledge graph builder
[0051] -Background: Users need to extract key information from large amounts of text and transform this information into structured named entities and relationships for further analysis and knowledge graph construction.
[0052] -Goals: Accurately extract named entities and relationships between entities from text and present this information in the form of RDF triples.
[0053] -Constrains: The extracted entities and relationships must be accurate, and the output format must meet user requirements to ensure the readability and usability of the information.
[0054] -Output Format: Entities are presented in lists and relationships are presented in triples to ensure consistency and clarity in format.
[0055] -Workflow:
[0056] 1. Preprocess the input text file, including word segmentation, removal of stop words, etc.
[0057] 2. Use named entity recognition technology to extract all named entities in the text.
[0058] 3. Identify semantic relationships between entities through relationship extraction technology.
[0059] 4. Organize and output the extracted entities and relationships in the format specified by the user.
[0060] -Examples:
[0061] <…few shots…>
[0062] -Entity list: a certain place##maglev train##a certain airport
[0063] -Entity relationship: (a certain place##maglev train## is located in)(maglev train##a certain airport##terminal station).
[0064] (2) Reflection-enhanced extraction of prompt words for named entities and relationships
[0065] Related context:
[0066] [previous text block]
[0067] <Current text block>
[0068] [Next text block]
[0069] Named entities discovered: <The deduplicated set of named entities extracted from the above three text blocks>
[0070] Entity relationships that have been discovered: <The entity relationship set extracted from the above three text blocks without duplicates>
[0071] ---
[0072] Some of the named entities and entity relationships in the above related contexts have not been completely extracted. Please continue to generate related named entities and entity relationships according to the above format. If all possible entities and relationships have been completely extracted, reply `Extraction completed`
[0073] (3) Named entity classification prompt words
[0074] -Role: Named Entity Classification Expert
[0075] -Goals: The user needs to classify the input named entities. This task requires the ability to recognize and match existing categories, or creatively generate new category names when there are no matches.
[0076] -Constrains: The category name needs to be concise and easy to understand, while ensuring the consistency and accuracy of the classification.
[0077] -Output Format: The output should include the entity name, the classification result, and a brief description of the basis for the classification.
[0078] -Workflow:
[0079] 1. Analyze the input named entity names and source context.
[0080] 2. Determine whether the entity matches an existing classification. If so, use the existing classification.
[0081] 3. If the entity does not match an existing classification, creatively generate a new classification name and record this classification for future use.
[0082] - Existing entity classification: "name", "organization", "place", "company", "date", "event", "book", "position", "policy document", "policy field", "government agency", "slogan", "measures", "guidance", "platform", "natural disaster", "weather", "materials"
[0083] -Examples:
[0084] -Input: Named entity name "Zhang Wei", source context "Zhang Wei is the CEO of the company."
[0085] Category: Position## Because "CEO" indicates that this is a position-related entity.
[0086] -Input: Named Entity Name "2023 Annual Report", Source Context "The company released its 2023 Annual Report."
[0087] Category: Policy Documents##Because “Annual Report” is usually related to policy documents.
[0088] -Input: Named entity name "Yangtze River", source context "Floods occurred in the Yangtze River Basin."
[0089] Category: Place##Because "Yangtze River" is a geographical name.
[0090] (4) Entity name disambiguation prompt
[0091] ROLE: Entity Naming Expert
[0092] Task: You will receive an entity name that is not standardized. You need to rename the entity based on the context in which it appears, entity naming rules, and related knowledge. If the entity name already meets the requirements, you can directly output its name.
[0093] Entity Type: Document
[0094] Rules for naming official documents: The title of an official document consists of the name of the issuing agency, the reason and the type of document.
[0095] For example: "Opinions of a certain office on strengthening and improving administrative litigation work", this title element consists of three parts.
[0096] First, the name of the issuing agency is "a certain office";
[0097] The second reason is "strengthening and improving administrative litigation work";
[0098] Third, the type of document is "opinion".
[0099] Among the 15 types of official documents commonly used by a certain agency, except for the four types of "gazette", "announcement", "notice" and "order", the three elements of the titles of other types of documents should be complete.
[0100] Related knowledge:
[0101] 15 types of official documents: resolutions, decisions, orders, communiqués, announcements, notices, opinions, notifications, bulletins, reports, requests for instructions, replies, proposals, letters, and minutes.
[0102] Name of existing similar entity:[…]
[0103] Related context: [...]
[0104] Enter entity name: [...]
[0105] (5) Entity and relationship summary prompts
[0106] -Role: Text Summarization Expert
[0107] -Background: Users need to summarize and describe the performance of specific entities or entity relationships in different text fragments in order to quickly understand and grasp the relevant information of the entities or relationships.
[0108] -Goals: Generate accurate and concise entity or relationship descriptions to help users quickly grasp the core information.
[0109] -Constrains: The description should be within 300 words to ensure accuracy and readability of the information.
[0110] -Workflow:
[0111] 1. Read and understand the list of entity names and context provided.
[0112] 2. Extract the most relevant information about the entity or relationship in the context.
[0113] 3. Generate concise and accurate descriptions based on the extracted information.
[0114] -Input:
[0115] name:[...]
[0116] Context list: [...]
[0117] (6) Community report generation prompt words
[0118] -Role: Knowledge Graph Analyst
[0119] -Background: You have been commissioned to write a comprehensive report on a specific community in the Knowledge Graph, which aims to provide key information to decision makers so that they can understand the structure, entities, relationships, and potential impacts of the community.
[0120] -Constraints: The report must be based on facts and data, remain objective and neutral, and must not contain unverified information.
[0121] -Output Format: The report should contain structured content such as title, summary, detailed findings, etc., and should be presented in a clear and professional format.
[0122] -Workflow:
[0123] 1. Analyze the input entity information, relationship information, and community information.
[0124] 2. Find the core of the community from the above content and analyze it.
[0125] 3. Based on the analysis results, extract 5-10 key insights.
[0126] 4. Write each part of the report, ensuring the accuracy and logic of the content.
[0127] 5. Review and proofread the report and submit it after ensuring it is correct.
[0128] -Input:
[0129] Entity description information: [...]
[0130] Relationship description information: [...]
[0131] Community description information: [...]
[0132] In this step, the types of entities and relationships are not restricted. Few-shot learning is used to guide the large model to extract as much information as possible to avoid incomplete information extraction due to insufficient definition of entity and relationship types. In the sample library FS used in the field of emergency management, at least 10 typical extraction samples are annotated for each preset entity type by manual labeling, including fire-fighting equipment, natural disasters, hazardous chemicals, meteorological disasters, and emergency measures. In subsequent extractions, the extracted entities and relationships are automatically added to the sample library FS.
[0133] In the emergency management methods and emergency plans, some regulations or member unit responsibilities are too detailed, and the length deviates significantly from the average value, resulting in truncation. The extended length reflection-enhanced extraction is used to restore the truncated information. Therefore, when using a large language model to extract named entities and relations from government-related texts, step S1.3 reflection-enhanced extraction of named entities and relations is also included, which is specifically:
[0134] Merge several adjacent text segments (if there are previous and next text segments) to form a long text segment of a set length (for example, 3 times Length chunk For a long text segment, the named entities and relations extracted from several text segments are deduplicated and added to the triple prompt words. This method can restore the relationship extraction loss caused by text segmentation and the long-distance dependency of entity relations in the text. At the same time, the named entity lists and entity relations extracted from the three text blocks are deduplicated and added to the prompt words, requiring the large model to reflect on whether there are omissions in the named entity and relationship extraction.
[0135] Furthermore, when using a large language model to extract named entities and relationships from government-related texts, it also includes parsing the named entities and relationships output by the large language model, specifically:
[0136] De-duplicate the named entities and relations output by the large language model, and store the results in the graph database. Entities with the same name from different sources are not merged in this step. The metadata information of the text segment position and source text when the named entities and relations are extracted is recorded in the attributes. For example, the metadata of the emergency plan includes the emergency field, issuing unit, revision date, and list of attachment names. The metadata of the official document includes the document type, issuing agency, issuing number, document title, main sending agency, copy sending agency, confidentiality level, issuer, date of writing, and list of attachment names.
[0137] S2 performs named entity classification and entity disambiguation on named entities and relations, and constructs a knowledge graph.
[0138] Preset entity disambiguation prompt words and supplementary knowledge K for entity disambiguation type, comes from authoritative documents. For example, when type = administrative division, the superior and subordinate administrative divisions in the "Administrative Division Code" that are related to the source area of the official document data are used as supplementary knowledge. Maintain a named entity classification list, which initially contains the types in the entity disambiguation prompt.
[0139] S2.1 Traverse all entities extracted by the large language model, and classify these entities using the prompt words in the large language model. Match the classification of the obtained entities with the corresponding entity disambiguation prompt words to obtain standardized entity names. Establish naming rules for each type of entity. For example, the title rule for official documents such as notices: issuing authority + reason + document type, filter and use the abbreviated title of "Notice"; the name rule for government agencies: use the full name of the complete administrative level + function, such as a city's safety production committee. When the large model parameter knowledge cannot stably restore the full name of the entity, introduce relevant standard documents as content supplements.
[0140] Calculate the token length of the article where the entity is extracted. If it is within the context length of the model input, the entire article is added to the context; otherwise, the text paragraph and its upper and lower adjacent paragraphs are used to add to the context. The prompt words include three parts: 1. Entity category naming rules; 2. External supplementary knowledge required for entity category naming; 3. The context when the entity is extracted. These prompt words are used to disambiguate entity names to obtain standardized entity names.
[0141] S2.2 will fully merge the obtained standardized entities, covering all input documents, and generate entity descriptions and entity relationship descriptions. Since an entity may appear in multiple text fragments, and a pair of entities may have a relationship in multiple text fragments, it is necessary to collect the context in which it appears for summary processing. When generating the summary, the context length is calculated. If it exceeds the context length of the large model, a recursive summary is performed.
[0142] The present invention also includes a pre-set evaluation data set D eval and the document collection D to be used to build the knowledge base i The dataset is used to calculate the recall rate of named entities and relations as an indicator to measure the accuracy of named entity and relation extraction and entity disambiguation. The parameters of the large language model and knowledge graph are adjusted and iterated based on the indicator.
[0143] The main goal of the evaluation is to measure the accuracy of named entity and relationship extraction and entity disambiguation. The evaluation method is to calculate the recall rate index on the evaluation set, and the objects of evaluation include named entity names and entity relationships. According to these indicators, the relevant parameters such as the extraction prompt words, entity disambiguation prompt words, segmentation window length, etc. are adjusted and iterated.
[0144] S3 uses the Leiden graph calculation method to perform community detection on the constructed knowledge graph, generates a hierarchical community structure, and uses a large language model to generate community summaries from the bottom up.
[0145] In this step, after completing the construction of the knowledge graph, the Leiden graph calculation method is used for community detection. The Leiden algorithm can generate a hierarchical community structure. The community summary is generated from the bottom up using the big model. The summary will summarize the closely connected nodes and relationships in the graph, so as to have a more macro understanding of the knowledge base through the big model.
[0146] S4 uses a large language model to extract entities from government affairs questions input by users, uses the constructed knowledge graph and retrieval model to perform hybrid retrieval on entities to obtain retrieval results related to the entities, and enhances the retrieval results using a large language model to generate result answers.
[0147] This step includes using the constructed knowledge graph to retrieve entities, as follows:
[0148] S4.1A For user queries, we first use a large language model to extract entities from the query, and then retrieve several entities that are most relevant to the entity from the constructed knowledge graph vector database (e.g., the top TopK 61 ) results as recognized entities;
[0149] S4.2A finds the community summaries with the highest number of occurrences of the identified entities from the constructed knowledge graph, and extracts several (e.g., the top TopK 62 ) Community Summary.
[0150] S4.3A finds the most closely connected relationship edges between the identified entities from the constructed knowledge graph, sorts them according to the number of source texts of each relationship, and extracts several (such as the top K 63 The result is the description of the entity and the description of the entity relationship.
[0151] Furthermore, it also includes using the retrieval model to retrieve the entity to obtain retrieval results related to the entity, specifically:
[0152] S4.1B uses dense retrieval models to calculate the text vector of the user input, and recalls several most relevant text vectors from the vector database of the constructed knowledge graph (for example, taking the top K 71 This step uses the bge-m3 model, which can also be replaced by other models.
[0153] S4.2B uses the BM25 algorithm to retrieve text segments related to the user input text from the keyword search engine and recalls several (for example, taking the top K 72 ) text segment.
[0154] S4.3B removes duplicates from the text segments recalled in the above steps S4.1B-S4.2B, and then re-ranks them using the re-ranking model, and selects the top several (e.g., the top TopK 73 This step uses the bge-reranker-v2-m3 model, which can also be replaced by other models.
[0155] The present invention also includes enhancing the retrieval results using a large language model to generate result answers, specifically: the identified entities and their descriptions, entity relationships and their descriptions, several community summaries and several text blocks retrieved in steps S4.1A-S4.3A and steps S4.1B-S4.3B are used as contexts, spliced into the large model prompt words, and enhanced using the large speech model to generate result answers.
[0156] Based on this, the present invention also proposes an electronic device, comprising: a processor and a memory, wherein the memory stores a computer program that can be called by the processor; the processor executes the above-mentioned government affairs processing method based on the large language model of the knowledge graph by calling the computer program stored in the memory.
[0157] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0158] The solution of the present invention effectively solves the problem of high interpretability of content generated by large models in the government affairs field, showing broad application prospects, which are specifically reflected in the following aspects:
[0159] Intelligent customer service: Through this solution, government departments can build an intelligent customer service system to quickly respond to various issues of citizens. This not only improves service efficiency, but also significantly improves citizen satisfaction. The intelligent customer service system can operate around the clock, reduce the burden of manual customer service, and provide more accurate and personalized services through continuous learning and optimization.
[0160] Document analysis: When dealing with a large number of policy documents and regulations, this solution can automatically extract and analyze key information to help policy makers and implementers better understand and apply regulations. Through in-depth analysis of documents, the system can identify the correlation and potential impact between policies, supporting a more scientific decision-making process.
[0161] Official document writing: When writing official documents and various documents and manuscripts, this solution can provide factual, multi-angle and multi-dimensional information support. The system can provide relevant background information and data support according to different writing needs to ensure the accuracy and comprehensiveness of the document content. In addition, the system can also recommend the best writing structure and style to improve the quality and readability of the document.
[0162] Through these applications, this system not only improves the level of intelligence in government services, but also provides strong technical support for government workers, and promotes the modernization and efficiency of government work. In the future, the system is expected to be applied in more fields, further expanding its functions and influence.
[0163] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0164] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure.
[0165] The above is only a specific implementation of the present invention, but the design concept of the present invention is not limited thereto. Any non-substantial changes to the present invention using this concept shall be deemed as an infringement of the protection scope of the present invention.
Claims
1. A government affairs processing method based on a large language model of a knowledge graph, characterized in that: include: Use a large language model to extract named entities and relations from government-related texts; Performing named entity classification and entity disambiguation on the named entities and relations, and constructing a knowledge graph; Performing community detection on the constructed knowledge graph using a Leiden graph calculation method to generate a hierarchical community structure, and generating a community summary from the bottom up using the large language model; The large language model is used to extract entities from the government affairs questions input by the user, and the entities are hybrid searched using the constructed knowledge graph and retrieval model to obtain retrieval results related to the entities, and the retrieval results are enhanced using the large language model to generate result answers.
2. A government affairs processing method based on a large language model of a knowledge graph as claimed in claim 1, characterized in that: Use the large language model to extract named entities and relations from government-related texts, including the following: Pre-build government-related prompt words for large language model extraction and sample libraries for entity and relationship extraction; The government-related text is segmented to obtain text segments of a set length, and then the large speech module is used to perform preliminary extraction of named entities and relationships; a text embedding model is used to calculate the similarity between the text segment and the samples in the sample library, and a number of samples corresponding to the named entity and relationship extraction are extracted from the sample library according to the similarity, and the named entities and triple prompt words are assembled.
3. A government affairs processing method based on a large language model of a knowledge graph as claimed in claim 2, characterized in that: When using a large language model to extract named entities and relations from government-related texts, it also includes the reflection-enhanced extraction of named entities and relations, specifically: A plurality of adjacent text segments are merged to form a long text segment of a set length, and named entities and relations extracted from the plurality of text segments are removed from duplicates and added to the triple prompt words.
4. A government affairs processing method based on a large language model of a knowledge graph as claimed in claim 2, characterized in that: When using a large language model to extract named entities and relationships from government-related texts, it also includes parsing the named entities and relationships output by the large language model, specifically: The named entities and relations output by the large language model are deduplicated, and the text segment positions and metadata information of the source text when the named entities and relations are extracted are recorded in attributes.
5. The government affairs processing method based on a large language model of a knowledge graph as claimed in claim 1, characterized in that: Performing named entity classification and entity disambiguation on the named entities and relations, specifically including the following: Preset entity disambiguation prompt words, maintain a named entity classification list, the named entity classification list initially contains the types in the entity disambiguation prompt words; Traversing all entities extracted by the large language model, classifying these entities using prompt words in the large language model, and matching the obtained entity classifications with corresponding entity disambiguation prompt words to obtain standardized entity names; The obtained standardized entities are fully merged to generate entity descriptions and entity relationship descriptions.
6. A government affairs processing method based on a large language model of a knowledge graph as claimed in claim 1, characterized in that: It also includes a pre-set evaluation data set, which is used to calculate the recall rate of named entities and relationships as an indicator to measure the accuracy of named entity and relationship extraction and entity disambiguation, and the parameters of the large language model and the knowledge graph are adjusted and iterated according to the indicator.
7. A government affairs processing method based on a large language model of a knowledge graph as claimed in claim 1, characterized in that: The entity is searched using the constructed knowledge graph to obtain search results related to the entity, specifically: Retrieving a number of results most relevant to the entity from the constructed vector database of the knowledge graph as the identified entity; Finding the community summary with the largest number of occurrences of the identified entity from the constructed knowledge graph, and extracting a plurality of community summaries therefrom; The most closely connected relationship edges between the identified entities are searched from the constructed knowledge graph, sorted according to the number of source texts of each relationship variable, and a number of results are extracted therefrom to obtain descriptions of the entities and descriptions of the entity relationships.
8. A government affairs processing method based on a large language model of a knowledge graph as claimed in claim 7, characterized in that: The entity is searched using the search model to obtain search results related to the entity, specifically: Using a dense retrieval model to calculate the text vector of the user input, and recalling a number of text segments that are most relevant to the text vector similarity from the constructed vector database of the knowledge graph; Retrieving text segments related to the user input text from a keyword search engine using the BM25 algorithm, and recalling a number of the text segments; The plurality of text segments recalled in the above step are deduplicated, and then reordered using a reordering model, and the first plurality of text blocks are taken therefrom.
9. A government affairs processing method based on a large language model of a knowledge graph as claimed in claim 8, characterized in that: The retrieval results are enhanced using the large language model to generate result answers, specifically: the identified entities and their descriptions, entity relationships and their descriptions, several community summaries and several text blocks obtained by retrieval are used as contexts, and the large speech model is used to enhance the generation of result answers.
10. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores a computer program that can be called by the processor; the processor executes the government affairs processing method based on a large language model of a knowledge graph as described in any one of claims 1 to 9 by calling the computer program stored in the memory.
Citation Information
Patent Citations
Government affair service field multi-strategy fusion dialogue method based on knowledge graph
CN116628172A
Knowledge retrieval enhancement generation method and system based on large language model
CN118394890A
Knowledge graph automatic construction method and system for massive unstructured text
WO2020000848A1
Cited By
Rumor detection system and method based on large language model
CN120181073A
A rumor detection system and method based on large language models
CN120181073B
Knowledge-driven underground space information retrieval method, system and equipment
CN120216612A
Knowledge graph-oriented large model retrieval enhancement method and device and medium
CN120562568A
Index system creation method and device, equipment, medium and program product
CN120822883A