Resource retrieval method and device, electronic equipment and readable storage medium

By combining multiple search methods (such as full-text search and vector search) to search query words and merge results, the problem of poor resource search results in the existing technology is solved, and better search results and reasonable results are achieved .

CN119202360APending Publication Date: 2024-12-27BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411336246.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

In the prior art, the single resource search method leads to poor query results. Due to its own limitations, it is difficult to take into account the accuracy and richness of the search results at the same time.

Method used

A variety of search methods (such as full-text search and vector search) are used to search the query words, generate separate results and mixed results of each search method, and obtain the final target search results through the results merging.

Benefits of technology

It improves the richness and accuracy of the search results, makes up for the shortcomings of a single search method, enhances the search effect, and ensures the rationality of the final results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119202360A_ABST
    Figure CN119202360A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a resource retrieval method and device, electronic equipment and a readable storage medium, and relates to the technical field of networks. The method comprises the following steps of: obtaining a query word of the round of retrieval; on the basis of the query terms, the alternative resources are retrieved according to at least two retrieval modes, and retrieval results, corresponding to the retrieval modes, of the query terms are obtained. On the basis of the retrieval results of the retrieval modes corresponding to the query terms, independent retrieval results corresponding to the retrieval modes and mixed retrieval results corresponding to the at least two retrieval modes are generated. And performing result merging based on the independent retrieval result and the mixed retrieval result to obtain a target retrieval result of the round of retrieval. In this way, the retrieval effect can be better.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network technology, and in particular to a resource retrieval method, device, electronic device and readable storage medium. Background Art

[0002] With the continuous development of network technology, more and more scenarios require resource retrieval. For example, resource recommendation scenarios and search engine scenarios all require resource retrieval.

[0003] In the prior art, when searching, a single search method is often used to search according to the query words input by the user to obtain the final query results. In this method, due to the limitations of the single search method itself, the query effect is poor. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a resource retrieval method, device, electronic device and readable storage medium to improve the query effect. The specific technical solution is as follows:

[0005] In a first aspect of the present invention, a resource retrieval method is provided, the method comprising:

[0006] Get the query words for this round of search;

[0007] Based on each of the query words, searching for candidate resources in at least two search methods respectively, to obtain search results corresponding to each of the query words and the search methods;

[0008] Based on the search results of each of the search methods corresponding to each of the query words, generate separate search results corresponding to each of the search methods and mixed search results corresponding to the at least two search methods;

[0009] The results are merged based on the individual search results and the mixed search results to obtain the target search results of the current round of search.

[0010] In a second aspect of the present invention, a resource retrieval device is provided, the device comprising:

[0011] An acquisition module is used to obtain the query words for this round of retrieval;

[0012] Based on each of the query words, searching for candidate resources in at least two search methods respectively, to obtain search results corresponding to each of the query words and the search methods;

[0013] Based on the search results of each of the search methods corresponding to each of the query words, generate separate search results corresponding to each of the search methods and mixed search results corresponding to the at least two search methods;

[0014] The results are merged based on the individual search results and the mixed search results to obtain the target search results of the current round of search.

[0015] In another aspect of the present invention, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is executed on a computer, the computer executes the resource retrieval method described in the first aspect.

[0016] In yet another aspect of the present invention, a computer program product comprising instructions is provided. When the computer program product is run on a computer, the computer executes the resource retrieval method described in the first aspect.

[0017] The resource retrieval method provided in the embodiment of the present invention first obtains the query words of this round of retrieval. Then, based on each query word, the candidate resources are searched according to at least two retrieval methods respectively, and the retrieval results of each query word corresponding to each retrieval method are obtained. Then, based on the retrieval results of each query word corresponding to each retrieval method, a separate retrieval result corresponding to each retrieval method and a mixed retrieval result corresponding to at least two retrieval methods are generated. The results are merged based on the separate retrieval results and the mixed retrieval results to obtain the target retrieval result of this round of retrieval. In the embodiment of the present invention, multiple retrieval methods are used to search for the query words respectively, and multiple retrieval results are obtained, and the multiple retrieval results are merged based on the multiple retrieval results to obtain the final target query result. Due to the combination of multiple retrieval methods. Therefore, compared with a single retrieval method, the richness of the target retrieval results can be improved, and the retrieval effect can be made better. At the same time, it can make up for the shortcomings of the retrieval results obtained by a single retrieval method to a certain extent, thereby avoiding the limitations of a single retrieval method, resulting in a poor retrieval effect.

[0018] Furthermore, for the search results of each query word corresponding to each search method, first merge and generate the individual search results corresponding to each search method and the mixed search results corresponding to all search methods, and then merge the individual search results of each search method and the mixed search results again to obtain the final target search results. By multiple merging of search results, the search effects of multiple channels can be effectively integrated, and to a certain extent, the rationality of the target search results generated in the end can be ensured while performing mixed search. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0020] Figure 1 A flowchart of a resource search method provided by an embodiment of the present invention;

[0021] Figure 2 A schematic diagram of the architecture of a resource retrieval system provided by an embodiment of the present invention;

[0022] Figure 3 A search schematic diagram provided for an embodiment of the present invention;

[0023] Figure 4 A schematic diagram of merging search results provided by an embodiment of the present invention;

[0024] Figure 5 A schematic diagram of a resource retrieval device provided by an embodiment of the present invention;

[0025] Figure 6 A schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0026] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0027] Figure 1 A flowchart of a resource search method provided by an embodiment of the present invention is shown in FIG. Figure 1 As shown, the method includes:

[0028] Step 101: Obtain the query words for this round of retrieval.

[0029] In an embodiment of the present invention, the resource retrieval method can be applied to an electronic device. The query terms of this round of retrieval may include the original query terms of this retrieval, wherein the original query terms may be the query terms input by the user for this round of retrieval, or may be the query terms automatically acquired by the electronic device for this round of retrieval when this round of retrieval is triggered. Exemplarily, in the case of personalized resource recommendation, the electronic device may confirm the triggering of this round of retrieval in response to a specified operation. Accordingly, the specified information may be obtained as the original query terms. For example, in response to an opening operation on a specified application, the triggering of this round of retrieval is confirmed. Accordingly, the account-related information of the login account of the specified application may be obtained as the original query terms.

[0030] Furthermore, in an embodiment of the present invention, multiple query terms can be generated based on the original query terms to obtain at least two query terms. The total number of the at least two query terms can be set as needed, and the embodiment of the present invention does not limit this. For example, the total number of the at least two query terms can be 2, or the total number can be 3, or the total number can be 6, and so on. The at least two query terms can include the original query terms themselves and terms related to the original query terms. In an embodiment of the present application, multiple query terms are generated based on the original query terms, which can enrich the expression of the query, improve the recall rate of the retrieval results, and thus optimize the search effect.

[0031] Step 102: Based on the query words, search for candidate resources in at least two search methods to obtain search results corresponding to the query words and the search methods.

[0032] In the embodiment of the present invention, the at least two retrieval methods include different retrieval methods, and the at least two retrieval methods can be set in advance according to actual needs, which is not limited in the embodiment of the present invention. The candidate resources can be resources available for retrieval in the network, for example, the candidate resources can be specifically resources included in a preset database. Among them, the resources can be network resources, for example, multimedia resources such as text, images, videos, and audio.

