A Smart Knowledge Retrieval Method Based on the RAG Framework

By analyzing users' level of expertise and historical behavior data, the intelligent knowledge retrieval method based on the RAG framework generates professional or easy-to-understand answers, solving the problem of mismatch between professional expertise and existing technologies, and improving the relevance of search results and user experience.

CN120929489BActive Publication Date: 2026-01-06BEIJING SIHAI TONGDA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510810416.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-17
Publication Date
2026-01-06
Estimated Expiration
2045-06-17

AI Technical Summary

Technical Problem

Existing intelligent knowledge retrieval methods based on the RAG framework cannot determine user needs based on their level of expertise, resulting in inappropriate answers being output when the level of expertise is mismatched, thus affecting the user experience.

Method used

By analyzing users' historical behavioral data and input question text, the system determines the user's level of expertise. Using techniques such as cosine similarity and keyword extraction, it generates professional or easy-to-understand answers, which are then searched in professional and general databases.

Benefits of technology

It improves the relevance and accuracy of search results, meets the personalized needs of different users, enhances user experience and satisfaction, and is applicable to knowledge retrieval in multiple fields.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120929489B_ABST
    Figure CN120929489B_ABST
Patent Text Reader

Abstract

This invention relates to the field of data retrieval and analysis technology, and discloses an intelligent knowledge retrieval method based on the RAG framework. The method includes: acquiring the user-input question text; determining the professionalism and specificity of the question; assessing the user's level of expertise in the field to which the searched question belongs; and, based on the user and the question, searching in different databases and generating answers with different directions. This intelligent knowledge retrieval method based on the RAG framework avoids providing highly professional answers to users with low expertise levels, making them difficult to understand, and also avoids providing unprofessional answers to users with high expertise levels, rendering the searched data unusable. This approach is more user-friendly and improves the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data retrieval and analysis technology, specifically to an intelligent knowledge retrieval method based on the RAG framework. Background Technology

[0002] Traditional knowledge retrieval methods often face problems such as insufficient retrieval accuracy and lack of answer context when dealing with complex problems and massive knowledge bases. Intelligent knowledge retrieval methods based on the Retrieval-Augmented Generation (RAG) framework are an effective knowledge retrieval technology. It can significantly improve the accuracy, completeness and interpretability of answers. It combines the advantages of retrieval and generation modules. By retrieving relevant information from the knowledge base and using it as context input into the generation model, it generates more accurate and complete answers, effectively improving the quality of knowledge retrieval and user experience.

[0003] Existing intelligent knowledge retrieval methods based on the RAG framework cannot determine a user's level of expertise in the corresponding field based on the user's input question text, nor can they determine the user's question requirements based on the user's level of expertise. They also cannot generate two independent databases, nor can they search different databases based on the user's level of expertise and generate answers that are easy for the user to understand and use. This can easily lead to situations where the user is not highly knowledgeable but receives highly knowledgeable answers that are difficult for the user to understand, or the user is highly knowledgeable but receives unknowable answers that make the search results unusable. Therefore, their practicality has certain limitations. Summary of the Invention

[0004] This invention provides an intelligent knowledge retrieval method based on the RAG framework, which can facilitate the solution of the problems mentioned in the background art.

[0005] This invention provides the following technical solution: an intelligent knowledge retrieval method based on the RAG framework, comprising:

[0006] Obtain user's historical behavior data H: H = {H search H browse H collect H feedback};

[0007] Among them, H search For users' search history, H browse H is a history of the content a user browses. collect H is the content that users save. feedback For user feedback on previous search results;

[0008] Calculate the percentage of user-generated content within a specific domain: Among them, C area C represents the number of times a user engages in activities within their professional field. total Total number of user actions;

[0009] Calculate the user's content depth metric: Among them, D major D represents the number of times users browse and save professional, in-depth content. total Total number of views and favorites by users;

[0010] Calculate the user's professional platform activity: Among them, A platform_pro A represents the number of times a user is active on a professional platform. platform_total Total number of user activities across all platforms;

[0011] Calculate the user's professional identity score S identity :S identity =w1·P area +w2·D content +w3·A platform ;

[0012] Where w1, w2, and w3 are the weights of each indicator, and the sum of the weights is 1.

[0013] Define an identity verification function to determine whether a user is a professional: Where, τ identity The threshold for identity verification;

[0014] If U major =1, then the user is determined to be a professional;

[0015] If U major =0, then the user is determined not to be a professional.

[0016] As an optional solution to the intelligent knowledge retrieval method based on the RAG framework described in this invention, the following is included: determining the user's expertise, including determining whether the user's question is professional, specifically:

[0017] Obtain the text content searched by the user, denoted as Q;

[0018] Build a keyword library containing high-frequency professional terms from multiple professional fields:

[0019] Among them, v mat Indicates a professional field;

