Historical knowledge graph construction and question answering enhancement method, system, device and medium

CN122965637APending Publication Date: 2026-10-23HUAZHONG NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611165030.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-03
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

[0005]本发明实施例的一个目的是提供一种历史知识图谱构建与智能问答增强方法的新的技术方案,可以解决现有技术中历史知识结构化程度低、问答准确性不足等问题中的至少一个

Benefits of technology

[0018]本发明实施例的一个有益效果在于,通过专用于历史知识的本体模式,特别是“前身/变更”演变关系的显式建模,解决了历史对象跨时期状态变化的精确表达问题,能够降低历史知识智能问答中的史实失真。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122965637A_ABST
    Figure CN122965637A_ABST
Patent Text Reader

Abstract

The present application relates to a kind of historical knowledge graph construction and question and answer enhancement method, system, equipment and medium, method includes the following steps: S100, historical knowledge resource preparation stage;S200, historical knowledge graph construction stage: first, predefine ontology mode, entity type in ontology mode at least include person, period, agency, official position, function and reform event;Attribute type at least includes person basic information, official position system information and event time sequence information;Relationship type at least includes time correlation, hierarchical membership, function configuration, person participation and object evolution relationship, extract from paragraph level text unit using large language model, the extraction result is verified and stored;S300, historical intelligent question and answer enhancement stage: including receiving natural language historical question and parsing generation graph query sentence, execute graph retrieval and obtain graph query result, constraint large language model generates answer, can reduce historical knowledge intelligent question and answer in fact distortion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the fields of artificial intelligence and natural language processing technology, and more specifically, to a method, system, device and medium for constructing historical knowledge graphs and enhancing question answering. Background Technology

[0002] Historical documents contain a wealth of structured knowledge, including institutional evolution, official systems, and interpersonal relationships. However, this knowledge is usually recorded in ancient books or academic works in a continuous natural language format. Existing general-purpose large language models often suffer from "illusions" when dealing with such specialized historical issues due to a lack of domain-specific factual constraints, leading to misattributions or chronological errors in answers. Furthermore, traditional keyword retrieval methods are ill-suited to handling the complex hierarchical, functional, and temporal relationships within historical knowledge.

[0003] While existing technologies have attempted to combine knowledge graphs with large models (GraphRAG), they still suffer from the following shortcomings when targeting the specific vertical domain of historical knowledge: First, there is a lack of ontology modeling methods adapted to the evolutionary characteristics of historical knowledge, making it difficult to express dynamic relationships such as "predecessor / change"; second, knowledge extraction lacks a quality verification loop for classical Chinese contexts; and third, the question-answer generation stage lacks a strict graph fact constraint mechanism, making it susceptible to interference from prior model knowledge.

[0004] Therefore, there is an urgent need for a method specifically designed for graph construction and question-answering enhancement of historical knowledge. Summary of the Invention

[0005] One objective of this invention is to provide a new technical solution for constructing historical knowledge graphs and enhancing intelligent question answering, which can solve at least one of the problems in the prior art, such as low degree of historical knowledge structuring and insufficient accuracy of question answering.

[0006] Another objective of this invention is to provide a new technical solution for a historical knowledge graph construction and intelligent question answering enhancement system that implements the above-described historical knowledge graph construction and intelligent question answering enhancement methods.

[0007] Another objective of this invention is to provide a new technical solution for an electronic device.

[0008] Another objective of this invention is to provide a new technical solution for computer storage media.

[0009] According to a first aspect of the present invention, a method for constructing a historical knowledge graph and enhancing intelligent question answering is provided, comprising the following steps: S100, Historical knowledge resource preparation stage: By extracting text and segmenting corpora from historical documents, paragraph-level text units that retain chapter structure information are formed; S200, Historical knowledge graph construction stage: First, an ontology pattern is predefined, the ontology pattern including a set of entity types, a set of attribute fields, and a set of relation types defined based on the historical knowledge structure. The entity types in the ontology pattern include at least people, periods, institutions, official positions, functions, and reform events; the attribute types include at least basic information about people, information about the official position system, and information about the event sequence, wherein the basic information about people includes at least name and place of origin; the information about the official position system includes at least institution name and official position name; the information about the event sequence includes at least start year and end year; the relation types include at least... The system includes time-related relationships, hierarchical affiliation, functional configuration, personnel participation, and object evolution relationships. The object evolution relationships are explicitly modeled through the relationship edges of "predecessor is" and "changed to". Then, the system uses a large language model to extract entity data and corresponding attribute data from the paragraph-level text units according to the ontology model. The system then identifies the relationship data between entities and verifies the extraction results to determine whether the relationship data conforms to the ontology model. The verified and normalized entity data, attribute data, and relationship data are stored as nodes and edges in the graph database to form the historical knowledge graph. S300, Historical Intelligent Question Answering Enhancement Stage: This includes receiving natural language historical questions input by users and parsing them to generate graph query statements, performing graph retrieval to obtain graph query results, and constraining the large language model to generate answers based on the graph query results.

[0010] Optionally, in step S100, when segmenting the corpus, the segmentation granularity remains at the paragraph-level text unit, and metadata tags are retained. The metadata tags include the chapter title, page number, and paragraph number. Optionally, step S200 specifically includes: S201, predefining the ontology pattern according to the knowledge structure of the target historical domain; S202, constructing entity extraction prompt template and relation extraction prompt template respectively. The entity extraction prompt template is used to instruct the large language model to extract entity data and its corresponding attribute data from the paragraph-level text unit, and the relation extraction prompt template is used to instruct the large language model to extract relation data from the paragraph-level text unit. The paragraph-level text unit obtained in step S100 is input into the large language model; S203, the extracted entity data and its attribute data are compared with the... The relationship data is sent to the review terminal; the review terminal receives the review feedback data output in response to the review interaction command, and the entity data, attribute data and relationship data are structurally updated according to the review feedback data to obtain the verified and standardized target knowledge data; S204, the target knowledge data is converted into graph database node data and relationship edge data. First, various entity nodes are established according to various entity names and entity types, and the attribute information corresponding to the entity is written into the corresponding node. Then, the directed relationship between the nodes is established according to the starting entity, target entity, relationship name and relationship direction, thereby forming a historical knowledge graph.