[0033] The search results of the query words corresponding to each search method may include the search results obtained by searching using the query words according to each search method of at least two search methods. Exemplarily, it is assumed that the query words of this round of search include: query words a and query words b, and the at least two search methods include: search method 1 and search method 2. Then in this step, the query word a can be used to search for the candidate resources according to search method 1 to obtain the search results of the query word a corresponding to search method 1 (recorded as search result 1), and the query word a can be used to search for the candidate resources according to search method 2 to obtain the search results of the query word a corresponding to search method 2 (recorded as search result 2). The query word b can be used to search for the candidate resources according to search method 1 to obtain the search results of the query word b corresponding to search method 1 (recorded as search result 3), and the query word b can be used to search for the candidate resources according to search method 2 to obtain the search results of the query word b corresponding to search method 2 (recorded as search result 4). Among them, the search results of each query word corresponding to each search method are the above-mentioned search results 1, search result 2, search result 3 and search result 4. Among them, for each query word, various search methods can be executed in parallel to achieve retrieval.

[0034] Step 103: Based on the search results of each search method corresponding to each query word, generate separate search results corresponding to each search method and mixed search results corresponding to the at least two search methods.

[0035] In an embodiment of the present invention, for any search method, the separate search result corresponding to the search method can be obtained based on the resources in the search result corresponding to the search method. Exemplarily, the resources in the search result corresponding to the search method can be merged to obtain the separate search result corresponding to the search method. Among them, the search result corresponding to the search method can include the search results obtained by searching according to the search method using the above-mentioned query terms, that is, the search result corresponding to the search method includes at least two search results, and the at least two search results are obtained using the above-mentioned at least two query terms. Taking search method 1 as an example, the search results corresponding to search method 1 can include: the above-mentioned search result 1 and search result 3.

[0036] The mixed search results corresponding to at least two search methods can be obtained based on the resources in the search results corresponding to the at least two search methods. Exemplarily, the resources in all the search results corresponding to the at least two search methods can be merged to obtain a mixed search result. For example, for search method 1, the search results corresponding to search method 1 can include: the above-mentioned search result 1 and search result 3. For search method 2, the search results corresponding to search method 2 can include: the above-mentioned search result 2 and search result 4. Accordingly, a mixed search result can be generated based on the resources included in the search results 1-4. The resources included in the search results are the alternative resources selected through the search.

[0037] Step 104: Merge the results based on the individual search results and the mixed search results to obtain the target search results of the current search round.

[0038] In an embodiment of the present invention, the results are merged based on the individual search results and the mixed search results, and these search results can be fused to obtain the final target search results. Among them, each individual search result can represent the search results for the query words of this round of search from the dimensions of different search methods. The mixed search results can represent the search results for the query words of this round of search from the dimensions of multiple search methods. Accordingly, through fusion, the target search results can fully reflect the search results of different search methods to a certain extent.

[0039] In a specific implementation scenario, after obtaining the target search result, the target search result can be output. For example, the target search result can be used as the output of a preset search engine, and the resources included in the target search result can be displayed in the search results page. Alternatively, in a resource recommendation scenario, a recommendation interface can be displayed, and the resources included in the target search result can be displayed in the recommendation page. Alternatively, the resources in the target search result can be pushed to the user in the form of push.

[0040] In summary, the resource retrieval method provided in the embodiment of the present invention first obtains the query words of this round of retrieval. Then, based on each query word, the candidate resources are searched according to at least two retrieval methods respectively, and the retrieval results of each query word corresponding to each retrieval method are obtained. Next, based on the retrieval results of each query word corresponding to each retrieval method, a separate retrieval result corresponding to each retrieval method and a mixed retrieval result corresponding to at least two retrieval methods are generated. The results are merged based on the separate retrieval results and the mixed retrieval results to obtain the target retrieval result of this round of retrieval. In the embodiment of the present invention, multiple retrieval methods are used to search for the query words respectively, and multiple retrieval results are obtained, and the multiple retrieval results are merged based on the multiple retrieval results to obtain the final target query result. Due to the combination of multiple retrieval methods. Therefore, compared with a single retrieval method, the richness of the target retrieval results can be improved, and the retrieval effect can be made better. At the same time, it can make up for the shortcomings of the retrieval results obtained by a single retrieval method to a certain extent, thereby avoiding the limitations of a single retrieval method, resulting in poor retrieval effect.

[0041] Furthermore, for the search results of each query word corresponding to each search method, first merge and generate the individual search results corresponding to each search method and the mixed search results corresponding to all search methods, and then merge the individual search results of each search method and the mixed search results again to obtain the final target search results. By multiple merging of search results, the search effects of multiple channels can be effectively integrated, and to a certain extent, the rationality of the target search results generated in the end can be ensured while performing mixed search.

[0042] Optionally, in some embodiments, the step of obtaining the query words for the current round of retrieval may specifically include:

[0043] Step 1011: Obtain the pronouns in the original query terms of the current round of retrieval, and determine the descriptive words of the objects referred to by the pronouns based on the historical query terms.

[0044] Step 1012: Use the description word to replace the reference word in the original query word as the first query word.

[0045] Step 1013: Based on a preset word vector model, generate related words for the original query word as the second query word.

[0046] Step 1014: Concatenate the original query term and the historical query term to form a third query term.

[0047] In an embodiment of the present invention, a pronoun refers to a word used to replace a noun or a noun phrase, and a pronoun can serve to refer to a specific entity in the original query. In actual scenarios, there may be a pronoun in the original query to refer to an object in the above text, so as to make the language expression more concise. Among them, the above text may include historical query words, for example, query words used in M ​​rounds of retrieval before the current round of retrieval. Specifically, based on a preset elimination model, the pronouns in the original query words can be identified, and the descriptive words of the entities included in the historical query words can be identified. Semantic analysis is performed based on the original query words and the historical query words to determine the descriptive words that match the identified pronouns. Finally, the pronouns in the original query words are replaced with the matching descriptive words. Among them, the descriptive words of the entity refer to the words used to represent the entity, and the preset elimination model can be a BERT-based reference elimination model in natural language processing technology. For example, assuming that in the previous round of search, the query term entered by the user is "Zhang San's portfolio", and the original query term in this round of search is "his personal hobbies", then "he" in the original query term can be used as a pronoun, and "he" can be replaced with "Zhang San" to obtain the first query term.

[0048] Further, the related words may include synonyms of the original query words. For example, the word vector of the original query word can be generated as the original vector based on the word vector model, and the word vector of each preset word in the preset dictionary can be generated based on the word vector model, and then the preset word whose similarity between the word vector and the original vector meets the preset similarity threshold is selected as the related word. Among them, the obtained related word is the second query word. For example, for the above example, "Zhang San's personal preferences" can be generated. Or, assuming that the original query word is "buy a car", then the related words "buy a car", "car purchase" and so on can be queried. Alternatively, the word vector of the first query word can also be generated as the original vector based on the word vector model to ensure the accuracy of the original vector. Further, the original query word can be directly combined with the historical query word to achieve concatenation (Concat). In this way, multiple query words in multiple rounds of dialogue can be connected into a longer query through concatenation, so that more context information can be used in the subsequent retrieval process. Among them, the content obtained by concatenation is the third query word. By generating a third query term and using it in the subsequent process, the retrieval capability in the continuous dialogue scenario can be increased, and the accuracy of the sorting of resources in the search results during the continuous dialogue can be improved. For example, assuming that the historical query terms involved in the splicing include: query-a, query-b, query-c, and the original query term of this round of retrieval is query, then the third query term can be expressed as Concatquery (query+query-a+query-b+query-c).

