A method to improve the accuracy of knowledge question answering based on semantic elements
By building a semantic element library and using gold investment algorithms for knowledge recall, the shortcomings in knowledge organization, user intention understanding, knowledge recall and answer generation in the intelligent question-and-answer system are solved, and high accuracy and user experience are improved.
Patent Information
- Application Number
- CN202411713153.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-11-27
AI Technical Summary
Intelligent Q&A systems face contradictions between high accuracy, high performance and user interaction, including difficulties in knowledge organization, low accuracy of user intention understanding, low efficiency of knowledge recall, insufficient accuracy of knowledge sorting evaluation, and insufficient stability and appropriateness of answer generation.
By building a semantic element library, extracting key information and forming semantic nodes, realizing humanized answer generation. The gold investment algorithm is used to perform knowledge recall, combining semantic factor splitting and multi-level weight comparison mechanism to ensure the relevance and accuracy of the answers.
It improves the accuracy and user experience of knowledge questions and answers, enhances the accessibility and utilization efficiency of information, ensures the timeliness and relevance of answers, and adapts to diverse user queries.
Smart Images

Figure CN119202209B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of natural language processing and intelligent question-answering systems, and in particular to a method for improving the accuracy of knowledge question-answering based on semantic elements. Background Art
[0002] With the rapid development of big model technology, various traditional IT applications are gradually transformed into intelligent applications, such as data operation and maintenance Q&A, ETC self-service Q&A, and intelligent data retrieval Q&A. However, these intelligent Q&A applications face significant challenges when applied on a large scale, especially the contradiction between high accuracy, high performance and user interaction. The main problems of existing technologies include:
[0003] First, the difficulty of high-quality knowledge organization makes it difficult for intelligent question-answering systems to effectively manage a large number of complex knowledge documents. Current knowledge organization methods can be roughly divided into two categories: one is low-cost document slicing and classification storage, but this method is difficult to effectively manage within the knowledge field; the other is specialized organization based on knowledge graphs, but its construction cost is high and requires continuous maintenance. This leads to a lack of flexibility and adaptability in the organization of knowledge, which affects the understanding and recall of subsequent user questions.
[0004] Secondly, the accuracy of understanding user intent is low. Traditional intent recognition methods rely on manually combing through user question scenarios, which easily leads to high maintenance costs, inability to exhaust user intent, and conflicts in triggering methods. This limitation reduces the user experience and increases the management burden of the system.
[0005] Third, efficient knowledge recall also faces problems. Existing recall technologies usually rely on multi-way parallel recall, but this may generate a large amount of irrelevant information in user queries, wasting system resources and reducing recall efficiency. The inefficiency of this process directly affects the speed and accuracy of users' acquisition of information.
[0006] In addition, the accuracy of knowledge ranking evaluation is insufficient. Existing ranking models are often evaluated based on pre-trained corpora, resulting in poor ranking results when faced with new knowledge or professional fields. Irrelevant information may be displayed first, affecting the effectiveness of user decisions.
[0007] Finally, the stability and relevance of answer generation are insufficient. Different large models generate answers to the same question in different formats, and the consistency and adaptability of the output cannot be guaranteed. This often results in users not meeting their needs when seeking accurate answers, thus affecting the overall service response speed and processing efficiency.
[0008] These problems will lead to a significant reduction in the accuracy and user satisfaction of the intelligent question-answering system in actual user applications, affecting the efficiency of enterprises in service response, information acquisition and decision support, and thus restricting the popularization and development of intelligent applications. Therefore, there is an urgent need for a novel method to effectively solve the above technical problems in order to improve the overall performance and user experience of the intelligent question-answering system. Summary of the invention
[0009] In order to overcome the shortcomings of the prior art, the present invention proposes a method for improving the accuracy of knowledge question and answer based on semantic elements. The method realizes humanized answer generation by constructing a logical framework and extracting relevant information. The answers obtained by users are not only accurate, but also conform to the natural language expression habits, which enhances the interactive experience and reduces the difficulty of users' understanding.
[0010] To achieve the above object, the present invention proposes a method for improving the accuracy of knowledge question answering based on semantic elements, comprising the following steps:
[0011] Step 1: Extract key information from text data in related fields, construct semantic nodes, including entities, attributes and relationships, and form a semantic element library. The semantic element library is organized at four levels: domain, classification, carrier and knowledge, and supports multi-level knowledge representation;
[0012] Step 2: Perform word segmentation on the question text input by the user, obtain the word sequence, and use the word segmentation tool in combination with the domain knowledge base; then, perform syntactic dependency parsing, extract key semantic dependencies, and form a semantic element representation of the question, including entities, attributes, and query intent;
[0013] Step 3: In the knowledge recall stage, the golden investment algorithm is applied to realize knowledge retrieval. The golden investment algorithm is as follows:
[0014] Treat semantic elements as keywords (investors) and knowledge content in the knowledge base as channels (producers); allocate initial funds to each keyword to simulate its investment behavior;
[0015] Based on the principle that the number of channels is inversely proportional to the return on investment, define the investment priority and profit mechanism of keywords.
[0016] Loop through all keywords, search them one by one, and record the gains of each round of search (the quality and relevance of the retrieved knowledge);
[0017] In each round of search, the keywords with the highest return rate are prioritized for the next search to ensure that the semantic elements in the user's question are met;
[0018] When the returns of all keywords reach the expected value or there is no new return, the search is stopped to form a candidate answer set.
[0019] Step 4: Match candidate answers with the semantic elements of the user's question, score and sort them according to keyword relevance, context information, and semantic coverage, select the most relevant answers through a hierarchical sorting mechanism, and streamline them;
[0020] Step 5: Based on the query intent of the user's question and the ranked candidate answers, construct the prompt words of the big model, and call the big model to generate the final answer. The output answer is presented in the specified format to ensure that the content meets user needs.
[0021] Furthermore, step 1 is as follows:
[0022] Step 1.1: Collect text data in the domain, including structured data and unstructured data;
[0023] Step 1.2: Perform text preprocessing, convert the format of the collected data, and remove meaningless characters, special symbols, and noise information;
[0024] Step 1.3: Use the word segmentation tool to segment the text data, and optimize the word segmentation results in combination with the domain vocabulary to ensure the accuracy of the word segmentation;
[0025] Step 1.4: Extract semantic nodes, including entities (such as concept names), attributes (such as description fields), and relationships (such as logical associations between entities);
[0026] Step 1.5: Based on the semantic nodes, organize the knowledge content into four levels: "field", "classification", "carrier" and "knowledge";
[0027] Step 1.6: Build a semantic element library, combine semantic nodes with hierarchical structures, and form a multi-level knowledge representation system;
[0028] Step 1.7: Update the semantic feature library regularly, re-extract nodes and relationships based on newly added domain knowledge, and ensure the timeliness and accuracy of the library content.
[0029] Furthermore, step 2 is as follows:
[0030] Step 2.1: Receive the original question text input by the user, clean it, and remove meaningless characters and format symbols;
[0031] Step 2.2: Use the word segmentation tool to segment the question text, generate word sequences, and optimize the word segmentation results based on domain knowledge;
[0032] Step 2.3: Perform part-of-speech tagging on the segmented text to identify the grammatical role of each word (such as noun, verb);
[0033] Step 2.4: Use the syntactic dependency parsing tool to generate a dependency graph and extract the grammatical dependencies between words;
[0034] Step 2.5: Extract the semantic elements of the question based on the parsing results, including entities (specific objects involved in the question), attributes (modifying elements in the question), and query intent (the operation required by the user);
[0035] Step 2.6: Match the extracted semantic elements with the semantic element library, mark their semantic categories, and form a structured semantic representation.
[0036] Furthermore, step 3 is as follows:
[0037] Step 3.1: Initialize the retrieval process, decompose the semantic elements of the question into a set of keywords, and map them to the corresponding keywords in the semantic element library;
[0038] Step 3.2: Define search variables, use keywords as “investors” and the content in the knowledge base as “channels”, and assign initial funds to each keyword;
[0039] Step 3.3: Define investment and return rules, set the priority of keyword search, and give priority to keywords with higher channel returns;
[0040] Step 3.4: Loop through each keyword and record the retrieved knowledge content and benefits, including the relevance and coverage of the knowledge;
[0041] Step 3.5: Based on the return rate of each round of retrieval, the keyword with the highest return rate is selected for the next retrieval;
[0042] Step 3.6: When all keyword searches are completed or there is no new benefit, terminate the search to form a candidate answer set;
[0043] Step 3.7: Perform a preliminary screening of the content in the candidate answer set to remove low-relevance or repeated knowledge blocks to ensure the quality of the recalled content.
[0044] Furthermore, step 4 is as follows:
[0045] Step 4.1: Receive the candidate answer set of knowledge recall and match the answer with the semantic elements of the user's question;
[0046] Step 4.2: Calculate the relevance between the answer and the question, including keyword matching, semantic similarity, and contextual consistency;
[0047] Step 4.3: Based on the intent of the user's question, grade the candidate answers and mark the priority of each answer;
[0048] Step 4.4: Use the four-level semantic system to compare the answers, and calculate the matching degree of entities, attributes, relations and semantic structures in turn;
[0049] Step 4.5: Sort the candidate answers according to the comprehensive scores, and select the specified number of records with the highest scores as the final results;
[0050] Step 4.6: Streamline the sorted answers, retain necessary contextual information, and remove redundant content.
[0051] Furthermore, step 5 is as follows:
[0052] Step 5.1: Generate prompt words for large model calling based on the query intent of the user's question and the ranked candidate answers;
[0053] Step 5.2: Format the prompt words to ensure that they meet the input requirements of the large model (such as JSON structure or natural language description);
[0054] Step 5.3: Call the big model to generate answers and reorganize the key information in the candidate answers into a complete natural language answer;
[0055] Step 5.4: Check the generated answers for grammar and consistency to ensure that the language is fluent and the content is accurate;
[0056] Step 5.5: Further process the answer based on the format requirements of the user's question (e.g., list format, table presentation, or paragraph description);
[0057] Step 5.6: Output the final answer and provide feedback to the user, while recording the answer generation process for subsequent optimization.
[0058] Furthermore, it also includes user feedback, as follows:
[0059] Step 6.1: Before generating an answer, receive the user's supplementary answer, re-segment the semantic elements and recall the knowledge to ensure accurate understanding of the user's intention;
[0060] Step 6.2: After providing the answer, the system allows the user to provide feedback on the satisfaction and accuracy of the answer;
[0061] Step 6.3: Collect and analyze user feedback data to identify common problems and system weaknesses;
[0062] Step 6.4: Based on the feedback results, adjust the question analysis method, knowledge recall strategy and answer generation mechanism to continuously optimize system performance.
[0063] Compared with the prior art, the present invention has the following beneficial effects:
[0064] 1. The present invention provides a method for improving the accuracy of knowledge question answering based on semantic elements. By constructing a semantic element library, the method can systematically extract the semantic dimensions, entities, attributes and relationships in a specific field to form a multi-level knowledge representation. This structured knowledge representation enables the system to fully understand the knowledge in the field and improve the accessibility and utilization efficiency of information.
[0065] 2. The present invention provides a method for improving the accuracy of knowledge question answering based on semantic elements. In the process of parsing user questions, the semantic element splitting technology is used to accurately identify the key information in the question. This refined processing method ensures that the system can better understand the user's query intention, reduce ambiguity, and improve the accuracy of question identification.
[0066] 3. The present invention provides a method for improving the accuracy of knowledge question and answer based on semantic elements, and applies the "golden investment algorithm" for knowledge recall, which can efficiently extract information related to user questions from a large number of knowledge blocks. Through continuous iterative optimization, the system can self-learn and improve the quality of recall, thereby ensuring the timeliness and relevance of the answers.
[0067] 4. The present invention provides a method for improving the accuracy of knowledge questions and answers based on semantic elements. The multi-level weight comparison mechanism can accurately evaluate the pros and cons of candidate answers by comprehensively considering the similarity and contextual relevance between candidate answers and user questions. This method ensures that the answer finally returned is not only the most suitable for the question, but also meets the specific needs and background of the user; the method also has the ability to flexibly respond to a variety of questions. By constructing question templates, the system can quickly adapt to questions of different types and formats. This feature makes the system more robust when processing diverse user queries and meets a wider range of application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0069] Figure 1 It is a schematic diagram of the question-answering process based on semantic elements;
[0070] Figure 2 It is a schematic diagram of automatic construction of semantic element library;
[0071] Figure 3 Develop flowcharts for problem understanding;
[0072] Figure 4 This is the gold recall algorithm diagram;
[0073] Figure 5 is the knowledge evaluation algorithm graph;
[0074] Figure 6 It is a schematic diagram of the process of constructing semantic elements;
[0075] Figure 7 It is a schematic diagram of the knowledge semantics basic system;
[0076] Figure 8 It is a schematic diagram of document conversion and element recognition;
[0077] Fig. 9 It is a schematic diagram of the Chinese semantic sentence segmentation process;
[0078] Fig.10 It is a schematic diagram of the process of semantic disambiguation within a sentence;
[0079] Fig.11 It is the semantic dependency analysis graph before completion;
[0080] Fig.12 It is the semantic dependency analysis graph after completion;
[0081] Fig.13 It is a schematic diagram of the semantic element extraction process;
[0082] Fig.14 It is based on understanding schematic diagrams of semantic elements. DETAILED DESCRIPTION
[0083] The technical solution of the present invention will be more clearly and completely explained below through description of preferred embodiments of the present invention in combination with the accompanying drawings.
[0084] The present invention is aimed at large-model knowledge question-answering scenarios and provides a knowledge organization and knowledge recall method based on key semantic elements. Based on this method, the cost of organizing document knowledge can be reduced and the accuracy of large-model knowledge question-answering can be improved. The implementation of the entire technical solution is divided into five steps: semantic element library construction, question understanding engineering, knowledge recall engineering, knowledge evaluation engineering, and answer generation engineering. The relationship between each step is as follows: Figure 1 As shown;
[0085] S1 semantic feature library automatic construction
[0086] like Figure 2As shown, semantic elements are the basic units of expressing meaning in natural language. They can be words, phrases or sentences, which are used to convey specific information. In natural language processing (NLP), the identification and representation of semantic elements are the basis of tasks such as text analysis, information extraction and knowledge representation. The automatic construction mechanism of the semantic element library of the present invention includes five steps: semantic dimension setting, document uploading, document slicing, syntactic dependency analysis, and semantic element extraction. The semantic elements finally stored are combined and represented using four layers: dimension, entity, modifier, and relationship.
[0087] Problem understanding engineering Figure 3 As shown, just like human reading comprehension, human understanding of a paragraph first requires recognizing every word, phrase, and sentence in it, and then understanding the semantic meaning based on the words read. If we encounter unfamiliar words, we need to look up a dictionary or ask experienced people for advice. The idea of understanding the problem of the present invention is to first physically separate sentences according to punctuation marks, then logically separate sentences according to logical conjunctions, and then use the semantic element library to split the elements, and finally split the remaining parts using natural language. For word segmentation that cannot be understood by the element library, it is necessary to ask questions and clarify.
[0088] Knowledge recall project Figure 4 As shown, in order to solve the problems of slow performance and low accuracy of traditional recall, the present invention proposes a golden investment algorithm for knowledge recall. Through this algorithm, the complexity involved in information retrieval and the complexity of information integration and filtering can be well solved. The core idea of the whole algorithm is to solve the problems of the inability to specify keyword weights and low recall efficiency in traditional knowledge retrieval by simulating the relationship between "investment" and "channel". The algorithm optimizes the keyword retrieval process through a set of investment and return analogy mechanisms to improve the efficiency and accuracy of knowledge recall. Specifically, the search keywords are regarded as "enterprises" (i.e. investors), and the search channels in the knowledge base are regarded as "channels" (i.e. producers). Keywords perform knowledge retrieval through investment channels, and each round of retrieval determines the retrieval priority of the next keyword according to the "investment return", and finally realizes efficient and accurate knowledge recall. The platform gives these enterprises (elements) some start-up funds (recall opportunities), drives these enterprises (retrieval elements) to make reasonable investments (retrievals) by using these funds (recall opportunities), creates more value, and can recall the knowledge required for knowledge engineering with low overhead through one or several iterations.
[0089] Knowledge Assessment Engineering Figure 5As shown, in order to solve the problem of traditional sorting models being black boxes for users, the present invention constructs a multi-level semantic weight comparison algorithm based on semantic elements. First, the key elements of the knowledge block are extracted through the semantic element extraction tool of S1, and then the segmentation intersection algorithm is used to obtain the segmentation intersection and calculate the proportion. Among the dimensions and entity elements, the entity elements have a higher weight than the dimension elements. Under the same conditions in the first round of evaluation, the semantic elements of the previous level are introduced for secondary sorting. Under the same conditions again, the semantic elements of the parent directory are introduced for sorting, and finally the closest sorting is obtained.
[0090] In order to solve the problem that traditional large models are not friendly to the original text and generate inappropriate answers, the present invention stipulates an expression method based on the combination of MarkDown and JSON structure. For each knowledge block, #, ##, ### are used to mark the source of this fragment, () is used to identify the ranking score, [] is used to indicate the semantic elements associated with the current knowledge block and the question, and <data>< / data> Express individual knowledge blocks. Improve the big model's ability to understand knowledge through solidification, combination, and fine-tuning of the big model.
[0091] As a specific implementation method, the details are as follows:
[0092] Build a semantic element library. Collect text corpora in a specific field, including books, papers, web pages, and question-and-answer records, to ensure that they cover a wide range of knowledge in that field. Apply text preprocessing techniques to denoise, segment, and tag the collected corpora to clearly identify the text structure. On this basis, identify entities in the text, extract the types, attributes, and relationships of the entities, and form a preliminary semantic dimension. Integrate the identified entities and their relationships into the semantic element library to build a multi-level knowledge representation, including the concept layer, entity layer, and relationship layer.
[0093] Separate the user's question into semantic elements. Receive the question text entered by the user, perform character cleaning, and remove meaningless characters. Use word segmentation technology to segment the question text and generate word sequences. Apply part-of-speech tagging technology to identify the part of speech of each word in the word sequence to determine its grammatical role. Extract entities, attributes, and query intent from the question text to form structured data and mark its category.
[0094] Apply the "Golden Investment Algorithm" for knowledge recall. Based on the query intent of the user's question, retrieve candidate knowledge blocks from the semantic element library. Perform feature extraction on each candidate knowledge block to generate a feature vector. Calculate the similarity score between each candidate knowledge block and the user's question based on the feature vector, sort the similarity scores, and select the knowledge block with the highest score as the candidate answer.
[0095] Based on the constructed semantic elements, the candidate answers are compared at multiple levels by weight. The similarity between the candidate answers and the user questions is preliminarily evaluated and the similarity value is calculated. The context information of the candidate answers is extracted and the context relevance score is calculated. The similarity value and the context relevance score are weighted and combined to generate a weighted score. The best candidate answer is selected based on the weighted score to ensure the relevance and accuracy of the answer.
[0096] Generate natural language answers based on the query intent of the user's question and its related semantic elements. Build the logical framework of the answer based on the query intent and related semantic elements of the user's question. Extract information from the selected knowledge blocks and integrate them into the answer content. Perform grammar check on the generated answer to ensure that it meets the language specifications, and return the final answer to the user to meet the user's question needs.
[0097] Through the above steps, the accuracy of knowledge questions and answers can be effectively improved, enabling the system to understand and answer users' questions more accurately.
[0098] As a specific implementation method,
[0099] The semantics of a natural sentence consists of two parts: internal semantics and external semantics. The external semantic environment refers to the knowledge base directory, document title, document directory, and the natural paragraph to which the natural sentence belongs. The internal semantic environment refers to the semantic elements that constitute the natural sentence, including words, phrases, etc. Comprehensively utilize the internal and external semantic environments of natural sentences to extract multi-level semantic elements, providing a retrieval basis for subsequent knowledge recall. Semantic element construction includes eight steps: semantic extraction rule setting, document element identification, semantic sentence segmentation, local semantic disambiguation, local semantic completion, keyword semantic element extraction, entity semantic element extraction, and fact semantic element extraction. Figure 6 shown.
[0100] Semantic extraction rules are set as follows Figure 7 As shown: The rules include two parts. The first is the knowledge domain classification rules, which are set by setting the knowledge base, knowledge base directory, and setting keyword tags for the knowledge base and directory. For example, the operation and maintenance knowledge base has directories such as interfaces, reports, indicators, and tags. Each directory uses keywords to describe semantic features. For example, the interface has keywords such as model and source system. The second is the semantic inheritance rule, that is, the knowledge blocks segmented from the document should inherit the semantic features of the knowledge base, directory, document, etc. from top to bottom. Through this step, a knowledge semantic basic system of knowledge base, directory, and features is obtained.
[0101] Document conversion and element recognition such as Figure 8As shown, use LlamaIndex or similar document processing tools to convert doc or pdf into Markdown format. Based on this type of document processing tool, the present invention adds a directory generation enhancement method based on serial number rule recognition. That is, for the content under any directory, if you encounter a
[0102] 1, 2, 3; 1), 2), 3); etc. The platform will use rules to intercept text. The text matching rules can be configured in the background. The rule template includes common serial numbers of word documents. Through this step, a document directory tree containing titles, multi-level directories, and document elements (paragraphs, pictures, tables) is obtained.
[0103] Chinese semantic clauses Fig. 9 As shown, HanLP or similar tools are used to segment Chinese sentences using punctuation rules. The Chinese rules used by such tools include period (.), exclamation mark (!), question mark (?), and line break (\n). The present invention enhances the sentence segmentation rules based on the existing tools. First, for the symbol content in the text box, semantic sentence segmentation is not performed. Secondly, for very long sentences, a similarity coefficient is set, and the separable punctuation marks (commas) in the sentence are used for segmentation. After segmentation, the semantic similarity is used for recursive judgment.
[0104] Intra-sentence semantic disambiguation Fig.10 As shown, traverse the first N natural paragraphs of the article, the first N natural paragraphs of this directory and the parent directory, and find out whether there is a reference statement. For example, at the beginning of an article about a company, there is a description: "A certain company is hereinafter referred to as the company". We use the prompt word project of the big model to extract this information from the text. Before each extraction, first determine whether the cache has been extracted. If it has been extracted, do not call the big model. Through this step, obtain the reference of the segmented noun. Use jieba or similar tools to load the seed word library preset in the knowledge base and perform word segmentation to obtain the segmentation array. Set the pronoun library, which consists of public pronouns (such as "you", "I", "he", "it", etc.) and specific pronouns in this article. Compare the pronoun library with the segmentation array. If a pronoun is found, write the prompt word of the big model to obtain the target word after the reference, and insert the reference supplement in the original text. For example: "A certain company does not hold shares in the company", the enhanced sentence is "A certain company does not hold shares in the company [full name]".
[0105] Semantic element completion Fig.11 and Fig.12As shown below: A complete sentence is a description of a specific object or event. The lack of semantic integrity in a sentence often results from the absence of a key central entity. For example, the sentence "Opening date: June 3, 2017" is an incomplete semantic sentence. The complete semantic sentence should be "The opening date of a certain entity is June 3, 2017". First, according to the sentence denoising rules, the present invention preprocesses the sentence data, including replacing the interfering symbols in the text with spaces, converting time symbols in specific formats, etc. Then, it uses HanLP or similar tools to perform semantic structure analysis to obtain a semantic structure tree. It determines whether the semantic structure tree contains a subject role and an object role. If neither is included, it uses the prompt words of the large model and combines the context (the first N natural paragraphs) to let the large model supplement the key subject or object. For example, the completed sentence should be "The opening date of
subject
[0106] Semantic element extraction is as follows Fig.13 As shown below: First, manually establish a stop word library. Stop words include "le", "de", "ba", etc. Replace the stop words in the sentence with spaces. Secondly, let the Hanlp tool load the domain knowledge base terms and use the Hanlp tool or a similar named entity recognition tool to perform named entity recognition to obtain a named entity set. Then, use the Hanlp tool or a similar semantic analysis tool to perform semantic analysis to extract the association relationships of the subject role and object role of the named entity to obtain a set of factual semantic elements. Then, use the Hanlp tool or a similar word segmentation tool to perform word segmentation, and fuse the segmented words with the word segmentation in the upper-level directory to obtain keyword semantic elements. Finally, store the entity semantic elements, keyword semantic elements, and factual semantic elements to form a semantic element inventory.
[0107] S2: Problem understanding based on semantic elements
[0108] As follows Fig.14 As shown below, similar to human reading comprehension, humans first simplify complex problems and then read each word and phrase of the sub-problems to understand the semantic meaning and perform reasoning. The present invention mimics part of the human reading behavior. First, use the Hanlp tool or a similar tool to perform syntactic analysis on a problem to decompose it into several atomic problems. Then, decompose the atomic problems into entity semantic elements, factual semantic elements, and keyword semantic elements, and set an understanding threshold. If the understanding range of any one of the elements exceeds the set threshold, it is considered that the platform understands the user's problem. If it does not reach the specified range, the platform needs to initiate an active inquiry to clarify the intention of the words that cannot be understood. Continuously recurse in this way until the user's problem is understood.
[0109] 1) Question Sentence Segmentation: First, use Hanlp or similar tools to physically segment the sentence based on punctuation marks (commas, periods, exclamation marks, line breaks, etc.), and then use Hanlp or similar tools to perform syntactic dependency analysis on the segmented question. This step will result in a grammatical dependency tree. Determine whether the atomic question contains conjunctions such as "and" and "than" and the connected nouns. If so, remove the conjunctions and the contents before and after, and then connect the connected nouns to obtain two decomposed sentences.
[0110] 2) Element decomposition: Use the previously constructed stop word library. Replace the stop words in the sentence with spaces. Secondly, let the Hanlp tool load the domain knowledge base terms, use the Hanlp tool or similar tools named entity recognition tools to perform named entity recognition, and obtain a set of named entities. Then use the Hanlp tool or similar semantic analysis tools to perform semantic analysis, extract the relationship between the subject role and object role of the named entity, and obtain a set of factual semantic elements. Then use the Hanlp tool or similar tools segmentation tool to perform word segmentation, and merge the segmented words with the segmentation of the parent directory to obtain keyword semantic elements. Finally, entity semantic elements, keyword semantic elements, and factual semantic elements are obtained.
[0111] 3) Question understanding: According to the set question understanding rules, entity semantic elements, keyword semantic elements, and factual semantic elements are used to compare the coverage of the original question. When comparing, the semantic elements themselves are used first for comparison. When the semantic elements themselves cannot be satisfied, the synonyms of the semantic words are used to continue the comparison. When the synonyms still cannot be matched, the recommended words with semantic similarity exceeding the specified threshold are used for comparison. If the coverage is greater than the specified coefficient, the question understanding ends. Otherwise, the platform initiates active follow-up questions. After the user supplements the question, the large model + promt method is used to supplement the understanding of the isolated semantic element points until the question coverage is greater than the execution threshold. When the cycle exceeds the set maximum number of times and still cannot meet the understanding requirements, the platform directly refuses to answer the question.
[0112] S3: Semantic element-based knowledge recall
[0113] According to S1 and S2, the knowledge stored in this knowledge base is of three index types: keyword index, fact map index, and original sentence index. These three types of indexes correspond to sentence semantic retrieval, key information retrieval, and multi-hop reasoning retrieval, respectively. Sentence semantic retrieval refers to the ability to find answers directly in the text, similar to the knowledge organization method of FAQ. However, key information retrieval can only retrieve partial information based on each part of the question, which needs to be recalled and sorted and assembled; multi-hop reasoning retrieval is used to deal with multi-hop question retrieval, such as "the income of a hospital indirectly invested by a certain equity investment fund." These three retrieval methods are all based on semantic elements, and the specific implementation is as follows:
[0114] 1) Sentence-based semantic recall: Compared with the traditional RAG semantic recall method, this method is mainly improved by enhancing the semantic environment of the original text. Based on the line index, it is organized in markdown, and supplemented with the keyword semantic index information of the document, directory, and knowledge base. Then, the m3e vector model or similar models are used to embed these vectors, and the cosine similarity is used for comparison. According to the threshold set by the system, the top N knowledge data is recalled.
[0115] 2) Keyword-based gold recall algorithm: Traditional knowledge retrieval mainly uses the bm25 algorithm, which cannot specify the weight of keywords. The present invention creates a brand new gold investment recall algorithm. The implementation steps of the entire gold investment recall algorithm consist of the following 6 steps.
[0116] Step 1: Establish two key variables for keyword search, investment and channel. Here, we simulate the semantic elements of keywords as enterprises (that is, the terms that the question focuses on) and the knowledge content to be searched as channels.
[0117] Step 2: Set up two identities of the enterprise: investor and producer. Investor refers to the number of times the keyword elements are used for knowledge retrieval, and producer refers to the number of times the knowledge retrieval brings back effective knowledge content each time.
[0118] Step 3: Set up an inverse relationship between channels and production. Each enterprise has many channels, which can be used for investment and production promotion. The more investment channels each enterprise has, the less investment funds it has, and the smaller the investment emphasis will be. Conversely, the investment emphasis will be larger. The more channels each enterprise has, the stronger its monetization ability will be.
[0119] Step 4: Loop through all keywords to retrieve information, helping each company to obtain the income from the previous round of investment from the channel as reserve funds for this round of investment, and calculate the overall effective income, including two aspects of information: whether all companies have obtained income and the total amount of income.
[0120] Step 5: Select the enterprise with the highest investment intensity and immediately execute the investment activity (excluding enterprises that have already made investment activities, each person has only one investment opportunity) Step 6: If no suitable company is found, the investment search fails. If it is found, the cost consumed is recorded at the same time. The implementation example of the above 6 steps is as follows: The user question is "What is the revenue gap between entity A and entity B in a certain year?", which is decomposed into two questions, "What is the revenue gap between entity A in a certain year?" and "What is the revenue gap between entity B in a certain year?", and further decomposed into four semantic elements, "entity A", "entity B", "certain year", and "revenue gap". Here, "entity A" and "entity B" are likened to channels, and each search is likened to investment. Assuming that "entity A" is used for information search first, if the search results contain the three elements of "entity A", "entity B", and "certain year", it is considered that the return on investment this time is very high. The next search directly skips these three keyword elements and directly starts the search from "revenue gap" until the search is completed.
[0121] 3) Recall based on fact graph: The organization form of fact graph is subject-relation-object. First, the fact graph decomposed from the user question is generalized using synonyms to obtain a new batch of facts. Recall the first N pieces of data of full match, matching subject, and matching object.
[0122] S4: Rearrangement based on semantic element knowledge
[0123] The knowledge rearrangement based on semantic elements mainly solves the problems of comprehensive screen sorting, merging, and filtering after different recall methods. Compared with the traditional sorting model solution, the knowledge rearrangement of the present invention comprehensively considers factors such as entities, keywords, and semantic features of the field in which they are located for comprehensive sorting.
[0124] 1) First-level ranking: Compare the keyword element set of the problem split and the keyword element set of the knowledge block to be retrieved. The ranking score retrieval formula is:
[0125] First-level ranking score = coefficient * number of entity intersections + number of keyword intersections / number of question keywords * 1
[0126] 2) Second-level sorting: Based on step 1, the keyword set is further compared with the semantic feature keywords of the document directory where the knowledge block is located. The score calculation formula is:
[0127] Second-level ranking score = coefficient * number of entity intersections + number of keyword intersections / number of question keywords * 0.1
[0128] 3) Three-level sorting: Based on step 2, the keyword set is further compared with the semantic feature keywords of the knowledge base directory where the knowledge block is located. The score calculation formula is:
[0129] Three-level ranking score = coefficient * number of entity intersections + number of keyword intersections / number of question keywords * 0.0.1
[0130] The comprehensive score is = first-level ranking score + second-level ranking score + third-level ranking score
[0131] S5: Answer generation based on semantic matching
[0132] In terms of answer generation, the present invention mainly optimizes the recall method of sample questions based on semantic elements. Use semantic + keyword feature recall to recall the most suitable samples of large model prompt engineering. 1) Set prompt word engineering sample rules: including answer generation keywords such as markdown, list, and attachment directory. 2) Use semantics for recall: match the top N instances with the highest semantic relevance based on user questions. 3) Use keyword features for secondary sorting: use the sorting method in S4 to calculate the comprehensive sorting score. Obtain the prompt word question sample with the sorting score.
[0133] The present invention improves the five parts of semantic element library construction, question understanding, knowledge recall, ranking evaluation and answer generation by engineering the questions with the idea of pipeline.
[0134] The semantic element library construction department can realize the knowledge base of any field, and can use the four-level semantic elements of field, classification, carrier, and knowledge for organization and representation; the question understanding part can decompose the user's questions based on the semantic element inventory to obtain a clear semantic element representation; the knowledge recall brings up the semantic elements decomposed in the previous link, and the algorithm rules provided by the knowledge part ensure that the knowledge can be retrieved and recalled; the sorting evaluation refers to the hierarchical distribution, comparison and sorting of the retrieved content with the four-level semantic system, and finally returns the most appropriate specified number of records. Finally, matching user prompt words are provided according to the user's questions. Since the large model organizes and generates answers, the effect is shown in Table 1:
[0135] Table 1
[0136]
[0137] The above specific implementations are only descriptions of the preferred implementations of the present invention, and do not limit the protection scope of the present invention. Without departing from the design concept and spirit of the present invention, various modifications, substitutions and improvements made by ordinary technicians in this field to the technical solution of the present invention based on the text description and drawings provided by the present invention should all fall within the protection scope of the present invention. The protection scope of the present invention is determined by the claims.
Claims
1. A method for improving the accuracy of knowledge question answering based on semantic elements, characterized in that: The following steps are involved: Step 1: Extract information from text data and construct semantic nodes, including entities, attributes and relationships, to form a semantic element library. The semantic element library is organized at four levels: domain, classification, carrier and knowledge, supporting multi-level knowledge representation. Step 2: Perform word segmentation on the question text input by the user to obtain the word sequence, use the word segmentation tool to perform syntactic dependency analysis in combination with the domain knowledge base, extract key semantic dependencies, and form a semantic element representation of the question; Step 3: In the knowledge recall stage, the golden investment algorithm is applied to realize knowledge retrieval. The golden investment algorithm is as follows: Treat semantic elements as keywords and knowledge content in the knowledge base as channels; allocate initial funds to each keyword to simulate keyword investment behavior; Define keyword investment priorities and revenue mechanisms based on the principle that the number of channels is inversely proportional to investment returns; Loop through all keywords, search them one by one, and record the revenue of each round of search; In each round of search, the keywords with the highest return rate are prioritized for the next search; When the benefits of all keywords reach the expected level or there is no new benefit, the search is stopped to form a candidate answer set; Step 4: Match candidate answers with the semantic elements of the user's question, score and sort them according to keywords, select the most relevant answers through a hierarchical sorting mechanism, and perform simplification; the details are as follows: Match candidate answers with the semantic elements of user questions, score and sort them according to keyword relevance, context information and semantic coverage, select the most relevant answers through a hierarchical sorting mechanism, and streamline them; Step 5: Based on the query intent of the user's question and the ranked candidate answers, construct the prompt words of the large model, call the large model to generate the final answer, and the output answer is presented in the specified format.
2. According to the method for improving the accuracy of knowledge question answering based on semantic elements according to claim 1, it is characterized in that: Step 1 is as follows: Step 1.1: Collect text data in the domain, including structured data and unstructured data; Step 1.2: Perform text preprocessing, convert the format of the collected data, and remove meaningless characters, special symbols, and noise information; Step 1.3: Use the word segmentation tool to segment the text data, and optimize the word segmentation results in combination with the domain vocabulary to ensure the accuracy of the word segmentation; Step 1.4: Extract semantic nodes, including entities, attributes and relationships; Step 1.5: Based on the semantic nodes, organize the knowledge content into four levels: "field", "classification", "carrier", and "knowledge"; Step 1.6: Build a semantic element library, combine semantic nodes with hierarchical structures, and form a multi-level knowledge representation system; Step 1.7: Update the semantic feature library regularly, re-extract nodes and relationships based on newly added domain knowledge, and ensure the timeliness and accuracy of the library content.
3. The method for improving the accuracy of knowledge question answering based on semantic elements according to claim 1, characterized in that: Step 2 is as follows: Step 2.1: Receive the original question text input by the user, clean it, and remove meaningless characters and format symbols; Step 2.2: Use the word segmentation tool to segment the question text, generate word sequences, and optimize the word segmentation results based on domain knowledge; Step 2.3: Perform part-of-speech tagging on the segmented text to identify the grammatical role of each word; Step 2.4: Use the syntactic dependency parsing tool to generate a dependency graph and extract the grammatical dependencies between words; Step 2.5: Extract the semantic elements of the question based on the parsing results, including entities, attributes, and query intent; Step 2.6: Match the extracted semantic elements with the semantic element library, mark their semantic categories, and form a structured semantic representation.
4. The method for improving the accuracy of knowledge question answering based on semantic elements according to claim 1, characterized in that: Step 3 is as follows: Step 3.1: Initialize the retrieval process, decompose the semantic elements of the question into a set of keywords, and map them to the corresponding keywords in the semantic element library; Step 3.2: Define search variables, use keywords as "investors" and the content in the knowledge base as "channels", and assign initial funds to each keyword; Step 3.3: Define investment and return rules, set the priority of keyword search, and give priority to keywords with high channel returns; Step 3.4: Loop through each keyword and record the retrieved knowledge content and benefits, including the relevance and coverage of the knowledge; Step 3.5: Based on the return rate of each round of retrieval, the keyword with the highest return rate is selected for the next retrieval; Step 3.6: When all keyword searches are completed or there is no new benefit, terminate the search to form a candidate answer set; Step 3.7: Perform a preliminary screening of the content in the candidate answer set to remove low-relevance or repeated knowledge blocks.
5. The method for improving the accuracy of knowledge question answering based on semantic elements according to claim 1, characterized in that: Step 5 is as follows: Step 5.1: Generate prompt words for large model calling based on the query intent of the user's question and the ranked candidate answers; Step 5.2: Format the prompt words; Step 5.3: Call the big model to generate answers and reorganize the key information in the candidate answers into a complete natural language answer; Step 5.4: Check the syntax and consistency of the generated answer; Step 5.5: Process the answer according to the format requirements of the user's question; Step 5.6: Output the final answer and provide feedback to the user, while recording the answer generation process for subsequent optimization.
6. The method for improving the accuracy of knowledge question answering based on semantic elements according to claim 1, characterized in that: It also includes user feedback, as follows: Step 6.1: Before generating the answer, receive the user's supplementary answer, re-segment the semantic elements and recall the knowledge; Step 6.2: After providing the answer, allow the user to provide feedback on the satisfaction and accuracy of the answer; Step 6.3: Collect and analyze user feedback data to identify common problems and system weaknesses; Step 6.4: Based on the feedback results, adjust the question analysis method, knowledge recall strategy and answer generation mechanism to continuously optimize system performance.
Citation Information
Patent Citations
Question answering method facing specific field
CN106844741A
Data query method and device, computer equipment and storage medium
CN118394896A