Intelligent search method based on retrieval enhancement generation
Using NLP technology to perform text fragment segmentation and feature analysis, combined with multiple rewriting large model evaluations, the problem of inaccurate rewriting in retrieval enhancement technology is solved, and the accuracy of text rewriting and system stability are improved.
Patent Information
- Application Number
- CN202411216968.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-09-02
AI Technical Summary
Existing retrieval enhancement technologies may generate inaccurate and unnatural language when rewriting the text to be retrieved through large models. Especially when dealing with complex or professional content, the rewriting may introduce errors or ambiguities, affecting the accuracy of subsequent steps. sex.
Through NLP-based text segmentation, feature extraction, feature deviation analysis and signal-to-noise ratio evaluation, a text segment priority evaluation model is constructed, pre-rewritten text segments are selected and pre-rewritten results are generated through multiple rewriting large models, and quality assessment is performed to select the best Best rewrite large models for text rewriting.
It improves the accuracy and system robustness of text rewriting, reduces errors and ambiguities in rewriting, optimizes model selection and resource utilization, and improves the overall rewriting effect and efficiency.
Smart Images

Figure CN118733712A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent search technology, and more specifically, to an intelligent search method based on retrieval enhancement generation. Background Art
[0002] Existing retrieval enhancement technologies combine vectorized representation, knowledge graphs, generative models, and multimodal data processing, enabling intelligent search systems to more accurately understand user queries and improve the quality of search results by matching relevant documents or generating context-related answers. Through these technologies, the system can not only improve the relevance and accuracy of retrieval, but also provide a more personalized and intelligent search experience.
[0003] For example, the invention patent announcement with announcement number: CN118152521B discloses a retrieval enhancement generation method based on text rewriting, through natural language processing, large models, and retrieval enhancement generation fields. The present invention first determines the user question text and the text to be retrieved as the knowledge base; secondly, the large model is used to rewrite the text, and the pronouns used in the text are modified to the original referents; the rewritten text is then segmented, converted into candidate vectors and stored in the vector database; finally, the large model is used to rewrite the user question text to generate multiple similar questions, and the feature vector is obtained for each question text and then the similarity is calculated with the candidate vectors in the vector database, and multiple reference texts are determined, and the user question text and the reference text are input into the large model as prompt texts to obtain the system response output. The accuracy of the recalled reference text can be improved without changing the word vector embedding method and the vector retrieval method, thereby improving the quality of the system output.
[0004] For example, the invention patent announcement with announcement number: CN117573815B discloses a retrieval enhancement generation method based on vector similarity matching optimization, which determines the feature vector of the text to be processed, obtains the similarity between the candidate vector and the feature vector of the text to be processed according to the candidate vector in the specified vector database, the feature vector of the text to be processed, and the similarity prediction model, determines the reference text associated with the text to be processed based on the similarity, and inputs the prompt text determined by the text to be processed and the reference text into the pre-trained natural language model to obtain the target text. It can be seen that the reference text obtained by the above scheme based on the similarity prediction model matching can be adapted to the specified field, and the accuracy of the reference text can be improved, thereby improving the quality of the target text.
[0005] The above-disclosed technical solution has at least the following technical problems: when the existing retrieval enhancement technology rewrites the text to be retrieved through a large model, the model will generate inaccurate and unnatural language, especially when dealing with complex or professional content; the rewriting may introduce errors or ambiguities, affecting the accuracy of subsequent steps.
[0006] In view of the above problems, the present invention proposes a solution. Summary of the invention
[0007] In order to overcome the above-mentioned defects of the prior art, an embodiment of the present invention provides an intelligent search method based on retrieval enhancement generation, which obtains the best rewritten large model through pre-rewriting to solve the problem that rewriting may introduce errors or ambiguities and affect the accuracy of subsequent steps.
[0008] To achieve the above object, the present invention provides the following technical solutions: In a preferred embodiment, the method comprises the following steps: obtaining a text to be retrieved, and performing text segmentation on the text to be retrieved based on NLP to obtain a number of text fragments, and constructing a text fragment set by labeling; performing text feature extraction on each text fragment in the fragment set to obtain text feature data of each text fragment; performing data analysis based on the text feature data to obtain feature deviation data of each text fragment; obtaining discrete data and text quality data of the text fragment, and constructing a text fragment priority evaluation model based on a neural network algorithm in combination with the feature deviation data to obtain the text fragment rewriting priority of each text fragment; obtaining a pre-rewritten text fragment set based on a preset number of pre-rewritten text fragments and the text fragment rewriting priority; passing the pre-rewritten text fragment set through several different types of rewriting macro models to generate pre-rewriting results; performing quality evaluation on the pre-rewriting results to obtain the best rewriting macro model; rewriting the text to be retrieved through the best rewriting macro model, and performing intelligent search.
[0009] In a preferred embodiment, the text segmentation based on NLP to obtain a plurality of text fragments is specifically as follows: text preprocessing is performed on the text to be retrieved, and the text preprocessing includes denoising and standardization; sentence segmentation is performed on the preprocessed text to be retrieved based on spaCy, and paragraph segmentation is performed based on NLTK to obtain a plurality of first text fragments; semantic segmentation is performed on the plurality of first text fragments based on NLP to obtain second text fragments; unique identifiers are assigned to the second text fragments to construct a text fragment set.
[0010] In a preferred embodiment, the feature deviation data includes a feature deviation coefficient, the discrete data includes a discrete influence coefficient, and the text quality data includes a text segment signal-to-noise ratio influence coefficient.
[0011] In a preferred embodiment, the specific method for obtaining the feature deviation coefficient is as follows: obtaining feature vectors corresponding to text feature data of several text segments; calculating the cosine similarity between the feature vectors corresponding to each text segment and other text segments; obtaining the average cosine similarity, maximum cosine similarity and minimum cosine similarity of the feature vectors corresponding to each text segment; and calculating the feature deviation coefficient based on a preset feature deviation coefficient calculation formula according to the average cosine similarity, maximum cosine similarity and minimum cosine similarity.
[0012] In a preferred embodiment, the specific method for obtaining the discrete influence coefficient is as follows: obtain a discrete data set, wherein the discrete data set includes word frequency, vocabulary distribution and discrete features; calculate the discreteness of each discrete data in the discrete data set based on the frequency distribution and the coefficient of variation; for each text fragment, count the frequency of occurrence of specific discrete features to obtain the word frequency of the text fragment; calculate the standard deviation and mean of the word frequency of the text fragment, and calculate the discrete influence coefficient based on the discreteness.
[0013] In a preferred embodiment, the specific method for obtaining the signal-to-noise ratio influence coefficient of the text segment is as follows: obtain the signal feature vector and the noise feature vector of the text feature data; calculate the signal mean vector of the signal feature, and calculate the signal covariance matrix of the signal feature as the statistic of the signal feature; calculate the noise mean vector of the noise feature, and calculate the noise covariance matrix of the noise feature as the statistic of the noise feature; calculate the mean vector difference between the signal and the noise and the covariance matrix difference between the signal and the noise; and use the ratio of the mean vector difference to the covariance matrix difference as the signal-to-noise ratio influence coefficient.
[0014] In a preferred embodiment, the text segment priority evaluation model is specifically as follows: the acquired feature deviation coefficient, discrete influence coefficient and signal-to-noise ratio influence coefficient are used to establish a text segment priority evaluation model to generate a text segment rewriting priority.
[0015] In a preferred embodiment, the pre-rewritten text fragment set is obtained based on the preset number of pre-rewritten text fragments combined with the text fragment rewriting priority, specifically: all text fragments are sorted in ascending order based on the corresponding text fragment rewriting priority to obtain a text fragment rewriting sorting table; according to the preset number of pre-rewritten text fragments, text fragments are selected from the text fragment rewriting sorting table from top to bottom for pre-text rewriting.
[0016] In a preferred embodiment, the quality of the pre-rewriting results is evaluated to obtain the best rewriting model, specifically: the pre-rewriting text fragment set is passed through several different types of rewriting large models to generate pre-rewriting results for each model; the pre-rewriting results include the output of the model after rewriting the same text fragment; the BLEU score is used to evaluate the similarity between the rewritten text and the reference answer, and the degree of vocabulary and phrase matching of the text is measured; the ROUGE score is used to calculate the number of overlapping words, phrases and sentences between the rewritten text and the reference text, and the coverage of the text is evaluated; the perplexity of the rewritten text is calculated to evaluate the naturalness of the generated text; the perplexity and coverage of the pre-rewriting results and the degree of vocabulary and phrase matching of the text are weighted summed, and the rewriting large model corresponding to the best pre-rewriting result is selected as the best rewriting large model.
[0017] The technical effects and advantages of the intelligent search method based on retrieval enhancement generation of the present invention are as follows: 1. The present invention optimizes the text rewriting process by performing precise text segmentation, comprehensive feature extraction, feature deviation analysis, discrete data analysis, and signal-to-noise ratio evaluation based on NLP technology. Specifically, by performing detailed feature extraction and analysis on text fragments, potential error fragments can be accurately identified and prioritized, thereby reducing errors and ambiguities in rewriting, optimizing the selection of rewriting models, and improving text quality and system robustness. In addition, the method also ensures efficient use of resources and optimization of processing procedures through a systematic priority evaluation model, thereby greatly improving the overall effect and efficiency of the rewriting process.
[0018] 2. The present invention generates pre-rewriting results by passing the pre-rewriting text fragment set through several different types of rewriting large models, with the aim of comparing the rewriting effects, selecting the best model, identifying the advantages of the model, optimizing the rewriting strategy, and reducing the rewriting error. Specifically, by evaluating the rewriting results generated by different models, we can fully understand the performance of each model in maintaining the original meaning of the text, natural language generation, and task processing accuracy, so as to select the model with the best effect. In addition, by analyzing the characteristics of the rewriting results, the rewriting strategy can be further optimized to ensure the accuracy and robustness of the system when processing text. The rewriting large models used include rule-based models, statistical method models, neural network generation models, and reinforcement learning models, each of which has its specific advantages and scope of application. Finally, the rewriting results are quality evaluated by BLEU scoring, ROUGE scoring, and perplexity calculation to select the best rewriting large model, thereby improving the quality of text rewriting and the accuracy of intelligent search. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 The present invention is a schematic diagram of the structure of an intelligent search method based on retrieval enhancement generation. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not 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.
[0021] Embodiment 1, Figure 1 The present invention provides an intelligent search method based on retrieval enhancement generation, comprising the following steps: S1, obtain the text to be retrieved, and perform text segmentation on the text to be retrieved based on NLP to obtain several text fragments, and label them to construct a text fragment set.
[0022] In this embodiment, the text to be retrieved is segmented based on NLP to obtain several text fragments, specifically: Performing text preprocessing on the text to be retrieved, wherein the text preprocessing includes noise removal and standardization; The preprocessed text to be retrieved is segmented into sentences based on spaCy and paragraphs based on NLTK to obtain several first text fragments; Performing semantic segmentation on the first text segments based on NLP to obtain second text segments; The second text segment is assigned a unique identifier, and a text segment set is constructed.
[0023] S2, extracting text features from each text segment in the segment set to obtain text feature data of each text segment.
[0024] In this embodiment, the text feature extraction is performed on each text segment in the segment set, specifically: Use lemmatization and stemming to restore each word to its base form and generate base words; Generate a vector representation for each basic word based on the pre-trained word vector model; Calculate the frequency of each basic word and extract the frequency feature through TF-IDF; Count the number of words in a text segment as a sentence length feature; Extract the syntactic structure features of the text based on dependency syntax analysis tools; Based on topic modeling technology, the topic distribution vector of the text fragment is generated as the topic feature; Combine all extracted features into a feature vector, one vector for each text segment; The feature vectors are standardized to ensure that each feature is in a similar numerical range, and the text feature data of each text segment is obtained.
[0025] Through the above steps, the features of the text fragments can be systematically extracted and processed, laying a solid foundation for subsequent analysis, pre-rewriting evaluation and model selection. These features will help determine the most suitable text fragments for rewriting and the best rewriting model.
[0026] S3, performing data analysis based on the text feature data to obtain feature deviation data for each text segment.
[0027] In this embodiment, the characteristic deviation data includes a characteristic deviation coefficient.
[0028] The feature deviation coefficient is obtained by analyzing the text feature data of a specific text segment and analyzing the correlation with the text feature data of all text segments. It is used to evaluate the effectiveness of the text segment.
[0029] The feature deviation coefficient is a metric derived from analyzing the feature data of a specific text segment. It is calculated by evaluating the correlation between the feature data of the segment and all other text segments. A higher or lower feature deviation coefficient indicates the degree of difference between the features of the segment and other segments. This coefficient is used to evaluate the validity or relevance of text segments, thereby helping to select the most appropriate segment for further processing or rewriting in subsequent processing, ensuring that the selected segment has high quality and applicability.
[0030] The specific method for obtaining the characteristic deviation coefficient is as follows: Obtain feature vectors corresponding to text feature data of several text segments; Calculate the cosine similarity between each text segment and the feature vectors corresponding to other text segments; Get the average cosine similarity, maximum cosine similarity and minimum cosine similarity of the feature vectors corresponding to each text segment; The feature deviation coefficient is calculated based on the average cosine similarity, the maximum cosine similarity and the minimum cosine similarity based on a preset feature deviation coefficient calculation formula.
[0031] The specific calculation formula of the cosine similarity between the feature vectors is as follows:
[0032] The specific calculation formula of the average cosine similarity is:
[0033] The specific calculation formula of the characteristic deviation coefficient is:
[0034] In the formula, is the cosine similarity between the feature vectors of the i-th text segment and the j-th text segment, is the kth vector value of the feature vector corresponding to the i-th text segment, is the kth vector value of the feature vector corresponding to the jth text segment, m is the dimension of the feature vector, is the average cosine similarity of the ith text segment, N is the total number of text segments, is the feature vector of the i-th text segment, is the feature vector of the jth text segment, is the characteristic deviation coefficient, is the maximum cosine similarity of the i-th text segment, is the minimum cosine similarity of the i-th text segment.
[0035] Furthermore, analyzing and obtaining the feature deviation coefficient has the following advantages for selecting the best pre-rewritten text segment and the best large model to solve the problem that rewriting may introduce errors or ambiguities and affect the accuracy of subsequent steps: Improve the accuracy of text rewriting: By calculating the feature deviation coefficient, we can identify those segments that show obvious feature deviation in the overall text segment set. These segments are more likely to have errors or ambiguities in the rewriting process. Prioritizing these segments will help correct potential problems in advance and ensure more accurate rewriting results; Optimize model selection: When selecting a large model, the feature deviation coefficient can be used to more accurately match the characteristics of the segment with the rewriting ability of the model, avoiding rewriting errors caused by improper model selection. In this way, the large model that is most suitable for processing a specific text segment can be selected, thereby minimizing the errors introduced by rewriting; Reduce ambiguity and information loss: The feature deviation coefficient helps identify those segments that are prone to ambiguity or information loss. Improving the processing of these segments can reduce misunderstanding or omission of the original meaning of the text during the rewriting process, thereby improving the overall rewriting quality; Enhance the robustness of the system: By comprehensively analyzing and optimizing the text fragments in the early stage, the system instability caused by rewriting errors in the subsequent steps is reduced; this preventive processing method makes the entire intelligent search method more reliable and robust; Save resources and time: Screening out the best text segments for rewriting evaluation in advance reduces the possibility of wasting resources on unsuitable segments. It also avoids repeated revisions due to improper rewriting in subsequent steps, improving the efficiency of the overall process.
[0036] S4, obtaining discrete data and text quality data of the text fragments, building a text fragment priority evaluation model based on a neural network algorithm in combination with feature deviation data, and obtaining the text fragment rewriting priority of each text fragment.
[0037] In this embodiment, the discrete data includes discrete influence coefficients, and the text quality data includes text segment signal-to-noise ratio influence coefficients.
[0038] Discrete data refers to a collection of data points with clear separation and intervals, which are not continuous in value or category; each data point is independent in a discrete data set and is usually measured and recorded in independent units or categories; for example, in text processing, discrete data may include the frequency of occurrence of specific words, the sentiment score of specific sentences, etc. The characteristics of this data enable it to be clearly classified and counted, thus providing a basis for further data analysis and model training.
[0039] Analyzing and obtaining discrete data has the following advantages for selecting the best pre-rewritten text fragments and the best large model to solve the problem that rewriting may introduce errors or ambiguities, affecting the accuracy of subsequent steps: Accurately identify key features: The analysis of discrete data can reveal specific features and information points in text fragments, which are crucial for accurate rewriting. By identifying these discrete features, it is possible to more accurately select the fragments that need to be rewritten first, ensuring that the integrity and accuracy of the information are maintained during the rewriting process.
[0040] Optimize rewriting strategies: Discrete data provides specific quantitative information in the text, such as word frequency, part-of-speech distribution, etc. These data can help determine which segments are more prone to errors or ambiguities. Based on these data, you can optimize the rewriting strategy and select the rewriting model that can best handle these specific features, thereby reducing potential errors introduced by rewriting. Improve model matching: Through discrete data analysis, we can understand the matching degree between the specific features of the text fragment and the processing capabilities of the large model; choosing a large model that can effectively handle these features will help improve the rewriting effect and ensure that the rewritten text is consistent with the original meaning; Reduce ambiguity introduced by rewriting: The analysis of discrete data can reveal subtle differences and potential sources of ambiguity in the text; based on these analysis results, the rewriting process can pay more attention to these potential problems, reduce ambiguity in the rewriting results, and thus improve the quality of the text; Improve efficiency: Through discrete data analysis, we can quickly filter out those text segments that need to be rewritten the most, avoiding wasting resources on irrelevant or unimportant segments. This method improves the efficiency of the rewriting and model selection process, reducing unnecessary duplication of work and resource consumption. In summary, the analysis of discrete data helps to accurately identify key features in the text, optimize the rewriting strategy, improve model matching, reduce ambiguity, and improve overall processing efficiency, thereby ensuring the accuracy of the rewriting process and the effectiveness of subsequent steps.
[0041] The specific method for obtaining the discrete influence coefficient is as follows: Acquire a discrete data set, the discrete data set comprising word frequency, vocabulary distribution, and discrete features; Calculate the discreteness of each discrete data in the discrete data set based on frequency distribution and coefficient of variation; For each text segment, count the frequency of occurrence of specific discrete features to obtain the word frequency of the text segment; The standard deviation and mean of the word frequency of the text fragments are calculated, and the dispersion is combined to calculate the dispersion influence coefficient.
[0042] The specific calculation formula for the word frequency of the text segment is as follows:
[0043] The specific calculation formula for the standard deviation of the text segment word frequency is as follows:
[0044] The specific calculation formula of the discrete influence coefficient is as follows:
[0045] In the formula, is the word frequency of feature a in the text segment, H is the total number of words in the text segment, is the average word frequency of text fragments, is the total number of discrete features, is the standard deviation of the word frequency of the text segment, is the discrete influence coefficient.
[0046] The signal-to-noise ratio impact coefficient of a text segment is used to measure the ratio of useful information to noise in a text segment. It evaluates the quality of the text by calculating the ratio of the signal (useful information) to the noise (irrelevant or interfering information) of the text segment. The higher the signal-to-noise ratio impact coefficient, the greater the ratio of useful information to noise in the text segment, and thus the higher the quality of the text segment. Through this indicator, text segments with high information quality can be screened out to ensure the accuracy and effectiveness of subsequent processing and analysis.
[0047] Analyzing the influence coefficient of the signal-to-noise ratio of text segments has the following advantages for selecting the best pre-rewritten text segment and the best large model to solve the problem that rewriting may introduce errors or ambiguities and affect the accuracy of subsequent steps: Improve text quality: signal-to-noise ratio: By using text segments with a high signal-to-noise ratio, more useful information can be retained during the rewriting process, reducing the impact of irrelevant or interfering information on the rewriting results. This helps improve the quality of the rewritten text and ensure that the information is accurately conveyed; Optimize model selection: Matching ability: Selecting text segments with high signal-to-noise ratio for rewriting can help better match the ability of the rewriting large model; this can avoid rewriting errors caused by improper model selection, and thus select the large model that is most suitable for processing specific types of text; Reducing errors and ambiguity: Information clarity: Text fragments with a high signal-to-noise ratio are more likely to maintain their original meaning during the rewriting process, reducing misunderstandings and information loss; this helps avoid rewriting ambiguities caused by noise or irrelevant information in the text, thereby improving the accuracy of the overall rewriting; Enhance system robustness: Preventive processing: By analyzing the signal-to-noise ratio of text segments in the early stages, high-noise texts can be processed preventively, thereby reducing system instability caused by rewriting errors in subsequent steps; this processing method enhances the stability and reliability of the entire system; Improve efficiency: Resource optimization: Selecting text segments with high signal-to-noise ratio for pre-rewriting evaluation can effectively reduce the waste of resources and time on low-quality segments; this optimization helps improve the efficiency of the overall processing flow and ensure the effective use of resources; With these advantages, analyzing the SNR impact coefficient of text segments can effectively improve the quality of text rewriting, optimize the model selection process, reduce errors and ambiguity, and enhance the robustness of the system.
[0048] The specific method for obtaining the text segment signal-to-noise ratio influence coefficient is as follows: Obtain signal feature vectors and noise feature vectors of text feature data; Calculate the signal mean vector of the signal feature, and calculate the signal covariance matrix of the signal feature as the statistic of the signal feature; Calculate the noise mean vector of the noise feature, and calculate the noise covariance matrix of the noise feature as the statistic of the noise feature; Calculate the difference in mean vectors of signal and noise and the difference in covariance matrices of signal and noise; The ratio of the mean vector difference to the covariance matrix difference is taken as the signal-to-noise ratio influence coefficient.
[0049]
[0050] In the formula, is the signal-to-noise ratio influence coefficient, is the mean vector difference between signal and noise, is the difference in covariance matrices between signal and noise.
[0051] In this embodiment, the text segment priority evaluation model is specifically: The acquired feature deviation coefficient, discrete influence coefficient and signal-to-noise ratio influence coefficient are used to establish a text segment priority evaluation model to generate the text segment rewriting priority; The calculation formula of the text segment rewriting priority is as follows:
[0052] In the formula, YA is the rewriting priority of the text segment, is the preset proportionality factor of the characteristic deviation coefficient, is the discrete influence coefficient, is the preset proportional coefficient of the signal-to-noise ratio influence coefficient, is the characteristic deviation coefficient, is the discrete influence coefficient, is the signal-to-noise ratio influence coefficient.
[0053] S5, obtaining a set of pre-rewritten text segments according to a preset number of pre-rewritten text segments and a rewriting priority of the text segments.
[0054] In this embodiment, the pre-rewritten text segment set is obtained according to the preset number of pre-rewritten text segments combined with the rewriting priority of the text segments, specifically: Sort all text segments in ascending order based on the corresponding text segment rewriting priorities to obtain a text segment rewriting sorting table; According to the preset number of pre-rewritten text segments, text segments are selected from the text segment rewriting sorting table from top to bottom for pre-text rewriting.
[0055] This embodiment optimizes the text rewriting process by performing precise text segmentation, comprehensive feature extraction, feature deviation analysis, discrete data analysis, and signal-to-noise ratio evaluation based on NLP technology. Specifically, by performing detailed feature extraction and analysis on text segments, potential error segments can be accurately identified and prioritized, thereby reducing errors and ambiguities in rewriting, optimizing the selection of rewriting models, and improving text quality and system robustness. In addition, this method also ensures efficient use of resources and optimization of processing procedures through a systematic priority evaluation model, thereby greatly improving the overall effect and efficiency of the rewriting process.
[0056] S6, passing the pre-rewriting text segment set through several different types of rewriting large models to generate pre-rewriting results.
[0057] In this embodiment, the purpose of generating pre-rewriting results by passing the pre-rewriting text segment set through several different types of rewriting models is: Comparing rewriting results: By rewriting the same pre-rewritten text snippet using different types of large models, we can compare the performance of these models on the text snippet; this allows us to evaluate each model’s ability to preserve the original meaning of the text, generate natural language expressions, and accurately handle specific tasks; Select the best model: Different large models have different strengths and scopes of application. By inputting the pre-rewritten text fragment sets into these models respectively, we can obtain the rewriting results generated by each model and select the model with the best effect to ensure the quality and accuracy of the final rewriting results. Identify model strengths: Different models may perform differently when processing different types of text segments. By evaluating the pre-rewriting results, you can identify the strengths and weaknesses of each model and then select the most appropriate model based on the characteristics and requirements of the text segment. Optimize rewriting strategies: Analyzing the pre-rewriting results of each model can help formulate more effective rewriting strategies, such as adjusting model parameters and selecting specific rewriting strategies, to improve the overall effect of the rewriting process and the reliability of the system; Reducing rewriting errors: Through multi-model comparison, potential errors and ambiguities in the rewriting process can be identified and reduced; selecting the model with the most accurate rewriting results can minimize the deviation from the original text meaning, thereby improving the accuracy of subsequent steps and the overall performance of the system.
[0058] The different types of rewriting models have their own unique characteristics and advantages in the field of natural language processing. Generally speaking, these models can be divided into the following categories: Rule-based rewriting models: These models rely on predefined language rules and templates to rewrite text through pattern matching and rule application; they are suitable for structured text or tasks that need to follow a specific format, but they are less flexible.
[0059] Statistical-based method models: Use statistical language models (such as n-gram models) to rewrite text. These models capture the statistical laws of vocabulary and syntax by analyzing large amounts of text data. Although the effect is better on large-scale data sets, their ability to handle rare or complex texts is limited.
[0060] Neural network-based generative models: Such as Seq2Seq models and Transformers, these deep learning models can generate more natural language expressions; in particular, models such as GPT and BERT, which use large-scale pre-training and contextual understanding capabilities, can generate high-quality text rewrites and adapt to multiple language tasks.
[0061] Reinforcement Learning Models: These models use reinforcement learning techniques to optimize rewriting, improve the quality of text rewriting through continuous trial and error and feedback mechanisms, and can gradually adjust the rewriting strategy to improve the relevance and accuracy of the results.
[0062] Each type of rewriting model has its applicable scenarios and advantages and disadvantages. The selection of a suitable model can be determined based on specific task requirements, text characteristics, and expected effects.
[0063] S7, performing quality assessment on the pre-rewriting results to obtain the best rewriting large model.
[0064] In this embodiment, the quality of the pre-rewriting results is evaluated to obtain the best rewriting model, specifically: Passing the pre-rewritten text segment set through several different types of rewriting large models respectively, generating pre-rewriting results for each model; the pre-rewriting results include the output of the model after rewriting the same text segment; Use BLEU score to evaluate the similarity between the paraphrase text and the reference answer, measuring the degree of vocabulary and phrase matching of the text; The ROUGE score was used to calculate the number of overlapping words, phrases, and sentences between the rewritten text and the reference text to assess the coverage of the text; Calculate the perplexity of the rewritten text and evaluate the naturalness of the generated text; The perplexity and coverage of the pre-rewriting results and the degree of vocabulary and phrase matching of the text are weighted and summed, and the rewriting model corresponding to the best pre-rewriting result is selected as the best rewriting model.
[0065] S8, rewrite the text to be retrieved through the optimal rewriting model and perform intelligent search.
[0066] This embodiment generates pre-rewriting results by passing the pre-rewriting text fragment set through several different types of rewriting large models, with the aim of comparing rewriting effects, selecting the best model, identifying model advantages, optimizing rewriting strategies, and reducing rewriting errors. Specifically, by evaluating the rewriting results generated by different models, we can fully understand the performance of each model in maintaining the original meaning of the text, natural language generation, and task processing accuracy, so as to select the model with the best effect. In addition, by analyzing the characteristics of the rewriting results, we can further optimize the rewriting strategy to ensure the accuracy and robustness of the system when processing text. The rewriting large models used include rule-based models, statistical method models, neural network generation models, and reinforcement learning models, each of which has its specific advantages and scope of application. Finally, the rewriting results are evaluated for quality through BLEU scores, ROUGE scores, and perplexity calculations to select the best rewriting large model, thereby improving the quality of text rewriting and the accuracy of intelligent search. The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.
[0067] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented by software, the above embodiments may be implemented in whole or in part in the form of a computer program product.
[0068] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0069] In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0070] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0071] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. An intelligent search method based on retrieval enhancement generation, characterized in that: The steps include: Obtain the text to be retrieved, and perform text segmentation on the text to be retrieved based on NLP to obtain several text fragments, and then label and construct a text fragment set; Performing text feature extraction on each text segment in the segment set to obtain text feature data of each text segment; Perform data analysis based on text feature data to obtain feature deviation data for each text segment; Obtaining discrete data and text quality data of text segments, building a text segment priority evaluation model based on a neural network algorithm in combination with feature deviation data, and obtaining the text segment rewriting priority of each text segment; Obtaining a set of pre-rewritten text segments according to a preset number of pre-rewritten text segments and a rewriting priority of the text segments; The pre-rewritten text segment set is passed through several different types of rewriting large models to generate pre-rewriting results; Conduct quality assessment on the pre-rewriting results to obtain the best rewriting model; The text to be retrieved is rewritten through the optimal rewriting model and then intelligently searched.
2. The intelligent search method based on retrieval enhancement generation according to claim 1 is characterized in that: The text segmentation based on NLP is performed to obtain several text fragments, specifically: Performing text preprocessing on the text to be retrieved, wherein the text preprocessing includes noise removal and standardization; The preprocessed text to be retrieved is segmented into sentences based on spaCy and paragraphs based on NLTK to obtain several first text fragments; Performing semantic segmentation on the first text segments based on NLP to obtain second text segments; The second text segment is assigned a unique identifier, and a text segment set is constructed.
3. The intelligent search method based on retrieval enhancement generation according to claim 2 is characterized in that: The feature deviation data includes feature deviation coefficients, the discrete data includes discrete influence coefficients and the text quality data includes text segment signal-to-noise ratio influence coefficients.
4. The intelligent search method based on retrieval enhancement generation according to claim 3 is characterized in that: The specific method for obtaining the characteristic deviation coefficient is as follows: Obtain feature vectors corresponding to text feature data of several text segments; Calculate the cosine similarity between each text segment and the feature vectors corresponding to other text segments; Get the average cosine similarity, maximum cosine similarity and minimum cosine similarity of the feature vectors corresponding to each text segment; The feature deviation coefficient is calculated based on the average cosine similarity, the maximum cosine similarity and the minimum cosine similarity based on a preset feature deviation coefficient calculation formula.
5. The intelligent search method based on retrieval enhancement generation according to claim 4 is characterized in that: The specific method for obtaining the discrete influence coefficient is as follows: Acquire a discrete data set, the discrete data set comprising word frequency, vocabulary distribution, and discrete features; Calculate the discreteness of each discrete data in the discrete data set based on frequency distribution and coefficient of variation; For each text segment, count the frequency of occurrence of specific discrete features to obtain the word frequency of the text segment; The standard deviation and mean of the word frequency of the text fragments are calculated, and the dispersion is combined to calculate the dispersion influence coefficient.
6. The intelligent search method based on retrieval enhancement generation according to claim 5 is characterized in that: The specific method for obtaining the text segment signal-to-noise ratio influence coefficient is as follows: Obtain signal feature vectors and noise feature vectors of text feature data; Calculate the signal mean vector of the signal feature, and calculate the signal covariance matrix of the signal feature as the statistic of the signal feature; Calculate the noise mean vector of the noise feature, and calculate the noise covariance matrix of the noise feature as the statistic of the noise feature; Calculate the difference in mean vectors of signal and noise and the difference in covariance matrices of signal and noise; The ratio of the mean vector difference to the covariance matrix difference is taken as the signal-to-noise ratio influence coefficient.
7. The intelligent search method based on retrieval enhancement generation according to claim 6 is characterized in that: The text segment priority evaluation model is specifically: The acquired feature deviation coefficient, discrete influence coefficient and signal-to-noise ratio influence coefficient are used to establish a text segment priority evaluation model to generate the text segment rewriting priority; The calculation formula of the text segment rewriting priority is as follows: In the formula, YA is the rewriting priority of the text segment, is the preset proportionality factor of the characteristic deviation coefficient, is the discrete influence coefficient, is the preset proportional coefficient of the signal-to-noise ratio influence coefficient, is the characteristic deviation coefficient, is the discrete influence coefficient, is the signal-to-noise ratio influence coefficient.
8. The intelligent search method based on retrieval enhancement generation according to claim 7 is characterized in that: The method of obtaining a set of pre-rewritten text segments according to the preset number of pre-rewritten text segments combined with the rewriting priority of the text segments is as follows: Sort all text segments in ascending order based on the corresponding text segment rewriting priorities to obtain a text segment rewriting sorting table; According to the preset number of pre-rewritten text segments, text segments are selected from the text segment rewriting sorting table from top to bottom for pre-text rewriting.
9. The intelligent search method based on retrieval enhancement generation according to claim 8, characterized in that: The quality of the pre-rewriting results is evaluated to obtain the best rewriting model, specifically: The pre-rewriting text segment set is passed through several different types of rewriting large models to generate pre-rewriting results for each model; the pre-rewriting results include the output of the model after rewriting the same text segment; Use BLEU score to evaluate the similarity between the paraphrase text and the reference answer, measuring the degree of vocabulary and phrase matching of the text; The ROUGE score was used to calculate the number of overlapping words, phrases, and sentences between the rewritten text and the reference text to assess the coverage of the text; Calculate the perplexity of the rewritten text and evaluate the naturalness of the generated text; The perplexity and coverage of the pre-rewriting results and the degree of vocabulary and phrase matching of the text are weighted and summed, and the rewriting model corresponding to the best pre-rewriting result is selected as the best rewriting model.
10. The intelligent search method based on retrieval enhancement generation according to claim 9, characterized in that: The specific calculation formula of the cosine similarity between the feature vectors is as follows: The specific calculation formula of the average cosine similarity is: The specific calculation formula of the characteristic deviation coefficient is: In the formula, is the cosine similarity between the feature vectors of the i-th text segment and the j-th text segment, is the kth vector value of the feature vector corresponding to the i-th text segment, is the kth vector value of the feature vector corresponding to the jth text segment, m is the dimension of the feature vector, is the average cosine similarity of the ith text segment, N is the total number of text segments, is the feature vector of the i-th text segment, is the feature vector of the jth text segment, is the characteristic deviation coefficient, is the maximum cosine similarity of the i-th text segment, is the minimum cosine similarity of the i-th text segment.
Citation Information
Patent Citations
Dialogue question and answer method and device based on artificial intelligence, computer equipment and medium
CN116680385A
Retrieval enhancement generation method based on text rewriting
CN118152521A
Diversity-enhanced text retrieval enhancement generation method and system
CN118260406A
Intelligent document retrieval generation method and system based on RAG technology
CN118332072A
Text generation method and device, computer program product, electronic equipment and medium
CN118396123A
Cited By
Searching method and device, equipment and storage medium
CN119646118A
Search method, device, equipment and storage medium
CN119646118B
Intelligent education platform interaction method and system based on child voice behavior analysis
CN119760139A
Text semantic partitioning method and device, equipment, medium and product
CN120031046A