[0020] Set up an extraction function to extract keywords from the text content searched by the user, forming a keyword set: K = Filter_K(Remove_S(S_A(Q'))); K = {k1, k2, ..., km}; where Q' represents the preprocessed user search text, S_A(·) represents the initial word segmentation result list W obtained by segmenting Q', Remove_S(·) represents the candidate keyword list W' obtained by removing stop words from W, and Filter_K(·) represents the keyword set K filtered from W';

[0021] Convert the keyword set K into vector form: k = [k1, k2, ..., k m ];

[0022] V professional domain keyword database major Convert to vector form: v major =[v ma1 v ma2 ,....,v mam ];

[0023] The matching degree is calculated using the cosine similarity formula:

[0024] Set a threshold τ for professional questions major ;

[0025] The question of determining whether the text content searched by a user is highly specialized:

[0026] If S P_Q =1, then the text content searched by the user is determined to be a highly technical question;

[0027] If S P_Q =0, then the text content searched by the user is determined to be not a highly technical question.

[0028] As an optional solution to the intelligent knowledge retrieval method based on the RAG framework described in this invention, determining the user's expertise further includes determining whether the user's question is specific, specifically:

[0029] Get the text content Q that the user searched for;

[0030] Obtain the dependency parsing results of text content Q: Among them, w i The word rel in the question i The word w i Dependency relationship;

[0031] Obtain the semantic role annotation results for text content Q: Among them, role j w represents a semantic role j Indicate the corresponding words;

[0032] Based on the results of dependency parsing and semantic role labeling, key information is extracted: Sub={w j |(role j =subject)∧(w j ∈S)};Pred={w j |(role j =predicate)∧(w j ∈S)};Obj={w j |(role j =object)∧(w j ∈S)};Tim={w j |(role j =time)∧(w j ∈S)};Pla={w j |role j =place^(w j ∈S)};Mod={w j |(role j =attribution)^(w j ∈S)};where Sub represents subject information, subject is the subject, Pred represents predicate information, predicate is the predicate, Obj represents object information, object is the object, Tim represents time information, time is the time, Pla represents location information, place is the location, Mod represents other modifying information, and attribute is the modifying relationship;

[0033] Define a specificity rule function f specificity (Q), determine whether the problem meets the specificity rule conditions: f specificity (Q)={f entity (Q), f operate (Q), f t_a_p (Q), f condition (Q)};

[0034] Specific rule function f specificity In (Q), f entity (Q) represents a specific entity name, specifically:

[0035] Where E_N is the entity name;

[0036] Specific rule function f specificity In (Q), f operate (Q) indicates a specific operation or query requirement, specifically: Where S_O represents the specific operation and Q_R represents the query requirement;

[0037] Specific rule function f specificity In (Q), f t_a_p (Q) indicates a specific time or location restriction, specifically: Where C_T represents time and C_L represents location;

[0038] Specific rule function f specificity In (Q), f condition (Q) indicates a clear condition description, specifically:

[0039] Where C_D represents the condition description;

[0040] Calculate the specificity score: S specificity =f entity (Q)+f operate (Q)+f t_a_p (Q)+f condition (Q);

[0041] Set a specificity judgment function to determine whether the text content Q searched by the user is specific:

[0042] Where, τ specificity For specificity threshold;

[0043] If S S_Q =1, then the text content Q searched by the user is determined to be specific;

[0044] If S S_Q If the value is 0, then the text content Q searched by the user is determined to be not specific.

[0045] As an optional solution to the intelligent knowledge retrieval method based on the RAG framework described in this invention, wherein: if S P_Q =1 and S S_Q If the value is 0, then an answer will be generated based on the user's level of expertise, including generating professional answers through precise searches. Specifically, this involves obtaining the result of the identity determination function.

[0046] If the user is a professional, then all of the user's behavior records in the system are collected and denoted as set H. pro ; Perform word segmentation on the user's historical data text to obtain word frequency vectors.

[0047]

[0048] Where H' represents the preprocessed user history data text, S_A(·) represents the initial word segmentation result list W obtained by segmenting Q', Remove_S(·) represents the candidate keyword list W' obtained by removing stop words from W, SS represents the stop word list, and Word_Frequency(·) is the function for calculating word frequency;

[0049] Calculate the TF-IDF weight of each word to form a keyword weight vector:

[0050] Select the n words with the highest weights as the set of keywords for user historical data:

[0051]

[0052] Topic modeling is performed on historical user data to obtain topic distribution vectors:

[0053] in, This indicates the user's level of interest in the j-th topic;

[0054] Construct a requirement feature library, and assign each requirement type d to a feature vector v. d express;

[0055] Calculate the similarity between the user topic distribution and the feature vectors of each demand, and find the index of the most similar demand type:

[0056] Based on the user's matched demand type d match and keyword set Generate Boolean logic expressions:

[0057] Construct a search query that includes exact phrase matching: Q precise =Construct-Precise(Q Boole );

[0058] Let the set of search results be D. result_pre ={d r1 d r2 , ..., d rp};

[0059] For each document d ri Calculate its relevance score to user needs:

[0060]

[0061] Where α and β are weighting coefficients, and Content-Similarity is the measure of document d. riContent and user history data keyword set Metadata-Score is a function that measures the similarity between documents. ri A function of the overall quality of metadata;

[0062] Set a descending order function to sort the search results in descending order of relevance score, resulting in the sorted result set: D sort_pre =Sort(D result_pre S relate (d ri ));

[0063] From the sorted search results D sort_pre Extract the set of content fragments from the first t documents: F = {f1, f2, ..., ft} t};

[0064] Organize the fragment set F according to logical coherence to generate professional answer text:

[0065] A pro_pre =Generate-Answer(F, d) match Generate-Answer is a function that integrates retrieved content fragments into a coherent and complete answer.

[0066] As an optional solution to the intelligent knowledge retrieval method based on the RAG framework described in this invention, wherein: if S P_Q =1 and S S_Q =0, then the answer is generated according to the user's level of expertise, and also includes general answer generation through a general search, specifically: obtaining the result of the identity determination function;

[0067] If the user is not a professional, obtain the text content Q that the user searched for;

[0068] The user-input question Q is segmented into words to obtain an initial segmentation result list W: W = S_A(Q); where S_A(·) represents the initial segmentation result list W obtained by segmenting Q into words;

[0069] Remove stop words from the initial word segmentation result list W: W' = Remove_S(W);

[0070] Where Remove_S(·) represents the candidate keyword list W' obtained after removing stop words from W;

[0071] Set up a keyword extraction algorithm to extract a keyword set K. original :K original=Filter_Keyword(W');Filter_Keyword(W')=TF-IDF(t,d);

[0072] TF-IDF(t, d) = TF(t, d) × IDF(t); where W' is the preprocessed word segmentation result, t represents the keyword in the keyword list W', and d represents the document;

[0073] Retrieve the predefined set of common requirement keywords from a general retrieval system: T demand ={t d1 , t d2 , ..., t dn};

[0074] Calculate each keyword t di With keyword set K original Semantic similarity:

[0075]

[0076] Based on the calculated semantic similarity, keywords that meet the requirements are selected as the guiding option set O: O = {t} di ∈T demand |Similarity(t di K original )≥τ guide}; where τ guide The similarity threshold;

[0077] Each element in the set of guided options O is presented to the user in an interactive dialogue format;

[0078] Record user choices and feedback information: Among them, o i This indicates the user's selected guidance options;

[0079] Extracting database D from the general retrieval system general ;

[0080] Define a requirement classification model based on the user's choice of guidance options F user Combining the original question keyword K original Perform preliminary requirement classification to generate preliminary requirement classification results:

[0081] C preliminary =M classify (K original F user );

[0082] Set up a requirement refinement dimension library, and obtain the available set of refinement dimensions from the requirement refinement dimension library based on the preliminary requirement classification results: VDimension ={vd1, vd2, ..., vd m};

[0083] For each refined dimension vd i ∈V Dimension Generate the corresponding set of detailed options:

[0084] O i ={o i1 o i2 , ..., o im};

[0085] The detailed dimensions and options are presented to the user in an interactive dialogue format, and the user's choices are recorded again to generate the user's detailed selection: F refine ={(vd i o ij )|User'sChoice(o ij →vd i};

[0086] Among them, User's Choice (o ij →vd i This indicates that the user selected option o. ij Corresponding to dimension vd i ;

[0087] Based on the preliminary needs classification results C preliminary And user-refined selection F refine Generate a general requirement description: D approximately =C preliminary +Refine_conditions(F refine ); where "+" indicates that more detailed conditions are added to the initial requirement category to form a more specific requirement description;

[0088] Define a thesaurus: Syn = {syn1, syn2, ..., syn...} m};

[0089] Set up a semantic association lexicon: Rel = {rel1, rel2, ..., rel...} p};

[0090] Based on general requirements D approximately And the original question keyword K original By combining the thesaurus and semantic association thesaurus in the general retrieval system, keywords are expanded to generate an expanded keyword set K. extend :

[0091]

[0092] Where, τ extend To expand the semantic relevance threshold of keywords;

[0093] Combine the expanded keywords into a Boolean logic search expression to form the search query statement Q. search :

[0094] Q search =(k1 ORk2 OR...ORk) r AND(o i1 ORo i2 OR...ORo is );

[0095] Where, k r To expand keywords, o is To guide the selection of related words;

[0096] In the general retrieval system database D general Execute search query Q search Obtain a collection of documents D that are relevant to the general requirements. result_doc ;

[0097] Calculate each document d∈D result_doc The overall ranking score of the results:

[0098] S sort (d)=α·S correlation (d)+β·S Timeliness (d)+γ·S reliability (d); where α, β, and γ are weighting coefficients, representing the importance of relevance, timeliness, and credibility in the ranking, respectively, and α+β+γ=1;