[0011] Optionally, the historical knowledge graph construction and intelligent question answering enhancement method further includes: an offline verification step, in which a test corpus of a preset size is selected before formal extraction using a large language model, and extraction indicators are calculated based on a pre-labeled sample dataset. The extraction indicators include the precision, recall and F1 score of the extraction results. If the extraction indicators are lower than a preset threshold, the prompt template is iteratively optimized until the quality requirements are met before formal extraction is performed.

[0012] Optionally, step S300 specifically includes: S301, User question parsing and graph query generation: receiving the user's input of a natural language historical question, and sequentially completing question standardization, verification type identification, evidence anchor point identification, query focus identification, and graph query statement generation through multiple large language model nodes; S302, Historical graph retrieval and graph query result acquisition: sending the graph query statement to the graph database for execution, obtaining the hit entities and their corresponding attributes and relationships, and forming graph query results through field extraction and format conversion; S303, Enhanced generation of historical graph result constraints and answer output: assembling the user's input of the natural language historical question, graph query results, and status markers into enhanced prompt words, and inputting them into the answer generation model.

[0013] Optionally, step S303 satisfies at least one of the following three conditions: (1) the enhanced prompt contains a fact constraint instruction; (2) the answer generation model is forced to generate an answer based solely on the graph query results; (3) the final node only performs the integration and rewriting of existing information, without supplementing unsupported specific historical facts based on the query results.

[0014] Optionally, step S301 satisfies at least one of the following three conditions: (1) the verification type includes attribute assertion verification, relation assertion verification, period constraint verification and multi-hop path verification; (2) the query instruction is one of Cypher statement, Gremlin statement or SPARQL statement; (3) the graph query statement is adapted to the target graph database and can be used to obtain entity attributes, direct relationships, period associations, hierarchical membership relationships and multi-hop paths.

[0015] According to a first aspect of the present invention, a historical knowledge graph construction and intelligent question answering enhancement system is provided, comprising: a document processing module configured to perform text extraction and corpus segmentation on historical documents to form paragraph-level text units that retain chapter structure information; an ontology and knowledge extraction module configured to define an ontology pattern and extract from the paragraph-level text units using a large language model, the extraction results including entity data, attribute data, and relation data; a verification and graph storage module configured to verify and standardize the extraction results and import them into a graph database to form a historical knowledge graph; a question parsing and query generation module configured to parse a natural language historical question input by a user and generate a graph query statement; a graph retrieval and graph query result acquisition module configured to perform a graph retrieval and acquire graph query results; and an enhancement generation module configured to generate answers based on the graph query results constraining the large language model.

[0016] According to a third aspect of the present invention, an electronic device is provided, comprising: a processor and a memory, wherein computer program instructions are stored in the memory, wherein when the computer program instructions are executed by the processor, the processor causes the processor to perform any of the methods described above.

[0017] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform any of the methods described above.

[0018] One beneficial effect of this invention is that by using an ontology model specifically designed for historical knowledge, particularly explicit modeling of the evolutionary relationship between "predecessors / changes," the problem of accurately expressing the state changes of historical objects across periods is solved, thereby reducing historical fact distortion in intelligent question answering of historical knowledge.

[0019] Other features and advantages of the present invention will become clear from the following detailed description of exemplary embodiments of the invention with reference to the accompanying drawings. Attached Figure Description

[0020] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments of the invention and, together with their description, serve to explain the principles of these embodiments.

[0021] Figure 1 A flowchart illustrating a method for constructing a historical knowledge graph and enhancing intelligent question answering according to some embodiments is shown; Figure 2 A flowchart illustrating the historical knowledge graph construction phase according to some embodiments is shown; Figure 3 A schematic diagram illustrating the processing flow of the historical intelligent question answering enhancement stage according to some embodiments is shown; Figure 4 A schematic diagram of the structure of a historical knowledge graph according to some embodiments is shown; Figure 5 A schematic diagram of the hardware structure of an electronic device according to some embodiments is shown.

[0022] Figure Labels Electronic device 100; processor 110; memory 120. Detailed Implementation

[0023] Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values ​​of the components and steps set forth in these embodiments do not limit the scope of the invention.

[0024] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the invention or its application or use.

[0025] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.

[0026] In all the examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values.

[0027] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.

[0028] The historical knowledge graph construction and intelligent question answering enhancement method of the present invention will be described in detail below with reference to the accompanying drawings.

[0029] like Figure 1 As shown, the historical knowledge graph construction and intelligent question answering enhancement method according to an embodiment of the present invention includes the following steps: S100, Historical Knowledge Resource Preparation Stage.

[0030] By extracting text and segmenting corpora from historical documents, paragraph-level text units that retain the structural information of the text are formed.

[0031] In step S100, the electronic document of the historical document to be processed can be obtained first, and then processed. The electronic document can be, but is not limited to, a PDF file. Regarding the processing of historical documents, the conversion between electronic PDF and TXT versions can be replaced by other parsable electronic formats or OCR transcription methods. The corpus can be segmented using methods such as chapters / paragraphs, fixed lengths, sliding windows, or semantic boundaries.

[0032] Furthermore, when extracting text and segmenting corpora from historical documents, text content can be extracted using a text parsing engine, and corpora can also be segmented based on the chapter structure identifiers of the historical documents to be processed (such as chapter numbers, paragraph indentation, and font size variations).

