A historical figure recognition reasoning method, device, equipment and storage medium

By constructing engineering prompts, extracting vectors, and generating Sankey diagrams through dynamic clustering, the problems of opaque reasoning paths and fragmented information in historical figure research are solved. This achieves a visualized and interactive display of reasoning paths, improving the operability of the analysis.

CN121413780BActive Publication Date: 2026-05-01ZHEJIANG UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG UNIV
Filing Date
2025-12-25
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing technologies in the study of historical figures suffer from problems such as opaque reasoning paths, severe information fragmentation, and a lack of systematic visual presentation and human-computer interaction support, making it difficult for experts to quickly determine the credibility of reasoning chains and the evolution of information sources.

Method used

By receiving natural language questions input by users, identifying question types, constructing engineering prompts, inputting them into a large language model, generating multiple answer results, performing vector extraction and dynamic clustering, generating nodes and connections in a Sankey diagram, and rendering a visual Sankey diagram.

Benefits of technology

It realizes the interpretability of the reasoning process for identifying historical figures and the systematic and visual presentation of information distribution, improves the transparency and interactivity of the reasoning path, and enhances the pertinence of information extraction and the operability of in-depth analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121413780B_ABST
    Figure CN121413780B_ABST
Patent Text Reader

Abstract

The application discloses a historical figure recognition reasoning method and device, equipment and a storage medium, the method comprises the following steps: receiving a natural language question and identifying the question type according to the natural language question; based on the question type, the engineering prompt word is constructed through the prompt word design mechanism and the external knowledge injection method; the engineering prompt word is input into a large language model to obtain a plurality of answer results; the vector extraction is carried out on the plurality of answer results to obtain a semantic representation vector; the semantic representation vector is dynamically clustered to generate a clustering result; based on the clustering result, the original answer node, the semantic clustering node and the keyword node of the Sankey diagram are generated, and the connection relationship and the flow direction structure between the original answer node, the semantic clustering node and the keyword node are determined; the Sankey diagram is rendered based on the original answer node, the semantic clustering node, the keyword node, the connection relationship and the flow direction structure. The method significantly improves the pertinence of information extraction and the operability of depth analysis.
Need to check novelty before this filing date? Find Prior Art

Description

A method, apparatus, device, and storage medium for identifying and reasoning about historical figures. Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method, apparatus, device, and storage medium for identifying and reasoning about historical figures. Background Technology

[0002] In the field of digital humanities, research on the uncertain reasoning of historical figures mainly progresses along two main lines: one is the traditional textual research methods in the humanities, and the other is technology-driven automated analysis methods. Among them, technology-driven automated analysis aims to assist the traditional textual research workflow, improve the efficiency and visualization of the reasoning process, and its current research status at home and abroad focuses on two core directions: "CoT hint engineering and RAG method of LLM" and "digital humanities visualization".

[0003] In terms of Prompt Engineering (CoT) and Retrieval-Augmented Generation (RAG) methods within Large Language Models (LLM), the combination of Prompt Engineering and Chain-of-Thought (CoT) techniques enables the generation of structured chain-based reasoning results. Coupled with the contextual and background information provided by Retrieval-Augmented Generation (RAG) techniques, this effectively suppresses the "illusion" tendency of LLM, ensuring its outputs conform to historical context. This demonstrates significant advantages in comparing massive amounts of data and conducting comprehensive analysis of large volumes of text, providing experts with insightful reasoning paths and results. In recent years, related research has expanded from few-shot learning to support complex reasoning tasks: Xu et al.'s IVRE system emphasizes the core role of interactive hypothesis generation and verification under uncertain conditions; Brown et al.'s GPT-3 demonstrates strong language task generalization ability through Few-shot Prompting; Reynolds proposed combining "meta-hints" to generate custom hint templates, tapping into the model's deep reasoning potential; and Wei et al.'s FLAN model improves zero-shot capability through instruction fine-tuning, verifying the feasibility of controlling model behavior based on natural language task descriptions. In complex reasoning tasks, the CoT (Copyright Principle) strategy is widely used. Wei et al. first verified its effectiveness in mathematical and common-sense reasoning. Cheng et al.'s ChainLM introduced a "stepwise debate" mechanism to address accumulated errors in reasoning. Deng et al. explored the transfer of explicit CoT to implicit reasoning. Zhang et al.'s Auto-CoT enabled large models to self-generate reasoning chains, significantly improving the scalability of prompting engineering. To alleviate the "illusion" and knowledge update lag problems of LLM in knowledge-intensive tasks, the RAG (Reinforcement Graph) method has become a research focus. Lewis et al. first combined parametric language models with nonparametric knowledge bases. Chen et al. constructed the RAG evaluation benchmark RGB and revealed its technical bottlenecks. Gao et al. reviewed the development path of the RAG framework and pointed out challenges such as dynamic knowledge updates and integration with professional databases. In addition, Huang et al.'s LLM-ARK framework modeled knowledge graph path reasoning as a reinforcement learning task, and Peng et al. optimized recommendation and explanation objectives through multi-task training, all demonstrating the potential of LLM to generate high-quality and credible explanations in complex semantic scenarios. However, the application of LLM in the field of digital humanities still has obvious shortcomings: domain knowledge is embedded on the surface and fails to deeply deconstruct the causal logic of historical events; interpretability is limited to the text level and lacks deep integration with visualization tools, making it difficult for experts to intuitively trace the source of evidence; the lack of feedback mechanism makes human-computer collaboration a one-way output, unable to dynamically optimize the reasoning path through interaction, and there is still room for breakthroughs in multi-path conflict resolution and dynamic evaluation.

[0004] In the field of digital humanities visualization methods, the core objective is to transform abstract historical logic into interactive visual forms. Early tools were mostly based on spatiotemporal maps or social network graphs, focusing on the presentation of static results. As research deepened, dynamic interactive elements were gradually introduced, supporting functions such as timeline zooming to filter key events and hierarchical expansion to display the evolution of character relationships. With the enrichment of digital cultural heritage accumulation, related visualization and analysis methods have received widespread attention: Windhager et al. outlined the design concepts and technological evolution of digital cultural collection visualization, emphasizing breakthroughs in traditional interaction modes; Zhang et al.'s CohortVA system constructs historical figure groups through knowledge graphs, achieving iterative group discovery and hypothesis verification; Zhang et al.'s ScrollTimes platform constructs a three-level "biographical" analysis model for Chinese handscrolls, improving the ability to visually restore cross-temporal and spatiotemporal cultural relic genealogies; Feng et al.'s iPoet system integrates image semantic analysis and sentiment recognition to assist in the generation of personalized verses; Guo et al.'s LiberRoad platform introduces multi-dimensional graphics to achieve hierarchical analysis of the cross-border dissemination of ancient books; Tang et al.'s PColorizor system improves the efficiency and accuracy of color restoration of ancient paintings by utilizing "consistent artistic conception" in verses. In research integrating reasoning and visualization, the VR4U system developed by Zhang et al. from the VAI Lab at Zhejiang University constructs a knowledge graph from CBDB data and visualizes the life trajectories of historical figures through the "Life Landscape" view. However, the reasoning process relies on manual screening and judgment by experts, lacking automation and interpretability. The CataAnno system developed by Shao et al. focuses on the standardized processing of ancient book catalog data. It achieves fuzzy item clustering and unified naming through recommendation mechanisms and multi-view linkage. Its expert-friendly design is worth learning from, but its analytical capabilities are limited. The CultiVerse system developed by Zhang et al. explores the application of LLM in the understanding of traditional paintings. It enhances the ability to interpret symbols in a cross-cultural context through a hybrid active dialogue mechanism, demonstrating the application potential of LLM in digital humanities visualization.

[0005] Currently, the application of large language models in digital humanities fields such as historical figure research, ancient book verification, and document inference continues to expand. However, existing technologies still face key bottlenecks: in the context of uncertain data reasoning about historical figures, the reasoning path is not transparent, information is severely fragmented, and there is a lack of systematic visual presentation and human-computer interaction support; the output of LLM is mostly unstructured natural language, lacking clear logical hierarchy and path organization, making it difficult for experts to quickly judge the credibility of the reasoning chain, the source of information, and its evolutionary relationship. This "black box" output limits the practical value of the model in scenarios with high reliability and high interpretability. Summary of the Invention

[0006] The purpose of this invention is to provide a method, apparatus, device, and storage medium for historical figure identification and reasoning, aiming to solve problems such as poor interpretability of the reasoning process, scattered information distribution, and difficulty in reconstructing the logical chain in the existing digital humanities field.

