Document retrieval method, device and equipment based on document quality screening processing
By obtaining the extended query information of the original query information and its similar semantic relationships, the candidate documents are retrieved and processed in chunks from the knowledge base, the document feature information is extracted and filtered, and the target search document is generated, which solves the problem of low document search accuracy in the existing technology and achieves higher retrieval comprehensiveness and accuracy.
Patent Information
- Application Number
- CN202510303026.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-13
- Publication Date
- 2025-07-04
AI Technical Summary
The existing document search methods mainly rely on character matching, resulting in low accuracy and lack of comprehensiveness in searching documents.
By obtaining the extended query information of the original query information and its similar semantic relationships, candidate documents are retrieved from the knowledge base, and chunked them, document feature information is extracted, valid document fragments that meet document quality conditions, and finally generate target search documents.
Improve the comprehensiveness and accuracy of document retrieval, avoid interference from invalid document fragments, and generate richer search results.
Smart Images

Figure CN120256612A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technologies, and in particular, to a document retrieval method, apparatus, and device based on document quality screening and processing. Background Art
[0002] With the development of Internet technologies, more and more users retrieve documents through an online search system, such as retrieving the food closest to the user's current location. During the process of retrieving documents, mainly by performing character matching between the query information input by the user and the data in the database to obtain the retrieved documents. It is found in practice that the retrieved documents obtained by this document retrieval method only match the characters with the query information, lacking comprehensiveness, resulting in relatively low accuracy of the retrieved documents. Summary of the Invention
[0003] Embodiments of this application provide a document retrieval method, apparatus, and device based on document quality screening and processing, which improve the accuracy of document retrieval.
[0004] On the one hand, an embodiment of this application provides a document retrieval method based on document quality screening and processing, including:
[0005] Obtaining N pieces of query information; the N pieces of query information include the original query information and extended query information having a similar semantic relationship with the original query information, and N is a positive integer greater than 1;
[0006] Retrieving candidate retrieved documents respectively associated with the N pieces of query information from a knowledge base, and performing chunking processing on the candidate retrieved documents respectively associated with the N pieces of query information to obtain P initial document segments, where P is an integer greater than 1;
[0007] Performing feature extraction on the P initial document segments to obtain document feature information respectively corresponding to the P initial document segments;
[0008] According to the document feature information respectively corresponding to the P initial document segments, screening valid document segments that meet the document quality conditions from the P initial document segments;
[0009] Generating a target retrieved document for the original query information according to the valid document segments, the original query information, and the extended query information.
[0010] On the one hand, an embodiment of this application provides a document retrieval apparatus based on document quality screening and processing, including:
[0011] An obtaining module, configured to obtain N pieces of query information; the N pieces of query information include the original query information and extended query information having a similar semantic relationship with the original query information, and N is a positive integer greater than 1;
[0012] A retrieval module, configured to retrieve candidate retrieval documents respectively associated with the above N query information from a knowledge base, perform chunking processing on the candidate retrieval documents respectively associated with the above N query information, and obtain P initial document fragments, where P is an integer greater than 1;
[0013] An extraction module, configured to extract feature information of the above P initial document fragments to obtain document feature information respectively corresponding to the above P initial document fragments;
[0014] A screening module, configured to screen out valid document fragments that meet the document quality conditions from the above P initial document fragments according to the document feature information respectively corresponding to the above P initial document fragments;
[0015] A generation module, configured to generate a target retrieval document for the above original query information according to the above valid document fragments, the above original query information, and the above extended query information.
[0016] On the one hand, an embodiment of the present application provides a computer device, including a memory and a processor. The above memory stores a computer program, and when the above processor executes the above computer program, the steps of the above method are implemented.
[0017] On the one hand, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the above computer program is executed by a processor, the steps of the above method are implemented.
[0018] On the one hand, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps of the above method are implemented.
[0019] In the present application, by retrieving candidate retrieval documents respectively associated with the original query information and the extended query information from the knowledge base, since the extended query information has a similar semantic relationship with the original query information, therefore, based on the original query information and the extended query information, more retrieval documents associated with the original query information can be retrieved, thus improving the comprehensiveness of document retrieval. By chunking the candidate retrieval documents, P initial document fragments are obtained. Based on the document feature information respectively corresponding to the P initial document fragments, valid document fragments that meet the document quality conditions are screened out from the above P initial document fragments, and invalid document fragments corresponding to the original query information can be filtered out. Based on the valid document fragments, the above original query information, and the above extended query information, a target retrieval document for the above original query information is generated, which can avoid the interference of invalid document fragments and is beneficial to improving the accuracy of document retrieval. Description of the Drawings
[0020] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.
[0021] Figure 1 It is a schematic structural diagram of a document retrieval system provided by the present application;
[0022] Figure 2 It is a schematic structural diagram of a document retrieval method based on document quality screening and processing provided by the present application;
[0023] Figure 3 It is a schematic flowchart of a document retrieval method based on document quality screening and processing provided by the present application;
[0024] Figure 4 It is a schematic structural diagram of a method for obtaining document feature information of each document fragment provided by the present application;
[0025] Figure 5 It is a schematic flowchart of another document retrieval method based on document quality screening and processing provided by the present application;
[0026] Figure 6 It is a schematic structural diagram of a method for deduplicating P initial document fragments provided by the present application;
[0027] Figure 7 It is a schematic structural diagram of a method for quality filtering of P initial document fragments provided by the present application;
[0028] Figure 8 It is a schematic structural diagram of a method for obtaining a fusion score of valid document fragments provided by the present application;
[0029] Figure 9 It is a schematic structural diagram of a method for extracting document sub-fragments from target document fragments provided by the present application;
[0030] Figure 10 It is a schematic structural diagram of a document retrieval device based on document quality screening and processing provided by an embodiment of the present application;
[0031] Figure 11 It is a schematic structural diagram of a computer device provided by an embodiment of the present application. Detailed implementation manners
[0032] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts belong to the scope of protection of the present application.
[0033] To facilitate a clearer understanding of the present application, a document retrieval system for implementing the present application is first introduced. As Figure 1 shown, the document retrieval system includes a server and a terminal cluster. The terminal cluster can include one or more terminals, and the number of terminals will not be limited here. As Figure 1 shown, taking the terminal cluster including 4 terminals as an example for illustration, the terminal cluster can specifically include a first terminal, a second terminal, a third terminal, and a fourth terminal; it can be understood that the first terminal, the second terminal, the third terminal, and the fourth terminal can all be network-connected to the server, so that each terminal can perform data interaction with the server through the network connection.
[0034] It can be understood that the server can be an independent physical server, or a server cluster or distributed system composed of at least two physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud knowledge bases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0035] Among them, the terminal can specifically refer to a vending terminal, a vehicle-mounted terminal, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a screen speaker, a smart TV, a smart watch, etc., but is not limited thereto. Each terminal and the server can be directly or indirectly connected through wired or wireless communication methods.
[0036] Among them, an information search application program can be installed and run on any terminal. The information search application program can be an independent application program, a web application program, a small program in a host application program, etc. The terminal can receive the query information input by the user through the information search application program. For the sake of distinction, the query information input by the user can be called the original query information. Generate the extended query information corresponding to the original query information, send the original query information and the extended query information to the server, receive the target retrieval document returned by the server based on the original query information and the extended query information, and display the target retrieval document in the information search application program.
[0037] Among them, the server can be used to provide backend services for an information search application. For example, the server can be used to receive the original query information and extended query information sent by the terminal, generate a target retrieval document corresponding to the original query information based on the extended query information and the original query information, and return the target retrieval document to the terminal.
[0038] In one embodiment, as Figure 2 shown, the server may include a retrieval system, a feature extraction network, a deduplication network, a quality filtering network, a buffer, a sorting network, an information extraction network, a generation model, etc.
[0039] Among them, Figure 2 the retrieval system in may include a knowledge base, which may include data other than the training data of the generation model, or the knowledge base may include data generated after the training of the generation model. After the server receives the original query information and extended query information (taking the first terminal as an example) sent by any terminal (taking the first terminal as an example, and taking the first extended query information and the second extended query information as an example for illustration), the server may retrieve the first candidate document associated with the original query information from the knowledge base according to the vector retrieval method, and retrieve the second candidate document associated with the original query information from the knowledge base according to the text retrieval method. According to the vector retrieval method, retrieve the third candidate document associated with the first extended query information from the knowledge base, and retrieve the fourth candidate document associated with the first extended query information from the knowledge base according to the text retrieval method. According to the vector retrieval method, retrieve the third candidate document associated with the second extended query information from the knowledge base, and retrieve the fourth candidate document associated with the second extended query information from the knowledge base according to the text retrieval method. Determine the first candidate document and the second candidate document as the candidate retrieval documents corresponding to the original query information, and determine the third candidate document and the fourth candidate document corresponding to the first extended query information and the second extended query information respectively as the candidate retrieval documents associated with the extended query information.
[0040] Among them, the text retrieval method may refer to comparing the characters in the query information with the characters in the candidate documents in the knowledge base to retrieve the candidate documents that match the characters of the query information. The vector retrieval method may refer to comparing the semantic feature vectors in the query information with the semantic feature vectors in the candidate documents in the knowledge base to retrieve the candidate documents that match the semantics of the query information.
[0041] Among them, after obtaining the candidate retrieval documents, the server may block each candidate retrieval document to obtain P initial document segments, where P is an integer greater than 1.
[0042] Among them, Figure 2The feature extraction network therein is used to extract features from P initial document segments, obtain the document feature information corresponding to each of the P initial document segments, and store the document feature information corresponding to each of the P initial document segments in a buffer.
[0043] Among them, Figure 2 the deduplication network therein can be used to read the document feature information corresponding to each of the P initial document segments from the buffer, generate P first text feature vectors according to the document feature information corresponding to each of the P initial document segments and the deduplication prompt words. Based on the P first document feature vectors, determine the segment similarity between every two of the P initial document segments, and based on the segment similarity, perform deduplication processing on the P initial document segments to obtain valid document segments that meet the document quality conditions. The specific implementation process can refer to the following description.
[0044] Among them, Figure 2 the quality filtering network therein can be used to read the document feature information corresponding to each of the P initial document segments from the buffer, generate P second text feature vectors according to the document feature information corresponding to each of the P initial document segments and the quality filtering words. Based on the P second document feature vectors, determine the quality scores corresponding to K first document segments and M second document segments respectively, and based on the quality scores, perform quality filtering on the P initial document segments to obtain valid document segments that meet the document quality conditions.
[0045] Among them, after obtaining the valid document segments, the computer device can delete the document feature information of the document segments in the buffer other than the valid document segments, and retain the document feature information of the valid document segments.
[0046] Among them, Figure 2 the sorting network therein can be used to calculate the fusion score corresponding to the valid document segments based on the original query information, the extended query information, and the document feature information of the valid document segments, and based on the fusion score, screen the valid document segments to obtain the target document segments. The specific implementation process can refer to the following description.
[0047] Among them, Figure 2 the information extraction network therein can be used to extract, from the target document segments, the document sub-segments associated with the original query information according to the above information extraction prompt words and the document feature information of the above target document segments. The generation model can be used to generate the target retrieval document of the original query information based on the above document sub-segments and the above original query information. Return the target retrieval document to the first terminal, and the first terminal can display the target retrieval document.
[0048] In summary, through the above deduplication network, document fragments with highly similar content can be filtered out. Through the quality filtering network, document fragments with low quality scores can be filtered out. Through the information extraction network, the document sub-fragments in the document fragments that are most relevant to the original query information can be extracted, and the target retrieval document is generated based on the document sub-fragments, improving the accuracy of document retrieval.
[0049] Further, please refer to Figure 3 , which is a schematic flowchart of a document retrieval method based on document quality screening provided by an embodiment of the present application. This method is executed by a computer device, and the computer device includes Figure 1 at least one of any terminal and server shown in Figure 3 . Specifically, an information search application is installed and run on the terminal. This method can be executed by the information search application on the terminal, and the server can be used as the background server of the information search application in the terminal to provide backend services for the information search application installed and run on the terminal. As
[0050] shown, this method may include the following steps:
[0051] S101. Obtain N query information; the N query information includes the original query information and extended query information having a similar semantic relationship with the original query information, where N is a positive integer greater than 1.
[0052] In the present application, the computer device can receive the original query information input by the user, rewrite or expand the original query information to obtain extended query information having a similar semantic relationship with the original query information.
[0053] Among them, the number of extended query information can be one or more, that is, the semantic similarity between the extended query information and the original query information is greater than the similarity threshold, that is, the extended query information and the original retrieval information can be used to describe the same query problem. For example, the original query information is: What are the tourist attractions near Area A; the extended query information can be: The tourist guide near Area A, or, The tourist route near Area A. Another example, the original query information is: "Is it worth buying the funds of Company A now?", and the extended query information is: "What is the latest financial performance of Company A?", "Is the valuation level of Company A reasonable?", "What are the market competitive advantages of Company A?", "What is the future growth potential of Company A?", "What is the dividend strategy of Company A?". The extended query information can be generated based on the original query information through a language model.
[0053] S102. Retrieve candidate retrieval documents associated with the N query information from the knowledge base, and perform chunking processing on the candidate retrieval documents associated with the N query information to obtain P initial document fragments, where P is an integer greater than 1.
[0054] In this application, the computer device can retrieve candidate retrieval documents associated with the above N query information from the knowledge base according to the target retrieval method. The candidate retrieval documents associated with the above N query information are processed in chunks to obtain P initial document fragments. By using the original query information and the extended query information, more retrieval documents can be retrieved, which is beneficial to improving the comprehensiveness of the retrieval documents. By chunking the retrieval documents, it is beneficial to improve the accuracy of screening effective document fragments in the subsequent process.
[0055] Among them, the lengths of different document fragments can be the same or different, and the length of the document fragment can be less than or equal to the limit length, which can be the maximum length of the data that the generation model can process. The generation model can be the model for generating the target retrieval document of the original query information.
[0056] Among them, the knowledge base can include data other than the training data of the generation model. For example, the knowledge base can include newly generated data after the training of the generation model. The knowledge base can be pre-prepared structured or unstructured data, such as a document library, web page content, etc. The generation model can refer to a Large Language Model (LLM), also known as a large language model, which is an artificial intelligence model designed to understand and generate human language.
[0057] Among them, the target retrieval method can include at least one of the text retrieval method and the vector retrieval method.
[0058] Among them, the candidate retrieval document corresponding to each query information can be one or more.
[0059] In one embodiment, step S102 above includes: the computer device can retrieve the first candidate document associated with the original query information from the above knowledge base according to the vector retrieval method, and retrieve the second candidate document associated with the above original query information from the above knowledge base according to the text retrieval method. The above first candidate document and the above second candidate document are determined as the candidate retrieval documents associated with the above original query information. By retrieving the retrieval documents associated with the original query information according to multiple retrieval methods, it is beneficial to improve the comprehensiveness of document retrieval and the accuracy of document retrieval.
[0060] In one embodiment, retrieving the first candidate document associated with the original query information from the knowledge base according to the vector retrieval method includes: The computer device may generate a semantic feature vector reflecting the original query information and a semantic feature vector reflecting the candidate documents in the knowledge base. Using a similarity algorithm, determine the semantic similarity between the semantic feature vector of the original query information and the semantic feature vectors of the candidate documents in the knowledge base; Determine the candidate documents in the knowledge base whose semantic similarity is greater than the second similarity threshold as the first candidate documents associated with the original query information. By relying on semantic feature vectors, it is beneficial to retrieve candidate documents that are semantically similar to the original query information, improving the comprehensiveness and accuracy of document retrieval.
[0061] Among them, the semantic feature vector of the original query information is used to reflect the semantics (meanings) of the original query information, and the semantic feature vector of the candidate document is used to reflect the semantics of the candidate document.
[0062] Among them, the similarity algorithm may refer to the cosine similarity algorithm, Pearson similarity, etc.
[0063] In one embodiment, retrieving the second candidate document associated with the original query information from the knowledge base according to the text retrieval method includes: The computer device may use a similarity algorithm to determine the character similarity between the characters in the original query information and the characters in the candidate documents in the knowledge base, and screen out the candidate documents in the knowledge base whose character similarity is greater than the third similarity threshold. Determine the screened candidate documents as the second candidate documents associated with the original query information. By character similarity, it is beneficial to retrieve candidate documents that are character-similar to the original query information, improving the comprehensiveness and accuracy of document retrieval.
[0064] In one embodiment, the computer device may retrieve the third candidate document associated with the extended query information from the knowledge base according to the vector retrieval method, and retrieve the fourth candidate document associated with the extended query information from the knowledge base according to the text retrieval method. Determine the third candidate document and the fourth candidate document as the candidate retrieval documents associated with the extended query information. By retrieving the retrieval documents associated with the extended query information according to multiple retrieval methods, this is beneficial to improving the comprehensiveness and accuracy of document retrieval.
[0065] In one embodiment, retrieving, from the knowledge base, a third candidate document associated with the extended query information according to the vector retrieval method includes: A computer device may generate a semantic feature vector reflecting the extended query information and a semantic feature vector reflecting candidate documents in the knowledge base. Using a similarity algorithm, determine the semantic similarity between the semantic feature vector of the extended query information and the semantic feature vectors of the candidate documents in the knowledge base; Determine the candidate documents in the knowledge base with a semantic similarity greater than a second similarity threshold as the third candidate documents associated with the extended query information. By virtue of the semantic feature vectors, it is conducive to retrieving candidate documents semantically similar to the extended query information, improving the comprehensiveness and accuracy of document retrieval.
[0066] Among them, the semantic feature vector of the extended query information is used to reflect the semantics (meaning) of the extended query information.
[0067] In one embodiment, retrieving, from the knowledge base, a fourth candidate document associated with the extended query information according to the text retrieval method includes: A computer device may use a similarity algorithm to determine the character similarity between the characters in the extended query information and the characters in the candidate documents in the knowledge base, and screen out the candidate documents in the knowledge base with a character similarity greater than a third similarity threshold. Determine the screened candidate documents as the fourth candidate documents associated with the extended query information. By virtue of the character similarity, it is conducive to retrieving candidate documents character-similar to the extended query information, improving the comprehensiveness and accuracy of document retrieval.
[0068] S103. Extract features from the above-mentioned P initial document segments to obtain document feature information corresponding to the above-mentioned P initial document segments respectively.
[0069] In this application, a computer device may input the above-mentioned P initial document segments into a feature extraction network, and through the feature extraction network, extract features from the above-mentioned P initial document segments to obtain document feature information corresponding to the above-mentioned P initial document segments respectively.
[0070] Among them, the document feature information includes the key and value of each token in the initial document segment. The key can be used to reflect the position of the token in the initial document segment, and the value can be used to reflect the importance of the token in the initial document segment.
[0071] Among them, a token refers to the basic unit of text preprocessing, usually referring to a part of a text segment separated by spaces, punctuation marks, etc., such as words, phrases, symbols, etc.
[0072] Among them, the feature extraction network may refer to the self-attention layer of the Transformer (self-attention) model. The document feature information will be used multiple times in the subsequent processing. Therefore, the computer device can store the document feature information in the buffer, which can avoid repeated calculation of the document feature information and improve the efficiency of retrieving documents.
[0073] For example, as Figure 4 shown, taking the example that the extended query information of the original query information includes first extended query information and second extended query information, the computer device can retrieve the first candidate document associated with the original query information from the knowledge base in the retrieval system according to the vector retrieval method, and retrieve the second candidate document associated with the original query information from the knowledge base in the retrieval system according to the text retrieval method. The first candidate document is segmented to obtain multiple initial document segments corresponding to the first candidate document, and the second candidate document is segmented to obtain multiple initial document segments corresponding to the second candidate document. The computer device can retrieve the third candidate document associated with the first extended query information from the knowledge base in the retrieval system according to the vector retrieval method, and retrieve the fourth candidate document associated with the first extended query information from the knowledge base in the retrieval system according to the text retrieval method. The third candidate document and the fourth candidate document corresponding to the first extended query information are segmented to obtain multiple initial document segments corresponding to the first extended query information. Similarly, the computer device can retrieve the third candidate document associated with the second extended query information from the knowledge base in the retrieval system according to the vector retrieval method, and retrieve the fourth candidate document associated with the second extended query information from the knowledge base in the retrieval system according to the text retrieval method. The third candidate document and the fourth candidate document corresponding to the second extended query information are segmented to obtain multiple initial document segments corresponding to the second extended query information. The computer device can extract features from each initial document segment through the feature extraction network to obtain the document feature information corresponding to each initial document segment, and store the document feature information corresponding to each initial document segment in the buffer.
[0074] S104. According to the document feature information respectively corresponding to the above P initial document segments, screen out the valid document segments that meet the document quality conditions from the above P initial document segments.
[0075] In this application, when the extended query information is generated by a language model, due to the relatively poor stability of the language model, the stability of the extended query information is relatively poor. Furthermore, there may be duplicate document fragments or document fragments with relatively poor quality among the above-mentioned P initial document fragments. Therefore, the computer device can perform duplicate removal processing or quality filtering processing on the above-mentioned P initial document fragments according to the document feature information corresponding to the above-mentioned P initial document fragments respectively, obtain valid document fragments that meet the document quality conditions, filter out the invalid document fragments of the original query information, avoid the interference of invalid document fragments, and improve the accuracy of document retrieval.
[0076] Among them, the document quality conditions can include one or both of the following. First, the P initial document fragments do not contain the same initial document fragment. Second, the quality score of the P initial document fragments is greater than or equal to the first score threshold. That is, the valid document fragments can refer to the initial document fragments whose quality score is greater than or equal to the first score threshold, and different valid document fragments are not the same, that is, there are no duplicate document fragments in the valid document fragments.
[0077] S105. Generate the target retrieval document of the original query information according to the above-mentioned valid document fragments, the above-mentioned original query information, and the above-mentioned extended query information.
[0078] In this application, the computer device can use a generation model to generate the target retrieval document of the query information according to the valid document fragments, the original query information, and the extended query information. The generation model will input these retrieved contents (valid document fragments) together with the query information to generate the final answer (target retrieval document). This stage combines the language ability of the generation model and the assistance of the valid document fragments, enabling the model to provide richer answer content.
[0079] Among them, the target retrieval document can be the answer data for the query problem indicated by the original query information, and the target retrieval document can be a sentence, a paragraph, a document, etc.
[0080] In this application, by retrieving candidate retrieval documents associated with the original query information and the extended query information respectively from the knowledge base, since the extended query information has a similar semantic relationship with the original query information, more retrieval documents associated with the original query information can be retrieved based on the original query information and the extended query information, thereby improving the comprehensiveness of document retrieval. By chunking the candidate retrieval documents, P initial document fragments are obtained. Based on the document feature information corresponding to the P initial document fragments respectively, valid document fragments that meet the document quality conditions are screened out from the above P initial document fragments, and invalid document fragments corresponding to the original query information can be filtered out. Based on the valid document fragments, the above original query information, and the above extended query information, a target retrieval document for the above original query information is generated, which can avoid the interference of invalid document fragments and is beneficial to improving the accuracy of document retrieval.
[0081] Further, please refer to Figure 5 , which is a schematic flowchart of a document retrieval method based on document quality screening and processing provided by an embodiment of this application. This method is executed by a computer device, and the computer device includes Figure 1 at least one of any terminal and server shown in Figure 5 . Specifically, an information search application is installed and run on the terminal, and this method can be executed by the information search application on the terminal. The server can be used as the background server of the information search application in the terminal to provide backend services for the information search application installed and run on the terminal. As shown in Figure 5 , this method may include the following steps:
[0082] S201. Obtain N pieces of query information; the above N pieces of query information include the original query information and extended query information having a similar semantic relationship with the above original query information, and N is a positive integer greater than 1.
[0083] S202. Retrieve candidate retrieval documents associated with the above N pieces of query information respectively from the knowledge base, and perform chunking processing on the candidate retrieval documents associated with the above N pieces of query information respectively to obtain P initial document fragments, where P is an integer greater than 1.
[0084] S203. Extract features from the above P initial document fragments to obtain the document feature information corresponding to the above P initial document fragments respectively.
[0085] S204. According to the document feature information corresponding to the above P initial document fragments respectively, screen out valid document fragments that meet the document quality conditions from the above P initial document fragments.
[0086] Among them, the document feature information of the above valid document fragments is stored in the buffer, and the number of the above valid document fragments is D, where D is an integer greater than 1.
[0087] In one embodiment, the above step S204 includes: the computer device can generate P first hidden state vectors through the hidden state generation layer of the deduplication network according to the deduplication prompt words corresponding to the deduplication network and the document feature information of each of the above P initial document segments; one document feature information corresponds to one first hidden state vector; one document feature information corresponds to one first hidden state vector. Through the pooling layer of the deduplication network, perform pooling processing on the above P first hidden state vectors to obtain P first document feature vectors; according to the above P first document feature vectors, perform deduplication processing on the above P initial document segments to obtain valid document segments that meet the document quality conditions. By performing deduplication processing on the initial document segments, subsequent repeated processing of the same document segments can be avoided, and the efficiency of document retrieval can be improved.
[0088] Among them, the deduplication prompt word can be used to indicate that the deduplication network filters out duplicate document segments in the above P initial document segments, and the first hidden state vector can include the feature information corresponding to the deduplication prompt word and the document feature information. The P first document feature vectors can refer to the key feature information in the first hidden state vector.
[0089] In one embodiment, the above performing deduplication processing on the above P initial document segments according to the above P first document feature vectors to obtain valid document segments that meet the document quality conditions includes: the computer device can calculate the similarity between the first document feature vectors corresponding to every two initial document segments to obtain the segment similarity between every two initial document segments. When the segment similarity between two initial document segments is greater than the first similarity threshold, filter out any one of the two initial document segments with the segment similarity greater than the first similarity threshold from the above P initial document segments; determine the initial document segments that are not filtered out among the above P initial document segments as valid document segments that meet the document quality conditions.
[0090] For example, as Figure 6As shown, the document fragment set includes P initial document fragments. The computer device can read the document feature information of the initial document fragments from the buffer, and through the hidden state generation layer in the deduplication network, generate the first hidden state vector of the initial document fragment according to the deduplication prompt word corresponding to the deduplication network. Through the pooling layer of the deduplication network, pool the first hidden state vector to obtain the first document feature vector. Repeat the above steps to calculate the first document feature vector corresponding to each initial document fragment in the document fragment set, and determine the similarity between the first document feature vectors of any two initial document fragments as the fragment similarity. Delete any one of the two initial document fragments in the document fragment set whose fragment similarity is greater than the first similarity threshold, and determine the initial document fragments that are not deleted in the document fragment set as the effective document fragments that meet the document quality conditions.
[0091] In one embodiment, screening the effective document fragments that meet the document quality conditions from the above P initial document fragments according to the document feature information corresponding to the above P initial document fragments includes: The computer device can generate P second hidden state vectors through the hidden state generation layer of the quality filtering network according to the quality filtering prompt word corresponding to the quality filtering network and the document feature information of each of the above P initial document fragments; one document feature information corresponds to one second hidden state vector. Through the pooling layer of the quality filtering network, pool the above P second hidden state vectors to obtain P second document feature vectors; according to the above P second document feature vectors, perform quality filtering on the above P initial document fragments to obtain the effective document fragments that meet the document quality conditions. By performing quality filtering on the first document fragment and the second document fragment, it is beneficial to improve the quality of the retrieved documents and the accuracy of document retrieval.
[0092] Among them, the quality filtering prompt word can be used to indicate that the quality filtering network filters out the initial document fragments with relatively low quality scores among the P initial document fragments, and the second hidden state vector can include the feature information corresponding to the quality filtering prompt word and the document feature information. The P second document feature vectors can refer to the key feature information in the second hidden state vector.
[0093] In one embodiment, for the above-mentioned P second document feature vectors, performing quality filtering processing on the above-mentioned P initial document segments to obtain valid document segments that meet the document quality conditions, including: The computer device can determine the quality scores corresponding to the above-mentioned P initial document segments respectively through a quality filtering network according to the above-mentioned P second document feature vectors; filter out the initial document segments with quality scores less than the first score threshold from the above-mentioned P initial document segments. Determine the initial document segments that are not filtered out among the above-mentioned P initial document segments as valid document segments that meet the document quality conditions. By based on the quality scores, it is beneficial to filter out the document segments with relatively low quality scores and improve the accuracy of document retrieval.
[0094] For example, as Figure 7 shown, the document segment set includes P initial document segments. For a single initial document segment in the document segment set, the computer device can read the document feature information of this initial document segment from the buffer. Through the quality filtering network, according to the quality filtering prompt words corresponding to this quality filtering network, generate a second hidden state vector corresponding to the document feature information. Through the pooling layer of this quality filtering network, perform pooling processing on this second hidden state vector to obtain a second document feature vector. According to this second document feature vector and a scoring function, determine the quality score of this initial document segment. According to the first score threshold, determine whether this initial document segment is filtered, that is, when the quality score of this initial document segment is less than the first score threshold, filter out this initial document segment. Repeat the above steps for each initial document segment in the document segment set in sequence.
[0095] In one embodiment, the computer device can perform quality filtering on P initial document segments according to the above method to obtain candidate document segments that meet the document quality conditions, and perform deduplication processing on the candidate document segments based on the document feature information and deduplication prompt words of the candidate document segments to obtain valid document segments that meet the document quality conditions.
[0096] Among them, this quality filtering network can be trained based on sample query information, sample document segments, and the labeled quality scores of sample document segments. The labeled quality scores can be set manually. Specifically, the computer device can input the document feature information of the sample document segments into the initial quality filtering network. The initial quality filtering network can generate sample document feature vectors based on the document feature information of the sample document segments and the quality filtering prompt words, determine the predicted quality scores of the sample document segments based on the sample document feature vectors, and adjust the parameters of the initial quality filtering network based on the predicted quality comments and the labeled quality scores to obtain the trained quality filtering network.
[0097] S205. Read the document feature information corresponding to D valid document segments from the above buffer.
[0098] In this application, after obtaining the document feature information corresponding to P initial document segments respectively, the computer device can store the document feature information corresponding to the P initial document segments in the buffer respectively. When the document feature information is needed in subsequent steps, it can be read from the buffer without recalculating the document feature information, improving the efficiency of document retrieval. Specifically, when the document feature information of the valid document segments is needed, the computer device can read the document feature information corresponding to D valid document segments from the above buffer.
[0099] S206. Determine the first relevance between the above D valid document segments and the above original query information according to the document feature information corresponding to the above D valid document segments respectively.
[0100] In this application, the computer device can extract the query feature information of the original query information through the above feature extraction network, and use a similarity algorithm to calculate the first feature similarity between the document feature information corresponding to D valid document segments respectively and the query feature information of the original query information. The first feature similarity corresponding to D valid document segments respectively is determined as the first relevance between the D valid document segments and the above original query information respectively.
[0101] Among them, the query feature information of the original query information may include the key and value of each token in the original query information.
[0102] S207. Determine the second relevance between the above D valid document segments and the above extended query information according to the document feature information corresponding to the above D valid document segments respectively.
[0103] In this application, the computer device can extract the query feature information of the extended query information through the above feature extraction network, and use a similarity algorithm to calculate the second feature similarity between the document feature information corresponding to D valid document segments respectively and the query feature information of the extended query information. The second feature similarity corresponding to D valid document segments respectively is determined as the second relevance between the D valid document segments and the above extended query information respectively.
[0104] S208. Generate the target retrieval document of the above original query information according to the first relevance and the second relevance corresponding to the above D valid document segments respectively, the above original query information and the above buffer.
[0105] In this application, after obtaining the first relevance and the second relevance, the computer device can generate a target retrieval document for the original query information based on the first relevance and the second relevance respectively corresponding to the D valid document segments, the original query information, and the buffer, which is beneficial to improving the accuracy of document retrieval.
[0106] In one embodiment, step S208 includes: Since different valid document segments may be retrieved by different query information, when a valid document segment is retrieved by the original query information, the relevance between the valid document segment and the original query information is relatively high, and the relevance between the valid document segment and the extended query information is relatively low. Similarly, when a valid document segment is retrieved by the extended query information, the relevance between the valid document segment and the extended query information is relatively high, and the relevance between the valid document segment and the original query information is relatively low. If the valid document segments are filtered based on the first relevance or the second relevance, some valid document segments with relatively high quality will be filtered out. Based on this, the computer device can determine a fusion score for the valid document segments based on the first relevance and the second relevance, and this fusion score reflects the fusion relevance between the valid document segment and the original query information and the extended query information. The valid document segments are screened (filtered) through the fusion score to improve the screening accuracy and stability of the valid document segments.
[0107] Specifically, the computer device can sort the D valid document segments in descending order according to the first relevance respectively corresponding to the D valid document segments, to obtain the first arrangement serial numbers respectively corresponding to the D valid document segments. For example, the first arrangement serial number of the valid document segment ranked first is 1, and the first arrangement serial numbers of the valid document segments ranked in other positions increase sequentially according to the arrangement positions.
[0108] Similarly, the computer device can sort the above D valid document segments in descending order of the second relevance corresponding to each of the above D valid document segments to obtain the second permutation numbers corresponding to each of the above D valid document segments. Sum the reciprocal of the first permutation number of the i-th valid document segment and the reciprocal of the second permutation number of the i-th valid document segment to obtain the fusion score of the i-th valid document segment; i is an integer less than or equal to D. Screen out the target document segments with a fusion score greater than the second score threshold from the above D valid document segments; generate the target retrieval document of the original query information according to the above target document segments, the above original query information, and the above buffer. Calculating the fusion score of the valid document segment through the reciprocal of the first permutation number and the reciprocal of the second permutation number is conducive to enabling the valid document segment with a high relevance to both the original query information and the extended query information to obtain a higher fusion score, and enabling the valid document segment with a low relevance to both the original query information and the extended query information to obtain a lower fusion score. Based on the fusion score, screen the valid document segments, which is conducive to improving the screening accuracy of the valid document segments.
[0109] For example, as Figure 8As shown, among the D valid document fragments, there are the first document fragment 81a retrieved based on the original query information, the second document fragment 82a retrieved based on the first extended query information, and the second document fragment 83a retrieved based on the second extended query information. The computer device can read the document feature information corresponding to the first document fragment 81a, the second document fragment 82a, and the second document fragment 83a from the buffer, generate a sorting prompt word 84a according to the original query information, and this sorting prompt word 84a is used to instruct the sorting network to sort each document fragment based on the original query information. Generate a sorting prompt word 85a according to the first extended query information, and this sorting prompt word 85a is used to instruct the sorting network to sort each document fragment based on the first extended query information; generate a sorting prompt word 86a according to the second extended query information, and this sorting prompt word 86a is used to instruct the sorting network to sort each document fragment based on the second extended query information. Through the sorting network, based on the sorting prompt word 84a, calculate the first relevance between the original query information and the first document fragment 81a, the second document fragment 82a, and the second document fragment 83a respectively, and sort the first document fragment 81a, the second document fragment 82a, and the second document fragment 83a in descending order according to the first relevance corresponding to the first document fragment 81a, the second document fragment 82a, and the second document fragment 83a respectively, to obtain the first arrangement serial numbers 87a corresponding to the first document fragment 81a, the second document fragment 82a, and the second document fragment 83a respectively. Through the sorting network, based on the sorting prompt word 85a, calculate the second relevance a1 between the first extended query information and the first document fragment 81a, the second document fragment 82a, and the second document fragment 83a respectively, and sort the first document fragment 81a, the second document fragment 82a, and the second document fragment 83a in descending order according to the second relevance a1 corresponding to the first document fragment 81a, the second document fragment 82a, and the second document fragment 83a respectively, to obtain the second arrangement serial numbers 88a corresponding to the first document fragment 81a, the second document fragment 82a, and the second document fragment 83a respectively. Through the sorting network, based on the sorting prompt word 86a, calculate the second relevance a2 between the second extended query information and the first document fragment 81a, the second document fragment 82a, and the second document fragment 83a respectively, and sort the first document fragment 81a, the second document fragment 82a, and the second document fragment 83a in descending order according to the second relevance a2 corresponding to the first document fragment 81a, the second document fragment 82a, and the second document fragment 83a respectively, to obtain the second arrangement serial numbers 88a corresponding to the first document fragment 81a, the second document fragment 82a, and the second document fragment 83a respectively.Through the fusion algorithm, obtain the sum of the reciprocals of the first permutation number 87a, the second permutation number 88a, and the third permutation number 89a corresponding to the first document segment 81a, to obtain the fusion score of the first document segment 81a. Through the fusion algorithm, obtain the sum of the reciprocals of the first permutation number 87a, the second permutation number 88a, and the third permutation number 89a corresponding to the second document segment 82a, to obtain the fusion score of the second document segment 82a. Through the fusion algorithm, obtain the sum of the reciprocals of the first permutation number 87a, the second permutation number 88a, and the third permutation number 89a corresponding to the second document segment 83a, to obtain the fusion score of the second document segment 83a. When the fusion scores corresponding to the first document segment 81a and the second document segment 82a are both greater than the second score threshold, and the fusion score corresponding to the second document segment 83a is less than or equal to the second score threshold, the first document segment 81a and the second document segment 82a can be determined as the target document segments of the original query information. Based on the target document segments, the original query information, and the above buffer, generate the target retrieval document of the original query information.
[0110] In one embodiment, the generating the target retrieval document of the original query information based on the target document segments, the original query information, and the buffer includes: As Figure 9 shown, the computer device can add the original query information to the prompt template of the information extraction network to obtain an information extraction prompt; read the document feature information of each target document segment from the buffer. For a single target document segment, through the information extraction network, according to the information extraction prompt and the document feature information of the target document segment, extract the document sub-segment associated with the original query information from the target document segment. Repeat the above steps to obtain the document sub-segments corresponding to each target document segment respectively. Through the generation model, based on the document sub-segments and the original query information, generate the target retrieval document of the original query information. Extracting the document sub-segment associated with the original query information from the target document segment through the information extraction network is beneficial to improving the accuracy of document retrieval.
[0111] In this application, by storing the document feature information in the buffer, subsequent repeated calculation of the document feature information can be avoided, improving the efficiency of document retrieval.
[0112] Please refer to Figure 10 The structural schematic diagram of a document retrieval device based on document quality screening and processing provided by an embodiment of this application. As Figure 10 shown, the document retrieval device based on document quality screening and processing may include:
[0113] An acquisition module 1011, configured to acquire N query messages; the N query messages include an original query message and an extended query message having a similar semantic relationship with the original query message, and N is a positive integer greater than 1;
[0114] A retrieval module 1012, configured to retrieve candidate retrieval documents respectively associated with the N query messages from a knowledge base, and perform chunking processing on the candidate retrieval documents respectively associated with the N query messages to obtain P initial document fragments, where P is an integer greater than 1;
[0115] An extraction module 1013, configured to perform feature extraction on the P initial document fragments to obtain document feature information respectively corresponding to the P initial document fragments;
[0116] A screening module 1014, configured to screen out valid document fragments that meet the document quality conditions from the P initial document fragments according to the document feature information respectively corresponding to the P initial document fragments;
[0117] A generation module 1015, configured to generate a target retrieval document for the original query message according to the valid document fragments, the original query message, and the extended query message.
[0118] Optionally, the screening module 1014 is specifically configured to:
[0119] Generate P first hidden state vectors through the hidden state generation layer of the deduplication network according to the deduplication prompt words corresponding to the deduplication network and the document feature information of the P initial document fragments respectively; one document feature information corresponds to one first hidden state vector;
[0120] Perform pooling processing on the P first hidden state vectors through the pooling layer of the deduplication network to obtain P first document feature vectors;
[0121] Perform deduplication processing on the P initial document fragments according to the P first document feature vectors to obtain valid document fragments that meet the document quality conditions.
[0122] Optionally, the screening module 1014 is specifically configured to:
[0123] Determine the fragment similarity between every two of the P initial document fragments according to the P first document feature vectors;
[0124] When the fragment similarity between two initial document fragments is greater than a first similarity threshold, filter out any one of the two initial document fragments with a fragment similarity greater than the first similarity threshold from the P initial document fragments;
[0125] Determine the initial document fragments that are not filtered out among the above-mentioned P initial document fragments as valid document fragments that meet the document quality conditions.
[0126] Optionally, the screening module 1014 is specifically configured to:
[0127] Generate P second hidden state vectors through the hidden state generation layer of the quality filtering network according to the quality filtering prompt words corresponding to the above-mentioned quality filtering network and the document feature information of each of the above-mentioned P initial document fragments; one document feature information corresponds to one second hidden state vector;
[0128] Perform pooling processing on the above-mentioned P second hidden state vectors through the pooling layer of the quality filtering network to obtain P second document feature vectors;
[0129] Perform quality filtering processing on the above-mentioned P initial document fragments according to the above-mentioned P second document feature vectors to obtain valid document fragments that meet the document quality conditions.
[0130] Optionally, the screening module 1014 is specifically configured to:
[0131] Determine the quality scores corresponding to each of the above-mentioned P initial document fragments according to the above-mentioned P second document feature vectors;
[0132] Filter out the initial document fragments with quality scores less than the first score threshold from the above-mentioned P initial document fragments;
[0133] Determine the initial document fragments that are not filtered out among the above-mentioned P initial document fragments as valid document fragments that meet the document quality conditions.
[0134] Optionally, the document feature information of the above-mentioned valid document fragments is stored in a buffer, and the number of the above-mentioned valid document fragments is D, where D is an integer greater than 1;
[0135] The generation module 1015 is specifically configured to:
[0136] Read the document feature information corresponding to each of the D valid document fragments from the above-mentioned buffer;
[0137] Determine the first relevance between each of the above-mentioned D valid document fragments and the above-mentioned original query information according to the document feature information corresponding to each of the above-mentioned D valid document fragments;
[0138] Determine the second relevance between each of the above-mentioned D valid document fragments and the above-mentioned extended query information according to the document feature information corresponding to each of the above-mentioned D valid document fragments;
[0139] Generate the target retrieval document for the original query information based on the first relevance and the second relevance corresponding to the above-mentioned D valid document fragments respectively, the above-mentioned original query information, and the above-mentioned buffer.
[0140] Optionally, the generation module 1015 is specifically configured to:
[0141] Sort the above-mentioned D valid document fragments in descending order according to the first relevance corresponding to each of the above-mentioned D valid document fragments to obtain the first permutation numbers corresponding to each of the above-mentioned D valid document fragments;
[0142] Sort the above-mentioned D valid document fragments in descending order according to the second relevance corresponding to each of the above-mentioned D valid document fragments to obtain the second permutation numbers corresponding to each of the above-mentioned D valid document fragments;
[0143] Sum the reciprocal of the first permutation number of the i-th valid document fragment and the reciprocal of the second permutation number of the i-th valid document fragment to obtain the fusion score of the i-th valid document fragment; i is an integer less than or equal to D;
[0144] Screen out the target document fragments from the above-mentioned D valid document fragments whose fusion scores are greater than the second score threshold;
[0145] Generate the target retrieval document for the original query information based on the above-mentioned target document fragments, the above-mentioned original query information, and the above-mentioned buffer.
[0146] Optionally, the generation module 1015 is specifically configured to:
[0147] Add the above-mentioned original query information to the prompt template of the information extraction network to obtain the information extraction prompt;
[0148] Read the document feature information of the above-mentioned target document fragments from the above-mentioned buffer;
[0149] Through the above-mentioned information extraction network, according to the above-mentioned information extraction prompt and the document feature information of the above-mentioned target document fragments, extract the document sub-fragments associated with the above-mentioned original query information from the above-mentioned target document fragments;
[0150] Generate the target retrieval document for the above-mentioned original query information based on the above-mentioned document sub-fragments and the above-mentioned original query information through a generation model.
[0151] Optionally, the retrieval module 1012 is used for:
[0152] Retrieve a first candidate document associated with the above original query information from the above knowledge base according to the vector retrieval method, and retrieve a second candidate document associated with the above original query information from the above knowledge base according to the text retrieval method;
[0153] Retrieve a third candidate document associated with the above extended query information from the above knowledge base according to the vector retrieval method, and retrieve a fourth candidate document associated with the above extended query information from the above knowledge base according to the text retrieval method;
[0154] Determine the above first candidate document and the above second candidate document as candidate retrieval documents associated with the above original query information, and determine the above third candidate document and the above fourth candidate document as candidate retrieval documents associated with the above original query information.
[0155] Optionally, the retrieval module 1012 is used for:
[0156] Generate a semantic feature vector reflecting the above original query information and a semantic feature vector reflecting the candidate documents in the above knowledge base;
[0157] Determine the semantic similarity between the semantic feature vector of the above original query information and the semantic feature vectors of the candidate documents in the above knowledge base;
[0158] Determine the candidate documents in the above knowledge base with a semantic similarity greater than the second similarity threshold as the first candidate documents associated with the above original query information.
[0159] Optionally, the retrieval module 1012 is used for:
[0160] Determine the character similarity between the characters in the above original query information and the characters of the candidate documents in the above knowledge base;
[0161] Screen the candidate documents in the above knowledge base with a character similarity greater than the third similarity threshold;
[0162] Determine the screened candidate documents as the second candidate documents associated with the above original query information.
[0163] In this application, by retrieving candidate retrieval documents associated with the original query information and the extended query information respectively from the knowledge base, since the extended query information has a similar semantic relationship with the original query information, more retrieval documents associated with the original query information can be retrieved based on the original query information and the extended query information, thus improving the comprehensiveness of document retrieval. By partitioning the candidate retrieval documents, P initial document fragments are obtained. Based on the document feature information corresponding to the P initial document fragments respectively, valid document fragments that meet the document quality conditions are screened from the above P initial document fragments, and invalid document fragments corresponding to the original query information can be filtered out. Based on the valid document fragments, the above original query information, and the above extended query information, a target retrieval document for the above original query information is generated, which can avoid the interference of invalid document fragments and is conducive to improving the accuracy of document retrieval.
[0164] Please refer to Figure 11 , which is a schematic structural diagram of a computer device provided by an embodiment of this application. As Figure 11 shown, the computer device may refer to the above recognition device, and the computer device 1000 may refer to a terminal or a server, including: a processor 1001, a network interface 1004, and a memory 1005. In addition, the computer device 1000 may further include: a user interface 1003 and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, in some embodiments, the user interface 1003 may include a display screen (DiSPlay) and a keyboard (Keyboard). Optionally, the user interface 1003 may further include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (non-volatile MeMory), such as at least one disk memory. Optionally, the memory 1005 may further be at least one storage device far from the foregoing processor 1001. As Figure 11 shown, the memory 1005, as a computer-readable storage medium, may include an operating system, a network communication module, a user interface module, and a computer program.
[0165] In Figure 11 the computer device 1000 shown, the network interface 1004 can provide network communication functions; while the user interface 1003 is mainly used to provide an input interface; and the processor 1001 can be used to call the computer program stored in the memory 1005 to implement the following steps:
[0166] Obtain N query information; the above N query information includes the original query information and extended query information with a similar semantic relationship to the above original query information, where N is a positive integer greater than 1;
[0167] Retrieve candidate retrieval documents associated with the above N query information from the knowledge base, and perform chunking processing on the candidate retrieval documents associated with the above N query information to obtain P initial document fragments, where P is an integer greater than 1;
[0168] Extract features from the above P initial document fragments to obtain document feature information corresponding to the above P initial document fragments respectively;
[0169] According to the document feature information corresponding to the above P initial document fragments respectively, filter out valid document fragments that meet the document quality conditions from the above P initial document fragments;
[0170] Generate a target retrieval document for the above original query information according to the above valid document fragments, the above original query information, and the above extended query information.
[0171] Optionally, the processor 1001 can be used to call a computer program stored in the memory 1005 to implement the following steps:
[0172] Through the hidden state generation layer of the deduplication network, generate P first hidden state vectors according to the deduplication prompt words corresponding to the above deduplication network and the document feature information of the above P initial document fragments respectively; one document feature information corresponds to one first hidden state vector;
[0173] Through the pooling layer of the deduplication network, perform pooling processing on the above P first hidden state vectors to obtain P first document feature vectors;
[0174] According to the above P first document feature vectors, perform deduplication processing on the above P initial document fragments to obtain valid document fragments that meet the document quality conditions.
[0175] Optionally, the processor 1001 can be used to call a computer program stored in the memory 1005 to implement the following steps:
[0176] According to the above P first document feature vectors, determine the fragment similarity between every two of the above P initial document fragments;
[0177] When the fragment similarity between two document fragments is greater than the first similarity threshold, filter out any one of the two initial document fragments with a fragment similarity greater than the first similarity threshold from the above P initial document fragments;
[0178] Determine the initial document fragments that are not filtered out among the above-mentioned P initial document fragments as valid document fragments that meet the document quality conditions.
[0179] Optionally, the processor 1001 can be used to call the computer program stored in the memory 1005 to implement the following steps:
[0180] Through the hidden state generation layer of the quality filtering network, generate P second hidden state vectors according to the quality filtering prompt words corresponding to the above quality filtering network and the document feature information of each of the above P initial document fragments; one document feature information corresponds to one second hidden state vector;
[0181] Through the pooling layer of the quality filtering network, perform pooling processing on the above P second hidden state vectors to obtain P second document feature vectors;
[0182] According to the above P second document feature vectors, perform quality filtering processing on the above P initial document fragments to obtain valid document fragments that meet the document quality conditions.
[0183] Optionally, the processor 1001 can be used to call the computer program stored in the memory 1005 to implement the following steps:
[0184] According to the above P second document feature vectors, determine the quality scores corresponding to each of the above P initial document fragments;
[0185] Filter out the initial document fragments with quality scores less than the first score threshold from the above P initial document fragments;
[0186] Determine the initial document fragments that are not filtered out among the above P initial document fragments as valid document fragments that meet the document quality conditions.
[0187] Optionally, the document feature information of the above valid document fragments is stored in the buffer, and the number of the above valid document fragments is D, where D is an integer greater than 1;
[0188] Optionally, the processor 1001 can be used to call the computer program stored in the memory 1005 to implement the following steps:
[0189] Read the document feature information corresponding to each of the D valid document fragments from the above buffer;
[0190] According to the document feature information corresponding to each of the above D valid document fragments, determine the first relevance between each of the above D valid document fragments and the above original query information;
[0191] Determine the second relevance between each of the above D valid document segments and the above extended query information according to the document feature information corresponding to each of the above D valid document segments;
[0192] Generate the target retrieval document of the above original query information according to the first relevance and the second relevance corresponding to each of the above D valid document segments, the above original query information and the above buffer;
[0193] Optionally, the processor 1001 can be used to call a computer program stored in the memory 1005 to implement the following steps:
[0194] Sort the above D valid document segments in descending order according to the first relevance corresponding to each of the above D valid document segments to obtain the first permutation numbers corresponding to each of the above D valid document segments;
[0195] Sort the above D valid document segments in descending order according to the second relevance corresponding to each of the above D valid document segments to obtain the second permutation numbers corresponding to each of the above D valid document segments;
[0196] Sum the reciprocal of the first permutation number of the i-th valid document segment and the reciprocal of the second permutation number of the i-th valid document segment to obtain the fusion score of the i-th valid document segment; i is an integer less than or equal to D;
[0197] Screen out the target document segments from the above D valid document segments whose fusion scores are greater than the second score threshold;
[0198] Generate the target retrieval document of the above original query information according to the above target document segments, the above original query information and the above buffer;
[0199] Optionally, the processor 1001 can be used to call a computer program stored in the memory 1005 to implement the following steps:
[0200] Add the above original query information to the prompt template of the information extraction network to obtain the information extraction prompt;
[0201] Read the document feature information of the above target document segments from the above buffer;
[0202] Through the above information extraction network, according to the above information extraction prompt and the document feature information of the above target document segments, extract the document sub-segments associated with the above original query information from the above target document segments;
[0203] Through the generation model, based on the above document sub-segments and the above original query information, generate the target retrieval document of the above original query information.
[0204] Optionally, the processor 1001 may be used to call a computer program stored in the memory 1005 to implement the following steps:
[0205] Retrieve a first candidate document associated with the original query information from the knowledge base according to the vector retrieval method, and retrieve a second candidate document associated with the original query information from the knowledge base according to the text retrieval method;
[0206] Retrieve a third candidate document associated with the extended query information from the knowledge base according to the vector retrieval method, and retrieve a fourth candidate document associated with the extended query information from the knowledge base according to the text retrieval method;
[0207] Determine the first candidate document and the second candidate document as candidate retrieval documents associated with the original query information, and determine the third candidate document and the fourth candidate document as candidate retrieval documents associated with the original query information.
[0208] Optionally, the processor 1001 may be used to call a computer program stored in the memory 1005 to implement the following steps:
[0209] Generate a semantic feature vector reflecting the original query information and a semantic feature vector reflecting the candidate documents in the knowledge base;
[0210] Determine the semantic similarity between the semantic feature vector of the original query information and the semantic feature vectors of the candidate documents in the knowledge base;
[0211] Determine the candidate documents in the knowledge base with a semantic similarity greater than the second similarity threshold as the first candidate documents associated with the original query information.
[0212] Optionally, the processor 1001 may be used to call a computer program stored in the memory 1005 to implement the following steps:
[0213] Determine the character similarity between the characters in the original query information and the characters of the candidate documents in the knowledge base;
[0214] Screen the candidate documents in the knowledge base with a character similarity greater than the third similarity threshold;
[0215] Determine the screened candidate documents as the second candidate documents associated with the original query information.
[0216] In this application, by retrieving candidate retrieval documents associated with the original query information and the extended query information respectively from the knowledge base, since the extended query information has a similar semantic relationship with the original query information, more retrieval documents associated with the original query information can be retrieved based on the original query information and the extended query information, thereby improving the comprehensiveness of document retrieval. By partitioning the candidate retrieval documents, P initial document fragments are obtained. Based on the document feature information corresponding to the P initial document fragments respectively, valid document fragments that meet the document quality conditions are screened out from the above-mentioned P initial document fragments, and invalid document fragments corresponding to the original query information can be filtered out. Based on the valid document fragments, the above-mentioned original query information, and the above-mentioned extended query information, a target retrieval document for the above-mentioned original query information is generated, which can avoid the interference of invalid document fragments and is conducive to improving the accuracy of document retrieval.
[0217] It should be understood that the computer device described in the embodiments of this application can execute the description of the above-mentioned document retrieval method based on document quality screening processing in the corresponding previous embodiments, and can also execute the description of the above-mentioned document retrieval device based on document quality screening processing in the corresponding previous embodiments, which will not be elaborated here. In addition, the description of the beneficial effects of adopting the same method will not be elaborated either.
[0218] In the practical application of data collection and processing in this application, the informed consent or separate consent of the personal information subject should be obtained strictly in accordance with the requirements of relevant laws and regulations, and subsequent data use and processing behaviors should be carried out within the scope authorized by laws and regulations and the personal information subject.
[0219] In addition, it should be pointed out here that: the embodiments of this application also provide a computer-readable storage medium, and the above-mentioned computer-readable storage medium stores a computer program executed by the above-mentioned document retrieval device based on document quality screening processing, and the above-mentioned computer program includes program instructions. When the above-mentioned processor executes the above-mentioned program instructions, it can execute the description of the above-mentioned document retrieval method based on document quality screening processing in the corresponding previous embodiments. Therefore, it will not be elaborated here. In addition, the description of the beneficial effects of adopting the same method will not be elaborated either. For the technical details not disclosed in the embodiments of the computer-readable storage medium involved in this application, please refer to the description of the method embodiments of this application.
[0220] As an example, the above-mentioned program instructions can be deployed to be executed on a computer device, or deployed to be executed on at least two computer devices at one location, or, executed on at least two computer devices distributed at at least two locations and interconnected through a communication network. The at least two computer devices distributed at at least two locations and interconnected through a communication network can form a blockchain network.
[0221] The above computer-readable storage medium may be the document retrieval device for document quality screening processing provided in any of the foregoing embodiments or the middle storage unit of the above computer device, such as the hard disk or the middle memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Further, the computer-readable storage medium may also include both the middle storage unit and the external storage device of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store the data that has been output or will be output.
[0222] In the embodiments of the present application, the terms "first", "second", etc. in the description, claims and drawings of the present application are used to distinguish the content in different media, rather than to describe a specific order. In addition, the term "comprising" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, device, product or equipment that includes a series of steps or units is not limited to the listed steps or modules, but optionally further includes steps or modules that are not listed, or optionally further includes other step units inherent to these processes, methods, devices, products or equipment.
[0223] In the embodiments of the present application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of the overall module or unit that includes the function of the module or unit.
[0224] In the practical application of the relevant data collection and processing in this application book, the informed consent or separate consent of the personal information subject should be obtained strictly in accordance with the requirements of relevant laws and regulations, and subsequent data use and processing behaviors should be carried out within the scope authorized by laws and regulations and the personal information subject.
[0225] The embodiments of the present application also provide a computer program product, including a computer program. When the computer program is executed by a processor, it implements the descriptions of the document retrieval method and decoding method for document quality screening and processing in the corresponding previous embodiments. Therefore, details will not be repeated here. In addition, the beneficial effects of using the same method will not be described again. For the technical details not disclosed in the embodiments of the computer program product involved in the present application, please refer to the description of the method embodiments of the present application.
[0226] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0227] The methods and related devices provided in the embodiments of the present application are described with reference to the method flowcharts and / or structural schematic diagrams provided in the embodiments of the present application. Specifically, each process and / or block of the method flowchart and / or structural schematic diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable network-connected devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable network-connected devices generate a device for implementing the functions specified in one process Figure 1 one process or multiple processes and / or structural schematic Figure 1 one block or multiple blocks. These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable network-connected devices to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured product including an instruction device, and the instruction device implements the functions specified in one process Figure 1 one process or multiple processes and / or structural schematic Figure 1 one block or multiple blocks. These computer program instructions can also be loaded onto a computer or other programmable network-connected devices, so that a series of operation steps are executed on the computer or other programmable devices to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable devices provide steps for implementing the functions specified in one process Figure 1 one process or multiple processes and / or structural schematic one block or multiple blocks.
[0228] The above-disclosed is only the preferred embodiment of the present application. Of course, it cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application still fall within the scope covered by the present application.
Claims
1. A document retrieval method based on document quality screening and processing, characterized in that The method includes: Obtaining N query information; the N query information includes the original query information and extended query information having a similar semantic relationship with the original query information, where N is a positive integer greater than 1; Retrieving candidate retrieval documents respectively associated with the N query information from a knowledge base, and performing chunking processing on the candidate retrieval documents respectively associated with the N query information to obtain P initial document fragments, where P is an integer greater than 1; Performing feature extraction on the P initial document fragments to obtain document feature information respectively corresponding to the P initial document fragments; According to the document feature information respectively corresponding to the P initial document fragments, screening out valid document fragments that meet the document quality conditions from the P initial document fragments; Generating a target retrieval document for the original query information according to the valid document fragments, the original query information, and the extended query information.
2. The method according to claim 1, characterized in that, The screening out valid document fragments that meet the document quality conditions from the P initial document fragments according to the document feature information respectively corresponding to the P initial document fragments includes: Generating P first hidden state vectors through the hidden state generation layer of a deduplication network according to the deduplication prompt words corresponding to the deduplication network and the document feature information of the P initial document fragments respectively; one document feature information corresponds to one first hidden state vector; Performing pooling processing on the P first hidden state vectors through the pooling layer of the deduplication network to obtain P first document feature vectors; Performing deduplication processing on the P initial document fragments according to the P first document feature vectors to obtain valid document fragments that meet the document quality conditions.
3. The method according to claim 2, characterized in that, The performing deduplication processing on the P initial document fragments according to the P first document feature vectors to obtain valid document fragments that meet the document quality conditions includes: Determining the fragment similarity between every two of the P initial document fragments according to the P first document feature vectors; When the fragment similarity between two initial document fragments is greater than a first similarity threshold, filtering out any one of the two initial document fragments with a fragment similarity greater than the first similarity threshold from the P initial document fragments; Determining the initial document fragments that are not filtered out among the P initial document fragments as valid document fragments that meet the document quality conditions.
4. The method according to claim 1, wherein The screening out valid document fragments that meet the document quality conditions from the P initial document fragments according to the document feature information respectively corresponding to the P initial document fragments includes: Generating P second hidden state vectors through the hidden state generation layer of a quality filtering network according to the quality filtering prompt words corresponding to the quality filtering network and the document feature information of the P initial document fragments respectively; one document feature information corresponds to one second hidden state vector; Performing pooling processing on the P second hidden state vectors through the pooling layer of the quality filtering network to obtain P second document feature vectors; Performing quality filtering processing on the P initial document fragments according to the P second document feature vectors to obtain valid document fragments that meet the document quality conditions.
5. The method according to claim 4, wherein Performing quality filtering on the P initial document segments according to the P second document feature vectors to obtain valid document segments that meet the document quality conditions, including: Determining the quality scores corresponding to the P initial document segments respectively according to the P second document feature vectors; Filtering out the initial document segments with quality scores less than the first score threshold from the P initial document segments; Determining the initial document segments that are not filtered out among the P initial document segments as valid document segments that meet the document quality conditions.
6. The method according to claim 1, characterized in that, The document feature information of the valid document segments is stored in a buffer, and the number of the valid document segments is D, where D is an integer greater than 1; Generating a target retrieval document for the original query information according to the valid document segments, the original query information, and the extended query information, including: Reading the document feature information corresponding to the D valid document segments respectively from the buffer; Determining the first relevance between the D valid document segments and the original query information respectively according to the document feature information corresponding to the D valid document segments; Determining the second relevance between the D valid document segments and the extended query information respectively according to the document feature information corresponding to the D valid document segments; Generating a target retrieval document for the original query information according to the first relevance and the second relevance corresponding to the D valid document segments respectively, the original query information, and the buffer.
7. The method according to claim 6, wherein Generating a target retrieval document for the original query information according to the first relevance and the second relevance corresponding to the D valid document segments respectively, the original query information, and the buffer, including: Sorting the D valid document segments in descending order according to the first relevance corresponding to the D valid document segments respectively to obtain the first permutation numbers corresponding to the D valid document segments; Sorting the D valid document segments in descending order according to the second relevance corresponding to the D valid document segments respectively to obtain the second permutation numbers corresponding to the D valid document segments; Performing a summation process on the reciprocal of the first permutation number of the i-th valid document segment and the reciprocal of the second permutation number of the i-th valid document segment to obtain the fusion score of the i-th valid document segment; i is an integer less than or equal to D; Screening out target document segments with fusion scores greater than the second score threshold from the D valid document segments; Generating a target retrieval document for the original query information according to the target document segments, the original query information, and the buffer.
8. The method according to claim 7, wherein Generating a target retrieval document for the original query information according to the target document segments, the original query information, and the buffer, including: Adding the original query information to the prompt template of the information extraction network to obtain an information extraction prompt; Reading the document feature information of the target document segments from the buffer; Through the information extraction network, according to the information extraction prompt word and the document feature information of the target document fragment, extract a document sub-fragment associated with the original query information from the target document fragment; Through a generation model, based on the document sub-fragment and the original query information, generate a target retrieval document for the original query information.
9. The method according to claim 1, characterized in that, The retrieving, from the knowledge base, candidate retrieval documents respectively associated with the N query information includes: Retrieve a first candidate document associated with the original query information from the knowledge base according to the vector retrieval method, and retrieve a second candidate document associated with the original query information from the knowledge base according to the text retrieval method; Retrieve a third candidate document associated with the extended query information from the knowledge base according to the vector retrieval method, and retrieve a fourth candidate document associated with the extended query information from the knowledge base according to the text retrieval method; Determine the first candidate document and the second candidate document as candidate retrieval documents associated with the original query information, and determine the third candidate document and the fourth candidate document as candidate retrieval documents associated with the original query information.
10. The method according to claim 9, wherein, The retrieving, according to the vector retrieval method, a first candidate document associated with the original query information from the knowledge base includes: Generate a semantic feature vector reflecting the original query information and a semantic feature vector reflecting the candidate documents in the knowledge base; Determine the semantic similarity between the semantic feature vector of the original query information and the semantic feature vectors of the candidate documents in the knowledge base; Determine the candidate documents in the knowledge base with a semantic similarity greater than the second similarity threshold as the first candidate documents associated with the original query information.
11. The method according to claim 9, wherein The retrieving, according to the text retrieval method, a second candidate document associated with the original query information from the knowledge base includes: Determine the character similarity between the characters in the original query information and the characters of the candidate documents in the knowledge base; Screen the candidate documents in the knowledge base with a character similarity greater than the third similarity threshold; Determine the screened candidate documents as the second candidate documents associated with the original query information.
12. A document retrieval device based on document quality screening and processing, characterized in that, The device includes: An acquisition module, configured to acquire N query information; the N query information includes the original query information and extended query information having a similar semantic relationship with the original query information, and N is a positive integer greater than 1; A retrieval module, configured to retrieve candidate retrieval documents respectively associated with the N query information from the knowledge base, and perform chunking processing on the candidate retrieval documents respectively associated with the N query information to obtain P initial document fragments, where P is an integer greater than 1; An extraction module, configured to perform feature extraction on the P initial document fragments to obtain document feature information respectively corresponding to the P initial document fragments; A screening module, configured to screen out valid document fragments that meet the document quality conditions from the P initial document fragments according to the document feature information respectively corresponding to the P initial document fragments; A generation module, configured to generate a target retrieval document for the original query information according to the valid document fragment, the original query information, and the extended query information.
13. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 11 are implemented.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