[0033] Preferably, in step S100, when segmenting the corpus, the segmentation granularity is maintained at "paragraph-level text units," and metadata tags are retained. These metadata tags include the chapter title, page number, and paragraph number, and are used for subsequent knowledge tracing and entity disambiguation. Unlike existing technologies that segment by a fixed number of characters, this embodiment preserves the original semantic boundaries of historical documents, avoiding entity relationship breaks caused by cross-sentence segmentation.

[0034] S200, Historical Knowledge Graph Construction Phase.

[0035] First, a predefined ontology schema is defined, comprising a set of entity types, attribute fields, and relation types based on a historical knowledge structure. In other words, the ontology schema consists of a triplet data structure framework composed of the entity type set, attribute field set, and relation set. Entity types in the ontology schema must include at least people, periods, institutions, official positions, functions, and reform events. Attribute types must include at least basic information about people, information about the official system, and chronological information about events. The basic information about people must include at least name and place of origin; the information about the official system must include at least institution name and official position name; and the chronological information about events must include at least start year and end year. For example, attribute types may include at least name, birth and death years, place of origin, period, start year, end year, function name, function category, institution name, institution category, stage description, official position name, rank, official position attribute, official position nature, reform type, stage of occurrence, and change description. Relation types must include at least time association, hierarchical affiliation, functional configuration, person participation, and object evolution relationships. Object evolution relationships explicitly model the institutional evolution process of historical objects through "predecessor was" and "changed to" relation edges. For example, a triplet data structure framework includes at least: {period, ruler, person}, {institution, superior institution, organization}, {reform event, change to, official position}, etc. It should be noted that the above entities, attributes, and relationship types are merely illustrative examples. Those skilled in the art can extend or tailor the ontology model according to specific historical periods (such as Song, Ming, and Qing dynasties) or themes (such as taxation and military affairs), and such adjustments all fall within the protection scope of this invention.

[0036] Subsequently, using a large language model, entity data and its corresponding attribute data are extracted from paragraph-level text units according to the ontology pattern. Then, the relationship data between entities is identified, and the extraction results are verified to determine whether the relationship data conforms to the ontology pattern. The verified and normalized entity data, its attribute data, and the relationship data are stored as nodes and edges in the graph database to form a historical knowledge graph.

[0037] In this embodiment, by setting entity types such as people, periods, institutions, official positions, functions, and reform events, and establishing relationship types between people and periods, official positions and institutions, institutional levels, functional configurations, stages of events, and objects before and after institutional changes, facts scattered in historical documents are organized into a unified graph structure. This allows for joint queries on multiple entity relationships, institutional affiliations, functional associations, and period conditions, reducing potential relationship omissions and incorrect combinations of cross-period facts that may occur when relying solely on keywords or local text similarity, and improving the organization and querying capabilities of complex relationships in historical knowledge.

[0038] By setting up reform events and using relationships such as "predecessor was" and "changed to" to connect the institutions or official positions before and after the institutional changes, while also associating the period of the reform with relevant figures, the evolution of the institutional objects can be preserved while standardizing names. This method can be used to query the renaming, reorganization, and phased changes of institutions or official positions, reducing the possibility of incorrectly juxtaposing names, affiliations, or functions from different historical periods. Therefore, preserving the institutional evolution of institutions and official positions improves the targeted identification of historical inaccuracies.

[0039] In terms of knowledge modeling, entity types and attribute fields can be adjusted according to the target historical theme. Institutional evolution can be expressed by reform events and their predecessors, change relationships, or by relationships with time attributes, version nodes, or other structures that can retain the objects before and after the change and the period of occurrence.

[0040] As can be seen, the historical knowledge graph construction and intelligent question-answering enhancement method according to embodiments of the present invention can establish a knowledge model for historical knowledge that includes entities such as people, periods, institutions, official positions, functions, and reform events, and organize historical facts through time association, hierarchical affiliation, functional configuration, and object evolution relationships. Moreover, it can also associate reform events with the period of occurrence, decision-makers, objects before the change, and objects after the change to form a queryable institutional evolution chain.

[0041] According to one embodiment of the present invention, such as Figure 2 As shown, step S200 specifically includes: S201. Based on the knowledge structure of the target historical domain, predefine the ontology schema. It can be seen that step S201 is used for historical knowledge ontology design.

[0042] S202. Construct entity extraction prompt templates and relation extraction prompt templates respectively. The entity extraction prompt template is used to instruct the large language model to extract entity data and its corresponding attribute data from paragraph-level text units. The relation extraction prompt template is used to instruct the large language model to extract relation data from paragraph-level text units. Step S202 is used to implement the historical entity and relation extraction based on the large language model. It can be understood that attribute data is not an independent extraction object, but rather a component of the entity extraction result. While identifying entities, the corresponding attribute data is extracted synchronously according to the preset attribute fields in the ontology model. Therefore, this embodiment does not set a separate attribute extraction step or attribute extraction prompt template.

[0043] Alternatively, in terms of entity data, attribute data, and relation data extraction, prompt-based large language model knowledge extraction can be replaced by named entity recognition, relation extraction models, rule templates, dictionaries, or human-computer collaboration methods.

[0044] S203. Send the extracted entity data, attribute data, and relation data to the audit terminal; receive the audit feedback data output by the audit terminal in response to the audit interaction command; and perform structured updates on the entity data, attribute data, and relation data based on the audit feedback data to obtain the verified and standardized target knowledge data.

[0045] This process involves extracting entity data and its corresponding attribute data from paragraph-level text units using a large language model based on ontology patterns. The extracted entity data, including its name, type, and attributes, can be reviewed to correct obvious identification errors, attribute misalignments, and duplicate records. Furthermore, the names of the same knowledge object can be standardized and made unique, ensuring that subsequent relationships point to a unified entity node. For example, duplicate records of the same object from the same period can be merged and made unique. For changes in the status of the same historical object at different times, a composite primary key strategy of "entity name + stage identifier" can be used, or the evolution process can be explicitly modeled through "predecessor is / changed to" relationship edges, rather than simply overwriting or merging, ensuring that subsequent relationships point to the object node of the corresponding period.