[0049] It should be noted that when searching based on each search term according to a certain search method, the search term can be further segmented to facilitate the identification of matching alternative resources, and the embodiment of the present invention does not limit this. Furthermore, the execution order of the above steps 1011 to 1014 is not unique, as long as step 1011 is executed before step 1012. For example, steps 1011-1012, step 1013, and step 1014 can be executed in parallel, that is, the operations of generating the first query term, the second query term, and the third query term are executed at the same time, or step 1013 can be executed first, then step 1014, and finally step 1011-1012.

[0050] In the embodiment of the present invention, by generating the first query term, the second query term and the third query term as the query term for the current round of retrieval, the query term can be optimized, and while enriching the query, the problem of too many query terms leading to excessive search calculations can be avoided. In addition, by replacing the pronouns and adding related words, the query term is made more specific, the accuracy of the query is increased, and the semantic richness is increased. Furthermore, by splicing with the historical query terms and expanding to obtain the third query term, the device can be helped to better understand the user's query intent, thereby improving the relevance and accuracy of the retrieval results.

[0051] Optionally, in some embodiments, the step of searching for candidate resources in at least two search methods based on each of the query words to obtain search results corresponding to each of the query words in each of the search methods may specifically include:

[0052] Optionally, in some embodiments, the at least two search methods include a full-text search method and a vector search method. The above-mentioned search based on the text data of each query word and each candidate resource is performed according to at least two search methods to obtain the search results of each query word corresponding to each search method, which may specifically include:

[0053] Step 1021: For any of the query words, use the query word as a keyword of the full-text search method, and perform keyword matching on a preset inverted index based on the keyword to retrieve alternative resources whose text data matches the query word, and obtain a search result of the full-text search method corresponding to the query word; the preset inverted index is established based on the text data of the alternative resources.

[0054] Step 1022: use the query term as the input of a preset vector retrieval model, and based on the vector representation of each of the candidate resources, retrieve the candidate resources whose similarity with the word vector of the query term is greater than a preset similarity threshold, to obtain the retrieval result of the query term corresponding to the vector retrieval method; the preset vector retrieval model is a retrieval model defined in the vector retrieval method, and the vector representation is obtained based on the text data of the candidate resources.

[0055] In an embodiment of the present invention, the query word is in text form, so it can be searched according to at least two search methods based on the query word and the text data of each candidate resource. Specifically, the candidate resources whose text data is related to the query word can be searched according to the search method as related resources. Based on the related resources, a search result corresponding to the search method of the query word is generated. Among them, the search result can include related resources sorted according to the degree of relevance. Specifically, an inverted index can be established in advance for the text data of each candidate resource to obtain a preset inverted index. When searching using the full-text search method, the query word used this time can be used as a keyword of the full-text search method, and the keyword can be keyword matched with the text data of each candidate resource. Specifically, keyword matching can be performed based on the full-text search engine through a preset inverted index, that is, text data containing the keyword can be searched to obtain candidate resources whose text data matches the query word. Among them, the candidate resources whose text data matches the query word are the aforementioned related resources. Based on the candidate resources corresponding to the found text data, search results are generated. When searching using a vector retrieval method, the preset vector retrieval model can be used to perform text vectorization on the query terms used this time, and calculate the similarity between the query term vector and the vector representation of each candidate resource. Then search for candidate resources whose similarity is greater than the preset similarity threshold, and generate search results based on the searched candidate resources whose similarity is greater than the preset similarity threshold. Among them, the candidate resources whose similarity is greater than the preset similarity threshold are the aforementioned related resources. The preset vector retrieval model can be selected as needed. For example, the preset vector retrieval model can be a model such as BERT, GPT-3, and BM-25. The vector representation of the candidate resources can be obtained by converting the text data of each candidate resource in advance based on the preset vector retrieval model.

[0056] In the current field of information retrieval, accuracy and richness are the two core indicators for evaluating retrieval methods. However, it is difficult for a single retrieval method to take into account both accuracy and richness at the same time. Retrieval methods in the retrieval field mainly include full-text retrieval and vector retrieval. Among them, full-text retrieval refers to retrieval by matching keywords and text content. Full-text retrieval relies on inverted indexes for search, and the retrieval results are richer. Vector retrieval refers to the use of deep learning large models to transform text data into vectors, and to search by vector similarity, and the retrieval results are more accurate. A single retrieval method has limitations. Among them, full-text retrieval is prone to missing resources with similar semantics but different text expressions in the retrieval results. Vector retrieval has insufficient text vocabulary, which limits vector transformation.

[0057] In an embodiment of the present invention, a hybrid search is performed by using full-text search and vector search, and vector search and full-text search are used simultaneously to obtain multiple search results for query words based on these two search methods. Accordingly, in the result merging link, a separate search result of the full-text search method, a separate search result of the vector search method, and a hybrid search result corresponding to the full-text search and vector search methods can be generated based on the separate search results. Further, the three results of the separate search result of the full-text search method, the separate search result of the vector search method, and the hybrid search result corresponding to the full-text search and vector search methods can be merged and rearranged again to obtain the final target search result. In this way, the advantages of multiple search methods can be combined to a certain extent through hybrid search, so that the search results are richer and more accurate, and the limitations of a single search method are compensated. Moreover, by multiple merging of the search results, the search effects of multiple channels can be integrated, and the rationality of the target search results finally generated can be ensured to a certain extent while performing hybrid search.

[0058] It should be noted that, in an embodiment of the present invention, when a specified update occurs in a preset database, for example, when the amount of newly added text data is greater than a preset quantity threshold, the preset vector retrieval model and the preset inverted index are triggered to be updated. Alternatively, when the performance index of the preset vector retrieval model is less than the preset performance index threshold, that is, when the performance of the preset vector retrieval model is significantly reduced, the preset vector retrieval model and the preset inverted index are updated. Alternatively, the preset vector retrieval model and the preset inverted index may also be updated periodically to continuously optimize the preset vector retrieval model and the preset inverted index, thereby improving the retrieval accuracy. And, ensure that the newly added text data can be used for retrieval in a timely manner, thereby ensuring the real-time and timeliness of the search results. Further, in an embodiment of the present invention, the newly added text data may also be used through an automated training pipeline to retrain the preset vector retrieval model to optimize the model, thereby improving the retrieval accuracy of the model. Alternatively, replace a more advanced large model, for example, replace it with a retrieval model with higher accuracy, thereby improving the retrieval accuracy.

[0059] Optionally, in an embodiment of the present invention, the text data of the candidate resource is pre-processed according to a specified text operation. Accordingly, before the above step 102, it may also include: processing the query word according to the specified text operation; wherein the specified text operation includes: one or more of a text formatting operation, a special character removal operation, and a noise word removal operation.