[0007] In a first aspect, embodiments of the present invention provide a method for historical figure identification and reasoning, including:

[0008] Receive natural language questions input by the user, and identify the question type based on the natural language questions;

[0009] Based on the aforementioned problem types, engineering prompts are constructed through a prompt word design mechanism and an external knowledge injection method.

[0010] The engineering prompts are input into a large language model to obtain multiple response results;

[0011] Vector extraction is performed on multiple of the aforementioned answer results to obtain the semantic representation vector of each answer result;

[0012] Dynamically cluster the semantic representation vectors of the answer results at the same path location to generate clustering results;

[0013] Based on the clustering results, the original answer node, semantic clustering node, and keyword node of the Sankey diagram are generated, and the connection relationship and flow structure between the original answer node, the semantic clustering node, and the keyword node are determined.

[0014] The Sankey diagram is rendered based on the original answer node, the semantic clustering node, the keyword node, the connection relationship, and the flow structure.

[0015] Secondly, embodiments of the present invention provide a historical figure recognition and reasoning device, comprising:

[0016] A receiving unit is used to receive natural language questions input by the user and identify the question type based on the natural language questions.

[0017] The construction unit is used to construct engineering prompts based on the problem type, through a prompt word design mechanism and an external knowledge injection method;

[0018] The input unit is used to input the engineering prompts into the large language model to obtain multiple response results;

[0019] An extraction unit is used to extract vectors from multiple answer results to obtain semantic representation vectors for each answer result;

[0020] Clustering units are used to dynamically cluster the semantic representation vectors of the answer results at the same path positions to generate clustering results;

[0021] The determining unit is used to generate the original answer node, semantic clustering node and keyword node of the Sankey diagram based on the clustering results, and to determine the connection relationship and flow structure between the original answer node, the semantic clustering node and the keyword node;

[0022] The rendering unit is used to render the Sankey diagram based on the original answer node, the semantic clustering node, the keyword node, the connection relationship, and the flow structure.

[0023] Thirdly, embodiments of the present invention provide a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the historical figure recognition and reasoning method described in the first aspect.

[0024] Fourthly, embodiments of the present invention also provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program that, when executed by a processor, implements the historical figure identification and reasoning method described in the first aspect.

[0025] This invention discloses a method, apparatus, device, and storage medium for historical figure identification and reasoning. The method includes: receiving a natural language question input by a user and identifying the question type based on the natural language question; constructing engineering prompts based on the question type through a prompt word design mechanism and an external knowledge injection method; inputting the engineering prompts into a large language model to obtain multiple answer results; extracting vectors from the multiple answer results to obtain semantic representation vectors for each answer result; dynamically clustering the semantic representation vectors of the answer results at the same path position to generate clustering results; generating original answer nodes, semantic clustering nodes, and keyword nodes of a Sankey diagram based on the clustering results, and determining the connection relationships and flow structures between the original answer nodes, the semantic clustering nodes, and the keyword nodes; and rendering the Sankey diagram based on the original answer nodes, the semantic clustering nodes, the keyword nodes, the connection relationships, and the flow structures. This invention, by introducing a multi-round answer aggregation mechanism, dynamic path summarization, and multi-level visual node construction, forms a reasoning path visualization algorithm that supports clear structure and convenient interaction. By constructing three types of visual nodes, users can perform horizontal comparison and vertical tracing of multiple paths from a semantic similarity perspective, thereby significantly improving the targeting of information extraction and the operability of in-depth analysis. This invention also provides a historical figure recognition and reasoning device, a computer-readable storage medium, and a computer device, all possessing the aforementioned beneficial effects, which will not be elaborated upon further here. Attached Figure Description

[0026] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0027] Figure 1 is a flowchart illustrating the reasoning method for identifying historical figures;

[0028] Figure 2 shows the Sankey diagram for multipath visualization analysis;

[0029] Figure 3 is a Sankey diagram showing the hierarchical relationship of locations for location-related questions.

[0030] Figure 4 is a schematic diagram of the Sankey diagram highlighting relevant nodes in the search results;

[0031] Figure 5 is a schematic block diagram of a historical figure identification and reasoning device. Detailed Implementation

[0032] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0033] It should be understood that, when used in this specification and the appended claims, the terms “comprising” and “including” indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more of its features, integrals, steps, operations, elements, components and / or collections thereof.

[0034] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0035] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the relevant listed items and all possible combinations, and includes such combinations.

[0036] Please refer to Figures 1 and 2. This embodiment provides a method for historical figure identification and reasoning, including:

[0037] S101: Receive a natural language question input by the user, and identify the question type based on the natural language question;

[0038] Specifically, user input is received through input boxes on the front-end visual interface. Users can directly input natural language questions containing uncertainties, with no fixed restrictions on the form of expression. These questions can include words reflecting uncertainty such as "possibly," "speculate," "whether," and "probably," and the core focus is on questions related to historical figures. For example, user input could include questions such as: Around what period did Su Shi request a post outside the capital? Is there a connection between Wang Anshi's reforms and Su Shi's demotion to Huangzhou? Where might Ouyang Xiu have recommended Su Shi? And who might be involved in the Wutai Poetry Case?

[0039] After the user inputs the text, it is segmented into words to obtain lexical units. At the same time, semantic dependency analysis is used to sort out the logical relationships between words and clarify the core of the question and the modifying components. Then, uncertainty keyword detection is initiated to identify words in the text that reflect uncertainty and mark the uncertainty attributes of the question, providing a basis for subsequent reasoning strategy adaptation.

[0040] Subsequently, based on the semantic analysis results, the basic types of questions are identified according to preset rules: if the core question points to the time dimension, including questions about when, period, year, etc., and the uncertainty statement revolves around the time range, it is determined to be a time-related question; if the core question points to the geographical dimension, including questions about where, location, region, etc., and the uncertainty statement focuses on the location attribution, it is determined to be a location-related question; if the core question points to the identity, relationship, behavior, etc. of historical figures, and the uncertainty statement revolves around the connections between figures, it is determined to be a figure-related question; if the core question points to the cause, result, connection, etc. of historical events, and the uncertainty statement focuses on the logic of the events, it is determined to be an event-related question.

[0041] While identifying the types, key entity information in the problem is extracted using named entity recognition technology: for historical figures, the names of historical figures explicitly mentioned in the text are directly extracted; for time-related entities, time descriptions contained in the text are extracted, including specific years and ambiguous periods; for geographical entities, geographical names are extracted, including ancient administrative divisions and specific locations; and for event-related entities, the names of core events and related event descriptions are extracted.

[0042] For example, when a user inputs the approximate time period when Su Shi requested a post outside the capital, semantic analysis identifies the uncertain keyword as "approximately," with the core question pointing to time, classifying it as a time-related question. The extracted key entities are Su Shi and "requested a post outside the capital." When a user inputs whether Wang Anshi's reforms are related to Su Shi's exile to Huangzhou, the uncertain keyword is "whether," with the core question pointing to event association, classifying it as an event-related question. The extracted key entities are Wang Anshi's reforms, Su Shi, and exile to Huangzhou. When a user inputs where Ouyang Xiu might have recommended Su Shi, the uncertain keyword is "possibly," with the core question pointing to geographical location, classifying it as a location-related question. The extracted key entities are Ouyang Xiu, Su Shi, and "recommendation." When a user inputs which figures might be related to the cause of the Wutai Poetry Case, the uncertain keyword is "possibly," with the core question pointing to figure association, classifying it as a figure-related question. The extracted key entities are the Wutai Poetry Case and the cause.

[0043] After the question type and key entities are extracted, the two types of information are associated with and stored with the original question text to provide data support for adapting the corresponding CoT prompt template and RAG retrieval strategy.

[0044] In this embodiment, users can select the large language model instance to be called (such as ChatGPT, Claude, GLM, etc.) through the front-end interactive interface, and customize the model's parameter configuration (including temperature parameters, maximum number of generated tokens, etc.) to complete the input preparation.

[0045] S102: Based on the aforementioned problem type, construct engineering prompts through a prompt word design mechanism and external knowledge injection method;

[0046] Specifically, based on the question type, and through a prompt word design mechanism and external knowledge injection methods, engineering prompt words are constructed, including:

[0047] Obtain external knowledge graphs;

[0048] Natural language problems are identified and analyzed to obtain problem types and sets of key entities;