[0046] After identifying the relationship data between entities, it is possible to check whether the relationship name, starting entity, target entity, and relationship direction conform to the preset ontology schema in step S201. Sampling methods can also be used to verify the accuracy and consistency of the relationship content. For example, for historical objects such as institutions and official positions that have undergone name changes, reorganizations, or institutional adjustments at different times, the related objects are not simply merged into indiscriminate names, but their evolution process is preserved through event entities and relationships such as "predecessor was" and "changed to".

[0047] As can be seen, step S203 facilitates the verification, standardization, and structured organization of the extraction results. Furthermore, to ensure the data foundation for the historical knowledge graph construction is usable for subsequent queries, this embodiment can limit entity categories, attribute fields, and relationship directions using a preset ontology schema. Entity extraction and relationship extraction are organized separately, and the extraction results are verified and standardized. This reduces the risk of erroneous entities, misplaced attributes, or incorrect relationship directions entering the knowledge graph and being transmitted to the question-and-answer stage. This step constitutes auxiliary quality control during implementation, enabling both auxiliary quality control and usability verification.

[0048] S204. Convert the target knowledge data into graph database node data and relation edge data. Specifically, convert the verified and standardized entity data and its attribute data into graph database node data, and convert the relation data into relation edge data. Specifically, first, establish various entity nodes based on entity names and entity types, and write the corresponding attribute information of the entities into the corresponding nodes. Then, establish directed relationships between nodes based on the starting entity, target entity, relation name, and relation direction, thereby forming a historical knowledge graph. The verified entity table and relation table are used as graph database entry data, that is, the standardized data is imported into the graph database. Adopting step S204 facilitates the construction and storage of the historical knowledge graph.

[0049] In step S204, the specific type of graph database is not limited; any graph database that supports attribute graph models and directed edge queries (such as Neo4j, NebulaGraph, JanusGraph, etc.) is applicable. For example, using Neo4j for storage, a knowledge graph of the Tang Dynasty's central official system containing 1302 nodes and 4203 edges can be constructed (e.g., Figure 4 (As shown).

[0050] In addition, in terms of knowledge storage, Neo4j can be replaced by other attribute graph databases, RDF graph databases, or data systems that support graph structure queries, and Cypher can be replaced by SPARQL, Gremlin, GQL, or corresponding query interfaces.

[0051] In some specific embodiments of the present invention, an offline verification step is also included. Before formal extraction using a large language model, a test corpus of a preset size is selected, and extraction metrics are calculated based on a pre-labeled sample dataset. These extraction metrics include precision, recall, and F1 score. Precision reflects the accuracy of the extraction results, recall reflects the degree to which pre-labeled knowledge is successfully extracted, and the F1 score is the harmonic mean of precision and recall, used to comprehensively evaluate the extraction effect. For example, if the F1 score is lower than a preset threshold (e.g., 0.75), the constraint instructions or example samples in the prompt template are iteratively optimized until the quality requirements are met. In this embodiment, selecting test corpus and calculating extraction metrics based on a pre-labeled sample dataset, and iteratively optimizing the prompt template until the quality requirements are met before performing formal extraction, ensures extraction quality. In a specific test case, after two rounds of prompt word optimization, the F1 score for entity type extraction reached 0.807. It should be understood that this value is only used to verify the feasibility of this method and does not constitute a necessary limitation on the technical solution of this invention.

[0052] During the knowledge extraction phase, multi-source heterogeneous texts from the target historical domain were used as the test set, and the results were manually reviewed to verify their accuracy. Through multiple rounds of prompt word engineering adjustments, the comprehensive evaluation index of entity extraction showed a significant improvement trend and converged to a stable range. For example, after prompt word adjustments, the Precision, Recall, and F1 of entity extraction were 0.749, 0.875, and 0.807, respectively, verifying that this auxiliary quality control mechanism can provide a data foundation that meets quality requirements for the formal knowledge graph construction.

[0053] S300, Enhanced Historical Question Answering Stage: This stage includes receiving user-input natural language historical questions and parsing them to generate graph query statements, performing graph retrieval to obtain graph query results, and generating answers based on the graph query results constraining the large language model.

[0054] In some specific embodiments of the present invention, step S300 specifically includes: S301, User Question Analysis and Graph Query Generation.

[0055] like Figure 3 As shown, the system receives natural language history questions input by the user and sequentially completes question standardization, verification type identification, evidence anchor point identification, query focus identification, and graph query statement generation through multiple large language model nodes.

[0056] Step S301 satisfies at least one of the following three conditions: Condition 1: Validation types include attribute assertion validation, relation assertion validation, period constraint validation, and multi-hop path validation; Condition 2: The query command is one of the following: Cypher statement, Gremlin statement, or SPARQL statement; Condition 3: The graph query statement is compatible with the target graph database and can be used to retrieve entity attributes, direct relationships, period relationships, hierarchical membership, and multi-hop paths. Specifically, the graph query statement must be compatible with the graph database and can be used to retrieve entity attributes, direct relationships, period relationships, hierarchical membership, and multi-hop paths.

[0057] This allows for the generation of graph query statements based on entity names and their attributes. For example, sample Cypher statements are shown in Table 1 below: Table 1 Furthermore, in terms of question parsing, single or multiple large language models, rule templates, semantic parsing, or intermediate query representations can be used to transform the user-input natural language history question into an executable graph query targeting entities and their attributes, relation types, multi-hop association paths, and time conditions. Specifically, relation types are used to limit the association methods between the entities to be queried, multi-hop association paths represent the sequence of entity associations formed by multiple relation edges, and time conditions are used to limit the query scope based on information such as period entities, start year, end year, initial time node, active period, or event occurrence period.

[0058] As can be seen, the historical knowledge graph construction and intelligent question answering enhancement method according to the embodiments of the present invention can standardize the parsing of user questions, identify the question verification type, evidence anchor point, query entity and its attributes, relationship type, multi-hop association path and time condition, and generate graph query statement.

