Fuzzy multi-keyword-based retrieval method and device, computer equipment and storage medium
By adopting a fuzzy multi-keyword search method in the ciphertext search technology, using local sensitive hash data to match the target index vector of the document, the problem of inefficient search caused by keyword error in the prior art is solved, and more efficient and accurate document retrieval is achieved.
Patent Information
- Application Number
- CN202411575283.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-02-28
Smart Images

Figure CN119537565A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of ciphertext retrieval, and in particular to a retrieval method, apparatus, computer equipment, storage medium and computer program product based on fuzzy multi-keywords. Background Art
[0002] In cloud computing environments, it is a challenge to achieve efficient information retrieval while protecting data security. Ciphertext retrieval technology has emerged, which allows direct retrieval of encrypted data without decryption, thus ensuring the confidentiality of the data.
[0003] In the related technology, Bloom filter and hash algorithm are generally combined to achieve accurate matching between multi-keyword vector index of documents and keywords of user queries based on ciphertext state. In actual application scenarios, the keywords input by users may have errors. When performing precise hash calculation and search through the above method, matching document results cannot be returned, resulting in low document search efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide a fuzzy multi-keyword retrieval method, device, computer equipment, computer-readable storage medium and computer program product that can improve search efficiency in response to the above technical problems.
[0005] In a first aspect, the present application provides a retrieval method based on fuzzy multiple keywords. The method comprises:
[0006] Obtaining local sensitive hash data corresponding to a query keyword, wherein the local sensitive hash data is obtained by processing the query keyword using a local sensitive hash algorithm;
[0007] Based on the local sensitive hash data corresponding to the query keyword and the target index vector of each document, calculating the evaluation score corresponding to each document, wherein the evaluation score represents the matching degree between the document and the query keyword;
[0008] Based on the evaluation scores of the documents, a target document is obtained.
[0009] In one embodiment, the method further comprises:
[0010] Determining an initial index vector based on the number of keywords in the document;
[0011] For each of the keywords, calculate local sensitive hash data of the keyword, the local sensitive hash data including expected subscript, fingerprint and relevance score;
[0012] The local sensitive hash data corresponding to each keyword is added to the initial index vector to obtain the target index vector corresponding to the document.
[0013] In one embodiment, the local sensitive hash data includes at least an expected subscript and a fingerprint, and the calculation of the evaluation score corresponding to each of the documents based on the local sensitive hash data corresponding to the query keyword and the target index vector of each document includes:
[0014] For each of the documents, based on the first expected subscript of each of the query keywords, searching in the target index vector corresponding to the document respectively;
[0015] For each of the query keywords, if a second expected subscript matching the first expected subscript of the query keyword is stored in the target index vector corresponding to the document, a second fingerprint and a relevance score corresponding to the second expected subscript are obtained in the target index vector, and a similarity distance between the second fingerprint and the first fingerprint of the query keyword is calculated; if the similarity distance satisfies a preset similarity condition, an evaluation score corresponding to the query keyword is obtained based on the relevance score;
[0016] Based on the evaluation scores corresponding to the query keywords, the evaluation scores of the documents are obtained.
[0017] In one embodiment, the query keyword includes at least a plurality of keywords, and obtaining the evaluation score corresponding to the query keyword based on the relevance score includes:
[0018] Determining the relevance score as the evaluation score corresponding to the query keyword;
[0019] The step of obtaining the evaluation score of the document based on the evaluation score corresponding to each query keyword includes:
[0020] The evaluation scores corresponding to the query keywords are superimposed to obtain the evaluation score of the document.
[0021] In one embodiment, obtaining a target document based on the evaluation scores of each of the documents includes:
[0022] In descending order of evaluation scores, the target number of documents are extracted as target documents.
[0023] In one embodiment, the method further comprises:
[0024] A document query request sent by a client is received, where the document query request at least includes local sensitive hash data corresponding to each query keyword, and the local sensitive hash data is obtained after the client processes the query keyword through a local sensitive hash algorithm.
[0025] In a second aspect, the present application also provides a retrieval device based on fuzzy multiple keywords. The device comprises:
[0026] A first acquisition module is used to acquire local sensitive hash data corresponding to a query keyword, wherein the local sensitive hash data is obtained by processing the query keyword through a local sensitive hash algorithm;
[0027] A first calculation module, configured to calculate an evaluation score corresponding to each of the documents based on the local sensitive hash data corresponding to the query keyword and the target index vector of each document, wherein the evaluation score represents a matching degree between the document and the query keyword;
[0028] The first determination module is used to obtain a target document based on the evaluation scores of each of the documents.
[0029] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0030] Obtaining local sensitive hash data corresponding to a query keyword, wherein the local sensitive hash data is obtained by processing the query keyword using a local sensitive hash algorithm;
[0031] Based on the local sensitive hash data corresponding to the query keyword and the target index vector of each document, calculating the evaluation score corresponding to each document, wherein the evaluation score represents the matching degree between the document and the query keyword;
[0032] Based on the evaluation scores of the documents, a target document is obtained.
[0033] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0034] Obtaining local sensitive hash data corresponding to a query keyword, wherein the local sensitive hash data is obtained by processing the query keyword using a local sensitive hash algorithm;
[0035] Based on the local sensitive hash data corresponding to the query keyword and the target index vector of each document, calculating the evaluation score corresponding to each document, wherein the evaluation score represents the matching degree between the document and the query keyword;
[0036] Based on the evaluation scores of the documents, a target document is obtained.
[0037] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0038] Obtaining local sensitive hash data corresponding to a query keyword, wherein the local sensitive hash data is obtained by processing the query keyword using a local sensitive hash algorithm;
[0039] Based on the local sensitive hash data corresponding to the query keyword and the target index vector of each document, calculating the evaluation score corresponding to each document, wherein the evaluation score represents the matching degree between the document and the query keyword;
[0040] Based on the evaluation scores of the documents, a target document is obtained.
[0041] The above-mentioned retrieval method, device, computer equipment, storage medium and computer program product based on fuzzy multi-keywords, wherein the method includes: obtaining local sensitive hash data corresponding to the query keyword, the local sensitive hash data is obtained by processing the query keyword through the local sensitive hash algorithm; based on the local sensitive hash data corresponding to the query keyword and the target index vector of each document, calculating the evaluation score corresponding to each document, the evaluation score represents the degree of matching between the document and the query keyword; based on the evaluation score of each document, obtaining the target document. By adopting this method, the local sensitive hash data calculated by the p-stable local sensitive hash LSH algorithm can be combined to realize fuzzy query and improve the retrieval flexibility in the field of ciphertext retrieval of documents; based on the evaluation score of each document, the target document is screened, which can improve the correlation between the target document and the query keyword, ensure the correlation between the output document and the required document, ensure the accuracy and effectiveness of the query result, and further improve the data retrieval efficiency and the user's retrieval experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 is an application environment diagram of a retrieval method based on fuzzy multiple keywords in one embodiment;
[0043] Figure 2 A schematic diagram of a flow chart of a retrieval method based on fuzzy multiple keywords in one embodiment;
[0044] Figure 3 is a schematic flow chart of a step of obtaining a target index vector in one embodiment;
[0045] Figure 4 A schematic diagram of a flow chart of a step of obtaining an evaluation score in one embodiment;
[0046] Figure 5 A schematic diagram of a structure for constructing a target index vector in one embodiment;
[0047] Figure 6 1 is a schematic diagram of the structure of a document D index vector based on a Quotient Filter and a schematic diagram of the structure of a matching process in an embodiment;
[0048] Figure 7 is a schematic diagram of a specific target index vector structure in one embodiment;
[0049] Figure 8 A schematic diagram of a matching process in one embodiment;
[0050] Fig. 9 A schematic diagram of a process of constructing a target index vector in one embodiment;
[0051] Fig.10 is a flow chart of a retrieval method based on fuzzy multiple keywords in another embodiment;
[0052] Fig.11 A schematic diagram of a process of deleting a vector in one embodiment;
[0053] Fig.12 is a structural block diagram of a retrieval device based on fuzzy multiple keywords in one embodiment;
[0054] Fig.13 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0056] The fuzzy multi-keyword search method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the client 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The client 102 can obtain a query keyword or multiple query keywords input by the user, and hash the query keyword through the local sensitive hashing algorithm to obtain the local sensitive hash data corresponding to the query keyword. Based on this, the client 102 can send a request carrying the local sensitive hash data to the server 104. The server 104 can query in the index vectors corresponding to multiple documents stored locally on the server 104 based on the local sensitive hash data in the received request, and obtain multiple target documents. In this way, the server 104 can return multiple target documents to the client 102, and each document sent by the server 104 can be an encrypted document. The client 102 can decrypt the received target document to obtain the decrypted document.
[0057] The client 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers, wherein the server may be a cloud server.
[0058] In one embodiment, Figure 2 As shown, a retrieval method based on fuzzy multiple keywords is provided. This embodiment takes the method applied to a server as an example. The server can be implemented by an independent server or a server cluster composed of multiple servers. In this embodiment, the retrieval method based on fuzzy multiple keywords includes the following steps:
[0059] Step 202, obtaining the local sensitive hash data corresponding to the query keyword.
[0060] Among them, the locally sensitive hash data is obtained by processing the query keyword through the locally sensitive hash algorithm; the query keyword can be data input by the user, and the query keyword is used to query the document, and can be a keyword in the document to be queried. For example, the user determines the document to be queried based on the needs of the actual application scenario, and determines one or more query keywords based on the document to be queried; the user can also determine one or more query keywords related to the document based on the needs of the actual application scenario. The locally sensitive hash algorithm can be a p-stable locally sensitive hash algorithm. The locally sensitive hash data obtained by this hash algorithm can map text with similar features to the same hash bucket with a higher probability. The locally sensitive hash data can at least include the expected subscript and fingerprint obtained after hashing the query keyword. The expected subscript can be a quotient value, and the fingerprint can be a remainder.
[0061] Specifically, the server can obtain local sensitive hash data corresponding to a query keyword, and the server can also obtain multiple corresponding local sensitive hash data. Specifically, the user can perform a trigger operation on the client. In response to the trigger operation, the client can obtain the query keyword input by the user, and hash the query keyword based on the local sensitive hash algorithm to at least obtain the expected subscript and fingerprint corresponding to the query keyword. The client can generate a request, which at least carries the local sensitive hash data corresponding to the query keyword. The client can send a request to the server, and the server can parse the received request to obtain the local sensitive hash data corresponding to each query keyword carried in the request.
[0062] Step 204, based on the local sensitive hash data corresponding to the query keyword and the target index vector of each document, calculate the evaluation score corresponding to each document.
[0063] Among them, the evaluation score represents the degree of match between the document and the query keyword, and the evaluation score can be a criterion for users to select from multiple documents. The local sensitive hash data corresponding to the query keyword can be a hash value obtained by processing the query keyword through a local sensitive hash algorithm. The process of determining the target index vector corresponding to each document can include determining at least one keyword in the document, and hashing the keyword through a local sensitive hash algorithm to obtain the local sensitive hash data corresponding to the keyword, and based on the local sensitive hash data corresponding to each keyword in the document and the initial index vector, obtaining the target index vector corresponding to the document.
[0064] Specifically, the server can screen the target index vectors corresponding to the documents stored locally on the server, and the server can traverse and process each document, or process each document separately based on multiple parallel threads. The process of processing each document can be that when there are multiple query keywords obtained by the server, the server can calculate the similarity distance between the local sensitive hash data of each query keyword and the target index vector. For each query keyword, the server can determine the evaluation score of the document on the statistical dimension of the query keyword based on the similarity distance. Based on the evaluation scores of the document on the statistical dimensions of each query keyword, the server can obtain a comprehensive evaluation score for the document.
[0065] Optionally, when the server determines that there is one query keyword, the server can calculate the similarity distance between the local sensitive hash data of the query keyword and the target index vector. Based on the similarity distance, the server can determine the evaluation score of the document on the statistical dimension of the query keyword, and determine the evaluation score as the comprehensive evaluation score of the document.
[0066] Step 206: Get the target document based on the evaluation score of each document.
[0067] The target document may include multiple documents, and the document may be a document matching the query keyword.
[0068] Specifically, the server can filter based on the calculated evaluation scores corresponding to each document to obtain a target document, and the server can return the obtained target document to the client, for example, it can be returned to the client as response data received by the server from a request sent by the client; optionally, the target document returned by the server can be an encrypted document, and the server can decrypt the target document to obtain a decrypted document.
[0069] In the above retrieval method based on fuzzy multiple keywords, the local sensitive hash data corresponding to the query keyword is obtained, and the local sensitive hash data is obtained by processing the query keyword through the local sensitive hash algorithm; based on the local sensitive hash data corresponding to the query keyword and the target index vector of each document, the evaluation score corresponding to each document is calculated, and the evaluation score represents the degree of matching between the document and the query keyword; based on the evaluation score of each document, the target document is obtained. By adopting this method, the local sensitive hash data calculated by the p-stable local sensitive hash (LSH) algorithm can be combined to realize fuzzy query, improve the retrieval flexibility in the field of ciphertext retrieval of documents, and filter the target document based on the evaluation score of each document, which can improve the correlation between the target document and the query keyword, ensure the correlation between the output document and the required document, ensure the accuracy and effectiveness of the query result, and further improve the data retrieval efficiency and the user's retrieval experience.
[0070] In one embodiment, Figure 3 As shown, the retrieval method based on fuzzy multiple keywords also includes:
[0071] Step 302: Determine an initial index vector based on the number of keywords in the document.
[0072] Specifically, the server can adjust and optimize the number of keywords in the document based on the performance and the test effect of hash collision, and determine the size of the initial index vector. That is, the server can create an initial index vector of appropriate size for each document stored locally on the server based on the number of keywords in the preset corpus, and the initial index vector can be a Quotient Filter vector. That is, the server can create an initial index vector of appropriate size for each document based on the number of keywords in the document, and the document and the initial index vector are in one-to-one correspondence, and accordingly, the document and the target index vector are also in one-to-one correspondence.
[0073] Step 304: For each keyword, calculate the local sensitive hash data of the keyword.
[0074] Among them, the locally sensitive hash data includes an expected subscript, a fingerprint, and a correlation score. The expected subscript can be a quotient value, and the fingerprint can be a remainder. Optionally, for each keyword, the server can perform hash processing on the keyword through a locally sensitive hashing algorithm to obtain a hash value LSH corresponding to the keyword, and perform a first processing on the hash value through a target value to obtain the expected subscript corresponding to the keyword, that is, the quotient value; the server can also perform a second processing on the hash value through the target value to obtain the fingerprint corresponding to the keyword, that is, the remainder. In other words, the server can determine the high bit of the calculated hash value as the expected subscript, that is, the quotient value, and the server can determine the low bit of the calculated hash value as the fingerprint, that is, the remainder.
[0075] Accordingly, the target value may be 2n. LSH (keyword) represents the hash value (LSH local sensitive hash value) obtained by hashing the keyword based on the local sensitive hashing algorithm; the server may calculate the expected subscript Q and the fingerprint R by the following formula:
[0076] Q = LSH (keyword) / 2n,
[0077] R=LSH(keyword)%2n.
[0078] In a specific embodiment, the service end (server) can negotiate with the client to obtain a negotiation result. The server can determine the parameters in the local sensitive hash algorithm based on the negotiation result. The local sensitive hash algorithm is used to map two or more similar vectors to the same hash value to implement a basis for detecting similarity between texts. The local sensitive hash algorithm can be a p-stable algorithm, where the value of p is 1 or 2, and the p-stable distribution is a Cauchy distribution; when p=2, the p-stable distribution is a normal distribution. The server can calculate the local sensitive hash value corresponding to the keyword using the following formula:
[0079]
[0080] Among them, h represents the local sensitive hash value corresponding to the keyword, is the vector after text vectorization, that is, the vector obtained after text vectorization of keywords; w is the width of the vector slice; b is a random number in [0,w]; is a random number vector, which can be a vector of random numbers that conform to the p-stable distribution, and its dimension is That is, the server can perform text vectorization post-processing on the keyword to obtain a text vector, and determine a random number and a random number vector, the dimension of which is the same as that of the text vector. The server can process the text vector and the random number vector to obtain a processing result, and calculate the local sensitive hash value corresponding to the keyword based on the processing result, the random number, and the width of the vector slice.
[0081] In one example, the device can perform text vectorization processing on the keyword, and after obtaining the text vector, After b and w are subjected to the relevant p-stable hash calculation, the local sensitive hash value is obtained. For example, the device can pre-configure the value of p and the corresponding distribution, and randomly generate a random number vector. Based on the dimension of the initial index vector, the equal width of each segment of the vector (the width of the vector slice) w is determined, and a random number is randomly selected and combined with the above random number vector to obtain the p-stable local sensitive hash algorithm.
[0082] Specifically, for each of the multiple keywords in the document, the server can perform hash processing on the keyword based on the p-stable local sensitive hashing algorithm to obtain the local sensitive hash value corresponding to the keyword, and perform a first processing and a second processing on the local sensitive hash value through the target value to obtain the expected subscript Q and fingerprint R of the keyword respectively. The server can also perform processing based on the local sensitive hash value to obtain the correlation score TF-IDF.
[0083] Step 306: Add the local sensitive hash data corresponding to each keyword to the initial index vector to obtain a target index vector corresponding to the document.
[0084] The initial index vector may be a blank quotation filter, and each index vector corresponds to each document one by one.
[0085] Specifically, each keyword and the expected subscript, remainder, and correlation score corresponding to each keyword may be stored inside the server, and the specific storage form may be stored in the form of an index vector.
[0086] It should be noted that the initial index vector can have multiple equally divided sub-vectors, and the sub-vectors can be arranged in sequence according to the size of the index value in the initial index vector; the server can query the index value consistent with the expected subscript Q in the initial index vector based on the expected subscript of the keyword, and add the fingerprint R and the correlation score corresponding to the keyword to the sub-vector corresponding to the index value; the sub-vector corresponding to the index value can be the run / cluster corresponding to the index value.
[0087] If the subvector corresponding to the index value matched by the expected subscript of the keyword is already occupied, the starting position of the run corresponding to Q can be determined in the traditional Quotient Filter manner, and the position that can be inserted or the new free position can be found in the run and its corresponding cluster in ascending order, and [R, TF-IDF] is inserted, and the subsequent elements in the run / cluster are all shifted back one position. That is, if the subvector corresponding to the index value of the expected subscript is currently occupied, the server can determine whether the next subvector adjacent to the subvector is occupied. If not, the fingerprint and relevance score corresponding to the expected subscript can be added to the subvector, until the local sensitive hash data corresponding to each keyword in the document are added to the initial index vector, and the target index vector can be obtained. The structural diagram of the specific index vector will be described in detail in the following embodiments, and will not be repeated here.
[0088] In this embodiment, by performing local sensitive hash calculations on each keyword in each document, the expected subscript, fingerprint and correlation score corresponding to each keyword are obtained, and multiple target index vectors for document retrieval can be pre-stored locally on the server to provide a reliable data basis for subsequent document retrieval. By performing local sensitive hash processing, fuzzy query can be achieved to improve the user's retrieval experience. By adding the local sensitive hash data corresponding to the keyword to the index vector, the deletion function of the specified element can be implemented, and the storage space of the corresponding relationship can be reduced.
[0089] In one embodiment, the locality sensitive hash data includes at least an expected index and a fingerprint.
[0090] like Figure 4 As shown, the specific processing process of the step "calculating the evaluation scores corresponding to each document based on the local sensitive hash data corresponding to the query keyword and the target index vector of each document" includes:
[0091] Step 402: for each document, based on the first expected subscript of each query keyword, search in the target index vector corresponding to the document.
[0092] The query keyword may be a query keyword input in an application scenario for querying documents, or multiple query keywords input by a user. The document may be a document with a corresponding target index vector stored locally on the server, or may be a document stored locally on the server, and the server may request the target index vector corresponding to the document from other servers.
[0093] Specifically, the server can obtain multiple documents and the target index vector corresponding to each document, and calculate the evaluation score between the query keyword and each document. The specific evaluation score determination process may include: for each document, the server can query the index value that matches the expected subscript based on the expected subscript of the query keyword among the multiple index values in the target index item vector corresponding to the document.
[0094] In one example, the server may search for an index value that matches the first expected subscript of the query keyword among multiple index values in the target index vector of the document, that is, it may search for a second expected subscript that is consistent with the first expected subscript; in another example, the server may not search for an index value that matches the first expected subscript of the query keyword in the target index vector, that is, it may not search for the second expected subscript that matches the first expected subscript.
[0095] Step 404: for each query keyword, if a second expected subscript matching the first expected subscript of the query keyword is found in the target index vector corresponding to the document, a second fingerprint corresponding to the second expected subscript and a relevance score are obtained in the target index vector, and a similarity distance between the second fingerprint and the first fingerprint of the query keyword is calculated. If the similarity distance meets the preset similarity condition, an evaluation score corresponding to the query keyword is obtained based on the relevance score.
[0096] Specifically, for each query keyword, if the server searches for a target index value that matches the first expected subscript of the query keyword in multiple index values of the target index vector of the document, it can be determined that a second expected subscript that matches the first expected subscript is searched. In this way, the server can obtain the fingerprint (hereinafter referred to as the first fingerprint) and the relevance score stored in the subvector corresponding to the target index value in the target index vector. The server can calculate the similarity distance between the second fingerprint and the fingerprint (first fingerprint) of the query keyword, and determine whether the similarity distance meets the preset similarity condition. If it is determined that the similarity distance meets the preset similarity condition, the server can determine the evaluation score corresponding to the query keyword based on the relevance score obtained in the subvector.
[0097] The similarity distance may be the Hamming distance between the first fingerprint and the second fingerprint. If the Hamming distance is less than or equal to a preset distance threshold, the server may determine that the Hamming distance satisfies a preset similarity condition. If the preset similarity condition is met, the server may determine that the relevance score obtained in the subvector is the evaluation score corresponding to the query keyword; if the similarity condition is not met, the server may determine that the evaluation score corresponding to the query keyword is zero.
[0098] In the sub-vector corresponding to the target index value, the process of obtaining the fingerprint stored therein may be that the same index value may correspond to multiple local sensitive hash data with the same expected subscript, that is, the expected subscript is the same, but the relevance score and fingerprint are different. The server may sequentially obtain multiple fingerprints in the sub-vector, and respectively calculate the Hamming distance between each fingerprint and the fingerprint of the query keyword. If there is a fingerprint whose Hamming distance is less than or equal to the preset distance threshold, the relevance score corresponding to the fingerprint is used to determine the evaluation score of the query keyword.
[0099] Step 406: Obtain the evaluation score of the document based on the evaluation score corresponding to each query keyword.
[0100] Specifically, the server may perform superposition processing on the evaluation scores of the query keywords to obtain a sum value, and determine the sum value as the evaluation score of the document.
[0101] In this embodiment, by combining the Hamming distance between fingerprints, document retrieval based on fuzzy query keywords can be implemented, and the retrieved documents can be sorted by relevance, thereby improving query efficiency and ensuring query accuracy.
[0102] In one embodiment, the query keyword includes at least multiple keywords, and the keyword input by the user for searching for the required documents may include multiple query keywords, or the user needs to search for documents matching multiple query keywords.
[0103] Accordingly, the specific processing process of the step of "obtaining the evaluation score corresponding to the query keyword based on the relevance score" includes:
[0104] The relevance score is determined to be the evaluation score corresponding to the query keyword.
[0105] Specifically, if the Hamming distance is less than or equal to a preset distance threshold, the server may determine that the Hamming distance satisfies a preset similarity condition. If the preset similarity condition is met, the server may determine that the relevance score obtained in the subvector is the evaluation score corresponding to the query keyword; if the similarity condition is not met, the server may determine that the evaluation score corresponding to the query keyword is zero.
[0106] Correspondingly, the specific processing process of the step “obtaining the evaluation score of the document based on the evaluation score corresponding to each query keyword, including” includes:
[0107] The evaluation scores corresponding to each query keyword are superimposed to obtain the evaluation score of the document.
[0108] Specifically, the server may perform superposition processing on the evaluation scores of the query keywords to obtain a sum value, and determine the sum value as the evaluation score of the document.
[0109] In this embodiment, by combining the Hamming distance between fingerprints, document retrieval based on fuzzy query keywords can be implemented, and the retrieved documents can be sorted by relevance, thereby improving query efficiency and ensuring query accuracy.
[0110] In one embodiment, the specific processing of the step of "obtaining a target document based on the evaluation scores of each document" includes:
[0111] In descending order of evaluation scores, the target number of documents are extracted as target documents.
[0112] The target number may be a pre-configured number of document outputs.
[0113] Specifically, the server can obtain the evaluation scores of each document, and the server can screen each document based on the evaluation scores of each document, and determine the target number of documents with the largest evaluation scores as the target documents. In other words, the server can sort each document based on the evaluation scores of each document, and sort each document in descending order of the evaluation scores, and determine the target number of documents as the target documents.
[0114] In this embodiment, by sorting the retrieved documents according to their relevance, the query efficiency is improved and the query accuracy is guaranteed at the same time.
[0115] In one embodiment, the fuzzy multi-keyword based retrieval method further includes:
[0116] Receive document query requests sent by clients.
[0117] Among them, the document query request at least includes the local sensitive hash data corresponding to each query keyword, and the local sensitive hash data is obtained after the client processes the query keyword through the local sensitive hash algorithm.
[0118] Specifically, the user can perform a trigger operation on the client. In response to the trigger operation, the client can obtain the query keyword input by the user, and perform hash processing on the query keyword based on the local sensitive hashing algorithm to at least obtain the expected subscript and fingerprint corresponding to the query keyword. The client can generate a document query request, which at least carries the local sensitive hash data corresponding to the query keyword. The client can send the document query request to the server. The server can parse the received document query request to obtain the local sensitive hash data corresponding to each query keyword carried by the document query request, and based on the obtained local sensitive hash data corresponding to each query keyword, execute the fuzzy multi-keyword retrieval method described in the above embodiment to obtain the target document. Based on this, the server can return the target document to the sending end.
[0119] In this embodiment, fuzzy query can be implemented by combining the local sensitive hash data calculated by the p-stable local sensitive hash (LSH) algorithm.
[0120] The specific implementation process of the above fuzzy multi-keyword search method is described in detail below in conjunction with a specific embodiment:
[0121] The following content introduces multiple terms related to the fuzzy multi-keyword search method described in this embodiment:
[0122] The p-stable locality-sensitive hashing algorithm is an approximate similarity search algorithm for processing high-dimensional data. It can map data to a lower-dimensional hash space so that similar data is more likely to be mapped to the same hash value in the hash space. Its application scenarios include text retrieval, image recognition, and bioinformatics.
[0123] Quotient Filter is an efficient approximate data structure used to quickly find out whether an element exists. The elements can be mapped to a smaller numerical space through a hash function, and then these numerical values are modulo-operated to generate a shorter bit array. Its function is to reduce storage space while providing fast search. The main advantages of Quotient Filter are: Higher accuracy: The error rate of Quotient Filter can be controlled more precisely, while the error rate of Bloom Filter is fixed. Deletability: Quotient Filter supports deletion operations, while Bloom Filter does not. Flexibility: Quotient Filter can balance storage space and search speed by adjusting parameters.
[0124] Ciphertext search encrypts data before storage, and then performs search operations on the encrypted data. This ensures data confidentiality while providing basic search capabilities. Currently, the industry is mainly conducting innovative research on index encryption, search algorithms, and data encryption. Its main application scenarios are medical records, financial services, and cloud storage services.
[0125] Multi-keyword query allows users to search for information by entering multiple keywords, providing more accurate search results because it can simultaneously consider multiple words related to user needs. Multi-keyword query is a common function in databases, search engines, and various information retrieval systems. The multi-keyword query method in the field of ciphertext retrieval must be completed in the ciphertext state.
[0126] Fuzzy query: An information retrieval technique based on edit distance, Hamming distance, similarity measurement or index optimization that allows users to search without having to completely match keywords or phrases. This query method can tolerate some minor errors or changes, thereby providing more flexible and extensive search results and improving the practicality of information retrieval. Fuzzy query methods in the field of encrypted text retrieval must be completed in the encrypted state.
[0127] Relevance ranking: A technique in information retrieval systems that aims to sort search results by relevance to the query based on the intent and content of the user's query. This sorting method can significantly improve the user experience because it helps users find the information they need more quickly. The most common relevance score is TF-IDF. Relevance sorting in the field of encrypted retrieval must be done in the encrypted state.
[0128] The index building process in the fuzzy multi-keyword retrieval method provided in this embodiment includes: the data owner first selects keywords for each document, encrypts and calculates the expected subscript and fingerprint of the index keyword through the high and low bits of the p-stable LSH, maps them to the improved Quotient Filter as the document index vector, and encrypts all the index vectors and documents and uploads them to the cloud storage server; in the online query stage, the data user calculates the expected subscript and fingerprint of the request keyword in the same way, and sends the calculation result as a request to the server. The server searches for the fingerprint that matches the request keyword from the index vector of each document through the expected subscript, calculates and sorts, and returns the top-k ciphertext documents with the highest relevance to the data user, and the data user decrypts the top-k ciphertext documents.
[0129] In the first step, the server and the client negotiate to select a p-stable local sensitive hash. Based on the characteristics of the p-stable local sensitive hash algorithm, texts with similar features can be mapped to the same hash bucket with a higher probability, realizing a fuzzy query function that tolerates spelling errors.
[0130] In the second step, the server creates a Quotient Filter as an index vector (target index vector) for each document, and inserts the low bit of the LSH hash value of each keyword of the document into the vector as the relevance score between the fingerprint and the keyword. Specifically, according to the number of keywords in the overall corpus, a Quotient Filter vector of appropriate size is created for each document. The index keyword set of each document is traversed, and the following operations are performed: traverse each index keyword, calculate Q = LSH (new keyword) / 2n, R = LSH (new keyword) % 2n, TF-IDF for each index keyword; according to the rules of QuotientFilter, find the run corresponding to Q in QuotientFilter, and insert R and TF-IDF into the corresponding free elements in the insertion sort method to obtain the target index vector. After the index vector of the document library is constructed, it resides in the memory of the server.
[0131] like Figure 5 As shown, it can be a schematic diagram of index construction of Quotient Filter (target index vector):
[0132] The initial index vector may include sub-vector 0, sub-vector 1, ..., sub-vector 8. For each sub-vector, the first line contains flags, including is_occupied, is_continuation, and is shifted, and the second line contains storage space run / cluster:
[0133] The keywords in s1 can be boy, egg and fire, and the server can calculate Q, R and correlation score TF-IDF of the above keywords respectively; Q(boy)=1, Q(egg)=4, Q(fire)=7, the server can add R(boy) and TF-IDF(Boy) to the storage space of subvector 1 corresponding to the index value of 1, and correspondingly add R(egg) and TF-IDF(egg) to the storage space of subvector 4 corresponding to the index value of 4; add R(fire) and TF-IDF(fire) to the storage space of subvector 7 corresponding to the index value of 7.
[0134] The keywords in S2 can be cat and dog, and the server can calculate the Q, R and relevance score TF-IDF of each of the above keywords respectively; Q(cat)=1, Q(dog)=2, for the keyword cat, since the storage space of subvector 1 in the index vector has been occupied, R(cat) and TF-IDF(cat) can be added to the storage space of subvector 2 adjacent to subvector 1 corresponding to the index value of 1; for the keyword dog, since the storage space of subvector 2 in the index vector has been occupied, R(dog) and TF-IDF(cat) can be added to the storage space of subvector 3 adjacent to subvector 2 corresponding to the index value of 2
[0135] The keyword in S3 can be apple, and the server can calculate the Q, R and relevance score TF-IDF of each of the above keywords respectively; Q(apple)=1, for the keyword apple, since R(apple) and TF-IDF(apple) can be added to the storage space of subvector 1 corresponding to the index value of 1, and the R and relevance scores of other keywords are shifted back one position accordingly.
[0136] In the third step, the client constructs a request and sends it to the server: the client accepts the keyword entered by the user, calculates Q = LSH (new keyword) / 2n, R = LSH (new keyword) % 2n for each query keyword through the p-stable local sensitive hashing algorithm, and sends (Q, R) to the server.
[0137] The fourth step is that the server performs retrieval: On the server side, the Hamming distance between the R fingerprint of each requested keyword and the R fingerprint of the corresponding element of the document index vector is calculated. If the distance is lower than the preset threshold, the server will regard the requested keyword as a match with the index keyword, and add the relevance score of the matching index keyword to the score of the document to obtain the evaluation score corresponding to the document.
[0138] Step 5: The server returns the top-k documents with the highest scores to the client: The server sorts the documents by score and returns the top-k documents with the highest scores to the client.
[0139] For example, Figure 6 As shown, for document D, the query keywords input by the user may include apple, keywork, and gram. By executing the method described in the above embodiment, the request keywords (query keywords) that match the index keywords may include apple (matching the index keyword apple) and keywork (matching the index keyword keyword), and the server may obtain the evaluation score Score[D] of the document D through the following formula:
[0140] Score[D]=TF-IDF(apple)+TF-IDF(keyword).
[0141] The specific implementation process of the above fuzzy multi-keyword based retrieval method is described in detail below in conjunction with a specific embodiment:
[0142] Step 1: The server and the client negotiate and select a p-stable local sensitive hashing algorithm:
[0143] The p-stable local sensitive hashing algorithm can map two similar vectors into the same hash bucket, so it can be used as a basis for detecting the similarity of two texts. The value of p can be 1 or 2. When p = 1, the p-stable distribution is the Cauchy distribution; when p = 2, the p-stable distribution is the normal distribution. The server can calculate the local sensitive hash value corresponding to the keyword using the following formula:
[0144]
[0145] Among them, h represents the local sensitive hash value corresponding to the keyword, is the vector after text vectorization, that is, the vector obtained after text vectorization of keywords; w is the width of the vector slice; b is a random number in [0,w]; is a random number vector, which can be a vector of random numbers that conform to the p-stable distribution, and its dimension is same.
[0146] For example: [16.5,7.6,7.9,5.7,13.5,0.8] is a 5-dimensional vector of random numbers that conform to the normal distribution with a mean of 10 and a standard deviation of 4.
[0147] Therefore, the server can perform text vectorization on the keywords and obtain the text vector. After b and w are subjected to the relevant p-stable hash calculation, the locally sensitive hash value is obtained. For example, the device can pre-configure the value of p and the corresponding distribution, and randomly generate a random number vector. Based on the dimension of the initial index vector, the equal width of each segment of the vector (the width of the vector slice) w is determined, and a random number is randomly selected and combined with the above random number vector to obtain the p-stable locally sensitive hash algorithm. For example:
[0148] (1) Let p = 2. According to the normal distribution with an expected value of 100 and a standard value of 10, randomly generate a dimension of 676.
[0149] (2) Assume that the dimension of the Quotient Filter is 100000, the width w of each segment of the vector is 10, and the value of the random number b is 6. Composed of 1 p-stable locality sensitive hashing algorithm.
[0150] Step 2: The server creates a Quotient Filter for each document as the target index vector, and uses the low bit of the LSH hash value of each keyword in the document as the fingerprint, and the high bit of the LSH hash value as the expected subscript. The relevance score between the fingerprint and the keyword is inserted into the vector. The relevance score represents the degree of relevance between the keyword and the document. Specifically:
[0151] Filter the index keywords of each document according to the relevance score, and map the index keywords of each document to its corresponding new Quotient Filter. Take apple as an example:
[0152] (1) The 2-gram segmentation of apple is: [ap, pp, pl, le].
[0153] (2) Fixed random seed, map [ap, pp, pl, le] to a 676-dimensional vector through a pseudo-random function or sha256, and set the corresponding bits to 1.
[0154] (3) The text vector of the keyword is processed by the local sensitive hashing algorithm in step 1 to obtain Q and R corresponding to the keyword. Q can be used as the expected subscript. The server can find run in the initial index vector in the original Quotient Filter manner, and use R as the fingerprint to find the insertion position in the order from small to large from run and its corresponding cluster, or find the insertion position based on the free position, and insert the relevance score TF-IDF of apple into the Quotient Filter, while the positions of the subsequent four index keywords boy, cat, dog, and egg in run / cluster are shifted back by one position. As shown in Table 1, it can be the calculated local sensitive hash data of each keyword and each keyword:
[0155] Table 1
[0156]
[0157]
[0158] The server adds the above keywords and the expected subscripts, fingerprints and relevance scores corresponding to each keyword to the initial index vector, and the obtained target index vector can be as follows: Figure 7As shown, the adding method is the same as the steps shown in the above embodiment and will not be repeated here.
[0159] Optionally, (3.1) insert strategy:
[0160] (3.1.1) If there is a vacant element in the Q subscript of QuotientFilter, insert the keyword's [R, TF-IDF] directly into the vacant space of Q.
[0161] (3.1.2) If the element with the subscript Q of QuotientFilter is occupied, then according to the traditional QuotientFilter method, at the starting position of the run corresponding to Q, in the run and its corresponding cluster, search for a position that can be inserted or a new free position in ascending order, insert [R, TF-IDF], and all subsequent elements in the run / cluster are shifted back one position.
[0162] Optionally, (3.2) delete the policy:
[0163] If the deleted keyword is deleted, calculate Q = LSH (deleted) / 2n, R = LSH (deleted) % 2n, and query the starting position of the run corresponding to Q according to the QuotientFilter method. Start searching in the run and its corresponding cluster in ascending order. If the Hamming distance between the fingerprint of the existing element and R is less than the preset threshold, the existing element is considered to be the keyword deleted to be deleted, and it is deleted, and the subsequent elements in the run / cluster corresponding to Q are moved forward one position.
[0164] Step 3: The client constructs a request and sends it to the server:
[0165] (1) The client receives multiple request keywords (i.e., query keywords in the above embodiment) sent by the user. For example, if the user wants to search for documents related to (apple, keywork, play) (where keywork is an incorrectly input request keyword and play is a keyword that does not exist in the index), the client calculates [Q, R] of apple, [Q, R] of keywork, and [Q, R] of play using the same Q=LSH(keyword) / 2n and R=LSH(keyword)%2n. The request does not need to include a relevance score.
[0166] (2) The client can send a request containing three query keywords [Q, R] to the server.
[0167] Step 4: The server performs a search, such as Figure 8 As shown, it can be a schematic diagram of the retrieval process:
[0168] The fingerprints corresponding to the query keywords determined by the server may include: apples-(1,…,0,1,…,1,0,1,…), boy(1,…,0,1,1,…,,0,1,…), play(1,…,1,1,1,…,0,0,1,…); specifically, the Hamming distance threshold preset by the server is 3, and the Hamming distance between the R fingerprint of apples (1,…,0,1,…,1,0,1,…) and the R fingerprint of apple (0,…,0,1,…,1,0,1,…) is calculated to be 1. Because 1≤3, the server believes that although the user inputs apples, what he actually wants to input is apple, so the server matches apple and accumulates the TF-IDF score of 2.6 of the keyword into the score value of the document. In addition, boy is spelled correctly and gets 12.7 points after matching; and play cannot be matched because no fingerprint with a smaller R Hamming distance is found in the document index, so it is not scored. After calculation, the total relevance score of the current document is 2.6+12.7=15.3. Then the matching calculation of the next document is performed.
[0169] Step 5: The server returns the top-k documents with the highest scores to the client:
[0170] The server sorts the documents according to the relevance score and returns the k documents with the highest scores to the client.
[0171] Specifically, Fig. 9 As shown, this is the index building process of Quotient Filter:
[0172] S1, a Quotent Fiter (QF) is established for each document, and each slot has 3 bits, corresponding to is_occupied, is_continuation, and is_shifted respectively; in addition, each slot can store the quotient (high bit of the hash value) and remainder (low bit of the hash value), TF-IDF, where the remainder is the fingerprint.
[0173] S2, extract keywords of documents through relevance scores and other methods.
[0174] S3, traverse the keywords and calculate Q and R corresponding to each keyword. The specific formula has been described in the above embodiment and will not be repeated here.
[0175] S4, determine whether there is an empty position at Q of QF? If yes, execute S5, if not, execute S6.
[0176] S5, seed (Q, R, TF-IDF) into a new hash bucket, set is_occupied, and execute S13.
[0177] S6, determine whether there is a start position of the run corresponding to Q in QF. If yes, execute S7, if not, determine that QF is full, the insertion fails, and end the process.
[0178] S7, QF each run is sorted from small to large based on R, and the specific addition position is found in the run.
[0179] S8, determine whether the new element is the header of the run. If so, execute S9, if not, execute S10.
[0180] S9, set is_continuation of the old header of run.
[0181] S10, determine whether the new element is inserted in the Q position of QF? If yes, execute S9, if not, execute S11.
[0182] S11, sets is_shifted of the new element.
[0183] S12, insert a new element (Q, R, TF-IDF). All other elements after this position of the cluster are shifted backward, and is_shifted of the moved elements is set.
[0184] S13, determine whether all keywords have been traversed? If yes, end the process, if not, re-execute S2.
[0185] Specifically, Fig.10 As shown, this can be the query process of Quotient Filter:
[0186] S1, the index database based on QuotientFilter traverses all document indexes resident in memory.
[0187] S2, the server creates a score array whose length is the number of documents in the database and the initial value of the element is 0.
[0188] S3, the client traverses and reads multiple keywords requested by the user.
[0189] S4: The client calculates the
[0190] Q = LSH (keyword) / 2n,
[0191] R=LSH(keyword)%2n; and sent to the server.
[0192] S5, the server reads (Q, R) of each keyword.
[0193] S6, the server determines whether the run corresponding to Q exists, if yes, executes S7, if not, executes S11.
[0194] S7, the server finds the starting position of the run corresponding to Q.
[0195] S8, the server matches the remainders one by one starting from the beginning of the run.
[0196] S9, determine whether the server matches a fingerprint whose Hamming distance with R is less than a threshold in the index of the current document? If yes, execute S10.
[0197] S10, the server accumulates the TF-IDF of the fingerprint with the same Hamming distance less than the element of the index corresponding to the document in the score array.
[0198] S11, determine whether the server has read all the (QR) of each query keyword? If yes, the server selects the top k documents with the highest scores and sends them to the client; if no, return to re-execute S5.
[0199] Specifically, Fig.11 As shown, this is the specified element deletion process of Quotient Filter:
[0200] S1, the user specifies the document index where the keyword to be deleted is located.
[0201] S2, calculate Q = LSH (keyword) / 2n, R = LSH (keyword) % 2n.
[0202] S3, determine the subscript Q of the Quotient Filter and search for the corresponding run. Does the run contain a fingerprint whose Hamming distance with R is less than the threshold? If yes, execute S4. If not, end the process.
[0203] S4, remove the fingerprint from the run corresponding to the Q of the Quotient Filter. All subsequent fingerprints in the run and cluster are moved forward by one position.
[0204] The method provided in this embodiment is an innovative improvement to the mapping and query mechanism of Quotient Filter, introducing the p-stable local sensitive hashing (LSH) algorithm, combined with the Hamming distance, to realize the calculation of the similarity of two plaintext keywords in the ciphertext state. This improvement enables Quotient Filter to support fuzzy query functions, improving the flexibility and usability of ciphertext retrieval; by reconstructing the data structure of Quotient Filter and optimizing the result sorting algorithm, a calculation method based on correlation scores is introduced. This improvement significantly improves the correlation between matching results and query requests, ensures the accuracy and effectiveness of query results, and thus meets users' needs for efficient data retrieval; by adopting the fuzzy keyword ciphertext retrieval technology based on Quotient Filter, the storage space requirement is significantly lower than the traditional Bloom filter-based retrieval scheme.
[0205] The ciphertext retrieval solution based on Quotient Filter in this embodiment can simultaneously realize multi-keyword query, relevance sorting, fuzzy query, and designated element deletion functions, and improves query and deletion performance and reduces storage space.
[0206] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0207] Based on the same inventive concept, the embodiment of the present application also provides a fuzzy multi-keyword based retrieval device for implementing the above-mentioned fuzzy multi-keyword based retrieval method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in one or more fuzzy multi-keyword based retrieval device embodiments provided below can refer to the limitations of the fuzzy multi-keyword based retrieval method above, and will not be repeated here.
[0208] In one embodiment, Fig.12 As shown, a retrieval device 1200 based on fuzzy multiple keywords is provided, comprising:
[0209] A first acquisition module 1202 is used to acquire local sensitive hash data corresponding to a query keyword, where the local sensitive hash data is obtained by processing the query keyword using a local sensitive hash algorithm;
[0210] A first calculation module 1204 is used to calculate the evaluation score corresponding to each of the documents based on the local sensitive hash data corresponding to the query keyword and the target index vector of each document, wherein the evaluation score represents the matching degree between the document and the query keyword;
[0211] The first determination module 1206 is used to obtain a target document based on the evaluation scores of each of the documents.
[0212] In one embodiment, the device further comprises:
[0213] A second determination module, configured to determine an initial index vector based on the number of keywords in the document;
[0214] A second calculation module, for calculating, for each of the keywords, local sensitive hash data of the keyword, the local sensitive hash data including an expected subscript, a fingerprint, and a relevance score;
[0215] An adding module is used to add the local sensitive hash data corresponding to each keyword to the initial index vector to obtain a target index vector corresponding to the document.
[0216] In one embodiment, the local sensitive hash data includes at least an expected subscript and a fingerprint, and the first computing module is specifically configured to:
[0217] For each of the documents, based on the first expected subscript of each of the query keywords, searching in the target index vector corresponding to the document respectively;
[0218] For each of the query keywords, if a second expected subscript matching the first expected subscript of the query keyword is stored in the target index vector corresponding to the document, a second fingerprint and a relevance score corresponding to the second expected subscript are obtained in the target index vector, and a similarity distance between the second fingerprint and the first fingerprint of the query keyword is calculated; if the similarity distance satisfies a preset similarity condition, an evaluation score corresponding to the query keyword is obtained based on the relevance score;
[0219] Based on the evaluation scores corresponding to the query keywords, the evaluation scores of the documents are obtained.
[0220] In one embodiment, the query keyword includes at least a plurality of keywords, and the first calculation is further specifically used for:
[0221] Determining the relevance score as the evaluation score corresponding to the query keyword;
[0222] The step of obtaining the evaluation score of the document based on the evaluation score corresponding to each query keyword includes:
[0223] The evaluation scores corresponding to the query keywords are superimposed to obtain the evaluation score of the document.
[0224] In one embodiment, the first determining module is specifically configured to:
[0225] In descending order of evaluation scores, the target number of documents are extracted as target documents.
[0226] In one embodiment, the device further comprises:
[0227] The receiving module is used to receive a document query request sent by a client, wherein the document query request at least includes local sensitive hash data corresponding to each query keyword, and the local sensitive hash data is obtained after the client processes the query keyword through a local sensitive hash algorithm.
[0228] Each module in the above fuzzy multi-keyword based retrieval device can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0229] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.13 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store index vector data of documents. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a retrieval method based on fuzzy multiple keywords is implemented.
[0230] Those skilled in the art will understand that Fig.13The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0231] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0232] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0233] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0234] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0235] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0236] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0237] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A retrieval method based on fuzzy multiple keywords, characterized in that: The method comprises: Obtaining local sensitive hash data corresponding to a query keyword, wherein the local sensitive hash data is obtained by processing the query keyword using a local sensitive hash algorithm; Based on the local sensitive hash data corresponding to the query keyword and the target index vector of each document, calculating the evaluation score corresponding to each document, wherein the evaluation score represents the matching degree between the document and the query keyword; Based on the evaluation scores of the documents, a target document is obtained.
2. The method according to claim 1, characterized in that The method further comprises: Determining an initial index vector based on the number of keywords in the document; For each of the keywords, calculate local sensitive hash data of the keyword, the local sensitive hash data including expected subscript, fingerprint and relevance score; The local sensitive hash data corresponding to each keyword is added to the initial index vector to obtain the target index vector corresponding to the document.
3. The method according to claim 1, characterized in that The locally sensitive hash data at least includes an expected subscript and a fingerprint, and the evaluation scores corresponding to the documents are calculated based on the locally sensitive hash data corresponding to the query keyword and the target index vector of each document, including: For each of the documents, based on the first expected subscript of each of the query keywords, searching in the target index vector corresponding to the document respectively; For each of the query keywords, if a second expected subscript matching the first expected subscript of the query keyword is stored in the target index vector corresponding to the document, a second fingerprint and a relevance score corresponding to the second expected subscript are obtained in the target index vector, and a similarity distance between the second fingerprint and the first fingerprint of the query keyword is calculated; if the similarity distance satisfies a preset similarity condition, an evaluation score corresponding to the query keyword is obtained based on the relevance score; Based on the evaluation scores corresponding to the query keywords, the evaluation scores of the documents are obtained.
4. The method according to claim 3, characterized in that The query keyword includes at least a plurality of keywords, and obtaining the evaluation score corresponding to the query keyword based on the relevance score includes: Determining the relevance score as the evaluation score corresponding to the query keyword; The step of obtaining the evaluation score of the document based on the evaluation score corresponding to each query keyword includes: The evaluation scores corresponding to the query keywords are superimposed to obtain the evaluation score of the document.
5. The method according to any one of claims 1 to 4, characterized in that: The step of obtaining a target document based on the evaluation scores of each of the documents comprises: In descending order of evaluation scores, the target number of documents are extracted as target documents.
6. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: A document query request sent by a client is received, where the document query request at least includes local sensitive hash data corresponding to each query keyword, and the local sensitive hash data is obtained after the client processes the query keyword through a local sensitive hash algorithm.
7. A retrieval device based on fuzzy multiple keywords, characterized in that: The device comprises: A first acquisition module is used to acquire local sensitive hash data corresponding to a query keyword, wherein the local sensitive hash data is obtained by processing the query keyword through a local sensitive hash algorithm; A first calculation module, configured to calculate an evaluation score corresponding to each of the documents based on the local sensitive hash data corresponding to the query keyword and the target index vector of each document, wherein the evaluation score represents a matching degree between the document and the query keyword; The first determination module is used to obtain a target document based on the evaluation scores of each of the documents.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. 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 6 are implemented.
10. 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 6 are implemented.
Citation Information
Cited By
Document storage method and system, computer equipment and computer program product
CN121029709A
Method and system for quickly removing duplicate of document based on multi-algorithm fusion
CN121859883A