[0049] Based on the question type, a standardized prompt template is generated through a chain-thinking prompt design mechanism, which includes question introduction, clue extraction, logical analysis, intermediate conclusions and final results.

[0050] Based on a set of key entities, historical context information related to entities is extracted from an external knowledge graph through a retrieval-enhanced generation mechanism.

[0051] Natural language questions, key entity sets, standardized prompt templates, and historical context information are encapsulated into structured data to obtain engineering prompt words.

[0052] More specifically, an external knowledge graph CBDB is obtained through a dedicated interface. This external knowledge graph has pre-structured and stored data such as the life time nodes of historical figures, the occurrence period and duration of historical events, the correspondence between the calendar and the Gregorian calendar, the term system and norms of officials' appointments, and the timeline relationship of related events in the same period, providing authoritative knowledge support for reasoning on time-related issues.

[0053] When a user inputs a time-related natural language question with uncertainty, the system analyzes and identifies the question: First, it breaks down the text structure through word segmentation and semantic dependency analysis to identify uncertain keywords such as "approximately" or "perhaps." Then, based on the question's prompt, such as the period or year, it determines the question type to be time-related. Simultaneously, it uses named entity recognition technology to extract a set of key entities, including relevant historical figures, events, and geographical names. For example, if a user inputs "approximately when did Su Shi first serve as the Prefect of Hangzhou," the analysis determines the question type to be time-related, and the key entity set to be "Su Shi's first appointment as the Prefect of Hangzhou."

[0054] Subsequently, based on the reasoning requirements of time-related questions, a standardized CoT (Coding on Time) prompt template was generated through a chain-thinking prompt design mechanism. The template is fixed and includes five stages: question introduction, clue extraction, logical reasoning, intermediate conclusion, and final answer. The question introduction stage fully presents the user's input of time-related questions and uncertainties, clarifying the reasoning goal. The clue extraction stage guides the large model to filter clues related to key entities, such as time nodes, time intervals, appointment system constraints, etc., from subsequently injected knowledge. The logical reasoning stage requires the large model to cross-validate the extracted time clues by combining information such as the official appointment process and the timeline of events during the same period, eliminating contradictory data. The intermediate conclusion stage summarizes the stage-by-stage time judgments and corresponding supporting evidence. The final answer stage requires the output of a clear time conclusion, with the degree of uncertainty and verification logic indicated.

[0055] While generating templates, a retrieval-enhanced generation mechanism extracts relevant historical context information from the external knowledge graph CBDB: using key entity sets as search keywords, a retrieval is initiated by calling a dedicated interface of the external knowledge graph. The retrieval results are quantitatively evaluated based on an event relevance scoring mechanism, prioritizing information directly related to the key entity sets and with high credibility. For example, the extracted information includes the specific year Su Shi passed the imperial examination, the appointment and promotion process of Jinshi (successful candidates in the highest imperial examinations) in the Song Dynasty, the official rank and term of office of the Hangzhou Tongpan (assistant prefect) in the Song Dynasty, the reference for the tenure of officials who held relevant positions in Hangzhou during the same period as Su Shi, and key time nodes in Su Shi's early career trajectory.

[0056] Finally, the original natural language question, the extracted key entity set, the generated time-based CoT hint template, and the knowledge graph context information filtered by event relevance scoring are encapsulated in a unified structured data format: the structured data uses the CoT hint template as a framework, embedding the original question in the question introduction stage, the key entity set corresponding to the core retrieval objects in the clue extraction stage, and the filtered knowledge graph context information filling the logical reasoning stage as the basis for reasoning. Output fields are reserved for intermediate conclusions and the final answer stage, forming a unified and complete engineering hint. This structured engineering hint can be directly called by the large language model, guiding it to complete multi-step reasoning according to a preset process, ensuring the structured and accurate output results.

[0057] This embodiment saves the inference path results generated by LLM into a structured JSON file, refining it into a formatted structure containing meta information (question description, number of answers, call time, RAG data, etc.) and response information (path, nodes, summary, results, etc.). This not only supports multi-answer result tracking and posterior analysis but also facilitates subsequent semantic feature extraction and clustering tasks. This JSON structure transforms the data from the inference process into a standardized, computable intermediate representation.

[0058] S103: Input the engineering prompts into the large language model to obtain multiple response results;

[0059] Specifically, based on user-preset or system-default configuration parameters, a large language model instance is initialized. Configuration parameters include model temperature, which is set to a high level to promote diversity in generated results; and a high maximum generation length to ensure it can accommodate complete chained inference content. It supports integration with various large language models, such as ChatGPT, Claude, or GLM, and can be invoked through a unified application programming interface (API).

[0060] Next, the encapsulated structured engineering prompts are sent to the selected model server via a network request. To obtain multiple responses, a batch request operation is performed, requiring the model to generate a specified number of independent answers in a single call. Each answer must completely contain the entire reasoning chain from the question's introduction to the final conclusion.

[0061] After receiving the prompts, the model server generates and returns a set of answers based on its internal algorithm. The backend service receives these answers and immediately performs preliminary quality checks and format validations to ensure that each answer conforms to the expected JSON structure and contains all necessary fields, such as inference path nodes and intermediate conclusions.

[0062] Then, the multiple verified answers are preprocessed. Each answer is assigned a unique path identifier, and metadata such as the generation timestamp, the model type used, and parameter configurations are recorded. All answers are temporarily stored in memory or a cache database in the order they were generated, forming an initial multi-path inference set.

[0063] Finally, these independent and complete answers, along with their metadata, are integrated into a standardized multi-answer dataset. This dataset serves as direct input to subsequent natural language understanding and semantic clustering modules, providing the raw data foundation for constructing the visual reasoning Sankey diagram. The entire process ensures automation and efficiency from prompt word input to multi-answer generation.

[0064] S104: Extract vectors from the multiple answer results to obtain the semantic representation vector of each answer result;

[0065] Specifically, vector extraction is performed on multiple response results to obtain the semantic representation vector of each response result, including:

[0066] Based on multiple answer results, the node text content in the answer path of each answer result is parsed to form a set of text units;

[0067] An unsupervised semantic representation learning model is used to encode sentence vectors into a set of text units, and an attention masking mechanism is used to identify the semantic boundaries of valid text paragraphs.

[0068] Based on the semantic boundaries of effective text paragraphs, deep semantic features of each text unit within the text unit set are extracted to generate a preliminary representation vector;

[0069] The initial representation vector is subjected to average pooling to generate a semantic representation vector.

[0070] More specifically, the reasoning path of each answer is analyzed, and the key text elements corresponding to the key links in the path, such as clue extraction, logical reasoning, intermediate conclusions, and final answers, are broken down to ensure that each text element carries independent and complete semantics. All text elements are then aggregated into a text unit set. For example, regarding the three answers about when Su Shi first served as the prefect of Hangzhou, the text elements of the first answer, such as the analysis of the year of his imperial examination, the derivation of the official appointment process, and the verification of the term of office, are analyzed. The text elements of the second answer, such as the reference to the appointment of officials at the same time and the verification of handover records, are analyzed. The text elements of the third answer, such as the cross-verification of multiple clues and the explanation of differences in historical materials, are analyzed to obtain a text unit set containing 12 text units.

[0071] Next, a pre-defined unsupervised semantic representation learning model is invoked to perform sentence vector encoding on each text unit in the text unit set. During the encoding process, an attention masking mechanism is simultaneously enabled. This mechanism performs semantic filtering on the text content of each text unit, identifying valid text paragraphs containing core reasoning information and their semantic boundaries, while masking redundant expressions, modal particles, and other invalid information unrelated to reasoning. For example, in a certain text unit, the term of office for Song Dynasty officials is usually around three years. Based on the time when Su Shi passed the imperial examination, his first appointment as the Hangzhou Tongpan (assistant prefect) was most likely in the fourth year of the Xining era. The attention masking mechanism then identifies the text paragraph containing the term of office for Song Dynasty officials as usually around three years and the time when Su Shi passed the imperial examination and first appointed as the Hangzhou Tongpan in the fourth year of the Xining era as a valid text paragraph, thus clarifying its semantic boundary range.

[0072] Then, based on the semantic boundaries of the effective text segments identified by the attention masking mechanism, deep semantic features of each text unit are extracted from the encoding results. These features include core information such as reasoning logic tendency, temporal clue association, and evidence support type. A unified preliminary representation vector is generated, with each vector having 768 dimensions, consistent with the output dimension of the unsupervised semantic representation learning model. For example, the preliminary representation vector of a text unit containing verification of term limits focuses on retaining semantic features related to the term limit system for Song Dynasty officials; while the preliminary representation vector of a text unit containing references to the appointment of officials of the same period emphasizes temporal relational semantic features.