[0059] S302. Historical map retrieval and map query result construction: The graph query statement is sent to the graph database for execution, and the matched entities, corresponding attributes, and relationships are obtained. The graph query results are then generated through field extraction and format conversion.

[0060] Preferably, when no executable graph query statement is generated, a "cannot be generated" message is output; when the interface call fails, an execution failure status is output; when the query is successful but there are no records, a "no match" message is output; the answer generation stage is only entered when the query is successful and there are records, thus realizing branch judgment on the query status.

[0061] Optionally, in terms of retrieval and generation, retrieval methods such as nodes, paths, subgraphs, graph communities, or graph vectors can be used, and keyword or text vector retrieval can be used as a supplement.

[0062] The query results can be converted into graph query results by program rules, mapping components, or large language models. The final graph query results can be generated by different local or cloud-based large language models, templates, or a combination of rules and models. Dify, Docker, HTTP, and specific database products can also be replaced by other workflow platforms, application servers, interfaces, or database drivers.

[0063] S303, Enhanced generation and answer output of historical graph result constraints.

[0064] The system assembles the user's input of a natural language history question, graph query results, and query status into enhanced prompt words, which are then used to generate the input answer model.

[0065] Step S303 can satisfy at least one of the following three conditions: Condition 1: The enhanced prompt contains a factual constraint instruction; Condition 2: The mandatory answer generation model generates answers solely based on the graph query results; Condition 3: Ensure that the final node only integrates and rewrites existing information, without supplementing the query results with unsupported specific historical facts.

[0066] The enhanced prompts include factual constraint instructions, forcing the answer generation model to generate answers solely based on the graph query results, thus suppressing model illusions. Furthermore, when query results are insufficient or empty, a cautionary prompt can be output.

[0067] Understandably, by standardizing natural language historical questions, identifying query entities and attribute or relation constraints, generating graph query statements, retrieving historical graphs, and converting query result formats, the historical assertions proposed by users are transformed into structured queries targeting specific entity attributes or relations. The graph query results then serve as the primary basis for the large language model to generate answers. This approach supports the verification of facts such as official ranks, institutional affiliations, functional classifications, period relationships, and institutional evolution. When no relevant records are found, an insufficient information prompt is output, reducing the need for the large language model to supplement unsupported historical facts without relying on graph results. In other words, this method improves the consistency between historical assertion verification and the answers, as well as the facts presented in the graph.

[0068] As can be seen, the historical knowledge graph construction and intelligent question answering enhancement method according to the embodiments of the present invention can organize the graph query results returned by the graph database, such as entities and their attributes, entity relationships and multi-hop association paths, into graph query results, and use the graph query results as the basis for the large language model to generate answers, constrain the large language model to generate answers based on the graph query results, and output a prompt of no record or insufficient information when there are no matching results.

[0069] In summary, this invention provides a method for constructing a knowledge graph and enhancing intelligent question answering for historical knowledge, comprising three stages: historical knowledge resource preparation, historical knowledge graph construction, and historical intelligent question answering enhancement. Each stage uses the output of the previous stage as the input of the next, forming a complete data processing chain from historical documents to a structured knowledge graph, and then to graph-enhanced answers. Compared to general large language model question answering, ordinary text retrieval enhancement generation methods, and domain knowledge graph enhancement question answering schemes that do not establish specific knowledge models for historical knowledge, this invention employs techniques such as historical knowledge ontology construction, expression of institutional evolution relationships, graph querying, and generation of query result constraints. The historical knowledge graph construction and intelligent question answering enhancement method according to embodiments of this invention can construct a complete technical combination from historical knowledge organization to graph-constrained question answering, based on the temporal, hierarchical, functional, and evolutionary characteristics of historical knowledge, rather than using large language models, graph databases, or GraphRAG technology alone.

[0070] According to some embodiments of the present invention, by establishing historical knowledge models that can express knowledge objects such as people, periods, institutions, official positions, functions, and reform events, as well as their temporal, hierarchical, subordinate, functional, and evolutionary relationships, facts scattered in the natural language narratives of historical documents can be transformed into structured knowledge that can be stored, queried, and associated by a graph database. Furthermore, by preserving the name changes and institutional alterations of institutions and official positions at different stages through reform events and their preceding and following relationships, the natural language historical questions input by users are converted into graph queries oriented towards entities and their attributes, entity relationships, and association paths. The query scope is limited by combining period entities (one type of entity) or time attributes (one type of entity attribute), and the corresponding processing branch is entered based on the query generation status, graph database execution status, and returned records. Only when the query is successful and graph facts are obtained is the processed query result used as the basis for generating answers by the large language model. When the query statement cannot be generated, fails to execute, or does not return matching records, corresponding prompts are output, and the model is restricted from supplementing specific historical facts lacking graph basis, thereby improving the accuracy, completeness, and logical consistency of historical relationship retrieval, institutional evolution analysis, and factual expression. Understandably, "period" is a pre-defined entity type in the ontology schema. It can be used as a time-limited condition during the query process and can be combined with entity attributes such as start year and end year, as well as relationships such as "active period" and "occurrence period" to limit the query range. "Path" is a single-hop or multi-hop query structure formed by connecting entity nodes and relation edges.

[0071] The method of the present invention will be described in detail below with reference to specific embodiments.

[0072] Example 1 The following steps are used in Example 1: S100, Historical Knowledge Resource Preparation Stage.

[0073] This study selects the central government system of the Tang Dynasty as the target historical domain, using electronic versions of historical documents such as the *Tang Liudian* and the *Old Book of Tang* as the primary knowledge sources. PDF documents are converted to TXT text, and the text content is extracted using a text parsing engine. The corpus is then segmented according to the original chapters and paragraphs, retaining chapter titles and paragraph position information to form paragraph-level text units. It is understood that the specific ancient texts and the central government system of the Tang Dynasty are only used to illustrate the implementation process of this embodiment and do not constitute a limitation on the historical themes and periods to which this invention is applicable.