[0099] Press S on the document collection sort (d) Sort in descending order to obtain the sorted result set D. sort_doc ;

[0100] For the sorted document collection D sort_doc Each document in the dataset is processed to extract paragraphs or sentences highly relevant to the keyword set K, generating a content fragment set S. general :S general ={s|s∈D sort_doc S general (s)≥τ general}; where τ general For the threshold of the popularization index, S general (s) is an indicator of sentence accessibility, and the specific formula is: Among them, L s C represents the sentence length. s L represents the number of complex words in a sentence.avg and C avg These represent the average sentence length and average number of complex words in a corpus of easily understood language, respectively. L σ C Standard deviation;

[0101] The extracted content fragment set S general The answer A is generated by integrating the information according to logical coherence. general A general =CO_TE(S general ).

[0102] The present invention has the following beneficial effects:

[0103] 1. This intelligent knowledge retrieval method based on the RAG framework assesses the user's expertise by analyzing the specificity and level of expertise of the user's input question, as well as the professional nature of the user's browsing history. It determines whether the user requires a professional and accurate answer and searches different databases accordingly. This avoids providing highly professional answers when the user's expertise is low, making the answer difficult for the user to understand, and conversely, avoids providing unprofessional answers when the user's expertise is high, rendering the search results unusable. This user-friendly approach enhances the user experience and allows for precise searching based on the professionalism and specificity of the user's question, improving the relevance and accuracy of the search results.

[0104] 2. This intelligent knowledge retrieval method based on the RAG framework generates either highly professional or easily understandable answers according to the user's expertise. When the user's expertise is high, the method searches the professional database based on the user's question and generates a professional and accurate answer. When the user's expertise is low, the method guides and analyzes the user's needs in a general database before searching and generating an easily understandable answer. This avoids providing highly professional answers that are difficult for users to understand when their expertise is low, and also avoids providing unprofessional answers that render the search results unusable when the user's expertise is high. This approach is more user-friendly and improves the user experience. It generates highly professional or easily understandable answers tailored to different user needs and backgrounds, meeting personalized user requirements. By guiding users to clarify their needs, it helps them better obtain the information they require, improving user satisfaction. It is applicable to knowledge retrieval in various fields, providing higher-quality services to users in different areas.

[0105] 3. This intelligent knowledge retrieval method based on the RAG framework divides the database into a highly specialized database and a less specialized general database. The two databases have different data sources: the specialized database uses data from authoritative websites, ensuring its data is recent and accurate, while the general database uses data from ordinary websites, making its data easier to understand. This difference in level of expertise avoids providing users with highly specialized answers when their knowledge is limited, preventing them from being confused, and also avoids providing highly specialized answers when their knowledge is limited, making the search results unusable. This approach is more user-friendly, improves the user experience, and allows for timely collection of user feedback to update the database, ensuring the timeliness and accuracy of the database content and improving system performance and retrieval quality. Attached Figure Description

[0106] Figure 1 This is a flowchart of the intelligent knowledge retrieval method based on the RAG framework of this invention. Detailed Implementation

[0107] Example 1: An intelligent knowledge retrieval method based on the RAG framework, see [link / reference]. Figure 1 ,include:

[0108] Obtain user's historical behavior data H: H = {H search H browse H collect H feedback};

[0109] Among them, H search For users' search history, including search keywords, search frequency, search time, etc., H browse H provides a history of the user's browsing content, including viewed documents, page dwell time, browsing paths, etc. collect The content saved by users, including saved documents, the time of saving, etc., H feedback For user feedback on previous search results, including satisfaction ratings, error correction information, etc.;

[0110] Calculate the percentage of user-generated content within a specific domain: Among them, C area C represents the number of times a user engages in activities within their professional field. total The total number of user actions is the total number of user actions within a specific professional field, which includes the number of searches, browsing, and bookmarks within that field.

[0111] Calculate the user's content depth metric: Among them, D major D represents the number of times users browse and save professional, in-depth content. totalThis refers to the total number of times a user browses and saves content. The number of times a user browses and saves content of professional depth refers to the depth of content in the user's professional field, such as the number of times they browse academic papers and professional reports.

[0112] Calculate the user's professional platform activity: Among them, A platform_pro A represents the number of times a user is active on a professional platform. platform_total The total number of times a user is active across all platforms. The number of times a user is active on professional platforms refers to the user's activity level on professional platforms, such as professional forums and academic websites, including the number of posts and replies.

[0113] Calculate the user's professional identity score S identity :S identity =w1·P area +w2·D content +w3·A platform ;

[0114] Where w1, w2, and w3 are the weights of each indicator, and the sum of the weights is 1. The weights can be adjusted according to the actual application scenario and the importance of the data, for example, by training a machine learning model to determine the optimal weights.

[0115] Define an identity verification function to determine whether a user is a professional: Where, τ identity An identity verification threshold, such as 0.6, is used to determine whether a user is a professional in a certain industry.

[0116] If U major =1, then the user is determined to be a professional;

[0117] If U major =0, then the user is determined not to be a professional.

[0118] This embodiment also provides that, if S P_Q =1 and S S_Q If the value is 1, then the answer set is generated, specifically by obtaining the keyword set K;

[0119] Obtain the database; extract a set of extended keywords semantically similar to the keywords from the database, and extract them using word vector models such as Word2Vec: K extend ={K extend1 K extend2 , ..., K extendn};

[0120] Combine the keyword set K and the expanded keyword set into a query vector: V query =K∪K extend ;

[0121] Extracting database D from a professional retrieval system professional ; Calculate the query vector V query With each document d professional Correlation:

[0122] The documents are sorted based on relevance, and the top N most relevant professional documents are obtained to form a professional document set: D result_pro ={d professional ∈D professional |S relate (V query d professional )≥τ rel_pro};D result_pro ={d professional1 d professional2 , ..., d professionalN}; where τ rel_pro The relevance threshold for professional documents is used to first extract a subset of documents that are closest to the question, and then extract N professional documents that are most relevant to the query from these documents to form a set of professional documents.

[0123] Extracting database D from the general retrieval system general ; Calculate the query vector V query With each document d general Correlation:

[0124] The documents are sorted based on relevance, and the top M most relevant general documents are obtained to form a general document set: D result_gen ={d general ∈D general |S relate (V query d general )≥τ rel_gen};

[0125] D result_gen ={d general1 d general2 , ..., d generalM}; where τ rel_gen The relevance threshold for general documents is used to first extract a subset of documents that are closest to the question, and then extract N general documents that are most relevant to the query from these documents to form a general document set.

[0126] Integrated to generate a professional answer: A professional =Integration professional (D result_pro , K);

[0127] Integrated to generate a simple answer: Ageneral =Integration general (D result_gen , K);

[0128] Integrate professional and general answers to form an answer set: A = A professional ∪A general Output the answer set to the user;

[0129] The specific steps for integrating and generating professional answers are as follows:

[0130] For each professional document d professional Calculate the relevance of paragraphs or sentences: Where, p i To represent a paragraph or sentence in a document, TF-IDF(k, p) i This indicates that keyword k is in paragraph p. i TF-IDF values ​​in the text; filtering relevant paragraphs or sentence sets: P relate ={p i ∈d professional |S paragraph (p i )≥τ paragraph}; where τ paragraph A relevance threshold is set for paragraphs, used to filter out paragraphs or sentences with relevance higher than this threshold; an integrated logical structure is defined, for example, l1 represents the concept definition, l2 represents the working principle, etc.: L = {l1, l2, ..., l...} m Set a sorting function for set P. relate Sort the paragraphs or sentences in the text to obtain the sorted set P. relate :P sort =SORT(P relate According to the sorted set P), L); sort Generate professional answer A professional A professional =CO_TE(P sort ,L); where CO_TE represents a function that uses natural language generation technology to integrate paragraphs or sentences into a coherent answer;

[0131] The specific steps for integrating and generating a simplified answer are as follows:

[0132] For the general document set D result_gen Each document d in general Calculate the comprehensibility index S for each sentence. transparency (s i ): Among them, s i L represents a sentence in a document. iFor sentences measured by the number of words s i The length of L avg σ is the average sentence length in a general document corpus. L C represents the standard deviation of sentence length, used to control for the impact of sentence length on comprehensibility. i For sentence s i The number of complex words or technical terms contained, C avg σ represents the average number of complex words contained in sentences within a general document corpus. C The standard deviation of the number of complex words is used to control the impact of complex words on comprehensibility. This formula introduces a logistic function to comprehensively consider factors such as sentence length, word complexity, and the presence of technical terms. A higher comprehensibility index is achieved when sentence length is close to average and the number of complex words is low, and vice versa. Comprehensible content fragments are selected to form a set: S. transparency ={s i ∈d general |S transparency (s i )≥τ transparency};S transparency ={s transparency1 s transparency2 , ..., s transparencyn}; where τ transparency This is a comprehensibility threshold used to filter sentences with a comprehensibility index higher than this threshold; sentences containing keywords from keyword set K are extracted to ensure the content is relevant to the user's query. Based on the semantic type of the user query and the characteristics of general document content, determine the logical order of easily understandable answers. For example, for frequently asked questions, a logical order of "problem background - simple explanation - practical examples - operational suggestions" can be used; for concept explanation queries, a logical order of "common definition - analogies in life - explanation of importance" can be used. Based on the determined logical order, the set S... relate_tr The sentences in the answer are sorted to ensure logical coherence; the sentences that best match the logical order are selected and denoted as the sorted set S. sort_tr The cosine similarity of sentence embedding vectors is used to calculate the similarity between sentences and the topic vectors of each part of the logical sequence, in order to assist in the sorting and filtering process. Among them, s i For sentence s i The embedding vector, l j The embedding vector is the topic of the j-th part in a logically ordered manner; sentences are sorted according to similarity, and the top few sentences with the highest similarity in each part are selected as candidates; using natural language generation technology, the selected sentences are combined into a coherent, complete, and easy-to-understand answer A. general Ageneral =CO_TE(S sort_tr CO_TE represents a function that uses a language model to integrate sentences into a clear and understandable answer.

[0133] This embodiment also provides that, if S P_Q =1 and S S_Q If the value is 0, then an answer will be generated based on the user's level of expertise, including generating professional answers through precise searches. Specifically, this involves obtaining the result of the identity determination function.

[0134] If the user is a professional, then all user behavior records in the system will be collected, including search keywords, browsing content, saving documents, participating in professional discussions, etc., and denoted as set H. pro ;

[0135] The user's historical data text is segmented to obtain word frequency vectors.

[0136] Where H' represents the preprocessed user history data text, S_A(·) represents the initial word segmentation result list W obtained by segmenting Q', Remove_S(·) represents the candidate keyword list W' obtained by removing stop words from W, SS represents the stop word list, which contains common function words, auxiliary words, prepositions and other words that are not very meaningful for retrieval, Word_Frequency(·) is the function for calculating word frequency; the TF-IDF weight of each word is calculated to form a keyword weight vector: Select the n words with the highest weights as the set of keywords for user historical data:

[0137] Topic modeling is performed on historical user data to obtain topic distribution vectors: in, This indicates the user's level of interest in the j-th topic;

[0138] Construct a requirement feature library, and assign each requirement type d to a feature vector v. d express;

[0139] Calculate the similarity between the user topic distribution and the feature vectors of each demand, and find the index of the most similar demand type:

[0140] Based on the user's matched demand type d match and keyword set Generate Boolean logic expressions, such as Q. Boole =("k1"AND"k2")OR("k3"AND"k4"):

[0141] Construct a retrieval query that includes exact phrase matching, such as Q. precise =Q Boole AND("precise phrase 1" OR "precise phrase 2"): Q precise =Construct-Precise(Q Boole );

[0142] Let the set of search results be D. result_pre ={d r1 d r2 , ..., d rp}; for each document d ri Calculate its relevance score to user needs:

[0143] S relate (d ri )=α·Content-Similarity(d ri K Hpro )+β·metadata-Score(d ri );

[0144] Where α and β are weighting coefficients, and Content-Similarity is the measure of document d. ri Content and user history data keyword set K Hpro Metadata-Score is a function that measures the similarity between documents. ri Metadata such as publication date, author, source, etc., is used as a function to assess overall quality.

[0145] Set a descending order function to sort the search results in descending order of relevance score, resulting in the sorted result set: D sort_pre =Sort(D result_pre S relate (d ri From the sorted search results D sort_pre Extract the set of content fragments from the first t documents: F = {f1, f2, ..., ft} t}; where each fragment f j Includes a set of keywords in the document The most relevant paragraphs; organize the set of fragments F according to logical coherence to generate professional answer text: A pro_pre =Generate-Answer(F, d) match Generate-Answer is a function that integrates retrieved content fragments into a coherent and complete answer.

[0146] This embodiment also provides that, if S P_Q =1 and SS_Q =0, then the answer is generated according to the user's level of expertise, and also includes general answer generation through a general search, specifically: obtaining the result of the identity determination function;

[0147] If the user is not a professional, obtain the text content Q that the user searched for;

[0148] The user-input question Q is segmented into words to obtain an initial segmentation result list W: W = S_A(Q);

[0149] Wherein, S_A(·) represents the initial word segmentation result list W obtained by performing word segmentation on Q;

[0150] Remove stop words from the initial word segmentation result list W: W' = Remove_S(W);

[0151] Where Remove_S(·) represents the candidate keyword list W' obtained after removing stop words from W;

[0152] Set up a keyword extraction algorithm to extract a keyword set K. original :

[0153] K original =Filter_Keyword(W');Filter_Keyword(W')=TF-IDF(t,d);

[0154] TF-IDF(t, d) = TF(t, d) × IDF(t); where W' is the preprocessed word segmentation result, t represents the keywords in the keyword list W', and d represents the document. The keyword extraction algorithm is based on the TF-IDF keyword extraction formula, selecting the top n words with the highest weights as the keyword set K. original ;

[0155] Retrieve the predefined set of common requirement keywords from a general retrieval system: T demand ={t d1 , t d2 , ..., t dn};

[0156] Calculate each keyword t di With keyword set K original The semantic similarity is calculated using word vector models such as Word2Vec, taking the maximum or average value as the similarity between the topic word and the user's question.

[0157] Based on the calculated semantic similarity, those that meet the requirements, i.e., have a similarity greater than or equal to the threshold τ, are selected. guide The guiding keywords, as the guiding option set O: O = {t} di ∈Tdemand |Similarity(t di K original )≥τ guide}; where τ guide This is a similarity threshold used to filter out keywords that meet the requirements.