[0073] Finally, for the preliminary representation vectors of all text units corresponding to each answer result, the system performs an average pooling operation: calculating the mean of the corresponding dimensions of all preliminary representation vectors under the same answer result, and using the mean as the final value of that dimension to generate a single 768-dimensional semantic representation vector. For example, if the first answer result corresponds to 4 text units, the mean of the values ​​of the first to 768th dimensions of the preliminary representation vector of each text unit is calculated to obtain the semantic representation vector of that answer result. This vector comprehensively reflects the overall reasoning logic and core semantic features of the answer, providing data support for subsequent dynamic clustering.

[0074] S105: Dynamically cluster the semantic representation vectors of the answer results at the same path positions to generate clustering results;

[0075] Specifically, dynamic clustering is performed on the semantic representation vectors of the answer results at the same path positions, generating clustering results including:

[0076] Based on the semantic representation vectors of the answer results at the same path positions, construct a set of semantic vectors;

[0077] Based on the semantic vector set, the optimal number of clusters is determined by the silhouette coefficient analysis method, and the cluster number configuration parameters are generated.

[0078] Based on the clustering quantity configuration parameters, the semantic representation vector is clustered and divided using a multi-threaded concurrent computation method to generate a cluster set;

[0079] Based on the cluster set, the center vector of the cluster is calculated, and the belonging relationship of each semantic representation vector to the center vector is determined to form a preliminary clustering result;

[0080] The initial clustering results are iteratively optimized by reallocating boundary vectors and adjusting the positions of cluster centers to generate the final clustering results.

[0081] More specifically, based on the semantic representation vectors of the multiple answers generated above, they are categorized and integrated according to the same position in the answer path. Semantic representation vectors for the four corresponding path positions—clue extraction, logical reasoning, intermediate conclusion, and final answer—are grouped separately in all answer results, constructing four independent semantic vector sets. For example, regarding the three answers about when Su Shi first served as the prefect of Hangzhou, each answer contains semantic representation vectors for the four path positions. The final semantic vector sets are: a clue extraction vector set (3 vectors), a logical reasoning vector set (3 vectors), an intermediate conclusion vector set (3 vectors), and a final answer vector set (3 vectors), with each set containing vectors of 768 dimensions.

[0082] Next, for each semantic vector set, the silhouette coefficient analysis method is used to determine the optimal number of clusters: Assuming the number of clusters is 1, 2, 3, and 4 respectively, the silhouette coefficient values ​​under different assumptions are calculated. The value with the largest silhouette coefficient, high intra-cluster similarity, and significant inter-cluster differences is selected as the optimal number of clusters, generating the cluster number configuration parameter. For example, analyzing the final answer vector set, the silhouette coefficient is calculated to be 0.82 when the number of clusters is 2, 0.75 when the number of clusters is 3, and 0.31 when the number of clusters is 1. Therefore, the cluster number configuration parameter for this set is determined to be 2. After analyzing the logical reasoning vector set, the cluster number configuration parameter is determined to be 3.

[0083] Subsequently, based on the cluster count configuration parameters corresponding to each semantic vector set, a multi-threaded concurrent computation mechanism is initiated. Each thread is responsible for clustering one semantic vector set: using the K-means clustering algorithm, with the cluster count in the configuration parameters as the initial K value, the semantic representation vectors in the semantic vector set are iteratively grouped until the sum of squared errors within the clusters reaches the minimum threshold, generating a cluster set corresponding to each semantic vector set. For example, after the clue extraction semantic vector set is clustered according to configuration parameter 2, two clusters are generated: cluster 1 contains 2 vectors (both related to the time of passing the imperial examination and the official appointment process), and cluster 2 contains 1 vector (related to the reference clue of the appointment of officials during the same period).

[0084] Based on the generated set of clusters, the center vector of each cluster is calculated: the mean of the corresponding dimensions of all semantic representation vectors within the cluster is taken to obtain the center vector of the cluster, with the dimensions remaining consistent with the original vectors; then, the cosine distance between each semantic representation vector and each center vector is calculated, and the semantic representation vector is assigned to the cluster to which the nearest center vector belongs, clarifying the affiliation relationship of each semantic representation vector and forming a preliminary clustering result. For example, in the three clusters of the logical reasoning vector set, the center vectors focus on term system verification, historical data cross-checking, and event timeline association, respectively. After assigning each semantic representation vector by distance, the preliminary clustering result shows that the term system verification cluster contains 1 vector, the historical data cross-checking cluster contains 1 vector, and the event timeline association cluster contains 1 vector.

[0085] Next, the preliminary clustering results are iteratively optimized: boundary vectors between clusters are detected, the semantic similarity between the boundary vectors and each center vector is recalculated, and the affiliation is adjusted based on the semantic features of the text units corresponding to the boundary vectors. Simultaneously, for each reassigned boundary vector, the position of the center vector of the corresponding cluster is updated. This process is repeated until the proportion of boundary vectors is less than 5%, and the change in the position of the center vector is less than a threshold after three consecutive iterations. For example, in the preliminary clustering results of the final answer vector set, one semantic representation vector is a boundary vector. After recalculating the similarity and adjusting the affiliation, this boundary vector is assigned to a cluster that better matches its semantic features. After updating the center vector, there is no significant change in position after three consecutive iterations, generating the final clustering results. Each cluster clearly presents different temporal conclusion tendencies and inference logic clustering characteristics.

[0086] Furthermore, an automatic summarization task is performed for each clustering result. Specifically, based on the clustering results, the text content of all nodes in each cluster is obtained. For each cluster, the system extracts its cluster center vector and calculates the cosine similarity between the semantic vector of each node text within the cluster and the center vector. The similarity calculation uses the angle measure method in high-dimensional space to evaluate the semantic closeness of each sentence to the cluster center.

[0087] Simultaneously, the system performs keyword extraction, identifying highly discriminative keyword sets within each cluster by analyzing word frequency distribution and inverse document frequency in the node text. The system also evaluates the semantic coverage of each sentence, i.e., whether the sentence encompasses the main theme and key information of the cluster.

[0088] Based on the above multi-dimensional analysis results, a comprehensive scoring model is constructed. This model combines cosine similarity score, keyword matching degree, and semantic coverage index in a weighted manner to calculate a representative score for the text of each node within a cluster. The sentence with the highest score is selected as the summary sentence for that cluster because it best summarizes the semantic features of the cluster.

[0089] Finally, the selected summary sentences are set as text labels for the corresponding visualization nodes. These labels are displayed directly on the semantic clustering nodes of the Sankey diagram, providing users with an intuitive semantic summary and enhancing the readability and interpretability of the visualization results. The entire summary generation process is automated and requires no manual intervention.

[0090] In some embodiments, a time decay function is constructed to assess the temporal proximity of historical events. The function calculates the decay coefficient based on the time difference between the events; the smaller the time interval, the higher the correlation. Simultaneously, the system integrates a historical geographic information system to calculate the spatial correlation between locations, considering factors such as administrative affiliation, straight-line distance, and accessibility within the historical context.

[0091] The core of the algorithm employs a weighted optimization objective function: Comprehensive Similarity = α·Semantic Similarity + β·Temporal Relevance + γ·Spatial Relevance. The weight parameters α, β, and γ can be dynamically adjusted by historians through an interactive interface according to specific research needs. For example, setting β and γ higher emphasizes spatiotemporal continuity.

[0092] During the clustering process, the system calculates a comprehensive similarity matrix for each node and automatically identifies clusters using an improved hierarchical clustering method. The algorithm pays special attention to spatiotemporal continuity. For example, it identifies Su Shi's tenure in Hangzhou (1071-1074) and his tenure in Mizhou (1074-1076) as the same stage of his official career because of their close temporal connection and geographical proximity, rather than being classified solely based on semantic similarity.

[0093] The clustering results are then automatically integrated into subsequent visualization processes to generate Sankey diagrams that better reflect historical logic. The system maintains the correspondence between clusters and visualization nodes through a mapping table to ensure that the reasoning path accurately reflects spatiotemporal evolution.

[0094] The above approach significantly improves the historical reliability of clustering results. Users can adjust the spatiotemporal weight parameters in real time through the system interface, observe cluster changes, and support dynamic exploration. The entire process enhances the accuracy and depth of historical analysis.