[0074] S200, the historical knowledge graph construction stage, S200 includes the following steps S201 to S204, as detailed below: S201. Predefine the ontology schema based on the knowledge structure of the central government system of the Tang Dynasty. Specifically, set up six types of entities and their attributes: people, periods, functions, institutions, official positions, and reform events. Set up relationships such as those of the person in power, superior functions, superior institutions, core functions, active periods, affiliated institutions, occurrence periods, decision-makers, predecessors, and changes. The entity and attribute schemas and relation schemas are shown in Tables 2 and 3 below, which are used to limit the entity types, attribute fields, relation types, and entity types at both ends of the relation that can be extracted from the large language model.

[0075] Table 2 Table 3 S202. Construct entity extraction prompt templates and relation extraction prompt templates respectively. The entity extraction prompt template instructs the large language model to identify entity types from paragraph-level text units and simultaneously extract corresponding entity attributes; that is, it extracts entity data and its corresponding attribute data simultaneously. The relation extraction prompt template identifies the relationship type between entities, the starting entity, the target entity, and the relation direction. Attribute data is a component of the entity extraction results, and no separate attribute extraction step is set. Before formal extraction, the extraction effect is verified using pre-annotated test corpus samples; that is, after interactive verification feedback and sampling verification, the data is imported into the graph database. After two rounds of prompt template optimization, the precision, recall, and F1 score of the entity extraction results are 0.749, 0.875, and 0.807, respectively, indicating that the model performs well in terms of recall, while its overall precision and comprehensive balance are at a good level.

[0076] S203. For entity extraction results, verify entity names, entity types, and entity attributes; correct identification errors, attribute misalignments, and duplicate records; and standardize and uniquely name the same knowledge object. For institutions or official positions that have changed over different periods, preserve their evolution process through stage identifiers or reform events and relationships such as "predecessor was" and "changed to". For relation extraction results, verify whether the relation name, starting entity, target entity, and relation direction conform to the ontology schema preset in step S201.

[0077] S204. Import the entities and relations that have undergone interactive verification and normalization into the Neo4j graph database. Create nodes based on entity names and entity types, and write entity attributes into the corresponding nodes; then create directed relation edges based on the starting entity, target entity, relation name, and relation direction, forming a knowledge graph of the Tang Dynasty's central government system containing 1302 nodes and 4203 relation edges.

[0078] S300, the historical intelligent question-answering enhancement stage, S300 includes steps S301 to S303, as follows: S301. Receive the natural language history question input by the user and generate a graph query statement. Taking "Right Remonstrance Official and Right Advisor were both seventh-rank officials" as an example, the question is analyzed, "Right Remonstrance Official" and "Right Advisor" are identified as query entities, "rank" is identified as a query attribute, and a corresponding Cypher query statement is generated accordingly.

[0079] S302. Send the generated Cypher query statement to the Neo4j graph database for execution. The graph database returns two official entities, Right Assistant Minister and Right Remonstrance Official, along with their ranks and other attributes. The rank of Right Assistant Minister is "Upper Seventh Rank," and the rank of Right Remonstrance Official is "Upper Eighth Rank." The returned results are then integrated with structured evidence context to form a graph query result containing the query entities, attribute names, attribute values, and query status.

[0080] S303. Assemble the user-input natural language history question, graph query results, and query status into enhanced prompts, input them into the answer generation model, and require the model to generate answers based solely on the graph query results through fact constraint instructions. Based on the above query results, generate the answer: "The rank of Right Remonstrance Official is Upper Seventh Rank, and the rank of Right Remonstrance Official is Upper Eighth Rank, therefore they are not both Seventh Rank officials." The above results show that the GraphRAG question-answering method in this embodiment 1, which uses access to historical knowledge graphs, can convert natural language historical assertions into graph queries for specific entity attributes, make judgments based on the structured facts returned by the graph, and integrate the query results into natural language answers.

[0081] Comparative Example 1 Example 1 uses the GraphRAG question-answering method that integrates a historical knowledge graph. Comparative Example 1 uses the same basic large language model as Example 1, but does not integrate a knowledge graph; it directly generates answers based on user questions. Both use the same 54 test questions and unified answer requirements, and both disable internet access and deep thinking functions. The main difference lies in whether or not the graph retrieval results are used to constrain answer generation. Test questions are categorized by knowledge content into temporal-spatial, entity constraint, and semantic relationship categories. Temporal-spatial questions mainly involve historical periods and stage relationships, entity constraint questions mainly involve entity identities and attributes, and semantic relationship questions mainly involve institutional affiliation, functional attribution, and institutional evolution relationships. The tasks are categorized by method into fact-checking, comparative analysis, and multi-hop reasoning. Fact-checking is used to determine whether historical assertions are consistent with graph facts, comparative analysis is used to compare the differences in attributes or relationships between different historical objects, and multi-hop reasoning is used to obtain answers through two or more consecutive relationships.

[0082] The assessment employed a comparative scoring method for the same question, evaluating the answers generated by Example 1 and Comparative Example 1 across five dimensions: correctness, relevance, completeness, logic, and satisfaction. To reduce differences in absolute scoring scales among raters, a relative scoring mechanism of -5 to 5 points was used. The two sets of model answers to the same question were compared across these five dimensions: correctness, relevance, completeness, logic, and satisfaction. A positive value indicates that Example 1's answer was superior to Comparative Example 1, a negative value indicates that Comparative Example 1's answer was superior to Example 1, and 0 indicates that both performed similarly. The larger the absolute value, the more significant the difference between the two sets of answers.

