Intelligent retrieval and question answering method and device
By introducing time window optimization technology into the information retrieval system, identifying and processing time entities, and combining time decay factors, the accuracy and timeliness of traditional information retrieval systems are solved when processing time-sensitive queries, and more efficient information retrieval is achieved and answer generation.
Patent Information
- Application Number
- CN202411347119.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-01-10
AI Technical Summary
Traditional information retrieval systems are difficult to provide timely and accurate results when dealing with complex and time-sensitive user query needs, especially when facing ever-changing data flows, resulting in limited user experience and information value.
Using intelligent search and question answering methods based on time window optimization, through the knowledge base's time entity recognition, text vector quantization, vector storage, user problem vector quantization, vector search, combining time decay and similarity scores, merging propt statements and return Steps to answer to ensure the timeliness and accuracy of the search results.
It improves the accuracy and efficiency of information retrieval, ensures that users can quickly obtain the latest or historical information, significantly improves the quality and value of knowledge base services, and enhances user satisfaction.
Smart Images

Figure CN119293207A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the intersection of natural language processing (NLP) and information retrieval (IR), and specifically provides a method for performing natural language processing (NLP) and information retrieval (IR). Background Art
[0002] With the rapid development of the Internet, information is growing explosively. When users are faced with massive amounts of data, how to efficiently and accurately filter out information that meets their needs has become a major problem and challenge facing users.
[0003] Although traditional information retrieval systems have alleviated the difficulty of obtaining information to a certain extent, their core mechanisms mostly rely on simple keyword matching technology. This method may be barely competent when dealing with scenarios with clear literal meanings and single query intentions, but in the face of complex and changing user query needs, especially for highly time-sensitive query needs such as tracking the latest news events, grasping real-time stock quotes, or obtaining emergency rescue information, traditional retrieval systems are stretched thin. This type of information often requires extremely high timeliness and accuracy, and the retrieval method based on keyword matching is difficult to respond in a timely manner and accurately push when facing rapidly changing data streams, which greatly affects the user experience and the value of information.
[0004] Current Retrieval Augmented Generation (RAG) systems provide users with accurate and detailed answers by combining information retrieval and generation technologies. However, these systems usually rely only on keyword matching and text similarity, ignoring information in the time dimension. This approach often results in inaccurate or untimely retrieval results when dealing with time-sensitive queries. In addition, when building a knowledge base, existing systems only perform simple content segmentation and lack in-depth analysis and utilization of time information, which cannot effectively meet users' retrieval needs for time-related information. These deficiencies limit the application effect of the system in time-sensitive scenarios. Summary of the invention
[0005] The present invention aims at solving the above-mentioned deficiencies of the prior art and provides a highly practical intelligent retrieval and question answering method.
[0006] A further technical task of the present invention is to provide an intelligent retrieval and question answering device that is reasonably designed, safe and applicable.
[0007] The technical solution adopted by the present invention to solve its technical problem is:
[0008] An intelligent retrieval and question answering method based on time window optimization has the following steps:
[0009] S1, knowledge preprocessing and temporal entity recognition;
[0010] S2, text vector quantization;
[0011] S3, vector storage, retaining time information;
[0012] S4, raises questions, time entity recognition;
[0013] S5, user question vector quantization;
[0014] S6, vector retrieval, filtering time information;
[0015] S7, combining time decay and similarity score;
[0016] S8, merge prompt statements;
[0017] S9, return the answer;
[0018] S10. Answer the questions.
[0019] Furthermore, in step S1, the customer business knowledge base is subjected to comprehensive text preprocessing, and then, all time entities in the knowledge base are identified and annotated using time entity technology, wherein the time entities include specific dates, years, time periods, and relative time indicators.
[0020] Further, in step S2, the preprocessed text data is converted into a numerical vector representation through word embedding technology, and the vector captures the semantic information of the text, so that the text data can be effectively processed under the framework of the large language model;
[0021] In step S3, the generated text vector and its associated time information are stored together in a vector database, and when storing, each vector has corresponding timestamp information.
[0022] Further, in step S4, when the user asks a question to the system, the system starts the temporal entity recognition process and uses the same algorithm as the knowledge base preprocessing to identify the temporal entity in the question;
[0023] In step S5, the natural language text of the user's question is converted into a numerical vector representation so that the user's question and the knowledge base content can be compared in the same vector space.
[0024] Further, in step S6, the similarity search function of the vector database is used to retrieve the most relevant entries in the knowledge base according to the vector representation of the user's question. During the retrieval process, the system will filter the results according to the time range determined by the time entity in the question to exclude entries with mismatched or irrelevant time.
[0025] In step S7, based on the retrieved results, the similarity score of each knowledge base content is calculated, an improved sorting algorithm is designed, and the results are weighted and sorted in combination with the time decay factor. The time decay factor will reduce the weight of information with a longer time distance and increase the weight of new information.
[0026] Furthermore, the time decay factor is a dynamically adjusted weight coefficient, which adjusts the sorting weight according to the distance between the knowledge base entry and the current query time window. Entries closer to the time window will have higher weights, while entries farther from the time window will have lower weights.
[0027] Furthermore, the improved sorting algorithm processing steps are:
[0028] (1) Determine the time window;
[0029] Determine the time window range related to the query, which is set based on the results of extracting and processing the time information in the question;
[0030] (2) Calculate time decay;
[0031] For each knowledge base entry, calculate the difference between the publishing or updating time and the current query time;
[0032] Apply the time decay function to calculate the time decay factor, which can be expressed as follows using the exponential decay function: weight coefficient = e^(-λ*time difference), where λ is the decay rate and time difference is the difference between the entry time and the query time;
[0033] (3) Adjust the sorting weight;
[0034] Multiply the calculated time decay factor by the initial relevance score of the entry to obtain the adjusted ranking weight;
[0035] The formula is: adjusted weight = initial relevance score * time decay factor;
[0036] (4) Sorting algorithm optimization;
[0037] In the sorting algorithm, the adjusted weight is used as one of the sorting criteria. In this way, the entries in the time window will obtain a higher sorting weight due to the influence of the time decay factor.
[0038] Furthermore, in step S8, an input prompt statement is prepared for use by LLM, combining the vector representation of the user's question with the most relevant knowledge base content retrieved, and the combined prompt statement will reflect the user's needs and relevant background information.
[0039] Further, in step S9, the merged prompt statement is passed to the LLM, and the LLM generates the final answer;
[0040] In step S10, finally, the answer generated by the LLM is presented to the user who asked the question through the user interface, completing the entire question-answering process.
[0041] An intelligent retrieval and question answering device, comprising: at least one memory and at least one processor;
[0042] The at least one memory is used to store a machine-readable program;
[0043] The at least one processor is used to call the machine-readable program to execute an intelligent retrieval and question answering method.
[0044] Compared with the prior art, the intelligent retrieval and question answering method and device of the present invention has the following outstanding beneficial effects:
[0045] The present invention introduces the time element in the knowledge base construction process and saves it as key metadata, so that the knowledge base can accurately reflect the time dimension of information. This not only helps to manage the knowledge base content more effectively by segment, but also significantly improves the efficiency and accuracy of query and analysis based on the time dimension, so that users can find the required historical or latest information more quickly.
[0046] When answering questions, the time window of the question is determined by automatically identifying and processing the time information in the question, thereby accurately limiting the search scope. This mechanism ensures that the search process is more focused on the knowledge base entries that match the time context of the question, reduces the interference of irrelevant information, and improves the accuracy and pertinence of question answers.
[0047] The innovative sorting algorithm comprehensively considers the textual similarity between the knowledge base content and the query as well as the time decay factor, and realizes the priority sorting of the content within the time window. This design enables information that is not only content-related but also closer in time to the query to be displayed more prominently, improving the timeliness of the answer and user satisfaction.
[0048] Combining the above time window analysis and sorting optimization technology, the system can generate answers that are both in line with the user's query intent and highly timely. This is particularly important for application scenarios that require rapid access to the latest information or historical data comparative analysis, significantly improving the overall quality and value of knowledge base services. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0050] Attached Figure 1 It is a flowchart of the intelligent retrieval and question answering method. DETAILED DESCRIPTION
[0051] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0052] A best embodiment is given below:
[0053] like Figure 1 As shown, the intelligent retrieval and question answering method in this embodiment, based on time window optimization, has the following steps:
[0054] S1, knowledge preprocessing and temporal entity recognition;
[0055] Perform comprehensive text preprocessing on the customer's business knowledge base, including removing irrelevant characters, filtering stop words, and part-of-speech tagging. Subsequently, use time entity recognition technology, such as regular expressions and machine learning-based entity recognition models, to accurately identify and annotate all time entities in the knowledge base. These time entities include but are not limited to specific dates (e.g., October 15, 2023), years (e.g., 2021), time periods (e.g., "last quarter"), and relative time indicators (e.g., "next Wednesday").
[0056] S2, text vector quantization;
[0057] The preprocessed text data is further converted into numerical vector representations through word embedding techniques, such as bge-m3, Word2Vec, GloVe, or BERT. These vectors can capture the semantic information of the text and enable the text data to be effectively processed under the framework of a large language model.
[0058] S3, vector storage, retaining time information;
[0059] The generated text vectors and their associated time information are stored together in a vector database, such as Milvus. When storing, ensure that each vector has its corresponding timestamp information so that time-related data can be quickly located during subsequent retrieval.
[0060] S4, raises questions, time entity recognition;
[0061] When a user asks a question to the system, the system starts the temporal entity recognition process and uses the same algorithm as the knowledge base preprocessing or an algorithm optimized specifically for the query to identify the temporal entities in the question.
[0062] S5, user question vector quantization;
[0063] Similar to the knowledge base content processing, the natural language text of the user question is converted into a numerical vector representation. This step ensures that the user question and the knowledge base content are compared in the same vector space.
[0064] S6, vector retrieval, filtering time information;
[0065] Using the similarity search function of the vector database, the most relevant entries in the knowledge base are retrieved based on the vector representation of the user's question. During the retrieval process, the system filters the results based on the time range determined by the time entity in the question, excluding entries with mismatched or irrelevant time.
[0066] S7, combining time decay and similarity score;
[0067] Based on the retrieved results, the system calculates the similarity score of each knowledge base content, designs an improved sorting algorithm, and performs weighted sorting of the results in combination with the time decay factor.
[0068] The time decay factor downweights information that is more distant in time and upweights new information, ensuring that the answers users see are both relevant and up-to-date.
[0069] Among them, the time decay factor is a dynamically adjusted weight coefficient, which adjusts the sorting weight according to the distance between the knowledge base entry and the current query time window. Entries closer to the time window will get higher weights, while entries farther away from the time window will have lower weights.
[0070] The processing steps of the improved sorting algorithm are:
[0071] (1) Determine the time window;
[0072] Determine the time window range related to the query, which is set based on the results of extracting and processing the time information in the question;
[0073] (2) Calculate time decay;
[0074] For each knowledge base entry, calculate the difference between the publishing or updating time and the current query time;
[0075] Apply the time decay function to calculate the time decay factor, which can be expressed as follows using the exponential decay function: weight coefficient = e^(-λ*time difference), where λ is the decay rate and time difference is the difference between the entry time and the query time;
[0076] (3) Adjust the sorting weight;
[0077] Multiply the calculated time decay factor by the initial relevance score of the entry to obtain the adjusted ranking weight;
[0078] The formula is: adjusted weight = initial relevance score * time decay factor;
[0079] (4) Sorting algorithm optimization;
[0080] In the sorting algorithm, the adjusted weight is used as one of the sorting criteria. In this way, the entries in the time window will obtain a higher sorting weight due to the influence of the time decay factor.
[0081] In the sorting algorithm, the adjusted weight is used as one of the sorting criteria. In this way, the entries in the time window will get a higher sorting weight due to the influence of the time decay factor.
[0082] At the same time, ensure that the sorting algorithm comprehensively considers other relevance factors, such as the content matching degree of the entries, user query intent, etc., to maintain the timeliness and accuracy of the sorting results.
[0083] By introducing the time decay factor, the knowledge base ranking optimization module can ensure that the content within the time window is given appropriate priority in the search results, thereby improving the overall search quality and user experience while making the information obtained by users more timely and relevant.
[0084] S8, merge prompt statements;
[0085] Prepare input prompts for LLM, combining the vector representation of the user's question with the most relevant knowledge base content retrieved. The combined prompts clearly reflect the user's needs and relevant background information.
[0086] S9, return the answer;
[0087] Pass the merged prompt statement to LLM, which generates the final answer.
[0088] S10. Answer questions;
[0089] Finally, the answer generated by LLM is presented to the user who asked the question through the user interface, completing the entire question-answering process. In order to improve the user experience, additional information will be provided in the answer, such as the confidence of the answer, relevant reference source links, etc.
[0090] The present invention uses time entity recognition and contextual semantic analysis technology to accurately extract and process time information in the knowledge base content, including but not limited to specific dates, years, time periods and relative time indicators, and saves this time information as key metadata to the knowledge base and combines it with related content.
[0091] When answering a question, we first analyze whether the question contains time information. If so, we determine the time window of the question. Through time entity recognition and contextual semantic analysis technology, we accurately extract and process the time information in the question to limit the retrieval scope, making the search in the knowledge base more targeted.
[0092] An improved sorting algorithm is designed by combining the relevance of the time window and the query. This algorithm not only considers the text similarity between the knowledge base content and the query, but also introduces a time decay factor so that the knowledge base content within the time window obtains a higher sorting weight. Through this method, the system can more accurately match and sort content that is relevant to the query and closer in time, and generate answers based on the retrieved knowledge base, thereby improving the timeliness and accuracy of the answers.
[0093] When building a knowledge base, time elements are added, and time information such as specific dates, years, time periods, and relative time indicators are identified through time entity recognition technology. These time information are accurately extracted and processed through contextual semantic analysis technology and saved in the knowledge base as key metadata.
[0094] First, the technology performs contextual analysis on the identified time entity to determine the exact meaning of the time entity by understanding the words, phrases, and sentence structures surrounding the entity. For example, in the sentence "We achieved performance growth in the first quarter of 2023", contextual semantic analysis can identify that "first quarter" refers to the first three-month period of 2023.
[0095] Secondly, contextual semantic analysis technology considers the relationship between time entities, such as sequence, duration, etc. When processing complex time descriptions, such as "from the end of last year to the beginning of this year", the technology can correctly parse the start and end points of the time and convert it into a specific time interval.
[0096] Next, the technology normalizes the time information and converts various forms of time expressions into a standard format to facilitate the consistency and retrieval efficiency of the knowledge base. For example, "next Wednesday" is converted to the specific date "October 25, 2023".
[0097] Finally, through these precise extractions and processing, time information is integrated and saved into the knowledge base as key metadata. Such processing not only ensures the accuracy and completeness of time information in the knowledge base, but also provides efficient support for subsequent time-sensitive queries, allowing users to quickly retrieve relevant business knowledge based on the time dimension.
[0098] By analyzing the time information in the question, determining the time window of the question, and using time entity recognition and contextual semantic analysis technology, the time information in the question is accurately extracted and processed to limit the retrieval scope, making the search more targeted and accurate.
[0099] First, use temporal entity recognition to scan the question text and identify all possible time-related words, including specific dates, time points, time periods, seasons, holidays, and relative time expressions.
[0100] Secondly, identify and resolve the relationships between time entities, such as sequence, overlap, duration, etc. When dealing with descriptions such as "from the start to the end of an activity", it is possible to accurately define the start and end points of time.
[0101] Next, the identified time information is converted into a unified time format for subsequent processing and retrieval. For example, "next Monday" is converted into a specific date "September 16, 2024" or next week is identified as "September 16, 2024 - September 22, 2024".
[0102] Finally, based on the above analysis results, determine the time window of the problem, that is, the specific time range in which the problem occurred. This step helps narrow the search scope, improve the pertinence and accuracy of the search, and enable the system to give accurate and timely answers.
[0103] Based on the above method, an intelligent retrieval and question answering device in this embodiment includes: at least one memory and at least one processor;
[0104] The at least one memory is used to store a machine-readable program;
[0105] The at least one processor is used to call the machine-readable program to execute an intelligent retrieval and question answering method.
[0106] The above-mentioned specific implementations are only specific cases of the present invention. The patent protection scope of the present invention includes but is not limited to the above-mentioned specific implementations. Any technical solutions that conform to the above-mentioned specific implementations of the present invention and any appropriate changes or substitutions made by ordinary technicians in the relevant technical field shall fall within the patent protection scope of the present invention.
[0107] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. An intelligent retrieval and question answering method, characterized in that: Based on time window optimization, there are the following steps: S1, knowledge preprocessing and temporal entity recognition; S2, text vector quantization; S3, vector storage, retaining time information; S4, raises questions, time entity recognition; S5, user question vector quantization; S6, vector retrieval, filtering time information; S7, combining time decay and similarity score; S8, merge prompt statements; S9, return the answer; S10. Answer the questions.
2. The intelligent retrieval and question answering method according to claim 1, characterized in that: In step S1, the customer business knowledge base is comprehensively preprocessed, and then all time entities in the knowledge base are identified and annotated using time entity technology, wherein the time entities include specific dates, years, time periods, and relative time indicators.
3. The intelligent retrieval and question answering method according to claim 2, characterized in that: In step S2, the preprocessed text data is converted into a numerical vector representation through word embedding technology, and the vector captures the semantic information of the text, so that the text data can be effectively processed under the framework of the large language model; In step S3, the generated text vector and its associated time information are stored together in a vector database, and when storing, each vector has corresponding timestamp information.
4. The intelligent retrieval and question answering method according to claim 3, characterized in that: In step S4, when the user asks a question to the system, the system starts the temporal entity recognition process and uses the same algorithm as the knowledge base preprocessing to identify the temporal entity in the question; In step S5, the natural language text of the user's question is converted into a numerical vector representation so that the user's question and the knowledge base content can be compared in the same vector space.
5. The intelligent retrieval and question answering method according to claim 3, characterized in that: In step S6, the similarity search function of the vector database is used to retrieve the most relevant entries in the knowledge base based on the vector representation of the user's question. During the retrieval process, the system will filter the results according to the time range determined by the time entity in the question to exclude entries with mismatched or irrelevant time. In step S7, based on the retrieved results, the similarity score of each knowledge base content is calculated, an improved sorting algorithm is designed, and the results are weighted and sorted in combination with the time decay factor. The time decay factor will reduce the weight of information with a longer time distance and increase the weight of new information.
6. The intelligent retrieval and question answering method according to claim 5, characterized in that: The time decay factor is a dynamically adjusted weight coefficient that adjusts the sorting weight according to the distance between the knowledge base entry and the current query time window. Entries closer to the time window will receive a higher weight, while entries farther from the time window will have a lower weight.
7. The intelligent retrieval and question answering method according to claim 6, characterized in that: The improved sorting algorithm processing steps are: (1) Determine the time window; Determine the time window range related to the query, which is set based on the results of extracting and processing the time information in the question; (2) Calculate time decay; For each knowledge base entry, calculate the difference between the publishing or updating time and the current query time; Apply the time decay function to calculate the time decay factor, which can be expressed as follows using the exponential decay function: weight coefficient = e^(-λ*time difference), where λ is the decay rate and time difference is the difference between the entry time and the query time; (3) Adjust the sorting weight; Multiply the calculated time decay factor by the initial relevance score of the entry to obtain the adjusted ranking weight; The formula is: adjusted weight = initial relevance score * time decay factor; (4) Sorting algorithm optimization; In the sorting algorithm, the adjusted weight is used as one of the sorting criteria. In this way, the entries in the time window will obtain a higher sorting weight due to the influence of the time decay factor.
8. The intelligent retrieval and question answering method according to claim 7, characterized in that: In step S8, an input prompt statement is prepared for use by LLM, combining the vector representation of the user's question with the most relevant knowledge base content retrieved. The combined prompt statement will reflect the user's needs and relevant background information.
9. The intelligent retrieval and question answering method according to claim 8, characterized in that: In step S9, the merged prompt statement is passed to LLM, and LLM generates the final answer; In step S10, finally, the answer generated by the LLM is presented to the user who asked the question through the user interface, completing the entire question-answering process.
10. An intelligent search and question answering device, characterized in that: include: at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is configured to call the machine-readable program to execute the method according to any one of claims 1 to 9.
Citation Information
Cited By
Intelligent agent dialogue generation method and storage medium
CN120448511A
Intelligent assurance knowledge question and answer method and system based on LLM and RAG technologies
CN120744072A
Question information data storage method for webpage questions and answers
CN121117164A
Time dimension semantic retrieval method based on large model
CN121301383A
Method for enabling large model to quickly and accurately answer related time questions
CN121765043A