[0158] Each element in the set of guided options O is presented to the user in an interactive dialogue format, which can be displayed in the form of lists, buttons, etc., to facilitate user selection.

[0159] Record user choices and feedback information: Among them, o i This indicates the user's selected guidance options;

[0160] Extracting database D from the general retrieval system general ;

[0161] Define a requirement classification model based on the user's choice of guidance options F user Combining the original question keyword K original Perform preliminary requirement classification to generate preliminary requirement classification results:

[0162] C preliminary =M classify (K original F user );

[0163] Set up a requirement refinement dimension library, and obtain the available set of refinement dimensions from the requirement refinement dimension library based on the preliminary requirement classification results: V Dimension ={vd1, vd2, ..., vd m};

[0164] For each refined dimension vd i ∈V Dimension This generates a corresponding set of refined options. For example, for the dimension "fitness goals", the option set O 目标 = {Muscle gain, fat loss, improved physical fitness}: O i ={o i1 o i2 , ..., o im};

[0165] The detailed dimensions and options are presented to the user in an interactive dialogue format, and the user's choices are recorded again to generate the user's detailed selection: F refine ={(vd i o ij )|User'sChoice(o ij →vd i}; where User'sChoice(oij →vd i This indicates that the user selected option o. ij Corresponding to dimension vd i ;

[0166] Based on the preliminary needs classification results C preliminary And user-refined selection F refine Generate a general requirement description: D approximately =C preliminary +Refine_conditions(F refine ); where "+" indicates that more detailed conditions are added to the initial requirement classification to form a more specific requirement description. For example, the initial requirement classification result C preliminary For the "Fitness Plan Development" section, the user selected "Muscle Building" and "Beginner" in the detailed options, which roughly indicates the user's needs (D). approximately It can be described as a "muscle-building fitness program designed for beginners";

[0167] Define a thesaurus: Syn = {syn1, syn2, ..., syn...} m};

[0168] Set up a semantic association lexicon: Rel = {rel1, rel2, ..., rel...} p};

[0169] Based on general requirements D approximately And the original question keyword K original By combining the thesaurus and semantic association thesaurus in the general retrieval system, keywords are expanded to generate an expanded keyword set K. extend :

[0170]

[0171] Where, τ extend To expand the semantic relevance threshold of keywords, such as 0.6, to determine semantically relevant keywords;

[0172] Combine the expanded keywords into a Boolean logic search expression to form a search query statement Q that includes the original keywords, expanded keywords, and related terms of the guiding options. search :

[0173] Q search =(k1 ORk2 OR...ORk) r AND(o i1 ORo i2 OR...ORo is );

[0174] Where, k rTo expand keywords, o is To guide the selection of related words;

[0175] In the general retrieval system database D general Execute search query Q search Obtain a collection of documents D that are relevant to the general requirements. result_doc ;

[0176] Calculate each document d∈D result_doc The overall ranking score of the results: S sort (d)=α·S correlation (d)+β·S Timeliness (d)+γ·S reliability (d); where α, β, and γ are weighting coefficients, representing the importance of relevance, timeliness, and credibility in the ranking, respectively, and α + β + γ = 1, S correlation (d) represents the relevance between the document and the user's question, expressed as S. correlation (d)=α d ·TF-IDF(d,Q)+(1-α) d Semantic similarity (d, Q), in the formula, α d S is a weight parameter between 0 and 1, used to balance the contributions of TF-IDF and semantic similarity. TF-IDF measures the importance of keywords in a document, while semantic similarity is obtained by calculating the cosine similarity between the word vectors of the document and the query. Timeliness (d) represents the timeliness of the document, expressed as S. Timeliness (d)=β d Freshness (d) + (1 - β) d Content time relevance (d), where "freshness" is defined as a function of the difference between the document's publication date and the current date, such as an exponential decay function. "Content time relevance" is determined by examining the degree of match between the time information mentioned in the document and the user's query time requirements. reliability (d) represents the document's credibility, calculated using the formula S. reliability (d)=γ d • Authority (d) + δ d • Number of citations (d) + (1 - γ) d -δ d Data consistency (d), in the formula, γ d and δ d These are weighted parameters. "Authority" is measured by giving the publisher a reputation score, "citation count" is the number of times the document has been cited, and "data consistency" is evaluated by comparing data with other highly credible documents.

[0177] Press S on the document collection sort(d) Sort in descending order to obtain the sorted result set D. sort_doc ;

[0178] For the sorted document collection D sort_doc Each document in the dataset is processed to extract paragraphs or sentences highly relevant to the keyword set K. This is done by filtering based on criteria such as sentence length and accessibility to ensure the content is concise and easy to understand, generating a content fragment set S. general :

[0179] S general ={s|s∈D sort_doc S general (s)≥τ general}; where τ general The threshold value for accessibility is used to extract paragraphs or sentences that are highly relevant to the keyword set K. general (s) is an indicator of sentence accessibility, and the specific formula is:

[0180] Among them, L s C represents the sentence length. s L represents the number of complex words in a sentence. avg and C avg These represent the average sentence length and average number of complex words in a corpus of easily understood language, respectively. L σ C Standard deviation;

[0181] The extracted content fragment set S general The content is integrated according to logical coherence, using simple and easy-to-understand language, avoiding technical jargon or providing concise explanations of it, and employing text summarization algorithms such as TextRank or Transformer-based summarization models to generate an easily understandable answer A. general Ensure the answer covers the core points of user needs and is easy to understand: A general =CO_TE(S general ); where CO_TE represents the set of content fragments S digested using a text summarization algorithm. general A function that integrates logical coherence into a coherent answer.

[0182] This embodiment also provides that, if S P_Q If the value is 0, a general answer will be generated directly through a search, specifically:

[0183] Get query vector V query Extracting data from the general retrieval system database D general ;

[0184] Calculate query vector V query With each document d general Correlation:

[0185]

[0186] The documents are sorted based on relevance, and the top M most relevant general documents are obtained to form a general document set: D result_gen ={d general ∈D general |S relate (V query d general )≥τ rel_gen};

[0187] D result_gen ={d general1 d general2 , ..., d generalM}; where τ rel_gen The relevance threshold for general documents is used to first extract a subset of documents that are closest to the question, and then extract N general documents that are most relevant to the query from these documents to form a general document set.

[0188] Each document is processed to extract paragraphs or sentences highly relevant to the keyword set K. This is done by filtering based on criteria such as sentence length and accessibility to ensure the content is concise and easy to understand, generating a content fragment set S. general :S general ={s|s∈D result_gen S general (s)≥τ general}; where τ general The threshold value for accessibility is used to extract paragraphs or sentences that are highly relevant to the keyword set K. general (s) is an indicator of sentence accessibility, and the specific formula is:

[0189] Among them, L s C represents the sentence length. s L represents the number of complex words in a sentence. avg and C avg These represent the average sentence length and average number of complex words in a corpus of easily understood language, respectively. L σ C Standard deviation;

[0190] The extracted content fragment set S general The content is integrated according to logical coherence, using simple and easy-to-understand language, avoiding technical jargon or providing concise explanations of it, and employing text summarization algorithms such as TextRank or Transformer-based summarization models to generate an easily understandable answer A. general Ensure the answer covers the core points of user needs and is easy to understand: Ageneral =CO_TE(S general ); where CO_TE represents the set of content fragments S digested using a text summarization algorithm. general A function that integrates logical coherence into a coherent answer.