[0095] S106: Based on the clustering results, generate the original answer node, semantic clustering node, and keyword node of the Sankey diagram, and determine the connection relationship and flow structure between the original answer node, the semantic clustering node, and the keyword node;

[0096] Specifically, based on the clustering results, the original answer nodes, semantic clustering nodes, and keyword nodes of the Sankey diagram are generated, and the connection relationships and flow structures among the original answer nodes, semantic clustering nodes, and keyword nodes are determined, including:

[0097] Extract representative text units from each cluster within the clustering results;

[0098] Based on the correspondence between representative text units and the answer paths of the answer results, multiple original answer nodes are constructed;

[0099] Based on the center vector of the clustering results, multiple semantic clustering nodes are generated; each node represents a semantic category.

[0100] Extract high-frequency keywords from representative text units to generate multiple keyword nodes;

[0101] Based on the attribution relationship between each original answer node and its corresponding semantic clustering node, establish the first connection relationship between each original answer node and its corresponding semantic clustering node;

[0102] Based on the hierarchical organizational structure of clustering results, a second connection relationship is established between each semantic clustering node and the semantic clustering node of the next layer.

[0103] A third connection relationship between the last-layer semantic clustering node and the corresponding keyword node is established based on the frequency of occurrence of high-frequency keywords in the corresponding clusters.

[0104] Based on the first, second, and third connection relationships, construct the flow structure of the Sankey diagram.

[0105] More specifically, representative text units from each cluster are extracted from the clustering results. These text units are selected as the most representative summary sentences by calculating the cosine similarity between the sentence and the cluster center vector, combined with keyword extraction and semantic coverage analysis. Based on the correspondence between these representative text units and the original answer paths, the system constructs multiple original answer nodes. Each node uses a specific identifier to mark its original inference path and retains complete path number information. Multiple semantic clustering nodes are generated based on the center vectors of the clustering results. Each node represents a summarized semantic category, and the node identifier includes the cluster number and semantic summary text. Simultaneously, high-frequency keywords are extracted from the representative text units using word frequency statistics and the TF-IDF algorithm. Key terms are filtered out by setting a word frequency threshold, generating multiple keyword nodes.

[0106] In the node relationship establishment phase, the system establishes a first connection relationship based on the attribution relationship between each original answer node and its corresponding semantic cluster node. This relationship determines the semantic cluster node to which each original answer node belongs by querying the node mapping table, and the connection weight is determined by the number of original answer nodes contained in the same cluster. Next, a second connection relationship is established based on the hierarchical organization of the clustering results. This relationship connects upper-level semantic cluster nodes to lower-level semantic cluster nodes according to the logical order of nodes in the reasoning path, and the connection strength is quantified by the number of original answers supporting the connection path. Finally, a third connection relationship is established based on the frequency of high-frequency keywords in their corresponding clusters, connecting the last-level semantic cluster nodes to the relevant keyword nodes. The connection weight is obtained by calculating the normalized word frequency of the keywords in the cluster.

[0107] By integrating the connections at these three levels, a complete Sankey diagram flow structure is constructed.

[0108] S107: Render the Sankey diagram based on the original answer node, the semantic clustering node, the keyword node, the connection relationship, and the flow structure.

[0109] Specifically, based on the original answer nodes, semantic clustering nodes, keyword nodes, connection relationships, and flow structure, a visual layout of the Sankey diagram is generated, in which the original answer nodes are arranged in the left area of ​​the layout, the semantic clustering nodes are arranged in the middle area of ​​the layout according to the path hierarchy, and the keyword nodes are arranged in the right area of ​​the layout.

[0110] Next, flow connection lines are established between nodes based on the connection relationship. The width of the connection line is weighted and encoded based on the frequency of path occurrence, and the color of the connection line is distinguished by a gradient color scheme based on the node type.

[0111] Then, a mapping table is used to maintain the correspondence between the original answer nodes and the semantic clustering nodes to ensure that the connecting lines accurately reflect the semantic causal chain;

[0112] More specifically, based on the constructed node dataset and connections, the Sankey diagram visualization rendering process is initiated. A hierarchical layout engine is used to arrange the original answer nodes in path number order on the left side of the canvas, with each node labeled with its corresponding path identifier. Semantic clustering nodes are distributed from left to right in the middle area according to their hierarchical position in the reasoning chain, forming a progressive logical flow structure. Keyword nodes are grouped and arranged in the right side of the layout according to semantic relevance, forming a term set.

[0113] Based on pre-calculated connection relationship data, the system establishes flow connection lines between nodes. The width of the connection line is dynamically weighted based on the frequency of path occurrence, with high-frequency paths represented by thicker lines and low-frequency paths by thinner lines. The color of the connection line is differentiated by a gradient based on the type of node being connected: connections originating from the original answer node use a blue gradient, connections between semantic clustering nodes use a green gradient, and connections pointing to keyword nodes use an orange gradient.

[0114] A node mapping table is maintained to ensure that the connections accurately reflect the semantic causal chain. This table records the many-to-many correspondence between the original answer nodes and the semantic clustering nodes. During the rendering process, the system queries this mapping table in real time to verify the semantic rationality of each connection and automatically corrects abnormal connections. A dynamic update mechanism for the connections is also established; when the user interacts, the system adjusts the visual attributes of the connections in real time based on the mapping table data.

[0115] In terms of visualization optimization, the system adds flowing animation effects to the connecting lines, visually displaying the information flow through particle movement direction. For overlapping connecting lines, a Bézier curve path optimization algorithm is used to avoid visual intersections and confusion. All connecting lines support interactive operations; when a user hovers over a connecting line, the system highlights the connecting path and displays detailed flow data. The entire rendering process utilizes graphics acceleration technology to ensure smooth performance on large-scale node networks, ensuring that the visualization is both aesthetically pleasing and highly readable.

[0116] In some specific implementations, answer nodes are uniformly named and identified in brown; cluster nodes are numbered according to path number and cluster number and highlighted in cyan, with semantic summary text attached to each node; keyword nodes are mapped to different shades of purple based on statistical word frequency and confidence levels, making it easier for users to identify important keywords. For location-related questions, as shown in Figure 3, the system also calls the geographic hierarchy analysis module to parse the administrative level relationship of keywords and automatically construct a three-level node chain of "province-city-county," enhancing the sense of hierarchy and historical context in the reasoning. All node information is uniformly encapsulated into data structure objects, supporting the generation of subsequent flow connections.

[0117] Finally, the connection paths between Sankey diagram nodes are constructed: the left-side answer nodes are connected to the middle cluster nodes through mapping relationships, and the cluster nodes are connected layer by layer according to the path order, ultimately pointing to the right-side keyword nodes or geographical level nodes. The thickness of the connection lines is weighted and encoded according to the frequency of occurrence of the path, intuitively reflecting the primary and secondary relationships of the inference path. The visualization interface allows users to highlight nodes related to the search keywords, as shown in Figure 4, and allows users to deeply view the details of the inference path and quickly locate the semantic focus by clicking on nodes and expanding cluster summaries. In addition, the system supports dynamic updates and multi-path switching functions, making it convenient for users to comprehensively understand the inference logic of the large language model from multiple perspectives.

[0118] In some embodiments, it also includes:

[0119] Receive new query evidence or modified query conditions from users;

[0120] Extract semantic representation vectors from query evidence or query conditions using large language models and vector extraction techniques;

[0121] An incremental clustering algorithm is used to correlate the newly extracted semantic representation vector with the semantic representation vector in the clustering result to determine the clustering affiliation of the newly extracted semantic representation vector and obtain the new clustering result.

[0122] Based on the new clustering results, adjust the attribute information of the corresponding semantic clustering nodes in the Sankey diagram, and supplement the corresponding original answer nodes and the connection relationship between the original answer nodes and the semantic clustering nodes to obtain the new connection relationship;

[0123] The Sankey graph is updated based on the new connection relationships, the supplementary original answer nodes, and the adjusted semantic clustering nodes.

[0124] Specifically, the system receives new query evidence or modified query conditions from users through an interactive interface. The input data undergoes format validation and preprocessing, transforming it into a standardized structure and triggering the incremental processing pipeline. The new content is merged with existing data to form an expanded query set, providing a foundation for subsequent analysis.

[0125] Next, the system calls a large language model to generate an inference path for the new query and uses vector extraction techniques to process the path nodes. High-dimensional semantic representation vectors for the newly added nodes are extracted using a pre-trained sentence vector encoding model. The vector extraction process employs batch processing optimization to ensure consistency between the new data and the existing vector space, facilitating subsequent clustering and ensemble operations.