[0083] The results show that Example 1, compared to Comparative Example 1, achieved positive improvements in all indicators across the three knowledge dimensions and the three tasks of fact-checking, comparative analysis, and multi-hop reasoning. For time-space related questions, scores improved by 0.79, 0.18, 0.51, 0.67, and 0.62 points in correctness, relevance, completeness, logicality, and satisfaction, respectively; for entity constraint related questions, scores improved by 1.04, 0.41, 1.03, 0.99, and 1.38 points, respectively; and for semantic relation related questions, scores improved by 1.31, 0.28, 1.77, 1.51, and 1.73 points, respectively. The improvements in completeness, logicality, and satisfaction were the most significant. In terms of task type, the five indicators for the fact-checking task improved by 1.41, 0.24, 1.32, 1.26 and 1.43 points respectively; the comparison and analysis task improved by 0.78, 0.24, 1.20, 1.02 and 1.17 points respectively; and the multi-hop reasoning task improved by 0.96, 0.38, 0.79, 0.89 and 1.13 points respectively.

[0084] Therefore, the main technical effect of Example 1 lies in the organization of semantic relationships and the verification and correction of historical facts. For example, in the semantic relationship-based fact-checking question "As an agency under the Ministry of War, the Treasury Department, in addition to managing the selection and appointment of military officers, also manages ceremonial matters," the map query results show that the Treasury Department belongs to the Ministry of War and mainly manages military equipment, ceremonial matters, and imperial processions; the selection and appointment of military officers is the responsibility of the Minister of War, the Vice Minister of War, the Director of War, and the Assistant Director of War, not the Treasury Department; although the Office of Military Affairs is also under the Ministry of War, it is mainly responsible for maps and other matters. Based on this, Example 1 points out that the statement "the Treasury Department manages ceremonial matters" in the question stem is correct, while the statement "the Treasury Department manages the selection and appointment of military officers" is incorrect, and further explains the specific functional attribution of the selection and appointment of military officers. Although Comparative Example 1 also identifies that the Treasury Department is not responsible for the selection and appointment of military officers, it describes the selection and appointment of military officers as the responsibility of the Ministry of War's "Office of Military Affairs and Military Selection," which is inconsistent with the actual functions of the Office of Military Affairs.

[0085] As can be seen, by comparing Comparative Example 1 and Example 1, the question-answering enhancement effect of the present invention can be verified. Specifically, Comparative Example 1 shows that although ordinary large language models can identify erroneous historical assertions contained in the question stem in some questions, they tend to only focus on some entities or omit relevant facts; while Example 1 can perform queries and correlation verification based on entities and relationships in the graph, thereby forming a relatively complete answer. At the same time, the relative advantage in time-space and entity-type questions is relatively small, and the improvement in contrast discrimination and multi-hop reasoning tasks is also relatively limited, indicating that the current main enhancement effect of Example 1 of the present invention is concentrated on semantic relationship organization and the verification and correction of explicit historical facts.

[0086] The historical knowledge graph construction and intelligent question answering enhancement method according to embodiments of the present invention has at least the following beneficial effects: (1) By using an ontology model specifically designed for historical knowledge, especially explicit modeling of the evolution relationship between "predecessor / change", the problem of accurately expressing the state changes of historical objects across periods is solved; (2) The accuracy and recall of knowledge extraction in the context of classical Chinese can be guaranteed through the closed-loop mechanism of offline verification and prompt word iteration; (3) The enhanced generation mechanism of graph fact constraints can effectively suppress the illusion problem of large language models in the field of history and improve the interpretability and credibility of question answering.

[0087] This invention also provides a historical knowledge graph construction and intelligent question answering enhancement system, including: a document processing module, an ontology and knowledge extraction module, a verification and graph storage module, a question parsing and query generation module, a graph retrieval and graph query result acquisition module, and an enhancement generation module.

[0088] Specifically, the document processing module is configured to perform text extraction and corpus segmentation on historical documents, forming paragraph-level text units that retain the information of the text structure; the ontology and knowledge extraction module is configured to define ontology patterns and extract them from paragraph-level text units using a large language model, with the extraction results including entity data, attribute data, and relational data; the verification and graph storage module is configured to verify and standardize the extraction results and import them into a graph database to form a historical knowledge graph; the question parsing and query generation module is configured to parse the natural language historical questions input by the user and generate graph query statements; the graph retrieval and graph query result acquisition module is configured to perform graph retrieval and acquire graph query results; and the enhancement generation module is configured to generate answers based on the graph query results constraining the large language model.

[0089] The historical knowledge graph construction and intelligent question-answering enhancement system according to embodiments of the present invention can structure and graph-associate historical knowledge, retrieve relevant entities and relational facts based on user questions, and use graph query results to constrain the historical knowledge enhancement question-answering method that generates answers using a large language model. This improves the factual accuracy, relational completeness, logical consistency, and factual constraint of historical knowledge question-answering results, and reduces historical factual distortion in historical knowledge intelligent question-answering.

[0090] The present invention also provides a schematic diagram of the hardware structure of an electronic device.

[0091] like Figure 5 As shown, the electronic device 100 includes a processor 110 and a memory 120. The memory 120 is used to store an executable computer program, and the processor 110 is used to execute the historical knowledge graph construction and intelligent question answering enhancement method as described in any of the above method embodiments, under the control of the computer program.

[0092] Each module of the above-mentioned historical knowledge graph construction and intelligent question answering enhancement system can be implemented by the processor 110 in this embodiment executing the computer program stored in the memory 120, or it can be implemented by other structures, which are not limited here.

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

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

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

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

[0097] Various aspects of the present invention are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0098] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0099] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0100] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions. It will be known to those skilled in the art that implementation in hardware, implementation in software, and implementation using a combination of software and hardware are equivalent.

[0101] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, and are not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or technical improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein. The scope of the invention is defined by the appended claims.

Claims