[0191] The above method assesses the user's expertise based on their input question text. Then, it searches different databases accordingly, generating either a highly specialized or easily understandable answer. Furthermore, the databases are divided into highly specialized (highly specialized) and less specialized (general) databases. These two databases have different data sources and levels of expertise to avoid providing highly specialized answers that are difficult for users to understand, or providing unsuitable answers that render the search results unusable. This approach is more user-friendly and improves the overall user experience.

[0192] Example 2 is an improvement on Example 1. This intelligent knowledge retrieval method based on the RAG framework determines the user's professional competence, including whether the user's question is professional. Specifically, it obtains the text content searched by the user, denoted as Q.

[0193] Build a keyword library containing high-frequency professional terms from multiple professional fields:

[0194] Among them, v mat Indicates a professional field;

[0195] Set up an extraction function to extract keywords from the text content searched by the user, forming a keyword set: K = Filter_K(Remove_S(S_A(Q'))); K = {k1, k2, ..., k m}; where Q' represents the preprocessed user search text, S_A(·) represents the initial word segmentation result list W obtained by segmenting Q', Remove_S(·) represents the candidate keyword list W' obtained by removing stop words from W, and Filter_K(·) represents the keyword set K filtered from W';

[0196] Convert the keyword set K into vector form: k = [k1, k2, ..., k m ];

[0197] V professional domain keyword database major Convert to vector form: v major =[v ma1 v ma2 , ..., v mam];

[0198] The matching degree is calculated using the cosine similarity formula:

[0199] Set a threshold τ for professional questions major This is used to determine whether the question a user is searching for is a highly technical question;

[0200] The question of determining whether the text content searched by a user is highly specialized:

[0201]

[0202] If S P_Q =1, then the text content searched by the user is determined to be a highly technical question;

[0203] If S P_Q =0, then the text content searched by the user is determined to be not a highly technical question.

[0204] This embodiment also provides that, in order to determine the user's expertise, it further includes determining whether the user's question is specific, specifically by obtaining the text content Q that the user is searching for;

[0205] Obtain the dependency parsing results of text content Q: Among them, w i The word rel in the question i The word w i The dependency relations are obtained by performing dependency parsing on the text content Q using natural language processing tools such as SpaCy and StanfordNLP. The dependency relation tree represents the grammatical relations between words, such as subject-verb relations, verb-object relations, and modification relations.

[0206] Obtain the semantic role annotation results for text content Q: Among them, role j Indicates semantic roles, such as subject, predicate, object, etc. j Indicate the corresponding words;

[0207] Based on the results of dependency parsing and semantic role labeling, key information is extracted: Sub={w j |(role j =subject)∧(w j ∈S)};Pred={w j |(role j =predicate)∧(w j ∈S)};Obj={w j |(role j=object)∧(w j ∈S)};Tim={w j |(role j =time)∧(w j ∈S)};Pla={w j |role j =place∧(w j ∈S)};Mod={w j |(role j =attribution)∧(w j ∈S)};where Sub represents subject information, subject is the subject, Pred represents predicate information, predicate is the predicate, Obj represents object information, object is the object, Tim represents time information, time is the time, Pla represents place information, place is the place, Mod represents other modifying information, such as modifiers such as manner, reason, purpose, etc., and attribute is the modifying relationship;

[0208] Define a specificity rule function f specificity (Q) Determine whether the question meets the specificity rule conditions to determine whether the user-input question is specific:

[0209] f specificity (Q)={f entity (Q), f operate (Q), f t_a_p (Q), f condition (Q)};

[0210] Specific rule function f specificity In (Q), f entity (Q) represents a specific entity name, specifically:

[0211] Where E_N is the entity name;

[0212] Specific rule function f specificity In (Q), f operate (Q) indicates a specific operation or query requirement, specifically: Where S_O represents the specific operation and Q_R represents the query requirement;

[0213] Specific rule function f specificity In (Q), f t_a_p (Q) indicates a specific time or location restriction, specifically: Where C_T represents time and C_L represents location;

[0214] Specific rule function f specificityIn (Q), f condition (Q) indicates a clear condition description, specifically:

[0215] Where C_D represents the condition description;

[0216] Calculate the specificity score: S specificity =f entity (Q)+f operate (Q)+f t_a_p (Q)+f condition (Q);

[0217] Set a specificity judgment function to determine whether the text content Q searched by the user is specific:

[0218]

[0219] Where, τ specificity The specificity threshold is used to determine whether the text content Q searched by the user is specific.

[0220] If S S_Q =1, then the text content Q searched by the user is determined to be specific;

[0221] If S S_Q If the value is 0, then the text content Q searched by the user is determined to be not specific.

[0222] This embodiment also provides access to a database, including a professional retrieval system database D. professional Specifically, this means: setting a set of professional fields: F professional ={fp1, fp2, ..., fp n}; where fp i Represents the i-th professional field;

[0223] For each domain fp i Building a knowledge base (KP) i This includes authoritative literature, regulations, and cases in the field;

[0224] Set system parameters: P = {α, β, γ, δ}; where α, β, γ, δ are the weight coefficients of relevance, timeliness, credibility and user feedback in the comprehensive score, respectively, and α + β + γ + δ = 1;

[0225] Identify authoritative data source sets in various professional fields: S professional ={sp1, sp2, ..., sp m}; where sp j This represents the j-th data source;

[0226] Define a data extraction and transformation function, using an ETL process, to extract data from the source system and convert it into a unified format: D unified =ETL(S) professional ); where D unified Represents data in a uniform format;

[0227] The data, converted to a unified format, will be loaded into the database of a professional retrieval system.

[0228] The imported data is cleaned and labeled to obtain a cleaned dataset:

[0229] D clean =Clean(D unified );

[0230] The data is labeled with professional domains and keywords to obtain a labeled dataset:

[0231] D Annotation =Annotation(D clean F professional );

[0232] Based on the preprocessed data, extract document keywords and build an inverted index:

[0233] I keyword =Index_Construct_Keyword(D Annotation );

[0234] Use word vector models to generate semantic vectors for documents and build semantic indexes:

[0235] I semantics =Index_Construct_Semantics(D Annotation );

[0236] Generate retrieval system: R Search ={R Boole R Keyword R Semantics}; where R Boole For Boolean retrieval, R Keyword For keyword matching retrieval, R Semantics For semantic retrieval;

[0237] The formula for Boolean search is: R Boole =Search_Boole(Q, I) keyword ); where Q represents the user query, R Boole Indicates Boolean search results;

[0238] The formula for keyword matching retrieval is: R Keyword=Search_Keyword(Q, I) keyword );

[0239] The formula for semantic retrieval is: R Semantics =Search_Semantics(Q, I) semantics );

[0240] Update documents and indexes in the system at a set frequency: D new =Data_Update(D Annotation S professional );

[0241] I keyword_new =Index_Update_Keyword(I keyword D new );

[0242] I semantics_new =Index_Update_Semantics(I semantics D new );

[0243] Regularly optimize the retrieval model: M new =Model_Optimization(M, D) new );

[0244] Where M represents the current retrieval model, M new This represents the optimized retrieval model.