[0126] An incremental clustering algorithm is employed, where newly extracted semantic representation vectors are correlated with existing clustering vectors. Based on a similarity matrix and a dynamic threshold mechanism, the algorithm determines the affiliation of a new vector: if its similarity to a cluster center exceeds a threshold, it is included in that cluster and its center vector is updated; otherwise, a new cluster is created. This process optimizes computational efficiency through multi-threaded concurrency, generating incrementally updated clustering results.

[0127] Based on the new clustering results, the system adjusts the attribute information of the corresponding semantic clustering nodes in the Sankey diagram, including updating node labels, size, and color encoding. Simultaneously, it adds newly added original answer nodes and establishes connections between them and their related semantic clustering nodes. Connection weights are recalculated based on path frequency to ensure that the new connections accurately reflect changes in semantic flow.

[0128] Based on the new connections, supplementary original answer nodes, and adjusted semantic clustering nodes, the system dynamically updates the Sankey diagram. The visualization engine recalculates the node layout and flow paths, presenting the change process through smooth transition animations while maintaining the overall structural consistency.

[0129] The incremental update mechanism also maintains interactive functions simultaneously. Node information floating prompts refresh as node attributes are updated; path filtering and highlighting functions are automatically extended to newly added paths; keyword heatmaps are regenerated based on new frequency statistics. The entire process ensures users can seamlessly explore the updated inference network, supporting continuous iterative analysis needs.

[0130] Furthermore, an incremental clustering algorithm is used to correlate the newly extracted semantic representation vectors with the semantic representation vectors in the clustering results, thereby determining the cluster affiliation of the newly extracted semantic representation vectors and obtaining the new clustering results, including:

[0131] An incremental clustering algorithm is used to calculate the similarity between the newly extracted semantic representation vector and the center vector in the clustering result, and the similarity calculation result is obtained.

[0132] Based on the similarity calculation results, new semantic representation vectors that meet the preset threshold conditions are assigned to the corresponding existing clusters, while new semantic representation vectors that do not meet the preset threshold conditions are marked as outliers to be processed.

[0133] Recalculate the new center vector for the clusters that have been assigned the new vector, and update the attribution relationship between each semantic representation vector in the cluster and the new center vector;

[0134] Perform local cluster analysis on the outliers to be processed, and merge the outliers into the nearest cluster based on the distribution relationship between the outliers and the existing clusters.

[0135] Specifically, when processing newly extracted semantic representation vectors using the incremental clustering algorithm, the system first calculates the cosine similarity between the new vector and the center vectors of existing clusters to obtain a quantified similarity result. Based on a preset similarity threshold, the system assigns new vectors that meet the threshold to the existing cluster with the highest similarity, while marking new vectors with similarity below the threshold as outliers to be processed. For clusters successfully assigned new vectors, the system recalculates the coordinates of the cluster's center vector, updates the cluster center position using a weighted average method, and simultaneously adjusts the affiliation relationship between all semantic representation vectors within the cluster and the updated center vector. For vectors marked as outliers to be processed, the system performs local clustering analysis, calculating the minimum distance between these outliers and the boundaries of existing clusters. When the distance is less than a set merging threshold, the outlier is merged into the nearest cluster; otherwise, a new independent cluster is created. The entire incremental clustering process optimizes processing efficiency through multi-threaded parallel computation, ensuring rapid updates to the cluster structure when new data is added, while maintaining consistency with the original clustering results. The system maintains a historical record of clustering versions, supports backtracking and comparison between different clustering states, and provides complete data support for continuous knowledge discovery.

[0136] In some embodiments, the multimodal RAG framework first constructs a unified cross-modal index library, uses the CLIP-ViT-L / 14 model to extract features from 5836 historical images in batches, generating 768-dimensional visual vectors. Simultaneously, it calls a historical geographic information system to perform georegistration and vectorization on 1327 ancient maps, extracting spatial topological features. The system deploys a finely tuned BLIP-2 model to generate professional semantic descriptions for each unlabeled historical image. For example, the image "Dongpo Wearing a Bamboo Hat and Wooden Clogs" is described as a realistic portrait of the Northern Song Dynasty literary giant Su Shi during his exile in Huangzhou, depicting him wearing a bamboo hat and wooden clogs, strolling in front of the Dongpo Snow Hall. The image is estimated to have been created in the early Southern Song Dynasty, reflecting later generations' imagination and admiration for Su Shi's life in Huangzhou. The description quality has been verified by historians to achieve an accuracy score of 4.7 / 5.0. A dual-channel retrieval mechanism is established. When a user queries the location of Su Shi's residence during his time in Huangzhou, the text channel searches relevant records in the CBDB database, while the visual channel simultaneously searches topographic maps of Huangzhou, photos of the Dongpo site, and portraits of Su Shi from various dynasties. A cross-modal alignment algorithm is used to calculate text-image similarity, and the top-5 relevant visual evidence is selected. The system constructs an evidence association graph, explicitly connecting the text node "Dongpo Xuetang" with the visual nodes "Huangzhou Prefecture Gazetteer" map markings and modern aerial photographs of the Dongpo site. The association strength is calculated based on a combination of spatiotemporal consistency and semantic overlap. In the visualization interface, when the user clicks on the node "Su Shi built Xuetang in Huangzhou" in the reasoning path, the right-hand evidence panel automatically displays three types of visual evidence: the top displays a topographic reconstruction map of Huangzhou from the Yuanfeng era, highlighting the location of Xuetang; the middle presents photos of the Dongpo site discovered through modern archaeology; and the bottom displays the evolution sequence of imagined images of Dongpo Xuetang from various dynasties. The evidence panel supports timeline dragging, allowing users to observe the changes in Huangzhou's geographical environment from the Northern Song Dynasty to the present. The system implements an evidence consistency scoring mechanism. When there is a conflict between the textual description and visual evidence (such as the literature records Xuetang as a thatched hut while Qing Dynasty portraits show it as a brick and tile building), it automatically marks the confidence difference and provides an explanation of historical evolution.

[0137] In some embodiments, multi-dimensional interactive functionality is implemented in the Sankey diagram visualization interface. When the user hovers the cursor over any node, the system triggers an information hovering prompt mechanism, dynamically generating a semi-transparent information box and displaying the complete content of that node. For original answer nodes, the prompt information includes the complete answer text and a path credibility index. The prompt content for semantic clustering nodes displays the cluster summary text and the number of paths contained therein. Keyword nodes display the frequency of occurrence of the term and a list of associated clusters.

[0138] The system simultaneously implements path filtering and highlighting functions, receiving user input through a path number selector on the interface. When a user selects a specific path number, the system highlights the corresponding original answer node and its connected semantic clustering nodes and keyword nodes based on a pre-established path mapping relationship, while reducing the transparency of unrelated nodes to 30%. The highlighting of connecting lines uses an animated flowing effect, presenting a particle flow trajectory along the selected path direction.

[0139] The node expansion / collapse functionality is implemented through a hierarchical control panel, where users can click the collapse icon on a semantic clustering node to control its display state. When a node at a certain level is collapsed, the system automatically recalculates the layout space, adjusts the positional distribution of adjacent nodes, and maintains the overall topology unchanged. For expansion operations, the system dynamically loads the child nodes under that node and uses a smooth animation transition to show the hierarchical expansion process.

[0140] Based on frequency statistics of keyword nodes, the system generates a keyword heatmap on the right side of the visualization interface. The word cloud layout uses a spiral algorithm to avoid overlap, and the font size of each term is directly proportional to its frequency of occurrence in the clustering results. The color intensity reflects the uniformity of the term's distribution across different clusters. The word cloud supports click-based interaction; users can click on any term to highlight all nodes and connection paths containing that term in the Sankey diagram.

[0141] All interactive functions employ an event listening mechanism. When a user performs an action, the system updates the visualization status in real time and maintains synchronized responses between views. State changes during the interaction process are recorded through a history stack, supporting undo and redo operations to ensure users can freely explore different analytical perspectives.

[0142] At the technical level, this embodiment addresses the problems of poor interpretability, scattered information distribution, and difficulty in reconstructing logical chains in the reasoning process of uncertainties in the existing digital humanities field. It proposes an algorithmic framework that combines structured Prompt design based on LLM with the RAG mechanism, effectively standardizing the model output structure. Simultaneously, sentence vector extraction and dynamic clustering methods are introduced to abstract and classify semantic nodes in the reasoning path, thereby improving the ability to organize and process complex reasoning information and providing effective support for structured modeling of the reasoning process.