1. A method for constructing historical knowledge graphs and enhancing intelligent question answering, characterized in that, Includes the following steps: S100, Historical Knowledge Resource Preparation Stage: By extracting texts and segmenting corpora from historical documents, paragraph-level text units that retain chapter structure information are formed; S200, Historical Knowledge Graph Construction Phase: First, an ontology schema is predefined. This schema includes a set of entity types, a set of attribute fields, and a set of relation types defined based on the historical knowledge structure. Entity types in the ontology schema must include at least people, periods, institutions, official titles, functions, and reform events. Attribute types must include at least basic information about people, information about the official title system, and information about the event sequence. Basic information about people must include at least name and place of origin. Information about the official title system must include at least institution name and official title. Information about the event sequence must include at least the start year and end year. Relation types must include at least time. The system establishes relationships based on association, hierarchical affiliation, functional configuration, personnel participation, and object evolution. These relationships are explicitly modeled through "predecessor" and "changed to" relationships, outlining the institutional evolution of historical objects. Subsequently, a large language model is used to extract entity data and corresponding attribute data from paragraph-level text units according to the ontology model. Relationship data between entities is then identified, and the extraction results are verified to determine whether the relationship data conforms to the ontology model. The verified and standardized entity data, attribute data, and relationship data are stored as nodes and edges in a graph database, forming the historical knowledge graph. S300, Historical Intelligent Question Answering Enhancement Stage: This includes receiving natural language historical questions input by the user and parsing them to generate graph query statements, performing graph retrieval to obtain graph query results, and constraining the large language model to generate answers based on the graph query results.

2. The historical knowledge graph construction and intelligent question answering enhancement method according to claim 1, characterized in that, In step S100, when performing corpus segmentation, the segmentation granularity is maintained at the paragraph-level text unit, and metadata tags are retained. The metadata tags include chapter title, page number, and paragraph number.

3. The historical knowledge graph construction and intelligent question answering enhancement method according to claim 1, characterized in that, Step S200 specifically includes: S201. Based on the knowledge structure of the target historical domain, predefine the ontology pattern; S202. Construct an entity extraction prompt template and a relation extraction prompt template respectively. The entity extraction prompt template is used to instruct the large language model to extract the entity data and its corresponding attribute data from the paragraph-level text unit. The relation extraction prompt template is used to instruct the large language model to extract relation data from the paragraph-level text unit. Input the paragraph-level text unit obtained in step S100 into the large language model. S203. Send the extracted entity data, attribute data, and relationship data to the audit terminal; receive the audit feedback data output by the audit terminal in response to the audit interaction command; and perform structured updates on the entity data, attribute data, and relationship data based on the audit feedback data to obtain verified and standardized target knowledge data. S204. Convert the target knowledge data into graph database node data and relation edge data. First, establish various entity nodes according to various entity names and entity types, and write the attribute information corresponding to the entity into the corresponding node. Then, establish directed relationships between nodes according to the starting entity, target entity, relation name and relation direction, thereby forming a historical knowledge graph.

4. The historical knowledge graph construction and intelligent question answering enhancement method according to claim 3, characterized in that, Also includes: In the offline verification step, before formal extraction using a large language model, a test corpus of a preset size is selected, and extraction metrics are calculated based on a pre-labeled sample dataset. The extraction metrics include the precision, recall, and F1 score of the extraction results. If the extraction metrics are lower than a preset threshold, the prompt template is iteratively optimized until the quality requirements are met before formal extraction is performed.

5. The historical knowledge graph construction and intelligent question answering enhancement method according to claim 1, characterized in that, Step S300 specifically includes: S301, User Question Parsing and Graph Query Generation: Receives natural language historical questions input by users, and sequentially completes question standardization, verification type identification, evidence anchor point identification, query focus identification, and graph query statement generation through multiple large language model nodes; S302. Historical graph retrieval and graph query result acquisition: The graph query statement is sent to the graph database for execution to obtain the hit entities, corresponding attributes and relationships, and graph query results are formed through field extraction and format conversion. S303, Enhanced Generation and Answer Output of Historical Graph Results Constraints: The user-input natural language historical question, graph query results, and status markers are assembled into enhanced prompt words and input answer generation model.

6. The historical knowledge graph construction and intelligent question answering enhancement method according to claim 5, characterized in that, Step S303 must satisfy at least one of the following three conditions: (1) The enhanced prompt contains a fact constraint instruction; (2) The forced answer generation model generates answers solely based on the graph query results; (3) Ensure that the final node only performs the integration and rewriting of existing information, without supplementing the query results with unsupported specific historical facts.

7. The historical knowledge graph construction and intelligent question answering enhancement method according to claim 5, characterized in that, Step S301 satisfies at least one of the following three conditions: (1) The verification types include attribute assertion verification, relation assertion verification, period constraint verification and multi-hop path verification; (2) The query command is one of the Cypher, Gremlin, or SPARQL statements; (3) The graph query statement is compatible with the target graph database and can be used to obtain entity attributes, direct relationships, period associations, hierarchical affiliations and multi-hop paths.

8. A historical knowledge graph construction and intelligent question-answering enhancement system, characterized in that, include: The document processing module is configured to perform text extraction and corpus segmentation on historical documents, forming paragraph-level text units that retain the chapter structure information; The ontology and knowledge extraction module is configured to define an ontology schema and extract it from the paragraph-level text units using a large language model. The extraction results include entity data, attribute data, and relation data. The verification and graph storage module is configured to verify and standardize the extraction results and import them into a graph database to form a historical knowledge graph. The question parsing and query generation module is configured to parse the user's input of natural language historical questions and generate graph query statements; The map retrieval and map query result acquisition module is configured to perform map retrieval and acquire map query results; The enhanced generation module is configured to generate answers based on the constraints of the large language model according to the graph query results.

9. An electronic device, characterized in that, include: A processor and a memory, wherein computer program instructions are stored in the memory, wherein when the computer program instructions are executed by the processor, the processor causes the processor to perform the method of any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform the method described in any one of claims 1-7.