[0245] This embodiment also provides the ability to obtain a database, including a general retrieval system database D. general Specifically:

[0246] Define the broad areas covered by the general retrieval system, such as news, technology, lifestyle, and education, to form a general domain set: G general ={g1, g2, ..., g n};

[0247] Collect basic information from various general fields, including news articles, encyclopedic knowledge, forum posts, blogs, etc., to form a basic information database B;

[0248] Set the system operating parameters: P = {α, β, γ}; where α, β, and γ are the weight coefficients of relevance, timeliness, and credibility in the comprehensive score, respectively, and α + β + γ = 1;

[0249] Identify and access data sources in common domains, such as news websites, social media platforms, and knowledge communities, to form a data source set: S general ={sg1, sg2, ..., sgm};

[0250] Define a data extraction and transformation function, using an ETL process, to extract data from the source system and convert it into a unified format: D unified =ETL(S) general ); where D unified Represents data in a uniform format;

[0251] The data, converted to a unified format, will be loaded into the database of the general retrieval system.

[0252] The imported data is cleaned and noise is removed to obtain a cleaned dataset:

[0253] D clean =Clean(D unified );

[0254] Extract metadata from the data, such as publication date, author, and source, to obtain a metadata dataset: M metadata =Metadata_Extract(D clean );

[0255] Build a keyword index based on the cleaned data:

[0256] I keyword =Index_Construct_Keyword(D clean );

[0257] Using general semantic models, such as BERT, semantic vectors are generated for documents to build semantic indexes.

[0258] I semantics =Index_Construct_Semantics(D clean );

[0259] Generate retrieval system: R Search ={R Boole R Keyword R Semantics}; where R Boole For Boolean retrieval, R Keyword For keyword matching retrieval, R Semantics For semantic retrieval;

[0260] The formula for Boolean search is: R Boole =Search_Boole(Q, I) keyword );

[0261] Where Q represents a user query, R Boole Indicates Boolean search results;

[0262] The formula for keyword matching retrieval is: R Keyword =Search_Keyword(Q, I) keyword );

[0263] The formula for semantic retrieval is: R Semantics =Search_Semantics(Q, I) semantics );

[0264] Update documents and indexes in the system at a set frequency: D new =Data_Update(D clean S general );

[0265] I keyword_new =Index_Update_Keyword(I keyword D new );

[0266] I semantics_new =Index_Update_Semantics(I semantics D new );

[0267] Regularly optimize the retrieval model: M new =Model_Optimization(M, D) new );

[0268] Where M represents the current retrieval model, M new This represents the optimized retrieval model.

Claims