[0060] The text data of each candidate resource has been pre-processed, that is, it has been processed in advance according to the specified text operation. Accordingly, the text data of each candidate resource in the preset database can be collected in advance to facilitate pre-processing. Among them, the preset database can be a database used for retrieval, and the text data of the candidate resources can be stored in the database. Further, the operation of processing the query words according to the specified text operation can be specifically to collect the original query words before the above-mentioned step 1011, and then process the original query words according to the specified text operation. Since other query words are generated based on the original query words, only the specified text operation is performed on the original query words, and the text quality of all query words can be improved at the same time. Of course, it is also possible to perform the specified text operation on each query word after obtaining all the query words, and the embodiment of the present invention does not limit this.

[0061] Among them, the specified text operation can be set according to actual needs, and the embodiment of the present invention does not limit this. The specified text operation may include: one or more of a text formatting operation, a special character removal operation, and a noise word removal operation. After performing the specified text operation on the text data, standardized text data can be obtained. Specifically, the text formatting operation may include a morphological restoration operation, a synonym replacement operation, and a coding conversion operation. After the text formatting operation, the cleaning and formatting of the text data can be achieved. Among them, the morphological restoration operation refers to restoring the words of the first specified morphology included in the text to the words of the second specified morphology, and converting the vocabulary into a basic form through the morphological restoration operation. Among them, the text can be the text data or query words of the above-mentioned alternative resources, and the second specified morphology can be a basic morphology that can express complete semantics. For example, the first specified morphology can be a verb, and the second specified morphology can be the original form. The morphological restoration operation can unify the vocabulary representation, which is convenient for subsequent retrieval. The synonym replacement operation can be used to replace the vocabulary in the text with a synonym, specifically, it can be replaced with a synonym with a more concise representation form, or a synonym that conforms to a preset format, thereby increasing the consistency of the text. Exemplarily, the text can be recognized based on a preset synonym dictionary. In this way, the text can be simplified or made to conform to a preset format, making the text more standardized.

[0062] The encoding conversion operation can be to convert the text into a specified text encoding format. Exemplarily, a preset encoding conversion tool can be used to convert the text. When performing the specified text operation, the encoding conversion operation can be performed last. In this way, it can be ensured that the encoded text obtained by conversion can represent the text that has undergone other operations. Among them, the specified text encoding format can be UTF-8 encoding to ensure the compatibility of the encoded text. By performing encoding conversion operations on the query terms and the text data of each alternative resource, text consistency can be ensured, thereby simplifying the indexing and query processing process.

[0063] Further, based on a preset special character set, special characters included in the text can be identified, and the identified special characters can be removed, thereby realizing a special character removal operation. Wherein, the special characters included in the special character set can be set according to actual needs. Exemplarily, the special character set can include hypertext markup language (HTML) tags, punctuation marks, emoticons, etc. The text can be matched with a preset noise word set according to a preset matching rule, the noise words included in the text can be identified, and the identified noise words can be removed, thereby realizing a noise word removal operation. Wherein, the noise word set can be a stop word list, and the noise words included in the noise word set can be set according to actual needs. Exemplarily, the noise word set can include: "this is", "one", "about", "of", "we", "come", "use", etc. After the special characters and noise words are removed, more meaningful words can be left in the text.

[0064] In the embodiment of the present invention, since the text data of the candidate resources involved in the retrieval and the query words are preprocessed using the specified text operation, that is, the same text operation is used for preprocessing, the query words and the text data of the candidate resources can be made to conform to the same text specification, making it easier to perform retrieval based on the query words and the text data of the candidate resources, and the retrieval efficiency can be improved to a certain extent.

[0065] Optionally, in some embodiments, the above-mentioned merging of results based on the individual search results and the mixed search results to obtain the target search results of the current round of search may specifically include:

[0066] Step 1041: Generate a target resource set based on the individual search results and the mixed search results.

[0067] Step 1042: Generate a target combined score for each resource in the target resource set based on the first ranking value of each resource in the target resource set in the separate search results and the mixed search results; the target combined score is negatively correlated with the first ranking value.

[0068] Step 1043: reorder the resources in the target resource set according to the target combined score of each resource in the target resource set to obtain the target search result; the larger the target combined score, the higher the position of the resource in the target search result.

[0069] In an embodiment of the present invention, the resources included in all individual search results and the resources included in the mixed search results can be first combined into a total set. Exemplarily, the resource identifiers of the resources in all individual search results and the resource identifiers of the resources in the mixed search results can be put into the same set to obtain a total set. Among them, the resource identifier can be information such as the resource name, number, description information, etc. that can uniquely represent the resource. Since a resource may appear in multiple search results, the total set can be used as the first set, and the resources in the first set can be deduplicated to obtain the target resource set. In this way, by deduplication, the problem of resource duplication in the target resource set can be avoided, and the subsequent calculation operation can be repeated.

[0070] The first ranking value is used to indicate the ranking of the resource in the target resource set in the individual search results and the mixed search results. The larger the first ranking value, the later the resource is in the search results and the lower the ranking. The ranking value can indicate the resource number in the search results, in descending order of ranking. For example, assuming that the first ranking value of resource a in the mixed search results is 3, and the first ranking value of resource b in the mixed search results is 20, then resource a is ranked 3rd in the mixed search results, and resource b is ranked 20th, and the ranking of resource a in the mixed search results is higher than that of resource b.

[0071] For any resource in the target resource set, illustratively, assuming that two search methods are used, there are two separate search results: separate search result X1, separate search result X2, and 1 mixed search result Y. For resource a in the target resource set, assuming that resource a is included in X1, X2, and Y, the ranking value of resource a in X1, the ranking value in X2, and the ranking value in Y can be obtained, and three first ranking values ​​can be obtained. Among them, the lower the ranking value, the higher the position of the resource in the search result, and the higher the relevance of the resource to the query term used. For resource a in the target resource set, assuming that resource b is included in X1 and Y, the ranking value of resource b in X1 and the ranking value in Y can be obtained, and two first ranking values ​​can be obtained. It should be noted that for the search result in which the resource does not exist, the first ranking value of the resource in the search result can be set to 0. That is, for any resource, the non-zero first ranking value of the resource can be 1 or more. The specific number of non-zero first ranking values ​​of the first ranking value of the resource is the same as the number of search results including the resource in the separate search results and the mixed search results.

[0072] For any resource in the target resource set, a target combined score for the resource can be generated based on the first ranking value of the resource, wherein the target combined score determines the position of the resource in the final target search result, that is, determines the ranking of the resource in the final target search result. The larger the target combined score, the higher the position of the resource in the final target search result and the higher the ranking. Specifically, the resources in the target resource set can be re-ranked in descending order of the target combined score. After re-ranking, the target search result can be obtained to ensure the accuracy of the search result.

[0073] In an embodiment of the present invention, a target resource set is first generated based on individual search results and mixed search results, and then a target combined score is generated for each resource in the target resource set, and the resources in the target resource set are reordered according to the target combined score of each resource in the target resource set to obtain a target search result. Since the target combined score is negatively correlated with the first ranking value, the higher the ranking of a resource in the individual search results and the mixed search results, the larger the target combined score, and accordingly, the higher the ranking in the final target search result. In this way, the rationality of the resource ranking in the target search result finally generated can be ensured.

