Text retrieval method, apparatus, device, medium and product
By filtering and integrating document and paragraph similarity in text retrieval, and combining vector and BM25 algorithms, answers are generated using a large language model. This solves the problems of high workload and low accuracy in building question-answer pairs in existing technologies, and achieves more efficient and accurate text retrieval.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA CONSTRUCTION BANK
- Filing Date
- 2023-08-29
- Publication Date
- 2026-05-05
AI Technical Summary
Existing text retrieval technologies suffer from high workload and low retrieval accuracy when processing large amounts of risk policy and institutional documents, especially when the question format is different, making it difficult to find relevant answers.
By obtaining the similarity between the user's input target question and the preset knowledge base documents, relevant documents are initially screened. After the user selects the target document, the document and paragraphs are further retrieved based on the similarity algorithm. Combining vector retrieval and the BM25 algorithm, the information of the most similar paragraphs is integrated, and the answer is generated using a large language model.
It improves the accuracy and recall of text retrieval, reduces the cost of manual annotation, and ensures the accuracy of answers under different question formats.
Smart Images

Figure CN116932701B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information retrieval technology, and in particular to a text retrieval method, apparatus, device, medium and product. Background Technology
[0002] For policy documents, the same question may often lead to multiple document searches. For example, policies from different years or different policy categories (operation manuals, notices, management regulations, etc.) may contain similar content, and the accurate answer is usually found in one of these documents. Current search technologies typically construct question-answer pairs and match similar questions based on text similarity to obtain the corresponding answers. However, this method is labor-intensive for constructing question-answer pairs for a large number of risk policy documents, and it is easy to fail to retrieve relevant answers when the question is phrased differently, resulting in poor search accuracy. Summary of the Invention
[0003] This application provides a text retrieval method, apparatus, device, medium, and product that can improve the accuracy of text retrieval.
[0004] In a first aspect, embodiments of this application provide a text retrieval method, the method comprising:
[0005] The system obtains multiple first similarities between the user's input target question and various documents in a pre-defined knowledge base.
[0006] Select at least two first documents that meet preset rules from multiple documents with first similarity scores for the user to choose from. The preset knowledge base includes first documents.
[0007] Receive first input sent by the user, the first input being used to select a first target document from a plurality of first documents;
[0008] In response to the first input, based on the first similarity algorithm, multiple second similarities are determined between the target question and each paragraph in the first target document, and based on the second similarity algorithm, multiple third similarities are determined between the target question and each paragraph in the first target document.
[0009] For each second similarity, select the first target similarity in the top N positions of the second similarity in descending order; and for each third similarity, select the second target similarity in the top N positions of the third similarity in descending order, where N is a positive integer greater than 1.
[0010] By integrating the first paragraph corresponding to the first target similarity and the second paragraph corresponding to the second target similarity, we obtain the target answer corresponding to the target question.
[0011] Secondly, this application provides a text retrieval device, the device comprising:
[0012] The acquisition module is used to obtain multiple first similarities between the user-input target question and each document in the preset knowledge base;
[0013] The first selection module is used to select at least two first documents that meet preset rules from multiple documents corresponding to first similarity for the user to choose from. The preset knowledge base includes first documents.
[0014] The receiving module is used to receive the first input sent by the user, which is used to select a first target document from a plurality of first documents;
[0015] A determination module is configured to, in response to a first input, determine multiple second similarities between the target question and each paragraph in the first target document based on a first similarity algorithm, and determine multiple third similarities between the target question and each paragraph in the first target document based on the second similarity algorithm;
[0016] The second selection module is used to select the first target similarity in the top N positions of the second similarity in descending order for each second similarity, and to select the second target similarity in the top N positions of the third similarity in descending order for each third similarity, where N is a positive integer greater than 1.
[0017] The integration module is used to integrate the first paragraph corresponding to the first target similarity and the second paragraph corresponding to the second target similarity to obtain the target answer corresponding to the target question.
[0018] Thirdly, embodiments of this application provide an electronic device, which includes: a processor and a memory storing computer program instructions;
[0019] When the processor executes computer program instructions, it implements the text retrieval method as described in any of the embodiments of the first aspect.
[0020] Fourthly, embodiments of this application provide a computer storage medium storing computer program instructions, which, when executed by a processor, implement the text retrieval method as described in any of the embodiments of the first aspect.
[0021] Fifthly, embodiments of this application provide a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform a text retrieval method as described in any of the embodiments of the first aspect above.
[0022] In a text retrieval method, apparatus, device, medium, and product provided in this application embodiment, multiple first similarities are obtained between a user-input target question and each document in a preset knowledge base; at least two first documents that conform to preset rules are selected from the documents corresponding to the multiple first similarities for the user to choose from, the preset knowledge base including the first documents; a first input sent by the user is received, the first input being used to select a first target document from the multiple first documents; in response to the first input, multiple second similarities are determined between the target question and each paragraph in the first target document based on a first similarity algorithm, and multiple third similarities are determined between the target question and each paragraph in the first target document based on a second similarity algorithm; for each second similarity, the first target similarity ranked in the top N positions of the second similarity is selected in descending order, and for each third similarity, the second target similarity ranked in the top N positions of the third similarity is selected in descending order, where N is a positive integer greater than 1; the first paragraph corresponding to the first target similarity and the second paragraph corresponding to the second target similarity are integrated to obtain the target answer corresponding to the target question. By using the above method, multiple primary documents are first retrieved based on the target question for the user to choose from. The user then selects the most relevant document from the primary documents retrieved, and further searches are conducted based on the selected primary target document to obtain the target answer, thereby improving the accuracy of the search. Attached Figure Description
[0023] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a flowchart illustrating a text retrieval method provided in one embodiment of this application;
[0025] Figure 2 This is another flowchart illustrating a text retrieval method provided in one embodiment of this application;
[0026] Figure 3 This is a schematic diagram of a process for determining a first document provided in one embodiment of this application;
[0027] Figure 4 This is a schematic diagram of a process for determining a first paragraph and a second paragraph according to an embodiment of this application;
[0028] Figure 5 This is a schematic diagram of a process for generating a target answer provided in one embodiment of this application;
[0029] Figure 6This is a schematic diagram of a process for constructing a preset knowledge base according to an embodiment of this application;
[0030] Figure 7 This is a schematic diagram of the structure of a text retrieval device provided in an embodiment of this application;
[0031] Figure 8 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0032] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0033] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0034] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the term "comprising" or any other variations thereof is intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0035] It should be noted that the acquisition, storage, use, and processing of data in the technical solution of this application all comply with the relevant provisions of national laws and regulations.
[0036] Current document content retrieval typically relies on keyword matching and full-text search using a search engine like Elasticsearch (ES) to find relevant information. This method requires keywords to match the original text, leading to the inability to retrieve accurate information with similar wording but different expressions. Vector-based retrieval alone often fails to locate precise paragraphs with a large volume of documents and is prone to finding incorrect documents. Question-answer pairs are another approach, matching similar questions based on text similarity to obtain corresponding answers. However, this method suffers from drawbacks: for a large number of risk policy documents, the workload for constructing question-answer pairs is substantial, and different question formats can lead to unrelevant answers. Using pre-trained Chinese language models (Bidirectional Encoder Representations from Transformers, BERT) requires a large amount of labeled data, resulting in high manual costs.
[0037] To address the problems of the prior art, embodiments of this application provide a text retrieval method, apparatus, device, medium, and product. The text retrieval method provided in this application embodiment is described below first.
[0038] Figure 1 A flowchart illustrating a text retrieval method according to an embodiment of this application is shown. Figure 1 As shown, the method may specifically include the following steps:
[0039] S100, obtain the target question input by the user and its first similarity to each document in the preset knowledge base.
[0040] Optionally, in this embodiment, an input box or other interactive element can be provided on the user interface for the user to input a question or query. This interface can be a web application, a mobile application, or other form of user interface. Input events on the user interface are then listened to; when the user enters a question in the input box, the text content entered by the user, i.e., the target question, is obtained.
[0041] Optionally, in this embodiment, the target question input by the user first needs to undergo text preprocessing. This includes operations such as word segmentation, stop word removal, and stemming to convert the document content into a vector representation that allows for similarity calculation. Next, using the same method as preprocessing, the documents in the preset knowledge base are converted into vector representations that allow for similarity calculation. Subsequently, by calculating the similarity between the target question's vector and each document's vector, for example using cosine similarity, a first similarity score can be obtained between the target question and each document. These similarity values can represent the degree of relevance between the target question and the document, and are used for document filtering and ranking in subsequent steps.
[0042] S200: Select at least two first documents that meet preset rules from multiple documents corresponding to the first similarity for the user to choose from. The preset knowledge base includes the first documents.
[0043] Optionally, in this embodiment, the relative order of documents can first be obtained based on the previously calculated first similarity. Then, documents meeting the criteria are filtered out based on defined preset rules. For example, the first document corresponding to the top 5 paragraphs with the highest similarity can be filtered out for the user to select in subsequent steps. Then, necessary information, such as the document title, abstract, and keywords, is extracted from the selected documents. This information is displayed to the user during the selection process, allowing the user to decide which document to choose. Subsequently, document information matching the rules is displayed to the user for selection. Specifically, document information can be displayed on the user interface, allowing the user to make a selection according to their needs.
[0044] S300 receives a first input sent by the user, the first input being used to select a first target document from a plurality of first documents.
[0045] Optionally, in this embodiment, an input box or other interactive element can be provided on the user interface for the user to select a first target document from multiple first documents. This interface can be a web application, mobile application, or other form of user interface. Input events on the user interface are then listened to, and when the user selects a first target document in the interactive interface, the user's selection is obtained. The user input is then passed to the backend for processing. The backend can be a server, application, or other processing environment for the subsequent document selection process. The frontend user selects the first target document from the aforementioned user interface based on the returned first document name and corresponding document category.
[0046] S400, in response to the first input, determines multiple second similarities between the target question and each paragraph in the first target document based on the first similarity algorithm, and determines multiple third similarities between the target question and each paragraph in the first target document based on the second similarity algorithm.
[0047] Optionally, in one possible implementation of this application, the first target document can be segmented into multiple paragraphs or sentences based on document format, paragraph separators, etc., so that similarity calculation can be performed on each paragraph. Then, each paragraph of the first target document can be processed to make it suitable for similarity calculation. For each paragraph, it is segmented and vectorized to obtain a paragraph vector representation. Then, a similarity calculation method, such as cosine similarity, can be used to calculate the second similarity between the user-input target question and each paragraph. Furthermore, the BM25 algorithm, i.e., the second similarity algorithm, can be used to calculate the third similarity between the target question and each paragraph of the first target document, taking into account keyword matching.
[0048] S500: For each second similarity, select the first target similarity in the top N positions of the second similarity in descending order; and for each third similarity, select the second target similarity in the top N positions of the third similarity in descending order, where N is a positive integer greater than 1.
[0049] Optionally, in this embodiment, after receiving the first target document from the user's front end, a second search can be performed based on the content of the first target document. Specifically, the text paragraphs in the first target document can first be vectorized, and then vector similarity calculation (i.e., the first similarity algorithm) can be performed with the question, selecting the two paragraphs A and B with the highest similarity. Simultaneously, based on the BM25 algorithm (i.e., the second similarity algorithm), the two paragraphs C and D with the highest similarity are selected. After deduplication of paragraphs A, B, C, and D, they are merged into the final search results. In these optional embodiments, the combination of vector search and BM25 (keyword search) methods can improve the recall rate of the search and further improve the accuracy of text retrieval.
[0050] S600, integrate the first paragraph corresponding to the first target similarity and the second paragraph corresponding to the second target similarity to obtain the target answer corresponding to the target question.
[0051] Optionally, in one possible implementation of this application, the first paragraph corresponding to the first target similarity and the second paragraph corresponding to the second target similarity can be integrated firstly. Specifically, the user-input target question, the first paragraph, and the second paragraph can be input into a large language model. Utilizing the inductive and summarizing capabilities of the large language model, a more accurate answer can be extracted and returned to the front end. This answer comprehensively utilizes the document and paragraph information selected by the user, as well as the results of similarity calculation, to provide the user with possible solutions. This improves the accuracy of text retrieval.
[0052] Optionally, such as Figure 2As shown, in one specific embodiment of this application, ① the user first enters the target question in the dialog box on the front end. For example, entering: "Principles of collateral management". ② Subsequently, based on a preset knowledge base, the vector similarity between the target question and the text in the preset knowledge base is calculated. The similarity is sorted, and the top 20 paragraphs are selected. The documents corresponding to the retrieved paragraphs are statistically analyzed, and the top 5 documents with the highest similarity are selected and their categories are displayed for the front end user's reference. ③ The front end user selects the document name most likely to appear in the first returned document based on the document name and corresponding document category. ④ After receiving the document name of the first target document from the front end, a second search is performed based on the content of the first target document. Specifically, the text paragraphs in the first target document are vectorized, and then the vector similarity with the target question is calculated. The two paragraphs with the highest similarity, A and B, are selected. At the same time, based on the BM25 algorithm, the two paragraphs with the highest similarity, C and D, are selected. After deduplication of paragraphs A, B, C, and D, their respective contexts are concatenated and merged into the final search result. This approach combines vector retrieval and keyword retrieval (BM25) to improve retrieval recall. ⑤ Based on the text information retrieved in ④, a prompt is constructed. A prompt is instructive text used to guide the model to generate a specific type of response or produce the required information. Appropriate prompts can be used to guide the model to generate specific answers or complete specific tasks. The prompt is then fed into a large language model, leveraging its inductive and summarizing capabilities to extract more accurate answers, which are then returned to the front end. ⑥ If the user is not satisfied with the results, they can return to step ③ to reselect a document and then proceed to steps ④ and ⑤.
[0053] In a text retrieval method provided in this application embodiment, multiple first similarities are obtained between the target question input by the user and each document in a preset knowledge base; at least two first documents that conform to preset rules are selected from the documents corresponding to the multiple first similarities for the user to choose from, the preset knowledge base includes first documents; a first input sent by the user is received, the first input being used to select a first target document from the multiple first documents; in response to the first input, multiple second similarities are determined between the target question and each paragraph in the first target document based on a first similarity algorithm, and multiple third similarities are determined between the target question and each paragraph in the first target document based on a second similarity algorithm; for each second similarity, the first target similarity ranked in the top N positions of the second similarity is selected in descending order, and for each third similarity, the second target similarity ranked in the top N positions of the third similarity is selected in descending order, where N is a positive integer greater than 1; the first paragraph corresponding to the first target similarity and the second paragraph corresponding to the second target similarity are integrated to obtain the target answer corresponding to the target question. By using the above method, multiple primary documents are first retrieved based on the target question for the user to choose from. The user then selects the most relevant document from the primary documents retrieved, and further searches are conducted based on the selected primary target document to obtain the target answer, thereby improving the accuracy of the search.
[0054] In one embodiment, step 100 described above may specifically be performed as follows:
[0055] S110: For each third paragraph in the preset knowledge base, obtain the first vector similarity between the third paragraph and the target question. The third paragraph is any paragraph in any document in the preset knowledge base.
[0056] Optionally, in this embodiment, it is necessary to calculate the first vector similarity between each third paragraph (any paragraph in any document) in the preset knowledge base and the target question. Specifically, both the third paragraph and the target question can be converted into vector representations, and their similarity can be calculated. First, the target question can be preprocessed, including word segmentation, stop word removal, and lemmatization, to convert the question into a vector that can be used for similarity calculation. Next, for each third paragraph in the preset knowledge base, similar preprocessing can be performed to convert the paragraph content into a vector representation. Then, using a pre-trained text embedding model, the question vector and paragraph vector are projected into the same vector space. Subsequently, a cosine similarity algorithm is used to measure the angle between the two vectors; the smaller the angle, the more similar the vectors are. By calculating the cosine similarity between the target question vector and each third paragraph vector, the first vector similarity between the target question and the third paragraph can be obtained.
[0057] In these alternative embodiments, the semantic relevance between the question and the paragraphs can be quantified by calculating the vector similarity between each third paragraph and the target question. This helps to accurately identify the paragraphs most relevant to the user's question, thereby improving retrieval accuracy, ensuring that users receive answers that meet their needs, and providing a data foundation for subsequent steps of filtering and ranking.
[0058] In one embodiment, step 200 above may specifically be performed as follows:
[0059] S210, for each first vector similarity, select the third target similarity in the first K positions in descending order of the first vector similarity, where K is a positive integer greater than 1.
[0060] Optionally, in this embodiment, the similarity of each first vector can be sorted from largest to smallest. Then, the top K similarity values are selected from the sorted similarity list; these similarity values correspond to the third target similarity. This yields the top K most similar third target similarities, which will be used for document and paragraph filtering in subsequent steps.
[0061] S220, for each third target similarity, obtain the reference document to which the paragraph corresponding to the third target similarity belongs, and each reference document corresponds to at least one third target similarity.
[0062] Optionally, in this embodiment, for each third target similarity, the paragraph to which it belongs is determined, and the reference document to which it belongs is obtained from that paragraph. The same reference document may correspond to multiple third target similarities because multiple paragraphs may belong to the same document. In this way, an association can be established between each third target similarity and its corresponding reference document.
[0063] S230, for each reference document, the reference similarity corresponding to the reference document is assigned to the maximum similarity, and the maximum similarity is the similarity corresponding to the maximum value among the third target similarities of the reference document.
[0064] Optionally, in this embodiment, for each reference document, all its corresponding reference similarities are assigned, that is, these similarities are matched with the maximum value among their corresponding third target similarities. This ensures that each reference document is associated with its most relevant third target similarity.
[0065] S240, for each reference similarity, select the fourth target similarity in the first M positions of the reference similarity in descending order, where M is a positive integer greater than 1 and M is less than or equal to K.
[0066] S250, the reference document corresponding to the fourth target similarity is used as the first document.
[0067] Optionally, in this embodiment, for each reference similarity, the top M reference similarity values are selected in descending order, and these reference similarity values correspond to the fourth target similarity. Finally, the reference document corresponding to the fourth target similarity is used as the first document. The above steps help optimize the document selection and information extraction process, improve the accuracy of retrieval and the precision of answer generation, thereby better meeting user needs.
[0068] Optionally, in one specific embodiment of this application, such as Figure 3 As shown, the process first retrieves the documents most likely to contain the answer to the target question. Specifically, ① First, the similarity between the target question and paragraphs in a preset knowledge base is calculated, and a similarity threshold is set. Paragraphs that do not meet the threshold range are filtered out, and the paragraphs are sorted based on similarity to obtain the K paragraphs with the highest similarity. K can be set to 20. It should be noted that the value of K in this application is only illustrative, and K can be any positive integer greater than 1. ② Then, for these 20 paragraphs with the highest similarity, the document sources after sorting by paragraph similarity from high to low are deduplicated, and the top 5 document names with the highest similarity and their corresponding document categories are taken. For example, if it is assumed that these 20 paragraphs come from 10 different documents, the top 5 different documents are taken; if the 20 paragraphs come from 3 different documents, 3 document names are obtained. These are returned to the front end for display. ③ Then, the user selects a document name on the front end, which is returned to the model, and the model then performs a search within that document.
[0069] In these alternative embodiments, for policy documents, the same question may often lead to multiple document searches. For example, policies from different years or different policy categories (operation manuals, notices, management regulations, etc.) may contain similar content, and the accurate answer is often found in one of these documents. This application addresses document retrieval by establishing a front-end feedback mechanism that allows business personnel to select the most relevant document from the retrieved document names and corresponding document categories. Then, based on the selected document, further searches are performed to find content related to the question, thereby improving the accuracy of the search.
[0070] In one embodiment, step 400 above may specifically be performed as follows:
[0071] S410, in response to the first input, using a vector similarity algorithm, determine multiple second vector similarities between the target question and each paragraph in the first target document, wherein the first similarity algorithm is a vector similarity algorithm and the second similarity is a second vector similarity;
[0072] S420 uses the BM25 similarity algorithm to determine multiple similarity scores between the target question and each paragraph in the first target document. The second similarity algorithm is the BM25 similarity algorithm, and the third similarity is the similarity score.
[0073] Alternatively, in one possible implementation of this application, such as Figure 4 As shown, within the document selected by the user (i.e., the first target document), vector similarity and BM25 algorithm similarity calculations are performed between the target question and each paragraph of the first target document. The two paragraphs with the highest similarity are obtained, totaling four paragraphs. After deduplication, the context information of each paragraph is obtained, with the preceding context not exceeding 100 characters and the following context not exceeding 500 characters. This concatenated information serves as the document retrieval information for the user question.
[0074] Alternatively, in another possible implementation of this application, a pre-trained text vectorization model can be used first to convert the target question and each paragraph in the first target document into vector representations. Then, a cosine similarity calculation method is used to calculate the similarity score between the question vector and each paragraph vector. Subsequently, the BM25 algorithm is used to calculate the similarity score between the question and each paragraph. BM25 considers the frequency of keyword occurrences in the document to score the degree of matching between the question and the paragraph. These two steps employ different similarity algorithms in the document retrieval module, calculating the similarity score between the question and each paragraph in the first target document respectively. By comprehensively considering different similarity calculation methods, more accurate paragraph filtering results can be obtained, further improving the quality of answer generation.
[0075] In these alternative embodiments, combining vector retrieval with the BM25 algorithm extracts the most similar paragraphs, improving recall. Furthermore, by splicing context, richer information is obtained, further improving the accuracy of text retrieval. A front-end feedback mechanism is set up, allowing business personnel to select the most relevant documents from the retrieved document names and corresponding document categories, and then perform searches for content related to the question based on the selected documents, thereby improving retrieval accuracy.
[0076] In one embodiment, step 600 above may specifically be performed as follows:
[0077] S610, For each first paragraph corresponding to the first target similarity, concatenate the first paragraph and the paragraphs adjacent to the first paragraph to form the first answer;
[0078] S620, for each second paragraph corresponding to the second target similarity, concatenate the second paragraph and the paragraph adjacent to the second paragraph to form the second answer;
[0079] S630, when the first and second answers are related to the target question, integrate the first and second answers through a preset language model to obtain the target answer corresponding to the target question.
[0080] Optionally, in one possible implementation of this application, after obtaining the two paragraphs with the highest similarity using the first and second similarity algorithms (i.e., a total of four paragraphs), and removing duplicates, the context information of each paragraph is obtained, with the preceding information not exceeding 100 characters and the following information not exceeding 500 characters. This concatenated information serves as the document retrieval information for the user's target question. A prompt is then constructed. The prompt is: {context}\nquestion: {query}. If the answer is not within the context, i.e., the first and second answers obtained above are irrelevant to the user's target question, the answer is "don't know". Here, context refers to the first and second answers, and query refers to the user's target question. If the first and second answers obtained above are relevant to the user's target question, a Large Language Model (LLM) is invoked. Utilizing the LLM's inductive and information extraction capabilities, the target answer for the target question is extracted from the first and second answers and returned to the front end for display to the user. The model parameters are adjusted to ensure that the returned answer, based on the retrieved information, does not over-elaborate.
[0081] Optionally, in another possible implementation of this application, firstly, based on the positional information of the first paragraph corresponding to the first target similarity, its adjacent previous and next paragraphs can be determined. Then, the contents of the previous paragraph, the first target paragraph, and the next paragraph are concatenated to form a complete paragraph, which serves as the first answer. This concatenation process can be achieved through simple string concatenation operations, ensuring the coherence and contextual relevance between paragraphs. The concatenation method for each second paragraph is similar to that for the first answer, and will not be elaborated here. Subsequently, it is determined whether the first and second answers are relevant to the target question. This can be determined by judging whether the first and second answers contain keywords or relevant information about the question. If relevant, the first and second answers are then integrated using a preset language model to obtain the final target answer. Integration can be achieved by using the first and second answers as context and the question as a prompt, inputting them into a preset language model (such as an LLM model) to allow the model to generate a more accurate answer. The generated answer can better answer the user's question based on the model's understanding and summarization ability of the context.
[0082] In these alternative embodiments, pre-trained models often require extensive training on labeled data to extract information. Large language models, however, contain a wealth of built-in knowledge, enabling zero-shot information induction and generation. This application utilizes large language models to extract and summarize information from large segments of retrieved text, resulting in more accurate information. By concatenating paragraphs and leveraging language models, the retrieved information is integrated to generate more accurate, coherent, and content-rich target answers, meeting users' information needs and improving the accuracy of text retrieval.
[0083] In one embodiment, after step 600 above, the method may further perform the following steps:
[0084] S601, Receive the second input sent by the user, the second input is used to obtain the first answer and the second answer corresponding to the target answer;
[0085] S602, in response to the second input, displays the first and second answers.
[0086] Optionally, in this embodiment, after obtaining the target answer, the user can also be shown the original document paragraph information, namely the first paragraph and the second paragraph. Specifically, the generated target answer can be compared with the first and second answers using cosine similarity calculation. The paragraph with the highest similarity is then returned to the front end for display. This step mainly aims to determine which paragraph the answer generated by the large model is most likely based on for extraction and summarization. The front end displays two parts: first, the answer generated by the large model based on the search results, i.e., the target answer; and second, the retrieved original paragraphs, i.e., the first and second paragraphs. The retrieved original paragraphs are not displayed directly, but only when the user clicks to retrieve the original text, and the user can preview the document containing the paragraph.
[0087] In these alternative embodiments, mechanisms for interaction and feedback between the user and the system are facilitated. By receiving a second input from the user, the system can understand whether the user is satisfied with the previously generated answer and whether further information or clarification is needed. The user can view the first and second answers, choose the one that best suits their needs, or provide feedback. This interaction increases the user-friendliness of the system, provides the original paragraph for the user to review, and improves the user experience.
[0088] In one embodiment, prior to step 100 above, the method may further perform the following steps:
[0089] S101, Obtain sample document.
[0090] Optionally, in this embodiment, it is first necessary to collect representative sample documents covering various aspects of the areas or topics that the system needs to process. These sample documents can come from various sources, such as internal bank risk policy documents, institutional documents, etc. The collected sample documents should cover different document formats, such as Word, PDF, text files, etc., to ensure that the system can process documents of different formats.
[0091] S102, classify the sample documents and store sample documents belonging to the same category in the same storage directory.
[0092] Optionally, in this embodiment of the application, the sample documents can be categorized based on their content and business knowledge during this step. Documents belonging to the same category are placed in the same storage directory for subsequent processing and retrieval. For example, risk management-related documents can be placed in one directory, and product management-related documents in another.
[0093] S103, unify the document format of the sample document to the preset format to obtain the first processed document.
[0094] Optionally, in this embodiment, the collected sample documents can be formatted uniformly, converting all documents into a preset uniform format to obtain a first processed document, such as converting various document formats into text format (txt). This facilitates subsequent text processing and vectorization.
[0095] S104, Remove redundant information from the first processed document to obtain the second processed document. The redundant information includes at least one of the following: document title, document directory, contact person, contact information, copy recipient, proofreader, and sender.
[0096] Optionally, in this embodiment, redundant information in the first processed document can be cleaned up. Redundant information may include the document's title, table of contents, contact information, etc., which may interfere with the system's performance in subsequent retrieval and processing. By removing this redundant information, cleaner text data can be obtained, which is helpful for subsequent processing and analysis.
[0097] S105, concatenate the title in the second processing document that is less than the preset number of characters with the text adjacent to the title to obtain the target processing document.
[0098] Optionally, in this embodiment, for paragraphs with short headings, they can be concatenated with adjacent text. This avoids the impact of excessively short headings on retrieval and processing performance while preserving the contextual information of the paragraphs. The concatenated text is the target document for processing.
[0099] S106, vectorize each paragraph in the target processing document to obtain a preset knowledge base. The preset knowledge base includes the category corresponding to the target processing document and the vector information corresponding to each paragraph in the target processing document.
[0100] Optionally, in this embodiment, each paragraph in the target document can be vectorized into text, converting the text into a vector representation. A pre-trained text vector model, such as a pre-trained Chinese text-to-vector model (text2vec-large-chinese), can be used to convert each paragraph into a corresponding vector. This vector representation can then be used for subsequent similarity calculations and retrieval. Simultaneously, each paragraph needs to be associated with its document category to construct a pre-defined knowledge base, providing foundational data for subsequent question retrieval.
[0101] Alternatively, in one possible implementation of this application, such as Figure 5 As shown, the process begins by collecting internal bank documents such as risk policy management, implementation guidelines, approval guidelines, credit policies, work guides, and notices. These documents are then categorized according to business knowledge and stored in different directories. For example, business personnel can define several main categories: risk management methods, product management methods, operation manuals, and approval guidelines. Document processing primarily includes: 1) Standardizing document formats. Collected document formats include compressed files, Word documents, Portable Document Format (PDF), plain text (txt), and spreadsheets (Excel). By decompressing and reading the document content, the file format is standardized to txt. 2) Based on the characteristics of policy documents, paragraphs are first created based on line breaks, and blank lines are removed. Since titles are often short, and the following paragraphs often explain and elaborate on the title, short titles can negatively impact search results, easily leading to irrelevant or incomplete short titles. Therefore, short titles shorter than a threshold (e.g., 10 Chinese characters) can be concatenated with the following text. 3) Processing irrelevant and redundant information. Remove unnecessary information such as file titles, directories, contact persons, contact information, CC, send, and proofreading details from the beginning of the document. Perform text vectorization. Read the text content from each document after processing. Based on the pre-trained model text2vec-large-chinese, vectorize the text segments and store them in a vector database (i.e., a pre-defined knowledge base). The vector database contains document path information (document classification information) and vector information for each text segment.
[0102] In these alternative embodiments, a standardized and organized text database is established, providing a rich data foundation for question retrieval; redundant information is removed, improving data quality; and text representation capabilities are enhanced through vectorization, providing a foundation for subsequent similarity calculation and retrieval, thereby helping to improve the system's efficiency, accuracy, and user experience.
[0103] Optionally, in this embodiment, the text processing of policy and institutional documents is affected by the varying sentence lengths, which can impact the accuracy of subsequent searches. Therefore, it is necessary to process the text and formulate segmentation rules based on the characteristics of policy documents within the industry. The text segments are then converted into vectors and stored in a vector retrieval library to accelerate fast and accurate information retrieval. This application utilizes the information extraction capabilities of a large language model to explore multiple possible prompts, selecting the optimal one to enable the large language model to output accurate answers. This application proposes a risk policy and institutional document question-and-answer system based on a combination of retrieval technology and a large model, tailored to the characteristics of institutional documents. This system allows risk managers to easily find relevant policy and institutional content through question-and-answer methods. This approach eliminates the need for manual question-and-answer pair construction. Furthermore, this invention segments the documents to address their specific characteristics, and the semantic similarity based on text vectorization allows for the retrieval of more relevant information. The inclusion of institutional classification and feedback mechanisms from business personnel further enhances the retrieval of more accurate documents and information. Finally, the summarizing and generalizing capabilities of the large model and a suitable prompt for the specific scenario are used to extract more precise answers.
[0104] Figure 7 A schematic diagram of the structure of a text retrieval device provided in another embodiment of this application is shown. For ease of explanation, only the parts related to the embodiments of this application are shown.
[0105] Reference Figure 7 The text retrieval device may include:
[0106] The acquisition module 701 is used to acquire multiple first similarities between the user-input target question and each document in the preset knowledge base;
[0107] The first selection module 702 is used to select at least two first documents that meet preset rules from multiple documents corresponding to first similarity for the user to choose from. The preset knowledge base includes the first documents.
[0108] The receiving module 703 is used to receive a first input sent by the user, the first input being used to select a first target document from a plurality of first documents;
[0109] The determination module 704 is configured to, in response to the first input, determine multiple second similarities between the target question and each paragraph in the first target document based on the first similarity algorithm, and determine multiple third similarities between the target question and each paragraph in the first target document based on the second similarity algorithm;
[0110] The second selection module 705 is used to select the first target similarity in the first N positions of the second similarity in descending order for each second similarity, and to select the second target similarity in the first N positions of the third similarity in descending order for each third similarity, where N is a positive integer greater than 1.
[0111] Integration module 706 is used to integrate the first paragraph corresponding to the first target similarity and the second paragraph corresponding to the second target similarity to obtain the target answer corresponding to the target question.
[0112] In one embodiment, the acquisition module 701 may include:
[0113] The first acquisition submodule is used to obtain the first vector similarity between the third paragraph and the target question for each third paragraph in the preset knowledge base. The third paragraph is any paragraph in any document in the preset knowledge base.
[0114] In one embodiment, the first selection module 702 may include:
[0115] The first selection submodule is used to select the third target similarity in the first K positions of the first vector similarity in descending order for each first vector similarity, where K is a positive integer greater than 1;
[0116] The second acquisition submodule is used to acquire the reference document to which the paragraph corresponding to the third target similarity belongs for each third target similarity, and each reference document corresponds to at least one third target similarity;
[0117] The first determining submodule is used to assign the reference similarity corresponding to each reference document to the maximum similarity, where the maximum similarity is the maximum value among the third target similarities corresponding to the reference document.
[0118] The second selection submodule is used to select the fourth target similarity in the first M positions of each reference similarity in descending order, where M is a positive integer greater than 1 and M is less than or equal to K.
[0119] The second determining submodule is used to take the reference document corresponding to the fourth target similarity as the first document.
[0120] In one embodiment, the determining module 704 may include:
[0121] The third determining submodule is used to respond to the first input by using a vector similarity algorithm to determine multiple second vector similarities between the target question and each paragraph in the first target document. The first similarity algorithm is a vector similarity algorithm, and the second similarity is a second vector similarity.
[0122] The fourth determination submodule is used to determine multiple similarity scores between the target question and each paragraph in the first target document using the BM25 similarity algorithm. The second similarity algorithm is the BM25 similarity algorithm, and the third similarity is the similarity score.
[0123] In one embodiment, the integration module 706 may include:
[0124] The first splicing submodule is used to splice the first paragraph and the paragraphs adjacent to the first paragraph into the first answer for each first target similarity.
[0125] The second splicing submodule is used to splice the second paragraph and the paragraphs adjacent to the second paragraph into a second answer for each second target similarity.
[0126] The first integration submodule is used to integrate the first and second answers, which are related to the target question, using a preset language model to obtain the target answer corresponding to the target question.
[0127] In one embodiment, the text retrieval device may further include:
[0128] The second receiving module is used to receive a second input sent by the user, which is used to obtain the first and second answers corresponding to the target answer.
[0129] The display module is used to display the first answer and the second answer in response to the second input.
[0130] In one embodiment, the text retrieval device may further include:
[0131] The second acquisition module is used to acquire sample documents;
[0132] The classification module is used to classify sample documents and store sample documents belonging to the same category in the same storage directory;
[0133] The first processing module is used to unify the document format of the sample documents to a preset format to obtain the first processed document;
[0134] The second processing module is used to remove redundant information from the first processed document to obtain the second processed document. The redundant information includes at least one of the following: document title, document table of contents, contact person, contact information, copy recipient, proofreader, and sender.
[0135] The third processing module is used to concatenate the title (which is less than a preset number of characters) in the second processing document with the text adjacent to the title to obtain the target processing document.
[0136] The fourth processing module is used to vectorize the text paragraphs in the target document to obtain a preset knowledge base. The preset knowledge base includes the category corresponding to the target document and the vector information corresponding to each paragraph in the target document.
[0137] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. They are devices corresponding to the above-mentioned battery thermal runaway early warning method. All implementation methods in the above-mentioned method embodiments are applicable to the embodiments of this device. For details on its specific functions and the technical effects it brings, please refer to the method embodiment section. It will not be repeated here.
[0138] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0139] Figure 8 A schematic diagram of the hardware structure of the electronic device provided in an embodiment of this application is shown.
[0140] The device may include a processor 801 and a memory 802 storing program instructions.
[0141] When processor 801 executes the program, it implements the steps in any of the above method embodiments.
[0142] For example, the program can be divided into one or more modules / units, one or more of which are stored in memory 802 and executed by processor 801 to complete this application. The one or more modules / units can be a series of program instruction segments capable of performing a specific function, which describe the execution process of the program in the device.
[0143] Specifically, the processor 801 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0144] Memory 802 may include mass storage for data or instructions. For example, and not limitingly, memory 802 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 802 may include removable or non-removable (or fixed) media. Where appropriate, memory 802 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 802 is non-volatile solid-state memory.
[0145] Memory may include read-only memory (ROM), random access memory (RAM), disk storage media devices, optical storage media devices, flash memory devices, and electrical, optical, or other physical / tangible memory storage devices. Therefore, typically, memory includes one or more tangible (non-transitory) readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the methods according to one aspect of this disclosure.
[0146] The processor 801 implements any of the methods described in the above embodiments by reading and executing program instructions stored in the memory 802.
[0147] In one example, the electronic device may also include a communication interface 803 and a bus 810. The processor 801, memory 802, and communication interface 803 are connected via the bus 810 and communicate with each other.
[0148] The communication interface 803 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.
[0149] Bus 810 includes hardware, software, or both, that couples components of an online data traffic metering device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 810 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, any suitable bus or interconnect is contemplated herein.
[0150] Furthermore, in conjunction with the methods in the above embodiments, this application embodiment can provide a storage medium for implementation. This storage medium stores program instructions; when these program instructions are executed by a processor, they implement any of the methods in the above embodiments.
[0151] This application also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0152] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0153] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above method embodiments and achieve the same technical effects. To avoid repetition, it will not be described again here.
[0154] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0155] The functional modules shown in the above block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on machine-readable media or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable media" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer grids such as the Internet, intranets, etc.
[0156] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0157] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to create a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0158] The above are merely specific embodiments of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. A text retrieval method, characterized in that, The method includes: The system obtains multiple first similarities between the user's input target question and various documents in a pre-defined knowledge base. At least two first documents that meet preset rules are selected from the plurality of documents corresponding to the first similarity for the user to choose from, and the preset knowledge base includes the first documents; Receive a first input sent by the user, the first input being used to select a first target document from a plurality of first documents; In response to the first input, based on a first similarity algorithm, multiple second similarities are determined between the target question and each paragraph in the first target document, and based on the second similarity algorithm, multiple third similarities are determined between the target question and each paragraph in the first target document. For each second similarity, select the first target similarity in the top N positions of the second similarity in descending order; and for each third similarity, select the second target similarity in the top N positions of the third similarity in descending order, where N is a positive integer greater than 1. By integrating the first paragraph corresponding to the first target similarity and the second paragraph corresponding to the second target similarity, the target answer corresponding to the target question is obtained; The step of determining multiple second similarities between the target question and each paragraph in the first target document based on a first similarity algorithm, and determining multiple third similarities between the target question and each paragraph in the first target document based on a second similarity algorithm, in response to the first input, includes: determining multiple second vector similarities between the target question and each paragraph in the first target document based on a vector similarity algorithm, wherein the first similarity algorithm is the vector similarity algorithm and the second similarity is the second vector similarity; and determining multiple similarity scores between the target question and each paragraph in the first target document based on a BM25 similarity algorithm, wherein the second similarity algorithm is the BM25 similarity algorithm and the third similarity is the similarity score.
2. The method according to claim 1, characterized in that, The target question obtained from user input is compared with multiple first similarities between each document in a preset knowledge base, including: For each third paragraph in the preset knowledge base, obtain the first vector similarity between the third paragraph and the target question, where the third paragraph is any paragraph in any document in the preset knowledge base; The step of selecting at least two first documents that meet preset rules from the plurality of documents corresponding to the first similarity for the user to choose from includes: For each first vector similarity, select the third target similarity in the first K positions in descending order of the first vector similarity, where K is a positive integer greater than 1; For each third target similarity, obtain the reference document to which the paragraph corresponding to the third target similarity belongs, and each reference document corresponds to at least one third target similarity; For each reference document, the reference similarity corresponding to the reference document is assigned to the maximum similarity, where the maximum similarity is the maximum value among the third target similarities corresponding to the reference document. For each reference similarity, select the fourth target similarity in the first M positions of the reference similarity in descending order, where M is a positive integer greater than 1 and M is less than or equal to K; The reference document corresponding to the fourth target similarity is used as the first document.
3. The method according to claim 1, characterized in that, The step of integrating the first paragraph corresponding to the first target similarity and the second paragraph corresponding to the second target similarity to obtain the target answer to the target question includes: For each first paragraph corresponding to the first target similarity, the first paragraph and the paragraphs adjacent to the first paragraph are concatenated to form the first answer; For each second paragraph corresponding to the second target similarity, the second paragraph and the paragraph adjacent to the second paragraph are concatenated to form the second answer; If the first answer and the second answer are relevant to the target question, the first answer and the second answer are integrated using a preset language model to obtain the target answer corresponding to the target question.
4. The method according to claim 3, characterized in that, After integrating the first paragraph corresponding to the first target similarity and the second paragraph corresponding to the second target similarity to obtain the target answer corresponding to the target question, the method further includes: Receive a second input sent by the user, the second input being used to obtain the first answer and the second answer corresponding to the target answer; In response to the second input, the first answer and the second answer are displayed.
5. The method according to claim 1, characterized in that, Before obtaining the first similarity scores between the user-input target question and each document in the preset knowledge base, the method further includes: Obtain sample documents; The sample documents are classified, and sample documents belonging to the same category are stored in the same storage directory; The document format of the sample documents is unified to a preset format to obtain the first processed document; The redundant information in the first processed document is removed to obtain the second processed document. The redundant information includes at least one of the following: document title, document table of contents, contact person, contact information, copy recipient, proofreader, and sender. The title in the second processed document that is less than a preset number of characters is concatenated with the text adjacent to the title to obtain the target processed document; Each paragraph in the target processing document is vectorized into a text paragraph to obtain the preset knowledge base. The preset knowledge base includes the category corresponding to the target processing document and the vector information corresponding to each paragraph in the target processing document.
6. A text retrieval device, characterized in that, The device includes: The acquisition module is used to obtain multiple first similarities between the user-input target question and each document in the preset knowledge base; The first selection module is used to select at least two first documents that meet preset rules from the multiple documents corresponding to the first similarity for the user to choose from, and the preset knowledge base includes the first documents; A receiving module is configured to receive a first input sent by the user, wherein the first input is used to select a first target document from a plurality of first documents; A determining module is configured to, in response to the first input, determine multiple second similarities between the target question and each paragraph in the first target document based on a first similarity algorithm, and determine multiple third similarities between the target question and each paragraph in the first target document based on a second similarity algorithm; the step of determining multiple second similarities between the target question and each paragraph in the first target document based on the first similarity algorithm, and determining multiple third similarities between the target question and each paragraph in the first target document based on a second similarity algorithm, includes: in response to the first input, using a vector similarity algorithm to determine multiple second vector similarities between the target question and each paragraph in the first target document, wherein the first similarity algorithm is the vector similarity algorithm and the second similarity is the second vector similarity; and using a BM25 similarity algorithm to determine multiple similarity scores between the target question and each paragraph in the first target document, wherein the second similarity algorithm is the BM25 similarity algorithm and the third similarity is the similarity score; The second selection module is used to select the first target similarity in the top N positions of the second similarity in descending order for each second similarity, and to select the second target similarity in the top N positions of the third similarity in descending order for each third similarity, where N is a positive integer greater than 1. The integration module is used to integrate the first paragraph corresponding to the first target similarity and the second paragraph corresponding to the second target similarity to obtain the target answer corresponding to the target question.
7. An electronic device, characterized in that, The device includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the text retrieval method as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement the text retrieval method as described in any one of claims 1-5.
9. A computer program product, characterized in that, When the instructions in the computer program product are executed by the processor of the electronic device, the electronic device performs the text retrieval method as described in any one of claims 1-5.
Citation Information
Patent Citations
Non-structured document question and answer method and device, storage medium and equipment
CN115828893A
Document question and answer method, device and system, electronic equipment and storage medium
CN115934905A