1. A method for intelligent knowledge retrieval based on RAG framework, characterized in that: Comprise: Acquiring historical behavior data of a user : ; wherein, a search history of the user, a history of content viewed by the user, content that is bookmarked by the user, feedback from the user on previous search results; Calculate the proportion of domain content for the user: ; wherein, is the number of times the user has acted in the professional field, is the total number of times the user has acted. Calculate the content depth index of the user: ; wherein, the number of times the user browsed and collected professional depth content, the total number of times the user browsed and collected; Calculate the professional platform activity of the user: ; wherein, is the number of activities of the user on the professional platform, is the total number of activities of the user on all platforms; Computing a professional identity score for a user : ; wherein, , , is the weight of each index, and the sum of the weights is 1; Define an identity determination function to determine whether the user is a professional: ; wherein, is an identity determination threshold value; If then the user is determined to be a professional; If then it is determined that the user is not a professional; Determine the professional situation of the user, including whether the user's question is professional, specifically: Obtaining text content searched by a user, denoted as ; Build a keyword library containing high-frequency professional terms in multiple professional fields: ; wherein denotes the professional field; Set up an extraction function to extract the keywords of the user's search text content to form a keyword set: ; ; Wherein, represents the preprocessed user search text, represents the preprocessed user search text, is subjected to word segmentation processing to obtain an initial word segmentation result list , represents a candidate keyword list obtained after removing stop words from , , represents a keyword set screened out from , ; Set of keywords Convert to vector form: ; Convert the professional field keyword library Convert to vector form: ; Calculate the matching degree using the cosine similarity formula: ; Setting a professional problem threshold ; Determine whether the user's search text content is a strong professional question: ; If , it is determined that the text content searched by the user is a question with stronger professional nature; If then it is determined that the text content searched by the user is not a question with high professional level; Determine the professional situation of the user, including whether the user's question is specific, specifically: Acquiring text content of a user search ; Dependency parse results of the text content : ; wherein, represents a word in the question, represents a word of the dependency relation; Acquiring semantic role labeling results of text content of the text content ; wherein, denotes a semantic role, denotes a corresponding word; Extract key information based on dependency syntax analysis and semantic role labeling results: ; ; ; ; ; ; wherein, represents subject information, is a subject, represents predicate information, is a predicate, represents object information, is an object, represents time information, is a time, represents place information, is a place, represents other modification information, is a modification relationship; Define a concreteness rule function that determines whether the question satisfies the concreteness rule condition: ; Specific rule functions middle, This indicates a specific entity name, specifically: ; wherein is an entity name; Specificity rule function In particular, representing a specific operation or query requirement, in particular: ; wherein for the specific operation, for the query requirement; Specificity rule function In particular, the time or place restrictions are explicitly indicated, in particular: In particular, the time or place restrictions are explicitly indicated, in particular: ; wherein, is time, is place; Specificity rule function In particular, represents an explicit condition description, in particular: ; wherein is a conditional description; Calculate the specificity score: ; A specificity judging function is set to judge the text content searched by the user Is specific: ; wherein is a concrete threshold value; If then determine the text content of the user search Specific; If then determine the text content of the user search Not specific; If and then generate an answer set, specifically: Acquiring a keyword set ; Get the database; Extract an expanded keyword set from the database that is semantically similar to the keywords: ; Combining the set of keywords and the expanded set of keywords into a query vector: ; Extraction of professional search system database ; Computing query vectors Relevance to each document ​ ; Sort the documents according to relevance to obtain the top N most relevant professional documents for the query, forming a professional document set: ; ; wherein, is a relevance threshold for professional documents; Extracting generic search system database ; Computing query vectors Relevance to each document ​ ; Sort the documents according to relevance to obtain the top M most relevant general documents for the query, forming a general document set: ; ; wherein, is a relevance threshold for the general document; Integrate to generate a professional answer: ; Integrate to generate a popular answer: ; Integrate the professional answer and the popular answer to form an answer set: ; Output the answer set to the user. 2.The RAG framework based intelligent knowledge retrieval method of claim 1, wherein: If and , the answer is generated according to the professional level of the user, including accurate search to generate professional answers, specifically: Get the result of the identity determination function; If the user is a professional, then the behavior record of the user in the system is collected comprehensively, denoted as a set ; Carry out word segmentation processing on the user historical data text to obtain a word frequency vector : ; wherein, represents the pre-processed user historical data text, represents the pre-processed user historical data text, is subjected to word segmentation processing to obtain an initial word segmentation result list , represents a candidate keyword list obtained after removing stop words from , represents a stop word list, is a function for calculating the word frequency;​ Calculate the TF-IDF weight of each word to form a keyword weight vector: ; Select the n words with the largest weight as the user's historical data keyword set: ; ; Topic modeling of user historical data to get topic distribution vector: ; in, Indicates the user's opinion on the first The level of attention given to each topic; A requirement feature library is constructed, each requirement type is represented by a feature vector ; Calculate the similarity between user topic distribution and each demand feature vector to find the most similar demand type index: ; According to the user-matched demand type and the keyword set , a Boolean logic expression is generated: ; Construct a retrieval query statement containing exact phrase matching: ; Let the set of search results be ; For each document , a relevance score is computed with respect to the user need: ; wherein, and are weight coefficients, is a function that measures the similarity between the content of a document and the set of keywords from the user's history data, is a function that measures the similarity between the content of a document and the set of keywords from the user's history data, is a function that measures the overall quality of the metadata of a document; Set a descending function to sort the retrieval results in descending order of relevance score to get the sorted result set: ; from the ranked search results before extracting the content snippet from the ranked search results ; Segment collection according to logical coherence Organize, generate professional answer text: ; wherein, is a function to integrate the retrieved content snippets into a coherent, complete answer. 3.The RAG framework based intelligent knowledge retrieval method of claim 2, wherein: If and , the answer is generated according to the professional level of the user, and also includes a general answer generated by browsing search, specifically: Get the result of the identity determination function; if the user is not a professional, obtaining textual content searched by the user ; Questions for user input Carrying out word segmentation to obtain an initial word segmentation result list : ; wherein, represents a group is subjected to word segmentation processing to obtain an initial word segmentation result list ; From the initial word segmentation result list Remove stop words from the text: ; wherein, represents the list of candidate keywords obtained after removing stop words from the list of candidate keywords ; A keyword extraction algorithm is set up to extract a keyword set : ; ; ; wherein, is the pre-processed word segmentation result, represents a keyword list in the keyword list, represents a document; Get the common demand topic keyword set predefined by the general retrieval system: ; Computing semantic similarity of each topic word with the set of keywords :​ ; According to the calculated semantic similarity, the subject words meeting the requirements are screened out as the guide option set : ; wherein, is a similarity threshold value; Set of boot options Each element in the content is presented to the user in the form of an interactive dialogue; Record the user's selection and feedback information: ; wherein represents a guide option selected by the user; Extracting generic search system database ; Define a demand classification model based on user selection of guided options in combination with original question keywords to form a preliminary demand classification result: ; Set up a demand refinement dimension library to obtain the available refinement dimension set from the demand refinement dimension library based on the preliminary demand classification result: ; For each refinement dimension a corresponding set of refinement options is generated: ; Present the refinement dimensions and options to the user in an interactive dialogue form, record the user's selection again, and generate user refinement selection: ; wherein, represents that the user selected the option corresponding to the dimension ; Combining the initial needs classification results with the user's refined selections to generate a general needs description: ; Where "+" means adding refinement conditions to the preliminary demand classification to form a more specific demand description; Set a synonym dictionary: ; Set up a semantic association word library: ; According to the general requirements and the original problem keywords , the keyword expansion is performed in combination with the synonym dictionary and semantic association library in the general retrieval system to generate an expanded keyword set : ; wherein, a semantic correlation threshold for expanding keywords, a synonym dictionary, a semantic association library; Combining the extended keywords into a Boolean logic retrieval expression to form a retrieval query statement : ; wherein, as an extension keyword, as a guide option related keyword; In a general retrieval system database a retrieval query is executed , obtaining a set of documents related to the general need ; Compute each document Resulting composite ranking score: ; wherein, , , are weight coefficients, respectively representing the importance of the relevance, timeliness and credibility in the ranking, and ; By document collection Sort in descending order to obtain the sorted result set. ; For the sorted collection of documents Each document in the document is processed to extract a set of keywords. Generate a collection of content fragments from highly relevant paragraphs or sentences. : ; wherein, is a threshold value for the popularity index, is a sentence popularity index, and the specific formula is: ; wherein, is the sentence length, is the number of complex words in the sentence, and are the average sentence length and average number of complex words in the corpus, respectively, , is the standard deviation; Assembling the extracted content snippets Integrating according to logical coherence to generate an easy-to-understand answer : 。 4. The RAG framework based intelligent knowledge retrieval method of claim 3, wherein: If then directly search for a general answer, specifically: Acquiring query vector ; Extracting generic search system database ; Computing query vectors Relevance to each document ​ ; Sort the documents according to relevance to obtain the top M most relevant general documents for the query, forming a general document set: ; ; wherein, is a relevance threshold for the general document; Processing each document, extracting relevant segments or sentences Highly relevant segments or sentences, generating a set of content snippets : ; wherein, is a threshold for the colloquiality index, is a sentence colloquiality index, and the specific formula is: ; wherein, is the sentence length, is the number of complex words in the sentence, and are the average sentence length and average number of complex words in the corpus, respectively, , is the standard deviation; Assembling the extracted content snippets Integrating according to logical coherence to generate an easy-to-understand answer : 。 5. The RAG framework based intelligent knowledge retrieval method of claim 1, wherein: Database for obtaining, including professional retrieval system database , Specifically: Set the professional field set: ; wherein represents the professional field; For each domain , a knowledge base is constructed ; Set system parameters: ; wherein, , , , are the weight coefficients of the relevance, timeliness, credibility and user feedback in the comprehensive score, respectively, and ; Identify the authoritative data source set of each professional field: ; wherein represents the first data source; Define a data extraction and conversion function to extract data from the source system and convert it to a unified format: ; wherein represents data in a uniform format; Load the data converted to a unified format into the professional retrieval system database; Clean and label the imported data to get the cleaned data set: ; Label the data for professional field and keyword to get the labeled data set: ; Based on the preprocessed data, extract document keywords and build an inverted index: ; Generate semantic vectors for documents and build semantic indexes: ; Generate a retrieval system: ; wherein, is a Boolean search, is a keyword match search, is a semantic search; Update documents and index in the system at a set frequency: ; ; ; Optimize the search model periodically: ; wherein, denotes the current search model, denotes the optimized search model.

6. The RAG framework based intelligent knowledge retrieval method of claim 5, wherein: A database acquisition system includes a general search system database , in particular: Determine the broad areas covered by the general search system, forming a set of general areas: ; Collecting basic information of each general field to form a basic information library ; Set the system operating parameters: ; wherein, , , are the weight coefficients of the correlation, timeliness and reliability in the comprehensive score, respectively, and ; Identify and access data sources for general areas, forming a set of data sources: ; Define a data extraction and transformation function to extract data from the source system and convert it to a unified format: ; wherein represents data in a uniform format; Load the data converted to a unified format into the general search system database: Clean and remove noise information from the imported data to obtain a cleaned data set: ; Extract metadata from the data to obtain a metadata data set: ; Build a keyword index based on the cleaned data: ; Generate semantic vectors for documents to build a semantic index: ; Generate a search system: ; wherein, is a Boolean search, is a keyword match search, is a semantic search; Update documents and index in the system at a set frequency: ; ; ; Optimize the search model periodically: ; wherein, denotes the current search model, denotes the optimized search model.

Citation Information

Patent Citations

  • Medical auxiliary question and answer method and system based on knowledge calibration and retrieval enhancement

    CN117573843A

  • Method and system for providing a natural language question and answer service based on information retrieval augmentation for a building energy analytics platform

    KR102811533B1