[0074] At the same time, by calculating the target merge score and re-ranking based on the target merge score, the individual search results and the mixed search results can be merged into the target search results. In this way, the merging efficiency can be ensured to a certain extent.

[0075] Optionally, in some embodiments, generating a target combined score for each resource in the target resource set based on the first ranking value of each resource in the target resource set in the separate search result and the mixed search result may specifically include:

[0076] Step 1042a: For any resource in the target resource set, based on each of the first ranking values ​​of the resource, calculate the inverse corresponding to the first ranking value.

[0077] Step 1042b: Calculate the target combined score of the resource based on the inverse corresponding to the first ranking value.

[0078] In an embodiment of the present invention, the inverse of each first ranking value of the resource can be directly calculated to obtain the corresponding inverse, or the sum of each first ranking value of the resource and a preset constant can be calculated first, and then the inverse of the sum of each first ranking value and the preset constant can be calculated to obtain the corresponding inverse. The value of the preset constant can be set as needed, for example, the preset constant can be 60. By combining the preset constant, extreme values ​​in the calculated inverse can be avoided to a certain extent, making the calculated inverse smoother.

[0079] Furthermore, the sum of the reciprocals corresponding to the first ranking values ​​may be calculated as the target combined score of the resource. For example, d represents the resource, and RRF_score(d) represents the combined score of the resource. RRF_score(d) may be expressed as follows:

[0080] RRF_score(d)=Sum(1 / (k+rank_i(d))), i∈[1, n];

[0081] Among them, Sum() represents summation, k represents a preset constant, rank_i(d) represents the ranking value of the resource in the i-th search result, and n represents the number of search results involved in the merge. Corresponding to the above scenario of calculating the target merge score, d in rank_i(d) specifically represents any resource in the target resource set, rank_i(d) specifically represents the first ranking value of the resource in the i-th search result, and for values ​​of i in the interval [1, n], rank_i(1), rank_i(2), ..., rank_i(n) represent all first ranking values ​​of the resource in all search results, and n specifically represents the total number of individual search results and mixed search results.

[0082] In the embodiment of the present invention, based on each first ranking value of the resource, the inverse corresponding to the first ranking value is calculated, and the target combined score of the resource can be calculated based on the inverse corresponding to the first ranking value. The calculation logic is relatively simple, so that computing resources can be saved to a certain extent and computing efficiency can be improved.

[0083] It should be noted that in actual application scenarios, other merging methods can also be used. For example, weights can be assigned to individual search results and mixed search results. Based on the first ranking values ​​of each resource in the target resource set in the individual search results and mixed search results, a relevance score corresponding to each first ranking value is generated for each resource, wherein the relevance score may be negatively correlated with the first ranking value. Finally, based on each relevance score and the weight of each search result, a weighted sum is performed as the target merged score for the resource, thereby improving the merging effect.

[0084] Optionally, in some embodiments, the above-mentioned generation of the separate search results corresponding to each search method and the mixed search results corresponding to the at least two search methods based on the search results corresponding to each search method of each query word may specifically include:

[0085] Step 1031: For any of the search methods, based on the search results of each query word corresponding to the search method, generate a separate search result corresponding to the search method.

[0086] Step 1032: Merge the results based on all the individual search results to obtain the mixed search results.

[0087] Exemplarily, it is assumed that at least two query terms include query term a and query term b, and at least two search methods include search method 1 and search method 2. Then, the search result of search term a corresponding to search method 1 (recorded as search result 1), the search result of search term a corresponding to search method 2 (recorded as search result 2), the search result of search term b corresponding to search method 1 (recorded as search result 3), and the search result of search term b corresponding to search method 2 (recorded as search result 4) can be obtained. Accordingly, for search method 1, a separate search result can be generated for search method 1 based on search result 1 and search result 3. For search method 2, a separate search result can be generated for search method 2 based on search result 2 and search result 4.

[0088] For a separate search result of any search method, the separate search result is generated based on the search result of each query word corresponding to the search method. Therefore, in an embodiment of the present invention, a mixed search result is generated based on all separate search results. This is equivalent to using all search results to generate a mixed search result. At the same time, compared to directly using all search results, the number of separate search results is smaller. Therefore, generating a mixed search result based on all separate search results can reduce the amount of calculation, thereby improving calculation efficiency.

[0089] Optionally, in some embodiments, the generation of separate search results corresponding to the search method based on the search results corresponding to the search method for each query word may specifically include:

[0090] Step 1031a: for any of the query words, use the search result of the query word corresponding to the search method as the first search result, and generate a first resource set based on all the resources in the first search result.

[0091] Step 1031b: Generate a first combined score for each resource in the first resource set based on the second ranking value of each resource in the first search results; the first combined score is negatively correlated with the second ranking value.

[0092] Step 1031c: reorder the resources in the first resource set according to the first combined score of each resource in the first resource set to obtain a separate search result corresponding to the search method; the larger the first combined score, the higher the position of the resource in the separate search result.

[0093] In an embodiment of the present invention, the resources included in all the first search results can be combined into a total set. Exemplarily, the resource identifiers of the resources in the first search results of all query words can be put into the same set to obtain a total set. The total set is used as the second set, and the resources in the second set are deduplicated to obtain the first resource set. In this way, deduplication can avoid the problem of resource duplication in the first resource set, and then the calculation operation is repeated.

[0094] The second ranking value is used to indicate the ranking of the resources in the first resource set in the first search result. The larger the second ranking value, the later the position of the resource in the first search result and the lower the ranking. The first search result of the query term is: the search result obtained by searching with the query term according to the search method. Since there are at least two query terms, there are at least two first search results for any search method. Exemplarily, it is assumed that at least two query terms include: query term a and query term b, and at least two search methods include: search method 1 and search method 2. For search method 1, the first search result is: search result 1 and search result 3. Based on search result 1 and search result 3, the first resource set can be generated for search method 1. For search method 2, the first search result is: search result 2 and search result 4. Based on search result 2 and search result 4, the first resource set can be generated for search method 2.

[0095] For any resource in the first resource set, the ranking value of the resource in each first search result can be obtained as the second ranking value. For the first search result in which the resource does not exist, the second ranking value of the resource in the first search result can be set to 0. Exemplarily, for search method 1, if resource c in the first resource set appears in both search result 1 and search result 3, the ranking values ​​of resource c in search result 1 and search result 3 can be obtained respectively to obtain two ranking values. If resource c in the first resource set only appears in search result 1, the ranking value of resource c in search result 1 can be obtained, and the second ranking value of resource c in search result 3 can be set to 0 to obtain two second ranking values.

[0096] For any resource in the first resource set, a first combined score for the resource can be generated based on the second ranking value of the resource, wherein the first combined score determines the position of the resource in the separate search results for the search method, that is, determines the ranking of the resource in the separate search results for the search method. The larger the first combined score, the more forward the position of the resource in the separate search results and the higher the ranking. Specifically, the resources in the first resource set can be reordered in descending order of the first combined scores, and after reordering, the separate search results for the search method can be obtained. In an embodiment of the present invention, the number of separate search results is the same as the number of search methods for the at least two search methods mentioned above.

