Intelligent question-answering system optimization method and device based on knowledge graph
By constructing a knowledge graph structure model, generating a standardized expression set and a graph labeled training set, the semantic understanding and query generation of the intelligent question-answering system are optimized, solving the problems of inadequate semantic understanding and insufficient context utilization in existing systems, and achieving highly accurate and explainable question-answering results.
Patent Information
- Application Number
- CN202510881681.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-10-17
AI Technical Summary
Existing intelligent question-answering systems based on knowledge graphs have problems with semantic understanding granularity when converting natural language to graph queries, and lack deep mining and utilization of historical question-answering contexts, resulting in irregular grammar or incomplete logic, affecting query effectiveness and explainability.
By constructing a knowledge graph structure model in the form of a graph database, extracting terminology information of entity nodes and generating a standardized expression set, collecting historical question and answer example data to build a graph-labeled case training set, receiving user input and performing semantic understanding, generating a structured semantic representation of the question, combining the large language model to build a prompt word template and execute query instruction generation, submitting to the graph database to execute data retrieval, and finally performing personalized rendering processing.
It significantly improves the accuracy of entity recognition and matching, enhances the ability to parse complex intents, strengthens the robustness of query instruction generation, ensures query executableness, and improves the interpretability of results and user experience.
Smart Images

Figure CN120804142A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence and natural language processing, in particular to an intelligent question answering system optimization method and device based on a knowledge graph. BACKGROUND
[0002] At present, intelligent question answering systems are widely used in search engines, intelligent customer service, knowledge service and other scenarios. The core goal is to accurately understand the user's intention after the user puts forward a natural language question, and return a structured or unstructured answer highly matched with the user's question. In order to improve the accuracy and semantic interpretability of question answering, some existing solutions introduce a knowledge graph structure, model entities and relationships as nodes and edges in a graph database, and use entity linking and graph reasoning to assist the question answering process.
[0003] The existing intelligent question answering method based on a knowledge graph generally includes the processes of constructing a knowledge graph, performing entity recognition, and executing graph query. Some solutions further combine semantic similarity matching or template query generation mechanisms. However, in the process of converting natural language into a graph query, there are still the following technical bottlenecks: first, the semantic understanding granularity of user input is not detailed enough, making it difficult to accurately extract query targets and constraints; second, there is a lack of deep mining and utilization of historical question and answer context, resulting in a lack of context enhancement capability in prompt word construction; third, the generated graph query statement has problems of irregular syntax or incomplete logic, affecting the query effect and interpretability.
[0004] The existing technical solutions in the above have the following defects: the existing semantic analysis method cannot fully combine the semantic constraints of the knowledge graph structure model, lacks a graph labeling context feature mining mechanism based on historical question and answer examples, resulting in low accuracy of intelligent question answering results, and thus there is room for improvement. SUMMARY
[0005] In order to improve the query accuracy, the present application provides an intelligent question answering system optimization method and device based on a knowledge graph.
[0006] The above invention objectives of the present application are achieved by the following technical solutions: An intelligent question answering system optimization method based on a knowledge graph, the method comprising: acquiring original knowledge data of a target knowledge domain, and constructing a knowledge graph structure model in the form of a graph database; based on the knowledge graph structure model, extracting term information of entity nodes in the knowledge graph structure model, constructing an entity term set and generating a standardized expression set; Collect historical question and answer example data corresponding to the knowledge graph structure model, and construct a case training set with graph labeling; Receive a natural language question input by a user, perform a semantic understanding operation based on the standardized expression set, obtain a structured question semantic representation, and match the question semantic representation with the case training set to obtain context semantic features; Based on the question semantic representation, the context semantic features, and the knowledge graph structure model, a prompt word template for large language model invocation is constructed, and a query instruction generation operation is performed to obtain a target query statement of a graph database; Submit the target query statement to the graph database to perform a data retrieval operation, and obtain query result data corresponding to the question semantic representation; Perform semantic mapping analysis on the query result data and the question semantic representation, construct an interpretable association path, and perform personalized rendering processing on the query result data based on user portrait information to generate the final question and answer return content.
[0007] By using the above technical solutions, by obtaining original knowledge data of a target knowledge domain and constructing a knowledge graph structure model in the form of a graph database, scattered multi-source knowledge can be uniformly stored in a node-relation manner, forming a high-queryable and high-maintainable semantic network, thereby providing a structured and highly consistent knowledge base for subsequent question and answer; By extracting entity node term information and generating a standardized expression set, semantic ambiguity caused by polysemous words and aliases can be eliminated at the source data level, thereby significantly improving entity recognition and matching accuracy; By constructing a case training set with graph labeling, the large language model can be provided with example questions and answers with graph semantic background, so that the model has domain prior knowledge when reasoning with prompt words, thereby improving the accuracy of complex intent analysis and answering in the few-shot scenario; By semantic understanding and matching context semantic features, similar semantic information of user questions and historical cases can be comprehensively utilized to inject verifiable context clues into prompt words, thereby enhancing the robustness of the query instruction generation stage; By constructing prompt words based on semantic representations, context features, and graph Schema and generating query instructions, the large language model can output query statements that conform to the syntax of the graph database under structural constraints, reducing syntax errors and ensuring query executability; By submitting the query instruction to the graph database for retrieval, high-relevance structured results can be returned based on accurate path matching, thereby shortening the retrieval link and reducing recall noise; By performing semantic mapping analysis and personalized rendering, the query result and the question intent can be correspondingly displayed, and a customized view can be output in combination with user portraits, thereby improving the result interpretability and user experience. Figure 1
[0008] The application can be further configured in an example as follows: the original knowledge data of the target knowledge domain is acquired, and a knowledge graph structure model in the form of a graph database is constructed, including: The original knowledge data from the data source is acquired, and the data source includes table files, relational databases, or data returned by API interfaces; The original knowledge data is parsed and entity relationship extraction is performed to extract semantic unit information for graph modeling; According to a preset graph data modeling rule, the entity content in the semantic unit information is constructed as a node object in the graph database, the association information between the entities in the semantic unit information is modeled as a relationship edge object, and the node object and the relationship edge object are assigned attribute labels; The constructed node object and relationship edge object are written into the graph database to generate the knowledge graph structure model.
[0009] By using the above technical solution, the original knowledge data from tables, relational databases, or API interfaces is acquired and mapped into node objects and relationship edge objects according to rules, which can quickly convert heterogeneous format data into a unified graph data model, avoid high artificial modeling cost, thereby accelerating the construction of a knowledge base and ensuring the timeliness of data updates.
[0010] The application can be further configured in an example as follows: the term information of the entity node in the knowledge graph structure model is extracted, an entity term set is constructed, and a standardized expression set is generated, including: The term information of the entity node is identified, and the term information includes main names, aliases, synonyms, or abbreviation information, and a term mapping relationship between different expression modes is established; The term information is clustered and normalized to form an entity term set with unified semantic representation, and a standardized expression set for semantic understanding is constructed to support entity recognition and semantic normalization processing in user input.
[0011] By using the above technical solution, the term information of the entity node is identified and clustered and normalized to form a standardized expression set, which can instantly complete entity merging in the semantic analysis stage, reduce synonym conflicts in the subsequent matching process, and thereby significantly improve the recognition accuracy of the question and answer system in the multi-expression input scenario.
[0012] The application can be further configured in an example as follows: the historical question and answer example data corresponding to the knowledge graph structure model is collected, and a graph-labeled case training set is constructed, including: Natural language questions and corresponding answers covering the query intent of the target knowledge domain are collected to form structured historical question and answer example data; perform entity recognition and relation extraction operations on the natural language question in the historical question and answer example data, identify entity terms and semantic relations involved in the historical question and answer example data, and map and match the node objects and relation edge objects in the knowledge graph structure model to obtain a matching result; Based on the matching result, each question and answer example is structured and bound with its corresponding graph structure content to form a case training sample with graph label information, and the case training set is obtained.
[0013] By using the above technical solution, the question and answer corpus is strongly associated with the graph path by graph labeling and binding of historical question and answer examples to generate case training samples, which facilitates the model to learn the explicit corresponding relationship between entities, relations and intentions, thereby providing high confidence context support when reasoning new questions.
[0014] In an example, the application can be further configured to: receive a natural language question input by a user, perform semantic understanding operations based on the standardized expression set to obtain a structured question semantic representation, including: Performing a text analysis operation on the natural language question to extract entity words, relation words and question intention words from the natural language question; Standardizing the identified entity words based on the standardized expression set to eliminate semantic ambiguity and normalize them to corresponding standard entity expressions to obtain entity mapping results; Identify the query intention type of the natural language question to obtain an intention recognition result, and analyze the syntactic structure and semantic dependency relationship to determine the query target and restriction condition in the natural language question to obtain a semantic structure analysis result; According to the entity mapping result, the intention recognition result and the semantic structure analysis result, the structured question semantic representation is generated, which includes at least one standard entity slot, query action type and constraint condition information.
[0015] By using the above technical solution, by performing entity mapping, intention recognition and semantic structure analysis on the natural language question and generating a structured semantic representation, unstructured user input can be converted into machine processable slot-action-constraint triple information, thereby providing an accurate and complete semantic template for subsequent query instruction synthesis.
[0016] In an example, the application can be further configured to: the matching of the question semantic representation with the case training set to obtain context semantic features includes: Construct a semantic representation vector for each case sample in the case training set; calculate the matching degree of the problem semantic representation and each semantic representation vector of the case training set, and select a corresponding target case sample set based on the matching degree; Fuse the standard entity slot, query action type and constraint condition information in the target case sample set to generate the context semantic feature corresponding to the problem semantic representation.
[0017] By using the above technical solution, by calculating the matching degree of the problem semantic representation and the case vector and fusing the high correlation case features, the verifiable context evidence can be supplemented for the target problem, the probability of generating an error query by the large language model is reduced, and the accuracy and stability of the query result are improved.
[0018] The application can be further configured in an example as follows: based on the problem semantic representation, the context semantic feature and the knowledge graph structure model, a prompt word template for large language model calling is constructed, and a query instruction generation operation is performed to obtain a target query statement of a graph database, including: Based on the problem semantic representation, fill in the corresponding standard entity slot, query action type and constraint condition information in the prompt word template; Select the case sample with the highest matching degree with the problem semantic representation from the context semantic feature, and insert the corresponding example question and answer pair into the prompt word template; In the prompt word template, append the Schema description information and query output format constraint of the knowledge graph structure model; Call the large language model to input the prompt word template to generate an initial query instruction, perform a verification operation on the initial query instruction, and determine the target query statement when the verification passes.
[0019] By using the above technical solution, by filling in the standard entity slot, context example and Schema constraint in the prompt word and performing a verification feedback type query instruction generation, the large language model can iteratively output a query statement that conforms to the graph database syntax and is consistent with the intention of the user under the dual constraints of structure and semantics, thereby ensuring that the query is executable and the result is highly relevant. Figure 1
[0020] The above-mentioned second invention purpose of the application is realized by the following technical solution: An intelligent question and answer system optimization device based on a knowledge graph, the intelligent question and answer system optimization device based on a knowledge graph comprises: A graph construction module is configured to obtain original knowledge data of a target knowledge domain and construct a knowledge graph structure model in the form of a graph database. The term standardization module is configured to extract term information of entity nodes in the knowledge graph structure model based on the knowledge graph structure model, construct an entity term set, and generate a standardized expression set; The case labeling module is configured to collect historical question and answer case data corresponding to the knowledge graph structure model, and construct a case training set with graph labeling; The semantic analysis module is configured to receive a natural language question input by a user, perform semantic understanding based on the standardized expression set to obtain a structured semantic representation of the question, and match the semantic representation of the question with the case training set to obtain context semantic features; The prompt word generation module is configured to construct a prompt word template for large language model invocation based on the semantic representation of the question, the context semantic features, and the knowledge graph structure model, and perform query instruction generation to obtain a target query statement of a graph database; The graph query execution module is configured to submit the target query statement to the graph database to perform data retrieval, and obtain query result data corresponding to the semantic representation of the question; The result mapping rendering module is configured to perform semantic mapping analysis on the query result data and the semantic representation of the question, construct an interpretable association path, perform personalized rendering processing on the query result data based on user portrait information, and generate final question and answer return content.
[0021] By using the above technical solutions, the graph construction module-terminology standardization module-case labeling module-semantic analysis module-prompt word generation module-graph query execution module-result mapping rendering module work together in sequence, which can realize a complete closed loop of knowledge updating, semantic analysis, query generation, result interpretation and personalized display, thereby constructing an extensible, low-maintenance and high-accuracy knowledge graph intelligent question and answer device.
[0022] In summary, the present application has the following beneficial technical effects: 1. By obtaining original knowledge data of a target knowledge domain and constructing a knowledge graph structure model in the form of a graph database, dispersed multi-source knowledge can be uniformly stored in a node-relation manner, forming a high-queryable and high-maintainable semantic network, thereby providing a structured and highly consistent knowledge base for subsequent question and answer; by extracting term information of entity nodes and generating a standardized expression set, semantic ambiguity caused by polysemous words and aliases can be eliminated at the source data level, thereby significantly improving entity recognition and matching accuracy; 2. By constructing a case training set with graph tagging, the system can provide example questions and answers with graph semantic background for large language models, so that the model has domain prior knowledge when reasoning about prompt words, thereby improving the accuracy of complex intent analysis and answers in the few-shot scenario; by understanding and matching the semantic features of the context, the system can comprehensively utilize the similar semantic information of user questions and historical cases to inject verifiable context clues into the prompt words, thereby enhancing the robustness of the query instruction generation stage; 3. By constructing prompt words and generating query instructions based on semantic representation, context features, and graph Schema, the system can enable large language models to output query statements that conform to the syntax of graph databases under structural constraints, reducing syntax errors and ensuring query executability; by submitting query instructions to graph databases for execution, the system can return highly relevant structured results based on exact path matching, thereby shortening the search link and reducing recall noise; by performing semantic mapping analysis and personalized rendering, the system can display query results and questions, and output customized views combined with user portraits, thereby improving result interpretability and user experience. Figure 1 BRIEF DESCRIPTION OF DRAWINGS
[0023] Figure 1 is a flowchart of an intelligent question answering system optimization method based on a knowledge graph according to an embodiment of the present application; Figure 2 is an implementation flowchart of step S10 in the intelligent question answering system optimization method based on a knowledge graph according to an embodiment of the present application; Figure 3 is an implementation flowchart of step S20 in the intelligent question answering system optimization method based on a knowledge graph according to an embodiment of the present application; Figure 4 is an implementation flowchart of step S30 in the intelligent question answering system optimization method based on a knowledge graph according to an embodiment of the present application; Figure 5 is an implementation flowchart of step S40 in the intelligent question answering system optimization method based on a knowledge graph according to an embodiment of the present application; Figure 6 is another implementation flowchart of step S40 in the intelligent question answering system optimization method based on a knowledge graph according to an embodiment of the present application; Figure 7 is an implementation flowchart of step S50 in the intelligent question answering system optimization method based on a knowledge graph according to an embodiment of the present application; Figure 8 is a principle block diagram of an intelligent question answering system optimization device based on a knowledge graph according to an embodiment of the present application. DETAILED DESCRIPTION
[0024] The application will be further described in detail below with reference to the accompanying drawings.
[0025] In an embodiment, as shown in Figure 1 The application discloses an intelligent question and answer system optimization method based on a knowledge graph, and specifically comprises the following steps: S10: Obtain original knowledge data of a target knowledge domain, and construct a knowledge graph structure model in the form of a graph database.
[0026] Specifically, a data access interface is called to stream read original knowledge entries and relationship descriptions from configured Excel tables, JSON files and REST-APIs, and a parsing stage converts entity names, unique identifiers and attribute key-value pairs into node object formats according to field mapping rules; meanwhile, relationship triples are combined according to associated fields in the source data to map and generate edge object formats; then, the node files and edge files are imported into the graph database in sequence according to a batch writing strategy, and node IDs and edge IDs are returned in real time to complete the construction of the knowledge graph structure model.
[0027] S20: Based on the knowledge graph structure model, extract term information of entity nodes in the knowledge graph structure model, construct an entity term set and generate a standardized expression set.
[0028] Specifically, a term extraction operation is performed on the entity node information in the knowledge graph structure model, and a term keyword representing the meaning of an entity is identified by performing text analysis on the label content of each node, and a corresponding relationship between the terms, such as synonyms, aliases and abbreviations, is constructed, for example, the terms such as “myocardial infarction”, “heart infarction” and “myocardial infarction” are unified as the same semantic entity identifier, a term unified expression mapping dictionary is established, and on this basis, a standardized expression set is constructed, so that different sources and different expressions but the same semantics of user input can be accurately matched to the standard entity node expression in the graph, thereby improving the accuracy and stability of entity matching in the subsequent semantic understanding process.
[0029] S30: Collect historical question and answer example data corresponding to the knowledge graph structure model, and construct a case training set with graph labeling.
[0030] Specifically, for the field covered by the knowledge graph structure model, representative historical question and answer corpus is selected as a case corpus input source, complete question and answer pair information including natural language questions and their corresponding answers is collected, and after collection, each piece of corpus is structurally cleaned and format labeled, key semantic components in the corpus are identified through a natural language processing algorithm, and are structurally mapped with the node and relationship information in the current graph, and then a graph-level structural label is added to each historical question and answer corpus, and finally a case training sample set with structural constraints and graph reference information is generated, which is used for subsequent context semantic matching and model prompt word generation training.
[0031] S40: receiving a natural language question input by a user, performing a semantic understanding operation based on a standardized expression set to obtain a structured question semantic representation, and matching the question semantic representation with a case training set to obtain context semantic features.
[0032] Specifically, tokenization, part-of-speech tagging, and dependency syntax analysis are performed on the input sentence, and the entity words in the sentence are replaced with corresponding primary key placeholders using the standardized expression set; action verbs are identified according to the syntactic dependency structure and mapped to query intent labels; the entity primary key sequence and the intent label are concatenated into a semantic vector, and the cosine similarity between the semantic vector and the semantic vector in the case training set is calculated to select a number of case texts with the highest similarity as context semantic features and form a question semantic representation together with the semantic vector. Further, after receiving the natural language question input by the user, tokenization, part-of-speech tagging, and dependency syntax analysis are performed on the question text to identify word groups that may represent entities, predicate words that express query relationships, and interrogative word components that represent query intent, such as "high blood pressure" as an entity word, "treatment" as a relationship word, and "what are they" as an intent word in "what are the commonly used drugs for treating high blood pressure". Subsequently, the aforementioned standardized expression set is called to perform standard mapping processing on the entity words, ensuring that "high blood pressure" can be uniformly mapped to the standard entity defined in the knowledge graph. Then, the query intent type and query target structure are determined through a rule template or a trained model to form a structured question semantic representation. The current semantic representation is matched with existing question semantics in the case training set to calculate the similarity, and similar cases are selected to obtain supplementary context semantic feature content.
[0033] S50: based on the question semantic representation, the context semantic features, and the knowledge graph structure model, constructing a prompt word template for calling a large language model, and performing a query instruction generation operation to obtain a target query statement of a graph database.
[0034] Specifically, the entity primary key in the problem semantic representation is filled into the entity slot in the prompt template, the intent label is inserted into the action instruction slot, and the knowledge graph main relationship and attribute Schema segment are spliced to the tail of the template. Then the filtered context cases are inserted into the beginning of the template in the form of example question and answer. The complete template is sent as a text input to the large language model service to generate an initial graph query instruction. The returned instruction is checked for node name, relationship name, and syntax legality by a syntax parser. If the instruction is a target query statement, it is identified as such, otherwise the generation is retried until it passes. Further, after obtaining the problem semantic representation and context semantic features, a prompt word template for generating a query statement by a large language model is constructed according to the structure setting requirements of the current graph model. The prompt word template defines the filling slot position, constraint content, and semantic relationship rules in a structured text form. The standard entity name, query verb, and limiting condition in the problem semantic representation are inserted into the corresponding slots. One or more case samples closest to the problem representation are selected as reference questions and answers to provide aligned context guidance by being inserted into the template. The data Schema structure used by the graph database and the legal Cypher query syntax constraints are appended to the tail of the template to ensure that the language model has the necessary format and data structure cognition during the generation process, thereby driving the language model to generate a structured target query statement that meets the graph database query specification.
[0035] S60: The target query statement is submitted to the graph database for execution of a data retrieval operation to obtain query result data corresponding to the problem semantic representation.
[0036] Specifically, the target query statement generated as described above is submitted to the deployed graph database engine for actual execution. The graph database can be a graph storage platform such as Neo4j. During execution, the query engine traverses the graph structure and filters the results according to the condition nodes, relationship paths, and output format in the query statement. Finally, the graph structure subgraph or node attribute information that meets the query constraints is returned as the data query result. For example, when querying "What drugs treat high blood pressure?", all drug name nodes that have "high blood pressure" as the starting node and "treatment indication" as the relationship are returned, forming a structured original query return data.
[0037] S70: The query result data is semantically mapped and analyzed with the problem semantic representation to construct an explainable association path, and the query result data is personalized rendered based on user portrait information to generate the final question and answer return content.
[0038] Specifically, the node ID and the relationship ID in the result set are parsed and inversely mapped into the entity name and the relationship description according to the knowledge graph Schema, and a "user entity-relation-target entity" explainable path string is constructed according to the matching order in the query instruction; the display preference configured by the user portrait is read, if the preference is a chart display, a column chart data structure is generated after aggregation according to the entity classification, if the preference is a text display, an abstract text is generated according to the confidence order; finally, the explainable path and the rendering content are spliced and output as the final question and answer return result in the form of JSON or HTML. Specifically, the original query result returned from the graph database is further subjected to semantic analysis and structural explanation, the key jump nodes and edge information in the query path are extracted to form an explainable semantic path, such as the structure of "user question-entity node-associated relationship-result node", and the display order and expression mode of the result content are dynamically adjusted according to the portrait information of the current user, such as professional background, historical preference, etc., for example, more graph structure details can be displayed for professional users, and the result abstract and conclusion sentence mode are highlighted for ordinary users, finally, the personalized question and answer content integrating semantic expression and structural explanation is constructed as the final return result and output to the user interface.
[0039] By adopting the above technical solution, by acquiring the original knowledge data of the target knowledge domain and constructing a knowledge graph structure model in the form of a graph database, the dispersed multi-source knowledge can be uniformly stored in the form of node-relation, forming a high-query and high-maintenance semantic network, thereby providing a structured and highly consistent knowledge base for subsequent question and answer; by extracting entity node term information and generating a standardized expression set, semantic ambiguity caused by polysemy and alias can be eliminated at the source data level, thereby significantly improving the accuracy of entity recognition and matching; by constructing a graph-labeled case training set, the large language model can be provided with example questions and answers with graph semantic background, so that the model has domain prior knowledge when reasoning the prompt word, thereby improving the accuracy of complex intent analysis and answering in the few-sample scenario; by semantic understanding and matching of context semantic features, the similar semantic information of the user question and the historical case can be comprehensively utilized to inject verifiable context clues into the prompt word, thereby enhancing the robustness of the query instruction generation stage; by constructing the prompt word based on semantic representation, context features and graph Schema and generating the query instruction, the large language model can output a query statement conforming to the graph database syntax under structural constraints, reducing syntax errors and ensuring query executability; by submitting the query instruction to the graph database for execution and retrieval, high-relevant structured results can be returned based on accurate path matching, thereby shortening the retrieval link and reducing recall noise; by performing semantic mapping analysis and personalized rendering, the query result and the question intent can be correspondingly displayed, and a customized view is output combined with the user portrait, thereby improving the explainability of the result and the user experience. Figure 1 A corresponding display is output combined with the user portrait, thereby improving the explainability of the result and the user experience.
[0040] In one embodiment, if Figure 2 As shown, in step S10, the original knowledge data of the target knowledge domain is obtained and a knowledge graph structure model in the form of a graph database is constructed, which specifically includes: S11: Acquire original knowledge data from a data source, which includes a spreadsheet file, a relational database, or data returned by an API interface.
[0041] Specifically, it reads the knowledge data source path or connection parameter information defined in the configuration item. When reading a table file, it parses the structured text data in CSV or XLSX format line by line through file streaming, automatically identifies the header row to determine the field name, and parses each line of data into a field-value pair record. When reading a relational database, it establishes a data session through JDBC or ODBC connection, executes preset SQL statements to batch query the structured data content in the table, and supports paging loading and field filtering. When calling the API interface to obtain data, it accesses the RESTful interface by constructing an HTTP request and parses the returned JSON structure data. The nested fields are flattened and expanded to form a standard key-value pair format, and the original knowledge data from different data sources are cached and stored in a unified format.
[0042] S12: Format-parse the original knowledge data and extract entity relationships to extract semantic unit information for graph modeling.
[0043] Specifically, first, a unified format preprocessing operation is performed on the cached raw data, including character set conversion, special symbol cleaning, null value filling and field type inference. On the basis of ensuring data consistency, the entity recognition algorithm is called to perform named entity extraction on the field content, and keyword groups with independent semantic meanings are identified as entity candidates. Then, the potential semantic connections between entities are identified through logical associations or foreign key constraints between fields. For example, in the record where the "drug name" is "ibuprofen" and the "indication" is "fever", the two entities "ibuprofen" and "fever" are identified, as well as the "applicable to" relationship between the two. At the same time, the semantic unit attribute information such as the entity's time, effective range, and classification label are extracted in combination with the auxiliary information in the entity attribute column, thereby constructing a structured semantic unit information set.
[0044] S13: According to the preset graph data modeling rules, the entity content in the semantic unit information is constructed as a node object in the graph database, the association information between the entities in the semantic unit information is modeled as a relationship edge object, and attribute labels are assigned to the node object and the relationship edge object.
[0045] Specifically, based on the configuration content in the knowledge modeling rule library, the entity type in the semantic unit information is mapped to the node label name in the graph database. For example, the "disease" type entity is mapped to the node label "Disease", and the "treatment method" type entity is mapped to the node label "Treatment". A unique identification ID and name attribute are assigned to each node, and other auxiliary attributes such as source channel, update time and data confidence are attached. For the semantic relationship between the identified entities, such as "treatment", "concurrency", "propagation", etc., edge objects are generated through the relationship mapping rules. Each edge object contains the starting node ID, the ending node ID and the corresponding relationship type label, and the edge is given attribute fields such as "association strength", "source rule number", "establishment time", etc., thereby completely modeling the original knowledge data into the node and edge structure required by the graph database.
[0046] S14: Write the constructed node objects and relationship edge objects into the graph database to generate a knowledge graph structure model.
[0047] Specifically, first, according to the specifications of the target graph database, the node object collection is exported into a standard format CSV or JSON structured file, where each record contains the node label, node ID and all attribute key values. Then, the relationship edge objects are exported into an independent edge definition file, specifying the start node, end node, relationship type and attribute content of each edge. Then, the node file and edge file are written into the database instance in sequence through the batch import tool supported by the graph database (such as Neo4j's neo4j-adminimport or ArangoDB's arangorestore). During the writing process, node indexes and relationship type indexes are automatically created to improve query efficiency. After the data import is completed, the database cache is refreshed and a structural check is performed to verify the integrity of the graph. In this way, the initialization generation of the knowledge graph structure model is completed and can be used for subsequent retrieval.
[0048] In one embodiment, if Figure 3 As shown, in step S20, the term information of the entity nodes in the knowledge graph structure model is extracted, the entity term set is constructed and the standardized expression set is generated, which specifically includes: S21: Identify terminology information of the entity node, which includes primary name, alias, synonym or abbreviation information, and establish term mapping relationships between different expressions.
[0049] Specifically, the name field of each node and the additional alias, synonym, abbr attribute field value are read from the graph database node table, the possible synonymous expressions are extracted by splitting the symbols " / " ";" "," or Chinese brackets by using regular expressions, the core stems are obtained by using a word segmentation tool to segment multi-word phrases and removing stop words, then the candidate terms are compared with each other by using the edit distance algorithm, and those with a distance less than a set threshold are considered to have the same semantic expression and are recorded in the mapping, and the Word2Vec word vector cosine similarity is used to supplement the recognition of words with large spelling differences but similar semantics, for example, "beta blocker" "beta blocker" and "BetaBlocker" are mapped to the same main name "beta blocker", and finally a complete term mapping record is established in the mapping table with the main name as the key and the alias, synonym, abbreviation array as the value.
[0050] S22: The term information is clustered and normalized to form an entity term set with unified semantic representation, and a standardized expression set for semantic understanding is constructed to support entity recognition and semantic normalization processing in user input.
[0051] Specifically, the fast clustering algorithm is used to merge all mapping records into a cluster set with the previously generated main name as the cluster center, the alias items inside each cluster are calculated to generate an extended vocabulary list, and then the extended vocabulary is segmented by the forward maximum matching algorithm to generate a segmentation dictionary entry, which is written into the entity dictionary part of the standardized expression set; at the same time, a unified entity identifier such as ENT_000123 is generated for each main name, and a three-layer mapping relationship of entity identifier→main name→synonym list is established, and finally a JSON file containing entity identification, standard name, and synonym set is exported for subsequent semantic analysis stage to ensure that "Betablocker" or "beta blocker" can be normalized to point to the ENT_000123 entity node.
[0052] In an embodiment, as shown in Figure 4 In step S30, historical question and answer example data corresponding to the knowledge graph structure model is collected to construct a case training set with graph labeling, specifically including: S31: Collect natural language questions and corresponding answers covering the target knowledge domain query intent to form structured historical question and answer example data.
[0053] Specifically, a log extraction script is called to extract question and answer pairs with an accepted answer mark in the online customer service conversation library, FAQ knowledge base and community forum posts in the past three years. Through an intent classification model, idle chat and invalid questions are filtered out, and only questions judged as "domain fact query" or "operation guidance query" and the like are retained. After executing a text extraction algorithm on the answer paragraph to remove redundant customer greetings, pure answer text is obtained. Then, the question, answer, question time, context conversation ID and source channel are written into a structured table field to form a historical question and answer example data with complete fields and traceability.
[0054] S32: Perform entity recognition and relationship extraction operations on the natural language questions in the historical question and answer example data, identify the entity terms and semantic relationships involved in the historical question and answer example data, and map and match them with the node objects and relationship edge objects in the knowledge graph structure model to obtain a matching result.
[0055] Specifically, for each historical question, a named entity recognition module is run to identify the entity phrases appearing therein and call a standardized expression set to alias and normalize the terms. The normalized terms are mapped to graph database node IDs. Then, through dependency syntax analysis, the predicate or preposition combinations between entities such as "applicable to", "belong to", "produce" are determined to extract potential semantic relationships. The defined relationship edge types in the graph are compared to select the relationship label with the closest semantics and verify that the start and end node types match consistently. If the matching is successful, a mapping result record containing {question ID, start node ID, relationship type, end node ID} is generated.
[0056] S33: Based on the matching result, each question and answer example is structurally bound to its corresponding graph structure content to form a case training sample with graph label information, and a case training set is obtained.
[0057] Specifically, the mapping result output in the previous stage is merged with the original question and answer pair data. The start node and end node are associated using the question ID, and the relationship type is appended. The "answer entity set" field is added to the answer text to save all end node IDs. The question text, answer text, start node ID, relationship type, end node ID and source channel are packaged as a JSON structure and given a unique case identifier. Finally, all JSON samples are written into a NoSQL training sample collection, and the total sample number and entity coverage rate are recorded as statistical information of the case training set.
[0058] In an embodiment, as shown in FIG. 4, Figure 5 In step S40, a natural language question input by a user is received, and a semantic understanding operation is performed based on a standardized expression set to obtain a structured semantic representation of the question, specifically including: S41: Perform text parsing operations on natural language questions to extract entity words, relation words, and question intent words from the natural language questions.
[0059] Specifically, the Chinese word segmenter and part-of-speech tagging model are called to perform preliminary segmentation and part-of-speech tagging on the input sentence, and then the named entity recognition algorithm is used to locate fragments with proper noun or professional terminology features in the word segmentation results as entity candidates. Verbs, prepositions or prepositional phrases are detected through dependency syntactic analysis, and phrases that express semantic associations between entities are screened out as relational words. At the same time, interrogative sentence patterns such as "what", "which", "whether", etc. are matched at the beginning or end of the sentence to determine the interrogative intent words, thereby completing the multi-dimensional extraction of entity words, relational words and interrogative intent words.
[0060] S42: Based on the standardized expression set, the identified entity words are standardized and mapped to eliminate semantic ambiguity and normalize them to the corresponding standard entity expressions to obtain the entity mapping results.
[0061] Specifically, the extracted entity words are first case-normalized and converted to full-width and half-width characters, and then the main name entries that are identical or have a similarity higher than a threshold are retrieved in the standardized expression set index table. If an alias or abbreviation is retrieved, it is replaced with the corresponding main name and its entity unique identification ID is recorded. If multiple candidates are matched at the same time, the item with the highest matching degree is selected as the standard entity expression based on the context co-occurrence frequency or the word vector cosine distance, and the final output is the entity mapping result containing "original entity word → standard entity name → entity ID".
[0062] S43: Identify the query intent type of the natural language question, obtain the intent recognition result, analyze the syntactic structure and semantic dependency, determine the query target and restriction conditions in the natural language question, and obtain the semantic structure analysis result.
[0063] Specifically, the intent classification model is used to perform multi-dimensional feature combination input on the word segmentation results and syntactic feature vectors, and then output intent labels such as "attribute query", "relationship query" or "fact enumeration". The dependency syntax tree is then traversed to find the subject-predicate or prepositional phrase node associated with the intent verb to mark the query target entity or attribute field. At the same time, the modifiers and quantity-limiting phrases are parsed to determine the time range, numerical range or conditional limitation of the query, thereby generating a semantic structure analysis result including intent labels, target slots and constraints.
[0064] S44: Generate a structured question semantic representation based on the entity mapping results, the intent recognition results, and the semantic structure analysis results. The question semantic representation includes at least one standard entity slot, a query action type, and constraint information.
[0065] Specifically, the entity ID in the entity mapping result is written into the entity slot field, the action label in the intent recognition result is mapped into the query action type field, the target attribute or relationship and the limiting condition in the semantic structure analysis result are written into the constraint condition field, and then the entity slot, the action type and the constraint condition are encapsulated in a fixed order of “entity slot→action type→constraint condition” into a JSON structure or a key-value object for subsequent query instruction generation stage calling, so as to complete the construction of the structured problem semantic representation.
[0066] In an embodiment, as shown in FIG. 4, in step S40, the problem semantic representation is matched with the case training set to obtain the context semantic features, specifically including: Figure 6 S45: constructing a semantic representation vector for each case sample in the case training set.
[0067] Specifically, for each case training sample, the standard entity slot, the query action type and the constraint condition text are sequentially extracted from the structured content thereof, the entity words corresponding to the standard entity slot are input into the constructed entity word embedding dictionary to extract a high-dimensional embedding vector, for example, the word vector trained by Word2Vec or TransE can be used as the entity representation, at the same time, the query action type is converted into a fixed format action identifier and mapped into an action vector of corresponding dimension through one-hot encoding, for the constraint condition part, the BERT model is used to encode the semantic text to generate a sentence vector representation, then the entity embedding vector, the action type vector and the constraint condition sentence vector are sequentially spliced to form an original feature vector, then the spliced vector is dimensionally regularized and semantically abstracted through a two-layer fully connected network, for example, the spliced vector is compressed from 768 dimensions to 256 dimensions and a ReLU activation function is added to improve the non-linear expression ability, finally a normalized semantic representation vector is obtained, which can be used for subsequent similarity calculation and matching operation.
[0068] S46: calculating the matching degree of the problem semantic representation and each semantic representation vector of the case training set, and selecting a corresponding target case sample set based on the matching degree.
[0069] Specifically, after the natural language question input by the user is processed by the semantic understanding module to obtain a question semantic representation, the semantic representation vector is constructed in the same way as the case training sample, including embedding of entity words, encoding of query action type, and uniform encoding and normalization after splicing of sentence vectors of constraint condition text, and then the cosine similarity between the question vector and the semantic representation vector of each sample in the case training set is calculated as the matching degree index, and a similarity score between the question vector and each case sample is obtained to form a similarity ranking list, and a target set is formed by screening a number of case samples with higher matching degree from the list according to a set threshold (such as similarity greater than 0.65), and the first K most similar samples are selected to ensure that the context features are representative, and when the matching samples are insufficient, the threshold can be appropriately relaxed or a semantic supplement strategy can be introduced to ensure the completeness of the set.
[0070] S47: The standard entity slot, query action type and constraint condition information in the target case sample set are fused to generate context semantic features corresponding to the question semantic representation.
[0071] Specifically, for the target case sample set screened out, the entity embedding vector, query action type encoding vector and constraint condition semantic vector in each sample are extracted, each sample is assigned a weight coefficient according to the similarity score, and the three types of vectors are fused by weighted average, for example, for the set of entity slot vectors, the fused entity semantic representation is obtained by using the method of ∑(entity vector x similarity weight) / ∑weight, for the action type vector, the stable behavior representation is obtained by first adding the elements and then averaging, and for the constraint condition sentence vector, the same weighted fusion strategy is performed to ensure smooth expression of constraint semantics, and finally the three types of fused vectors are spliced again to form a complete context semantic feature representation, and a linear mapping operation is performed to encode it into a uniform dimension vector for subsequent prompt word template construction and instruction generation task of large language model, thereby enhancing the sensitivity and reasoning accuracy of context in the question and answer scenario.
[0072] In an embodiment, as shown in Figure 7 In step S50, a prompt word template for calling the large language model is constructed based on the question semantic representation, the context semantic features and the knowledge graph structure model, and a query instruction generation operation is performed to obtain a target query statement of the graph database, specifically including: S51: Fill the corresponding standard entity slot, query action type and constraint condition information in the prompt word template based on the question semantic representation.
[0073] Specifically, the system first traverses the structural fields of the question semantic representation to extract standard entity slot content, such as entity elements such as "target disease," "main drug," or "region." These elements are then inserted as variables into the predefined slot positions of the prompt word template. For example, "hypertension" is filled into the [disease] position in "Please query the treatment methods for [disease]" to form a complete sentence. The query action type field is then parsed, such as "obtain," "compare," "statistic," or "recommend," and formatted into a natural language verb phrase to be written into the query target description paragraph. For example, "compare" is transcribed into "Please compare the effectiveness of different treatment options." All restrictive factors in the constraint condition field are then extracted from the question semantic representation, such as "the time range is the past five years," "the query region is China," or "it must be an over-the-counter drug." The prompt word is then injected using a preset semantic fragment template. For example, "the past five years" is mapped to "the data time range is limited to 2019 to 2023." Finally, the aforementioned entity content, query behavior, and constraint conditions are integrated into the structural slot of the prompt word to generate instruction-oriented prompt input content.
[0074] S52: Select the case sample with the highest matching degree with the question semantic representation from the context semantic features, and insert the corresponding example question-answer pair into the prompt word template.
[0075] Specifically, vectorization processing is performed on the semantic representation of each case sample in the contextual semantic features, and its structured fields such as entity slots, action types and constraints are jointly encoded into a dense vector representation. A similarity calculation operation is performed with the current question semantic representation vector, and a ranking score is obtained using cosine similarity, Euclidean distance or BERT embedding comparison. The case sample with the highest similarity is selected from it, and then the original natural language question such as "What over-the-counter drugs can cold patients take" and its answer such as "Such as paracetamol and compound acetaminophen can be used to relieve symptoms" are extracted from the case. The structured question is transcribed into the format of "Q: What over-the-counter drugs can cold patients take? A: Such as paracetamol and compound acetaminophen can be used to relieve symptoms". This format fragment is inserted into the example question and answer area of the prompt word template to provide context reference and semantic alignment instructions to the large language model, thereby improving the model's understanding of the current query semantic structure and the accuracy of instruction output.
[0076] S53: Add the schema description information of the knowledge graph structure model and query output format constraints to the prompt word template.
[0077] Specifically, first read the Schema definition structure from the graph database, extract the entity types involved in the current knowledge graph (such as "disease", "drug", "inspection item"), attribute fields (such as "indication", "side effect", "price") and relationship types (such as "treatment relationship", "component relationship", "complication relationship"), organize these contents into structured description fragments and text, for example, write into "entity types include disease (Disease), drug (Drug) and so on, relationship types include treats, causes, has_symptom" and so on, and embed them into the prompt word template background information area. Then, according to the semantic requirements of the query target, set the output format requirements, such as requiring to output all matching entities "name, attribute value and relationship path" in JSON format, then explicitly inject the rule into the prompt word additional paragraph at the end, for example "please output as follows: { 'entity': name, 'property': attribute value,'relation': path}", this structured format restriction helps the model to generate data output sentences with format compliance and easy to parse.
[0078] S54: Call the large language model input prompt word template to generate an initial query instruction, and perform a verification operation on the initial query instruction. When the verification is passed, the target query statement is determined.
[0079] Specifically, the filled and enhanced prompt word template is sent to the accessed large language model inference interface in the form of pure text as complete input content, such as OpenAIGPT series or similar multi-round context large model service, and the sampling parameters of high temperature and low repetition rate are configured to improve the diversity and accuracy of instruction generation. The output content of the model is obtained as the initial query instruction text after the model is generated. Then, the query instruction is subjected to structure legality test, including whether there is syntax error, whether the key structure is omitted, such as whether the MATCH and RETURN statement blocks are included in Cypher language, and whether the SELECT and WHERE syntax is complete in SPARQL. At the same time, it is checked whether the entities and relationships used in the query match the definitions in the knowledge graph Schema, such as whether the reference to a non-existent field is marked as semantically illegal. Finally, the field type, value range and other semantic consistency are reviewed. When the syntax and semantics meet the expected standard, the query instruction is determined as the target query statement and used for subsequent graph database query task. Otherwise, feedback the error and recombine the prompt word template for iterative generation until the expected is met.
[0080] It should be understood that the size of the serial number of each step in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0081] In one embodiment, a device for optimizing an intelligent question-answering system based on a knowledge graph is provided. The device for optimizing an intelligent question-answering system based on a knowledge graph corresponds one-to-one to the method for optimizing an intelligent question-answering system based on a knowledge graph in the above embodiment. Figure 8 As shown in the figure, the intelligent question-answering system optimization device based on knowledge graph includes a graph construction module, a term standardization module, a case annotation module, a semantic parsing module, a prompt word generation module, a graph query execution module, and a result mapping rendering module. The functional modules are described in detail as follows: The graph construction module is used to obtain the original knowledge data of the target knowledge domain and build a knowledge graph structure model in the form of a graph database; The terminology standardization module is used to extract the terminology information of entity nodes in the knowledge graph structure model based on the knowledge graph structure model, build an entity term set and generate a standardized expression set; The case annotation module is used to collect historical question-and-answer case data corresponding to the knowledge graph structure model and construct a graph-labeled case training set; The semantic parsing module is used to receive natural language questions input by users, perform semantic understanding operations based on the standardized expression set, obtain structured semantic representation of the question, and match the semantic representation of the question with the case training set to obtain contextual semantic features; The prompt word generation module is used to build a prompt word template for calling the large language model based on the question semantic representation, context semantic features, and knowledge graph structure model, and perform query instruction generation operations to obtain the target query statement of the graph database; The graph query execution module is used to submit the target query statement to the graph database to perform data retrieval operations and obtain query result data corresponding to the semantic representation of the question; The result mapping rendering module is used to perform semantic mapping analysis on the query result data and the question semantic representation, build an explainable association path, and perform personalized rendering processing on the query result data based on user portrait information to generate the final question and answer return content.
[0082] Optionally, graph building modules include: The graph data acquisition submodule is used to obtain original knowledge data from data sources, including spreadsheet files, relational databases, or data returned by API interfaces; The format parsing and extraction submodule is used to parse the format of the original knowledge data and extract entity relationships, extracting semantic unit information for graph modeling; The graph node relationship generation submodule is used to construct the entity content in the semantic unit information into node objects in the graph database according to the preset graph data modeling rules, model the association information between entities in the semantic unit information into relationship edge objects, and assign attribute labels to the node objects and relationship edge objects; The graph data writing submodule is used to write the constructed node objects and relationship edge objects into the graph database to generate a knowledge graph structure model.
[0083] Optional terminology standardization modules include: The term identification submodule is used to identify the term information of the entity node, including the main name, alias, synonyms or abbreviation information, and establish the term mapping relationship between different expressions; The term normalization submodule is used to cluster and normalize term information to form an entity term set with unified semantic representation, and to construct a standardized expression set for semantic understanding to support entity recognition and semantic normalization processing in user input.
[0084] Optionally, the case annotation module includes: The case collection submodule is used to collect natural language questions and corresponding answers that cover the query intent of the target knowledge domain, forming structured historical question and answer case data; The case mapping submodule is used to perform entity recognition and relationship extraction operations on natural language questions in historical question and answer case data, identify the entity terms and semantic relationships involved in the historical question and answer case data, and map and match them with the node objects and relationship edge objects in the knowledge graph structure model to obtain matching results; The case binding submodule is used to structurally bind each question and answer example with its corresponding graph structure content based on the matching results, forming a case training sample with graph label information and obtaining a case training set.
[0085] Optional semantic parsing modules include: The question parsing submodule is used to perform text parsing operations on natural language questions and extract entity words, relation words and question intent words from natural language questions; The entity mapping submodule is used to perform standardized mapping on the identified entity words based on the standardized expression set, eliminate semantic ambiguity and normalize them into the corresponding standard entity expressions to obtain the entity mapping results; The intent analysis submodule is used to identify the query intent type of natural language questions, obtain intent recognition results, analyze the syntactic structure and semantic dependencies, determine the query target and constraints in the natural language questions, and obtain semantic structure analysis results; The semantic representation construction submodule is configured to generate a structured question semantic representation according to the entity mapping result, the intent recognition result, and the semantic structure analysis result, the question semantic representation including at least one standard entity slot, a query action type, and constraint condition information.
[0086] The case vectorization submodule is configured to construct a semantic representation vector for each case sample in the case training set. The case matching submodule is configured to calculate a matching degree of the question semantic representation and each semantic representation vector in the case training set, and select a corresponding target case sample set based on the matching degree. The context fusion submodule is configured to perform feature fusion on the standard entity slot, the query action type, and the constraint condition information in the target case sample set, and generate a context semantic feature corresponding to the question semantic representation.
[0087] Optionally, the prompt word generation module includes: The prompt word filling submodule is configured to fill the corresponding standard entity slot, query action type, and constraint condition information in the prompt word template based on the question semantic representation. The example insertion submodule is configured to select a case sample with the highest matching degree with the question semantic representation from the context semantic feature, and insert a corresponding example question and answer pair into the prompt word template. The Schema enhancement submodule is configured to attach Schema description information and query output format constraints of a knowledge graph structure model in the prompt word template. The instruction generation and verification submodule is configured to call a large language model to input the prompt word template to generate an initial query instruction, perform a verification operation on the initial query instruction, and determine a target query sentence when the verification passes.
[0088] The specific limitations of the intelligent question answering system optimization device based on a knowledge graph can be seen in the limitations of the intelligent question answering system optimization method based on a knowledge graph described above, and will not be repeated here. Each module in the intelligent question answering system optimization device based on a knowledge graph can be realized by software, hardware, and combinations thereof, in whole or in part. Each module described above can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so as to be called and executed by the processor to perform the operations corresponding to each module.
[0089] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional units and modules is exemplified, and in actual application, the above functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above.
[0090] The above-described embodiments are only used to illustrate the technical solutions of the present application, but not limit the present application; although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A method for optimizing an intelligent question-answering system based on a knowledge graph, characterized in that: The method for optimizing an intelligent question-answering system based on a knowledge graph includes: Obtain the original knowledge data of the target knowledge domain and build a knowledge graph structure model in the form of a graph database; Based on the knowledge graph structure model, extract the term information of the entity nodes in the knowledge graph structure model, construct an entity term set and generate a standardized expression set; Collect historical question-and-answer example data corresponding to the knowledge graph structure model and construct a graph-labeled case training set; receiving a natural language question input by a user, performing a semantic understanding operation based on the standardized expression set to obtain a structured semantic representation of the question, and matching the semantic representation of the question with the case training set to obtain contextual semantic features; Based on the question semantic representation, the context semantic features, and the knowledge graph structure model, a prompt word template for calling a large language model is constructed, and a query instruction generation operation is performed to obtain a target query statement of the graph database; Submitting the target query statement to the graph database to perform a data retrieval operation and obtain query result data corresponding to the semantic representation of the question; The query result data is subjected to semantic mapping analysis with the question semantic representation to construct an explainable association path, and personalized rendering processing is performed on the query result data based on user portrait information to generate the final question and answer return content.
2. The method for optimizing an intelligent question-answering system based on a knowledge graph according to claim 1, characterized in that: The process of obtaining the original knowledge data of the target knowledge domain and constructing a knowledge graph structure model in the form of a graph database includes: Acquire original knowledge data from a data source, such as a spreadsheet file, a relational database, or data returned by an API interface; Parsing the format of the original knowledge data and extracting entity relationships to extract semantic unit information for graph modeling; According to the preset graph data modeling rules, the entity content in the semantic unit information is constructed as a node object in the graph database, the association information between the entities in the semantic unit information is modeled as a relationship edge object, and attribute labels are assigned to the node objects and relationship edge objects; The constructed node objects and relationship edge objects are written into the graph database to generate the knowledge graph structure model.
3. The method for optimizing an intelligent question-answering system based on a knowledge graph according to claim 1, wherein: The step of extracting term information of entity nodes in the knowledge graph structure model, constructing an entity term set, and generating a standardized expression set includes: Identify terminology information of the entity node, the terminology information including primary name, alias, synonym or abbreviation information, and establish terminology mapping relationships between different expressions; The term information is clustered and normalized to form an entity term set with unified semantic representation, and a standardized expression set for semantic understanding is constructed to support entity recognition and semantic normalization processing in user input.
4. The method for optimizing an intelligent question-answering system based on a knowledge graph according to claim 1, wherein: The collecting of historical question-answering example data corresponding to the knowledge graph structure model and the construction of a graph-labeled case training set includes: Collect natural language questions and corresponding answers covering the query intent of the target knowledge domain to form structured historical question and answer example data; Performing entity recognition and relationship extraction operations on the natural language questions in the historical question and answer example data, identifying the entity terms and semantic relationships involved in the historical question and answer example data, and mapping and matching them with the node objects and relationship edge objects in the knowledge graph structure model to obtain matching results; Based on the matching results, each question and answer example is structurally bound to its corresponding graph structure content to form a case training sample with graph label information, thereby obtaining the case training set.
5. The method for optimizing an intelligent question-answering system based on a knowledge graph according to claim 1, wherein: The receiving of a natural language question input by a user and performing a semantic understanding operation based on the standardized expression set to obtain a structured semantic representation of the question includes: Performing a text parsing operation on the natural language question to extract entity words, relation words, and question intent words from the natural language question; Performing standardized mapping on the identified entity words based on the standardized expression set, eliminating semantic ambiguity and normalizing them into corresponding standard entity expressions, to obtain entity mapping results; Identify the query intent type of the natural language question, obtain intent recognition results, analyze the syntactic structure and semantic dependency relationships, determine the query target and restriction conditions in the natural language question, and obtain semantic structure analysis results; The structured question semantic representation is generated according to the entity mapping result, the intent recognition result and the semantic structure analysis result. The question semantic representation includes at least one standard entity slot, a query action type and constraint information.
6. The method for optimizing an intelligent question-answering system based on a knowledge graph according to claim 1, wherein: The step of matching the problem semantic representation with the case training set to obtain contextual semantic features includes: Constructing a semantic representation vector for each case sample in the case training set; Calculating the matching degree between the problem semantic representation and each semantic representation vector of the case training set, and selecting a corresponding target case sample set based on the matching degree; Feature fusion is performed on the standard entity slots, query action types and constraint information in the target case sample set to generate contextual semantic features corresponding to the semantic representation of the question.
7. The method for optimizing an intelligent question-answering system based on a knowledge graph according to claim 1, characterized in that: The process of constructing a prompt word template for calling a large language model based on the question semantic representation, the context semantic features, and the knowledge graph structure model, and performing a query instruction generation operation to obtain a target query statement for the graph database includes: Based on the semantic representation of the question, fill in the corresponding standard entity slots, query action types and constraint information in the prompt word template; Selecting a case sample with the highest matching degree with the question semantic representation from the context semantic features, and inserting the corresponding example question-answer pair into the prompt word template; Adding the schema description information of the knowledge graph structure model and query output format constraints to the prompt word template; The large language model is called to input the prompt word template to generate an initial query instruction, a verification operation is performed on the initial query instruction, and the target query statement is determined when the verification passes.
8. An intelligent question-answering system optimization device based on knowledge graph, characterized in that: The intelligent question-answering system optimization device based on knowledge graph includes: The graph construction module is used to obtain the original knowledge data of the target knowledge domain and build a knowledge graph structure model in the form of a graph database; A terminology standardization module is used to extract terminology information of entity nodes in the knowledge graph structure model based on the knowledge graph structure model, construct an entity term set and generate a standardized expression set; A case annotation module is used to collect historical question-answering example data corresponding to the knowledge graph structure model and construct a graph-labeled case training set; A semantic parsing module is configured to receive a natural language question input by a user, perform a semantic understanding operation based on the standardized expression set, obtain a structured semantic representation of the question, and match the semantic representation of the question with the case training set to obtain contextual semantic features; A prompt word generation module is used to construct a prompt word template for calling a large language model based on the question semantic representation, the context semantic features, and the knowledge graph structure model, and perform a query instruction generation operation to obtain a target query statement of the graph database; A graph query execution module is used to submit the target query statement to the graph database to perform a data retrieval operation and obtain query result data corresponding to the semantic representation of the question; The result mapping rendering module is used to perform semantic mapping analysis on the query result data and the question semantic representation, construct an explainable association path, and perform personalized rendering processing on the query result data based on user portrait information to generate the final question and answer return content.
Citation Information
Cited By
LLM-based data analysis method and electronic equipment
CN121029957A
Bidding document information extraction method
CN121031593A
A method for extracting information from bidding documents
CN121031593B
Method, system and device for generating reinsurance contract text based on large language model and medium
CN121032687A
Question and answer method and device, nonvolatile storage medium and electronic equipment
CN121051253A