[0143] In terms of visual analytics, this invention constructs a multi-path reasoning visualization method based on Sankey diagrams. By setting a three-part structure of "original answer node—intermediate logical clustering node—reasoning result node," a three-dimensional logical flow display framework is formed, enabling users to clearly grasp the logical connections and evolutionary processes between multiple rounds of answers. Combined with interactive functions such as keyword search and path highlighting, it significantly enhances the user's retrieval efficiency and understanding depth in multi-path, multi-information-source reasoning environments, and improves the intuitiveness and operability of human-computer interaction.

[0144] Finally, in terms of application effectiveness, this invention has been successfully implemented in the field of digital humanities, constructing a complete closed-loop system from problem input and logical reasoning to result evaluation. This system not only improves users' analytical efficiency and comprehension quality when facing uncertain issues such as historical figures, but also provides effective support for the research-oriented application of language models. As shown in Table 1,

[0145] Table 1

[0146]

[0147] For location-related questions, providing relevant address chain reference data results in a relatively high overall accuracy rate after inference matching. For time-related questions, time range matching makes direct matching easier. It can be seen that the system's inference accuracy rate is no less than 80% for both time and location-related uncertain questions.

[0148] This method has good versatility and scalability, and can be widely applied in many fields such as law, medicine, and education that require complex reasoning and structural visualization. It has high prospects for promotion and application and social value.

[0149] Please refer to Figure 5. This embodiment provides a historical figure recognition and reasoning device 200, including:

[0150] The receiving unit 201 is used to receive a natural language question input by the user and identify the question type based on the natural language question;

[0151] Construction unit 202 is used to construct engineering prompts based on the problem type, through a prompt word design mechanism and an external knowledge injection method;

[0152] Input unit 203 is used to input the engineering prompt words into the large language model to obtain multiple answer results;

[0153] Extraction unit 204 is used to extract vectors from multiple answer results to obtain semantic representation vectors for each answer result;

[0154] Clustering unit 205 is used to dynamically cluster the semantic representation vectors of the answer results at the same path position to generate clustering results;

[0155] The determining unit 206 is used to generate the original answer node, semantic clustering node and keyword node of the Sankey diagram based on the clustering results, and to determine the connection relationship and flow structure between the original answer node, the semantic clustering node and the keyword node;

[0156] The rendering unit 207 is used to render the Sankey diagram based on the original answer node, the semantic clustering node, the keyword node, the connection relationship, and the flow structure.

[0157] Furthermore, the building unit 202 includes:

[0158] The graph acquisition subunit is used to acquire external knowledge graphs;

[0159] The identification and analysis subunit is used to identify and analyze the natural language problem to obtain the problem type and key entity set;

[0160] The template generation subunit is used to generate a standardized prompt template containing problem introduction, clue extraction, logical analysis, intermediate conclusions and final results based on the problem type and through a chain-thinking prompt design mechanism.

[0161] The extraction subunit is used to extract historical context information related to entities from an external knowledge graph based on the set of key entities through a retrieval-enhanced generation mechanism.

[0162] The encapsulation subunit is used to encapsulate the natural language question, key entity set, standardized prompt template and historical context information into structured data to obtain engineering prompt words.

[0163] Furthermore, the extraction unit 204 includes:

[0164] The content parsing subunit is used to parse the node text content in the answer path of each answer result based on multiple answer results, and form a set of text units;

[0165] The sentence vector encoding subunit is used to encode the text unit set with sentence vectors using an unsupervised semantic representation learning model and to identify the semantic boundaries of valid text paragraphs through an attention masking mechanism.

[0166] The feature extraction subunit is used to extract deep semantic features of each text unit in the text unit set based on the semantic boundaries of the effective text paragraph, and generate a preliminary representation vector.

[0167] The pooling subunit is used to perform average pooling on the preliminary representation vector to generate a semantic representation vector.

[0168] Furthermore, the clustering unit 205 includes:

[0169] The set constructs sub-units, which are used to construct a set of semantic vectors based on the semantic representation vectors of the answer results at the same path positions;

[0170] The quantity determination subunit is used to determine the optimal number of clusters based on the semantic vector set using the silhouette coefficient analysis method, and to generate cluster number configuration parameters;

[0171] The concurrent computation subunit is configured to perform clustering on the semantic representation vector using a multi-threaded concurrent computation method based on the clustering quantity configuration parameters, thereby generating a cluster set.

[0172] The relation determination subunit is used to calculate the center vector of the cluster based on the cluster set, and determine the belonging relationship of each semantic representation vector to the center vector, so as to form a preliminary clustering result;

[0173] The iterative optimization subunit is used to iteratively optimize the preliminary clustering results by reallocating boundary vectors and adjusting the positions of cluster centers to generate the final clustering results.

[0174] Furthermore, the determining unit 206 includes:

[0175] Unit extraction sub-units are used to extract representative text units from each cluster within the clustering results;

[0176] The node construction subunit is used to construct multiple original answer nodes based on the correspondence between the representative text units and the answer paths of the answer results;

[0177] A node generation subunit is used to generate multiple semantic clustering nodes based on the center vector of the clustering result; wherein each node represents a semantic category;

[0178] The keyword extraction subunit is used to extract high-frequency keywords from the representative text unit and generate multiple keyword nodes.

[0179] The first connection relationship establishment subunit is used to establish a first connection relationship from each original answer node to the corresponding semantic cluster node based on the attribution relationship between each original answer node and the corresponding semantic cluster node.

[0180] The second connection relationship establishment subunit is used to establish the second connection relationship between each semantic clustering node and the semantic clustering node of the next layer based on the hierarchical organization structure of the clustering results.

[0181] The third connection relationship establishment subunit is used to establish the third connection relationship between the last layer semantic clustering node and the corresponding keyword node based on the frequency of occurrence of high-frequency keywords in the corresponding clusters.

[0182] The flow structure construction subunit is used to construct the flow structure of the Sankey diagram based on the first connection relationship, the second connection relationship, and the third connection relationship.

[0183] Furthermore, it also includes:

[0184] The evidence receiving unit is used to receive new query evidence or modified query conditions added by the user.

[0185] The vector extraction unit is used to extract semantic representation vectors from the query evidence or query conditions using a large language model and vector extraction techniques.

[0186] The association calculation unit is used to perform association calculations between the newly extracted semantic representation vector and the semantic representation vector in the clustering result using the incremental clustering algorithm, to determine the clustering affiliation of the newly extracted semantic representation vector and obtain the new clustering result;

[0187] The supplementary unit is used to adjust the attribute information of the corresponding semantic clustering node in the Sankey diagram according to the new clustering result, and to supplement the corresponding original answer node and the connection relationship between the original answer node and the semantic clustering node to obtain a new connection relationship;

[0188] The update unit is used to update the Sankey graph based on the new connection relationship, the supplementary original answer nodes, and the adjusted semantic clustering nodes.

[0189] Furthermore, the associated calculation unit includes:

[0190] The similarity calculation subunit is used to calculate the similarity between the newly extracted semantic representation vector and the center vector in the clustering result using an incremental clustering algorithm, and obtain the similarity calculation result.

[0191] The allocation subunit is used to allocate new semantic representation vectors that meet the preset threshold conditions to the corresponding existing clusters based on the similarity calculation results, and to mark new semantic representation vectors that do not meet the preset threshold conditions as anomalies to be processed.

[0192] The recalculation subunit is used to recalculate the new center vector for the clusters that have been assigned new vectors, and to update the attribution relationship between each semantic representation vector in the cluster and the new center vector.

[0193] The local clustering analysis subunit is used to perform local clustering analysis on the outliers to be processed, and merge the outliers to be processed into the nearest cluster according to the distribution relationship between the outliers to be processed and the existing clusters.

[0194] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described apparatus and unit can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0195] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed, can implement the methods provided in the above embodiments. The storage medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0196] The present invention also provides a computer device, which may include a memory and a processor. The memory stores a computer program, and when the processor calls the computer program in the memory, it can implement the methods provided in the above embodiments. Of course, the computer device may also include various network interfaces, power supplies, and other components.

[0197] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make various improvements and modifications to this invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this invention.

[0198] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusivity.