[0097] In an embodiment of the present invention, a first resource set is generated based on all resources in the first search result, and then a first combined score is generated for each resource in the first resource set, and the resources in the first resource set are reordered according to the first combined score of each resource in the first resource set to obtain a separate search result. Since the first combined score is negatively correlated with the second ranking value, the higher the ranking of the resource in the first search result, the larger the first combined score, and accordingly, the higher the final ranking in the separate search result. In this way, the rationality of the resource ranking in the separate search result generated in the end can be ensured.

[0098] At the same time, by calculating the first combined score and re-sorting based on the first combined score, it is possible to merge multiple first search results into a single search result from the dimension of a single search method. In this way, the merging efficiency can be ensured to a certain extent.

[0099] Optionally, in some embodiments, the generating of the first combined score for each resource in the first resource set based on the second ranking value of each resource in the first search result may specifically include: for any resource in the first resource set, based on each second ranking value of the resource, calculating the inverse corresponding to the second ranking value. Based on the inverse corresponding to the second ranking value, calculating the first combined score of the resource. Wherein, the specific implementation of each step can refer to the specific description of the aforementioned calculation target combined score, which will not be repeated here. It should be noted that for any search method, combined with the above calculation method, corresponding to the scenario of calculating the first combined score, d in rank_i(d) specifically represents any resource in the first resource set, rank_i(d) specifically represents the second ranking value of the resource in the i-th search result, and n specifically represents the total number of the first search results. In the embodiment of the present invention, based on each second ranking value of the resource, the inverse corresponding to the second ranking value is calculated, and the first combined score of the resource can be calculated based on the inverse corresponding to the second ranking value. The calculation logic is relatively concise, so that computing resources can be saved to a certain extent and computing efficiency can be improved.

[0100] Optionally, in some embodiments, the above-mentioned merging of results based on all the individual search results to obtain the mixed search result may specifically include:

[0101] Step 1032a: Generate a second resource set based on the resources in each of the individual search results.

[0102] Step 1032b: generating a second combined score for each resource in the second resource set based on the third ranking value of each resource in the second resource set in each of the individual search results; the second combined score is negatively correlated with the third ranking value;

[0103] Step 1032c, reorder the resources in the second resource set according to the second combined score of each resource in the second resource set to obtain the hybrid search result; the larger the second combined score, the higher the position of the resource in the hybrid search result.

[0104] In an embodiment of the present invention, the resources included in all the individual search results can be combined into a total set. Exemplarily, the resource identifiers of the resources in all the individual search results can be put into the same set to obtain a total set. The total set is used as the third set, and the resources in the third set are deduplicated to obtain the second resource set. In this way, deduplication can avoid the problem of resource duplication in the second resource set, and then the calculation operation is repeated.

[0105] The third ranking value is used to indicate the ranking of the resource in the second resource set in the separate search result. The larger the third ranking value, the further back the resource is in the separate search result and the lower the ranking. For a separate search result in which the resource does not exist, the third ranking value of the resource in the separate search result can be set to 0. It should be noted that, in an embodiment of the present invention, a second resource set can also be generated based on the resources in the second search results of all the query terms; the second search result includes the search results of the query terms corresponding to the at least two search methods; accordingly, a second combined score can be generated for each resource in the second resource set based on the third ranking value of each resource in the second search result; the second combined score is negatively correlated with the third ranking value. For any resource in the second resource set, the ranking value of the resource in each second search result can be obtained as the third ranking value. For a second search result in which the resource does not exist, the third ranking value of the resource in the second search result can be set to 0. Exemplarily, if resource f in the second resource set appears in search result 1, search result 3, and search result 4, then the ranking values ​​of resource f in search result 1, search result 3, and search result 4 can be obtained respectively, and the third ranking value of resource f in search result 2 can be set to 0, obtaining 4 third ranking values.

[0106] Furthermore, for any resource in the second resource set, a second combined score of the resource can be generated based on the third ranking value of the resource, wherein the second combined score determines the position of the resource in the mixed search result, that is, determines the ranking of the resource in the mixed search result. The larger the second combined score, the higher the position of the resource in the mixed search result and the higher the ranking. Specifically, the resources in the second resource set can be reordered in descending order of the second combined score, and the mixed search result can be obtained after reordering.

[0107] In an embodiment of the present invention, a second resource set is generated based on the resources in all individual search results, and then a second combined score is generated for each resource in the second resource set, and the resources in the second resource set are reordered according to the second combined score of each resource in the second resource set to obtain a mixed search result. Since the second combined score is negatively correlated with the third ranking value. Therefore, the higher the ranking of a resource in the individual search results, the larger the second combined score, and accordingly, the higher the final ranking in the mixed search results. In this way, the rationality of the resource ranking in the mixed search results finally generated can be ensured.

[0108] At the same time, by calculating the second combined score and re-ranking based on the second combined score, the dimension of mixed search from multiple search methods can be realized, and all search results can be merged into mixed search results. In this way, the merging efficiency can be ensured to a certain extent.

[0109] Optionally, in some embodiments, the above-mentioned generating a second combined score for each resource in the second resource set based on the third ranking value of each resource in each separate search result in the second resource set may specifically include: for any resource in the second resource set, based on each of the third ranking values ​​of the resource, calculating the inverse corresponding to the third ranking value. Based on the inverse corresponding to the third ranking value, calculating the second combined score of the resource. Among them, the specific implementation method of each step can refer to the specific description of calculating the first combined score above, which will not be repeated here. It should be noted that, in combination with the above calculation method, corresponding to the scenario of calculating the second combined score, d in rank_i(d) specifically represents any resource in the second resource set, rank_i(d) specifically represents the third ranking value of the resource in the i-th search result, and n specifically represents the total number of all search results. In the embodiment of the present invention, based on each of the third ranking values ​​of the resource, the inverse corresponding to the third ranking value is calculated, and the second combined score of the resource can be calculated based on the inverse corresponding to the third ranking value. The calculation logic is relatively concise. In this way, computing resources can be saved to a certain extent and computing efficiency can be improved.

[0110] By summing the inverses of the ranking values ​​in different search results to generate the final search results, the advantages of different search methods can be effectively integrated to generate high-quality search results.

[0111] In an embodiment of the present invention, retrieval support for multimodal resources can be implemented. For resources in text form, the text data of the resource is the resource itself. For resources in non-text form, the text data of the non-text resource can be extracted for retrieval. Exemplarily, optical character recognition (OCR) technology can be used to extract text in an image to obtain text data of the image resource. Audio is converted into text using speech recognition technology to obtain text data of the audio resource. Video analysis technology is used to generate a text description for the video to obtain text data of the video resource. Alternatively, an image description generation model (for example, a Caption generation model) can be used to generate a corresponding text description for the image to obtain text data of the image resource. Using an audio feature extraction and description generation model, a text tag is generated for the audio to obtain text data of the audio resource. A video description generation model is used to generate a corresponding text description for the video to obtain text data of the video resource.

[0112] The resource retrieval method provided by the embodiment of the present invention can be applied to search engine scenarios, which can improve the relevance and richness of search results of search engines, thereby improving user satisfaction. It can also be applied to recommendation system scenarios, for example, recommendation systems applied to content platforms, social media platforms, etc. The recommendation system uses the target retrieval results obtained by the resource retrieval method to make recommendations, which can improve the recommendation effect of the recommendation system. Furthermore, it can also be applied to data analysis scenarios. In the process of large-scale data analysis, the required resources can be retrieved based on the resource retrieval method, thereby providing more accurate and comprehensive information retrieval support for data analysis.

[0113] Figure 2 is a schematic diagram of the architecture of a resource retrieval system provided by the present invention. Figure 2 As shown, the system may include a data preprocessing module, a full-text search module, a vector search module, and a result merging module. The data preprocessing module may be used to implement the above steps 1011 to 1014 and perform specified text operations on text data and query terms. The full-text search module and the vector search module may be used to search for at least two query terms, thereby obtaining search results for each query term corresponding to each search method. The result merging module may be used to execute the above steps 103 to 104 to achieve multiple merging.

[0114] Further, Figure 3 It is a search schematic diagram provided by the present invention, such as Figure 3 As shown, for the original query word query, query1, query2 and query3 can be expanded. Query, query1, query2, query3 and the concatenated query word: Concat query (query+query-a+query-b+query-c) can be used as the above at least two query words and searched. Specifically, for each query word, the search results corresponding to the full-text search method and the vector search method can be obtained: vector search results and full-text search results. Furthermore, the search results of the same search method can be merged to obtain separate search results corresponding to each search method. Then, the separate search results corresponding to each search method are merged to obtain a mixed search result. Finally, the mixed search results and the separate search results corresponding to each search method are merged, and after multiple mergers, the final target search results are obtained. Figure 4 is a schematic diagram of merging search results provided by the present invention, such as Figure 4 As shown, for the vector retrieval method, it can be based on Figure 3 The vector search results A1 to A5 in the search result list are combined to obtain a single search result 1. For full-text search, the search result list can be based on Figure 3The full-text search results B1 to B5 in are combined to obtain a separate search result 2. Based on the separate search result 1 and the separate search result 2, a mixed search result 3 can be obtained. Further, based on the separate search result 1, the separate search result 2 and the mixed search result 3, a final target search result can be obtained.

[0115] Figure 5 FIG. 1 is a schematic diagram of a resource retrieval device in an embodiment of the present invention. Figure 5 As shown, including:

[0116] The acquisition module 201 is used to acquire the query words for this round of retrieval;

[0117] A search module 202 is used to search for candidate resources based on each of the query words in at least two search methods to obtain search results corresponding to each of the query words and the search methods;

[0118] A generating module 203, configured to generate, based on the search results of each query word corresponding to each search method, separate search results corresponding to each search method and mixed search results corresponding to the at least two search methods;

[0119] The merging module 204 is used to merge the results based on the individual retrieval results and the mixed retrieval results to obtain the target retrieval results of the current round of retrieval.

[0120] Optionally, the merging module 204 is specifically configured to:

[0121] Generate a target resource set based on the separate search results and the mixed search results;

[0122] Based on the first ranking values ​​of each resource in the target resource set in the individual search results and the mixed search results, respectively, generating a target combined score for each resource in the target resource set; the target combined score is negatively correlated with the first ranking value;

[0123] According to the target combined score of each resource in the target resource set, the resources in the target resource set are reordered to obtain the target search result; the larger the target combined score is, the higher the position of the resource in the target search result is.

[0124] Optionally, the merging module 204 is further configured to:

[0125] For any resource in the target resource set, based on each of the first ranking values ​​of the resource, calculating a reciprocal corresponding to the first ranking value;

[0126] The target combined score of the resource is calculated based on the inverse corresponding to the first ranking value.

[0127] Optionally, the generating module 203 is specifically used for:

[0128] For any of the search methods, based on the search results of each of the query words corresponding to the search method, generate a separate search result corresponding to the search method;

[0129] Merging all the individual search results to obtain the mixed search result;

[0130] Optionally, the generating module 203 is further configured to:

[0131] For any of the query words, taking the search result of the query word corresponding to the search method as the first search result, and generating a first resource set based on all the resources in the first search result;

[0132] generating a first combined score for each resource in the first resource set based on a second ranking value of each resource in the first search results; the first combined score is negatively correlated with the second ranking value;

[0133] According to the first combined score of each resource in the first resource set, the resources in the first resource set are reordered to obtain a separate search result corresponding to the search method; the larger the first combined score is, the higher the position of the resource in the separate search result.

[0134] Optionally, the generating module 203 is further configured to:

[0135] Generate a second resource set based on the resources in all the separate search results;

[0136] generating a second combined score for each resource in the second resource set based on the third ranking value of each resource in the second resource set in each of the separate search results; the second combined score is negatively correlated with the third ranking value;

[0137] According to the second combined score of each resource in the second resource set, the resources in the second resource set are reordered to obtain the hybrid search result; the larger the second combined score is, the higher the position of the resource in the hybrid search result is.

[0138] Optionally, the acquisition module 201 is specifically used to:

[0139] Obtaining the pronouns in the original query words of the current round of retrieval, and determining the descriptive words of the objects referred to by the pronouns based on the historical query words;

[0140] Using the descriptive word to replace the pronoun in the original query word as the first query word;

[0141] Based on a preset word vector model, generating related words for the original query word as a second query word;

[0142] The original query word and the historical query word are concatenated to form a third query word.

[0143] Optionally, the at least two search methods include a full-text search method and a vector search method; the search module 202 is specifically used to:

[0144] For any of the query words, the query word is used as a keyword of the full-text search method, and a keyword matching is performed on a preset inverted index based on the keyword to retrieve candidate resources whose text data matches the query word, and obtain a search result of the full-text search method corresponding to the query word; the preset inverted index is established based on the text data of the candidate resources;

[0145] The query term is used as the input of a preset vector retrieval model, and based on the vector representation of each of the candidate resources, the candidate resources whose similarity with the word vector of the query term is greater than a preset similarity threshold are retrieved to obtain the retrieval result of the query term corresponding to the vector retrieval method; the preset vector retrieval model is a retrieval model defined in the vector retrieval method, and the vector representation is obtained based on the text data of the candidate resources.

[0146] Optionally, the text data of the candidate resource is processed in advance according to a specified text operation; the device further includes:

[0147] A processing module is used to process the query word according to the specified text operation; wherein the specified text operation includes: one or more of a text formatting operation, a special character removal operation, and a noise word removal operation.

[0148] In summary, the resource retrieval device provided in the embodiment of the present invention first obtains the query words of this round of retrieval. Then, based on each query word, the candidate resources are searched according to at least two retrieval methods respectively, and the retrieval results of each query word corresponding to each retrieval method are obtained. Then, based on the retrieval results of each query word corresponding to each retrieval method, a separate retrieval result corresponding to each retrieval method and a mixed retrieval result corresponding to at least two retrieval methods are generated. The results are merged based on the separate retrieval results and the mixed retrieval results to obtain the target retrieval result of this round of retrieval. In the embodiment of the present invention, multiple retrieval methods are used to search for the query words respectively, and multiple retrieval results are obtained, and the multiple retrieval results are merged based on the multiple retrieval results to obtain the final target query result. Due to the combination of multiple retrieval methods. Therefore, compared with a single retrieval method, the richness of the target retrieval results can be improved, and the retrieval effect can be made better. At the same time, it can make up for the shortcomings of the retrieval results obtained by a single retrieval method to a certain extent, thereby avoiding the limitations of a single retrieval method, resulting in poor retrieval effect.