[0199] The term "comprises" implies that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A method for identifying and reasoning about historical figures, characterized in that, include: Receive natural language questions input by the user, and identify the question type based on the natural language questions; Based on the aforementioned problem types, engineering prompts are constructed through a prompt word design mechanism and an external knowledge injection method. The engineering prompt words are input into a large language model to obtain multiple response results; vector extraction is performed on the multiple response results to obtain the semantic representation vector of each response result; Dynamic clustering is performed on the semantic representation vectors of the answer results at the same path positions to generate clustering results; based on the clustering results, a summary sentence of the cluster is obtained, and the summary sentence is set as a text label; based on the clustering results, the original answer node, semantic cluster node, and keyword node of the Sankey diagram are generated, and the connection relationship and flow structure between the original answer node, the semantic cluster node, and the keyword node are determined; the Sankey diagram is rendered based on the original answer node, the semantic cluster node, the keyword node, the connection relationship, and the flow structure. The construction of engineering prompts based on the question type, through a prompt word design mechanism and external knowledge injection method, includes: acquiring an external knowledge graph; identifying and analyzing the natural language question to obtain the question type and key entity set; generating a standardized prompt template containing question introduction, clue extraction, logical analysis, intermediate conclusions, and final results based on the question type using a chain-thinking prompt design mechanism; extracting historical context information related to entities from the external knowledge graph based on the key entity set using a retrieval enhancement generation mechanism; encapsulating the natural language question, key entity set, standardized prompt template, and historical context information into structured data to obtain engineering prompts; and generating Sankey diagram original answer nodes, semantic clustering nodes, and keyword nodes based on the clustering results, and determining the connection relationships and flow structures between the original answer nodes, semantic clustering nodes, and keyword nodes, including: from the... Representative text units are extracted from each cluster within the clustering results. Multiple original answer nodes are constructed based on the correspondence between the representative text units and the answer paths of the answer results. Multiple semantic clustering nodes are generated based on the center vector of the clustering results, where each node represents a semantic category. High-frequency keywords are extracted from the representative text units to generate multiple keyword nodes. A first connection relationship is established between each original answer node and its corresponding semantic clustering node based on the attribution relationship between each original answer node and its corresponding semantic clustering node. A second connection relationship is established between each semantic clustering node and its next-level semantic clustering node based on the hierarchical organization structure of the clustering results. A third connection relationship is established between the last-level semantic clustering node and its corresponding keyword node based on the frequency of occurrence of high-frequency keywords in their respective clusters. Based on the first, second, and third connection relationships, a flow structure of the Sankey diagram is constructed.

2. The historical figure identification and reasoning method according to claim 1, characterized in that, The step of extracting vectors from multiple answer results to obtain semantic representation vectors for each answer result includes: based on multiple answer results, parsing the node text content in the answer path of each answer result to form a set of text units; using an unsupervised semantic representation learning model to encode sentence vectors in the set of text units, and identifying the semantic boundaries of valid text paragraphs through an attention masking mechanism; based on the semantic boundaries of the valid text paragraphs, extracting deep semantic features of each text unit in the set of text units to generate a preliminary representation vector; and performing an average pooling operation on the preliminary representation vector to generate a semantic representation vector.

3. The historical figure identification and reasoning method according to claim 1, characterized in that, The dynamic clustering of semantic representation vectors of answer results at the same path position to generate clustering results includes: constructing a semantic vector set based on the semantic representation vectors of answer results at the same path position; determining the optimal number of clusters based on the semantic vector set using silhouette coefficient analysis, and generating cluster number configuration parameters; clustering the semantic representation vectors according to the cluster number configuration parameters using multi-threaded concurrent computation to generate a cluster set; calculating the center vector of the clusters based on the cluster set, and determining the attribution relationship between each semantic representation vector and the center vector to form a preliminary clustering result; iteratively optimizing the preliminary clustering result by reallocating boundary vectors and adjusting the cluster center positions to generate the final clustering result.

4. The historical figure identification and reasoning method according to claim 1, characterized in that, Also includes: Receive new query evidence or modified query conditions from users; Semantic representation vectors are extracted from the query evidence or query conditions using a large language model and vector extraction techniques. An incremental clustering algorithm is then used to correlate the newly extracted semantic representation vectors with the semantic representation vectors in the clustering results, determining the cluster affiliation of the newly extracted semantic representation vectors and obtaining new clustering results. Based on these new clustering results, the attribute information of the corresponding semantic clustering nodes in the Sankey diagram is adjusted, and corresponding original answer nodes and the connection relationships between the original answer nodes and the semantic clustering nodes are added to obtain new connection relationships. The Sankey diagram is then updated based on these new connection relationships, the added original answer nodes, and the adjusted semantic clustering nodes.

5. The historical figure identification and reasoning method according to claim 4, characterized in that, The incremental clustering algorithm is used to correlate newly extracted semantic representation vectors with semantic representation vectors in the clustering results to determine the cluster affiliation of the newly extracted semantic representation vectors and obtain new clustering results. This includes: using the incremental clustering algorithm to calculate the similarity between the newly extracted semantic representation vectors and the center vectors in the clustering results to obtain similarity calculation results; based on the similarity calculation results, new semantic representation vectors that meet preset threshold conditions are assigned to corresponding existing clusters, while new semantic representation vectors that do not meet preset threshold conditions are marked as outliers to be processed; new center vectors are recalculated for the clusters assigned with new vectors, and the affiliation relationship between each semantic representation vector in the cluster and the new center vector is updated; local clustering analysis is performed on the outliers to be processed, and the outliers to be processed are merged into the nearest cluster according to the distribution relationship between the outliers to be processed and the existing clusters.

6. A historical figure identification and reasoning device, characterized in that, include: A receiving unit is used to receive natural language questions input by the user and identify the question type based on the natural language questions. The construction unit is used to construct engineering prompts based on the problem type, through a prompt word design mechanism and an external knowledge injection method; The input unit is used to input the engineering prompts into the large language model to obtain multiple response results; An extraction unit is used to extract vectors from multiple answer results to obtain semantic representation vectors for each answer result; Clustering units are used to dynamically cluster the semantic representation vectors of the answer results at the same path positions to generate clustering results; Based on the clustering results, a summary sentence for each cluster is obtained, and the summary sentence is set as a text label. The determining unit is used to generate the original answer node, semantic clustering node and keyword node of the Sankey diagram based on the clustering results, and to determine the connection relationship and flow structure between the original answer node, the semantic clustering node and the keyword node; A rendering unit is used to render the Sankey diagram based on the original answer node, the semantic clustering node, the keyword node, the connection relationship, and the flow structure. The construction unit includes: a graph acquisition subunit for acquiring an external knowledge graph; an identification and analysis subunit for identifying and analyzing the natural language question to obtain the question type and key entity set; a template generation subunit for generating a standardized prompt template containing question introduction, clue extraction, logical analysis, intermediate conclusions, and final results based on the question type using a chain-like thinking prompt design mechanism; an extraction subunit for extracting historical context information related to entities from the external knowledge graph based on the key entity set using a retrieval enhancement generation mechanism; and an encapsulation subunit for encapsulating the natural language question, key entity set, standardized prompt template, and historical context information into structured data to obtain engineering prompt words. The determination unit includes: a unit extraction subunit for extracting representative text units from each cluster within the clustering results; and a node construction subunit for constructing multiple original nodes based on the correspondence between the representative text units and the answer paths of the answer results. The system comprises the following subunits: a response node; a node generation subunit, used to generate multiple semantic clustering nodes based on the center vector of the clustering results; where each node represents a semantic category; a keyword extraction subunit, used to extract high-frequency keywords from the representative text units to generate multiple keyword nodes; a first connection relationship establishment subunit, used to establish a first connection relationship from each original response node to its corresponding semantic clustering node based on the attribution relationship between each original response node and its corresponding semantic clustering node; a second connection relationship establishment subunit, used to establish a second connection relationship from each semantic clustering node to the next layer of semantic clustering nodes based on the hierarchical organization structure of the clustering results; a third connection relationship establishment subunit, used to establish a third connection relationship from the last layer of semantic clustering nodes to the corresponding keyword nodes based on the frequency of occurrence of high-frequency keywords in the corresponding clusters; and a flow structure construction subunit, used to construct the flow structure of the Sankey diagram based on the first, second, and third connection relationships.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the historical figure identification and reasoning method as described in any one of claims 1 to 5.

8. 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 historical figure identification reasoning method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Question answering system based on semantic vectorization knowledge graph and approximate nearest neighbor clustering

    CN120316213A