[0149] Furthermore, for the search results of each query word corresponding to each search method, first merge and generate the individual search results corresponding to each search method and the mixed search results corresponding to all search methods, and then merge the individual search results of each search method and the mixed search results again to obtain the final target search results. By multiple merging of search results, the search effects of multiple channels can be effectively integrated, and to a certain extent, the rationality of the target search results generated in the end can be ensured while performing mixed search.

[0150] The embodiment of the present invention further provides an electronic device, such as Figure 6 As shown, it includes a processor 801, a communication interface 802, a memory 803 and a communication bus 804, wherein the processor 801, the communication interface 802, and the memory 803 communicate with each other through the communication bus 804.

[0151] Memory 803, used for storing computer programs;

[0152] The processor 801 is used to implement each step of the above-mentioned resource retrieval method when executing the program stored in the memory 803.

[0153] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0154] The communication interface is used for communication between the above terminal and other devices.

[0155] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0156] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0157] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions. When the instructions are executed on a computer, the computer executes the resource retrieval method described in any one of the above embodiments.

[0158] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the resource retrieval method described in any one of the above embodiments.

[0159] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.

[0160] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0161] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0162] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A resource retrieval method, characterized in that: The method comprises: Get the query words for this round of search; Based on each of the query words, searching for candidate resources in at least two search methods respectively, to obtain search results corresponding to each of the query words and the search methods; Based on the search results of each of the search methods corresponding to each of the query words, generate separate search results corresponding to each of the search methods and mixed search results corresponding to the at least two search methods; The results are merged based on the individual search results and the mixed search results to obtain the target search results of the current round of search.

2. The method according to claim 1, characterized in that: The step of merging the results based on the individual search results and the mixed search results to obtain the target search results of the current search round includes: Generate a target resource set based on the separate search results and the mixed search results; Based on the first ranking values ​​of each resource in the target resource set in the individual search results and the mixed search results, respectively, generating a target combined score for each resource in the target resource set; the target combined score is negatively correlated with the first ranking value; According to the target combined score of each resource in the target resource set, the resources in the target resource set are reordered to obtain the target search result; the larger the target combined score is, the higher the position of the resource in the target search result is.

3. The method according to claim 2, characterized in that The generating a target combined score for each resource in the target resource set based on the first ranking value of each resource in the target resource set in the separate search results and the mixed search results, comprises: For any resource in the target resource set, based on each of the first ranking values ​​of the resource, calculating a reciprocal corresponding to the first ranking value; The target combined score of the resource is calculated based on the inverse corresponding to the first ranking value.

4. The method according to claim 1, characterized in that: Based on the search results of each search method corresponding to each query word, generating a separate search result corresponding to each search method and a mixed search result corresponding to the at least two search methods, including: For any of the search methods, merging the search results corresponding to the search method based on the query words to obtain a separate search result corresponding to the search method; The mixed search result is obtained by merging all the individual search results.

5. The method according to claim 4, characterized in that The step of merging the search results based on the search terms corresponding to the search method to obtain a separate search result corresponding to the search method includes: For any of the query words, taking the search result of the query word corresponding to the search method as the first search result, and generating a first resource set based on all the resources in the first search result; generating a first combined score for each resource in the first resource set based on a second ranking value of each resource in the first search results; the first combined score is negatively correlated with the second ranking value; According to the first combined score of each resource in the first resource set, the resources in the first resource set are reordered to obtain a separate search result corresponding to the search method; the larger the first combined score is, the higher the position of the resource in the separate search result.

6. The method according to claim 5, characterized in that The step of merging the results based on all the individual search results to obtain the mixed search result includes: Generate a second resource set based on the resources in all the separate search results; generating a second combined score for each resource in the second resource set based on the third ranking value of each resource in the second resource set in each of the separate search results; the second combined score is negatively correlated with the third ranking value; According to the second combined score of each resource in the second resource set, the resources in the second resource set are reordered to obtain the hybrid search result; the larger the second combined score is, the higher the position of the resource in the hybrid search result is.

7. The method according to any one of claims 1 to 6, characterized in that: The step of obtaining the query words for the current round of search includes: Obtaining the pronouns in the original query words of the current round of retrieval, and determining the descriptive words of the objects referred to by the pronouns based on the historical query words; Using the descriptive word to replace the pronoun in the original query word as the first query word; Based on a preset word vector model, generating related words for the original query word as a second query word; The original query word and the historical query word are concatenated to form a third query word.

8. The method according to any one of claims 1 to 6, characterized in that: The at least two search methods include a full-text search method and a vector search method; based on each of the query words, searching the candidate resources in accordance with at least two search methods respectively, and obtaining the search results of each query word corresponding to each of the search methods, including: For any of the query words, the query word is used as a keyword of the full-text search method, and a keyword matching is performed on a preset inverted index based on the keyword to retrieve candidate resources whose text data matches the query word, and obtain a search result of the full-text search method corresponding to the query word; the preset inverted index is established based on the text data of the candidate resources; The query term is used as the input of a preset vector retrieval model, and based on the vector representation of each of the candidate resources, the candidate resources whose similarity with the word vector of the query term is greater than a preset similarity threshold are retrieved to obtain the retrieval result of the query term corresponding to the vector retrieval method; the preset vector retrieval model is a retrieval model defined in the vector retrieval method, and the vector representation is obtained based on the text data of the candidate resources.

9. The method according to claim 8, characterized in that The text data of the candidate resource is processed in advance according to the specified text operation; The method further comprises: Processing the query term according to the specified text operation; The specified text operation includes: one or more of a text formatting operation, a special character removal operation, and a noise word removal operation.

10. A resource search device, characterized in that: The device comprises: An acquisition module is used to obtain the query words for this round of retrieval; A search module, used to search for candidate resources according to at least two search methods based on each of the query words, and obtain search results corresponding to each of the query words and the search methods; A generating module, configured to generate, based on the search results of each query word corresponding to each search method, a separate search result corresponding to each search method and a mixed search result corresponding to the at least two search methods; The merging module is used to merge the results based on the individual retrieval results and the mixed retrieval results to obtain the target retrieval results of the current round of retrieval.

11. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the steps of any method as claimed in claim 1-9 when executing a program stored in a memory.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.

Citation Information

Patent Citations

  • Searching method and device based on keywords and semantics, equipment and storage medium

    CN115438166A

  • Searching method and device, model training method and device, electronic equipment and storage medium

    CN116662633A

  • Prompt text generation method, electronic equipment, storage medium and program product

    CN117708289A

  • Multi-document intelligent question and answer method and system based on large language model

    CN118394897A

  • Text vector-based data query method and device, equipment and storage medium

    CN118520124A