Searching method and device, electronic equipment and readable storage medium
By obtaining search terms in search engines, performing initial matching and semantic expansion, and comprehensive analysis combined with search results, the problem that users can input short and vague search terms is difficult to accurately capture user intentions, achieving high accuracy and correlation Search results improve user experience.
Patent Information
- Application Number
- CN202411533815.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-02-25
AI Technical Summary
In the prior art, when the search terms entered by the user are short and vague, it is difficult for search engines to accurately capture the user's true intentions, resulting in low accuracy and correlation of search results.
By obtaining search terms, performing preset database matching, obtaining the initial matching result, and then obtaining the target search terms and semantic expansion to obtain the extended search terms. Use target search terms and extended search terms to search comprehensively analyze search results to determine the final target search results.
Effectively deal with vague search terms, provide accurate and comprehensive search results that meet users' search intentions, improve user experience and satisfaction, and avoid the problem of low accuracy and relevance of search results.
Smart Images

Figure CN119513282A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a search method, device, electronic device and readable storage medium. Background Art
[0002] In the search scenario, that is, when users enter keywords through search engines to obtain relevant information, current search engines mainly rely on keyword matching technology to provide search results. The basic principle of this technology is that the search engine will analyze the keywords entered by users and search for web pages, articles or other information matching these keywords in its huge database, and then display them to users according to certain sorting rules.
[0003] However, when the search terms entered by users are short and ambiguous, this search method based on keyword matching is not very effective. This is because short search terms often contain limited information, while ambiguous expressions may contain multiple interpretations, which makes it difficult for search engines to accurately judge the real needs of users. In this case, existing search methods usually lack an effective query expansion mechanism. Therefore, when the search terms entered by users are short and ambiguous, search engines often cannot accurately capture the real intentions of users, resulting in low accuracy and relevance of search results. This not only affects the user's search experience, but also limits the application effect of search engines in complex query scenarios. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a search method, device, electronic device and readable storage medium to solve the problem in the prior art that when the search term input by the user is short and ambiguous, the search engine often cannot accurately capture the user's true intention, resulting in low accuracy and relevance of the search results.
[0005] A first aspect of an embodiment of the present application provides a search method, the method comprising:
[0006] Acquire a search term for searching; match the search term through a preset database to obtain an initial matching result; obtain a target search term based on the search term and the initial matching result, and semantically expand the target search term to obtain at least one extended search term; search using the target search term and at least one extended search term to obtain a first search result corresponding to the target search term and a second search result corresponding to the at least one extended search term; determine a target search result corresponding to the search term based on the first search result and the second search result.
[0007] According to a second aspect of an embodiment of the present application, a search device is provided, the device comprising:
[0008] An acquisition module is configured to acquire search terms for searching; a matching module is configured to match the search terms through a preset database to obtain an initial matching result; an expansion module is configured to obtain a target search term based on the search term and the initial matching result, and semantically expand the target search term to obtain at least one extended search term; a search module is configured to search using the target search term and at least one extended search term to obtain a first search result corresponding to the target search term and a second search result corresponding to at least one extended search term; a determination module is configured to determine a target search result corresponding to the search term based on the first search result and the second search result.
[0009] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0010] According to a fourth aspect of an embodiment of the present application, a readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0011] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0012] According to the technical solution provided in the embodiment of the present application, a search term for searching is obtained; the search term is matched through a preset database to obtain an initial matching result; a target search term is obtained based on the search term and the initial matching result, and the target search term is semantically expanded to obtain at least one extended search term; the target search term and the at least one extended search term are used to search to obtain a first search result corresponding to the target search term and a second search result corresponding to the at least one extended search term; the target search result corresponding to the search term is determined based on the first search result and the second search result. Through initial semantic matching, semantic expansion and comprehensive analysis, ambiguous search terms can be effectively handled, and accurate and comprehensive search results that meet the user's search intent can be provided to the user, thereby improving the user experience and satisfaction. This avoids the problem in the prior art that when the search term entered by the user is short and ambiguous, the search engine often cannot accurately capture the user's true intent, resulting in low accuracy and relevance of the search results. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0014] Figure 1 is a schematic diagram of an application scenario of an embodiment of the present application;
[0015] Figure 2 It is a flowchart of a search method provided in an embodiment of the present application;
[0016] Figure 3 is a structural schematic diagram of a search device provided in an embodiment of the present application;
[0017] Figure 4 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0018] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0019] A search method, device, electronic device, and readable storage medium according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.
[0020] Figure 1 1 is a schematic diagram of an application scenario of an embodiment of the present application. The application scenario may include terminal devices 1, 2 and 3, a server 4 and a network 5.
[0021] Terminal devices 1, 2 and 3 can be hardware or software. When terminal devices 1, 2 and 3 are hardware, they can be various electronic devices with display screens and supporting communication with server 4, including but not limited to smart phones, tablet computers, laptop portable computers and desktop computers, etc.; when terminal devices 1, 2 and 3 are software, they can be installed in the above electronic devices. Terminal devices 1, 2 and 3 can be implemented as multiple software or software modules, or as a single software or software module, and the embodiments of the present application are not limited to this. Furthermore, various applications can be installed on terminal devices 1, 2 and 3, such as data processing applications, instant messaging tools, social platform software, search applications, shopping applications, etc.
[0022] The server 4 may be a server that provides various services, for example, a background server that receives a request sent by a terminal device that establishes a communication connection with the server, and the background server may receive and analyze the request sent by the terminal device, and generate a processing result. The server 4 may be a single server, a server cluster composed of several servers, or a cloud computing service center, which is not limited in the present embodiment of the application.
[0023] It should be noted that the server 4 can be hardware or software. When the server 4 is hardware, it can be various electronic devices that provide various services for the terminal devices 1, 2, and 3. When the server 4 is software, it can be multiple software or software modules that provide various services for the terminal devices 1, 2, and 3, or it can be a single software or software module that provides various services for the terminal devices 1, 2, and 3, and the embodiments of the present application are not limited to this.
[0024] The network 5 can be a wired network connected by coaxial cable, twisted pair and optical fiber, or it can be a wireless network that can interconnect various communication devices without wiring, such as Bluetooth, Near Field Communication (NFC), infrared, etc., which is not limited in the embodiments of the present application.
[0025] The user can establish a communication connection with the server 4 via the network 5 through the terminal devices 1, 2 and 3 to receive or send information, etc. Specifically, after the user imports the collected data of the points of interest into the server 4, the server 4 obtains the first data of the points of interest to be processed, which includes the first longitude and latitude and the first classification of the points of interest to be processed, and performs a conflict check on the points of interest to be processed according to the first longitude and latitude and the first classification; further, in the case of determining a conflict, the server 4 performs conflict processing on the points of interest to be processed to avoid a large amount of duplicate data and unavailable data in the database.
[0026] It should be noted that the specific types, quantities and combinations of the terminal devices 1, 2 and 3, the server 4 and the network 5 can be adjusted according to the actual needs of the application scenario, and the embodiments of the present application do not limit this.
[0027] Figure 2 is a flowchart of a search method provided in an embodiment of the present application. Figure 2 As shown, the method includes:
[0028] S201, obtaining a search term for searching;
[0029] S202, matching the search term with a preset database to obtain an initial matching result;
[0030] S203, obtaining a target search term according to the search term and the initial matching result, and semantically expanding the target search term to obtain at least one expanded search term;
[0031] S204, searching using the target search term and at least one extended search term to obtain a first search result corresponding to the target search term and a second search result corresponding to the at least one extended search term;
[0032] S205: Determine a target search result corresponding to the search term according to the first search result and the second search result.
[0033] Specifically, the search terms used for searching are relatively short and ambiguous words. In addition, the search terms may have multiple interpretations or the search scope of the search terms is relatively large. For example, if a user enters "apple status" as a search term, due to the unclear meaning of the search term, the search term may refer to edible apples or the technology company Apple. If the search term is used, search results that do not meet the user's search intent may be obtained; for another example, if a user enters "smartphone" as a search term, the search scope of the search term is relatively large, and search results that do not meet the user's search intent may be obtained. Therefore, semantic expansion is needed to improve the accuracy and relevance of the search.
[0034] It can be understood that after obtaining the search term for the search, this example matches the search term through a preset database to obtain an initial matching result, wherein the preset database is a database that pre-stores relevant information. For example, the preset database may contain information such as various commodities, brands, technical terms, etc., and through matching, entries related to the search term can be preliminarily screened out. In addition, the preset database can be a third-party external database, or it can be a database used to store information within the company group. For example, in the preset database, if the search term "smartphone" is entered, the initial matching results of the preset database may include different categories such as Huawei phones and Apple phones. If the preset database is a database used to store information within the company group, when the user enters "group project" as the search term, the initial matching results of the preset database may include detailed information on ongoing projects, completed projects, and future planned projects within the group.
[0035] Furthermore, based on the search terms and the initial matching results, the target search terms are obtained, making the search field of the target search terms more specific and precise. The determination of the target search terms is based on the analysis of the initial matching results and the in-depth understanding of the possible meanings of the search terms. After the target search terms are determined, semantic expansion will be performed to obtain richer search results. Semantic expansion can include synonyms, related words, hyponyms, and hyponyms.
[0036] Furthermore, the target search term and at least one extended search term are used to search, and a first search result corresponding to the target search term and a second search result corresponding to at least one extended search term are obtained; finally, the target search result corresponding to the search term is determined based on the first search result and the second search result. In this way, by comprehensively analyzing the first search result and the second search result, the information that best matches the user's search intent can be further screened out. For example, if a user searches for "smartphone", the first search result may include the definition, classification, market trends, etc. of smartphones, while the second search result may include more specific information such as smartphone brands, models, user reviews, etc. By combining the first search result and the second search result, a comprehensive and accurate target search result corresponding to the search term can be provided to meet the needs of users.
[0037] According to the technical solution provided in the embodiment of the present application, a search term for searching is obtained; the search term is matched through a preset database to obtain an initial matching result; a target search term is obtained based on the search term and the initial matching result, and the target search term is semantically expanded to obtain at least one extended search term; the target search term and the at least one extended search term are used to search to obtain a first search result corresponding to the target search term and a second search result corresponding to the at least one extended search term; the target search result corresponding to the search term is determined based on the first search result and the second search result. Through initial semantic matching, semantic expansion and comprehensive analysis, ambiguous search terms can be effectively handled, and accurate and comprehensive search results that meet the user's search intent can be provided to the user, thereby improving the user experience and satisfaction. This avoids the problem in the prior art that when the search term entered by the user is short and ambiguous, the search engine often cannot accurately capture the user's true intent, resulting in low accuracy and relevance of the search results.
[0038] In some embodiments, the search terms are matched through a preset database to obtain initial matching results, including: performing word segmentation processing on the search terms to obtain at least two sub-search terms; for each sub-search term, searching for initial expansion terms that have a semantic relationship with each sub-search term from a preset semantic relationship library to obtain an initial expansion term set corresponding to each sub-search term; using the preset database to match the initial expansion term set corresponding to each sub-search term to obtain an initial matching result set; and obtaining an initial matching result based on the initial matching result set.
[0039] Specifically, the preset semantic relationship library stores a large number of predefined semantic relationships, including but not limited to synonyms, related words, hyponyms, translation words, etc. Through these semantic relationships, the search term can be linked to the relevant initial expansion words, thereby achieving the initial expansion of the search term semantics. For example, if the search term is "smartphone", the preset semantic relationship library may contain related synonyms such as "mobile phone", "mobile phone", "artificial intelligence", etc.
[0040] In some examples, the search terms are segmented to obtain at least two sub-search terms. After the segmentation, the initial expansion terms that have a semantic relationship with each sub-search term are searched from the preset semantic relationship library. For example, for the sub-search terms "smart" and "mobile phone", "smart" may be associated with "artificial intelligence", "smart technology", etc., and "mobile phone" may be associated with "mobile communication", "mobile phone brand", etc. At this time, "artificial intelligence", "smart technology", etc. are used as the initial expansion word set of the sub-search term "smart", and "mobile communication", "mobile phone brand", etc. are used as the initial expansion word set of the sub-search term mobile phone.
[0041] It can be understood that after obtaining the initial expansion word set corresponding to each sub-search word, the preset database can be used to match the initial expansion word set corresponding to each sub-search word to obtain an initial matching result set. For example, the preset database is used to match the initial expansion word "mobile phone brand" to obtain matching results of different categories such as Huawei mobile phones and Apple mobile phones. The preset database is used to match the initial expansion word "artificial intelligence" to obtain matching results in different fields such as deep learning and machine learning. Then, the initial matching result set is obtained based on the matching results obtained by matching, and the initial matching results are further obtained from the initial matching result set.
[0042] According to the technical solution provided in the embodiment of the present application, the search words are segmented to obtain at least two sub-search words; for each sub-search word, the initial expansion words that have a semantic relationship with each sub-search word are searched from the preset semantic relationship library to obtain the initial expansion word set corresponding to each sub-search word; the initial expansion word set corresponding to each sub-search word is matched using the preset database to obtain an initial matching result set; based on the initial matching result set, an initial matching result is obtained. By segmenting the search words, complex queries can be decomposed into smaller and more specific parts to more accurately understand the user's query intent. Then, using the preset semantic relationship library, the initial expansion words related to these sub-search words can be found to broaden the scope of the query and cover more content related to the user's query intent. Secondly, by matching the initial expansion word set with the preset database, the results most relevant to the user's query can be screened out, the accuracy of the query can be improved, and thus the efficiency of the search can be improved.
[0043] In some embodiments, obtaining initial matching results based on an initial matching result set includes: determining a target field corresponding to a search term; and screening each matching result in the initial matching result set using the target field corresponding to the search term to obtain an initial matching result.
[0044] Specifically, based on the initial matching result set, in the process of obtaining the initial matching result, the target field corresponding to the search term input by the user is first determined, and the target field represents the specific industry or field that the user is concerned about when searching. Continuing with the above example, for example, the search term is "smartphone", then the target field corresponding to "smartphone" is consumer electronics;
[0045] Furthermore, each matching result in the initial matching result set is screened using the target field corresponding to the search term to obtain the initial matching result, that is, each matching result in the initial matching result set is screened using the label of consumer electronics to screen out matching results related to consumer electronics. For example, if the initial matching result set contains matching results such as "smartphone", "artificial intelligence", and "mobile phone", then by screening in the field of consumer electronics, matching items that are not related to consumer electronics can be excluded, such as "artificial intelligence" may be excluded, although it has a semantic association with "smartphone", but does not directly belong to the field of consumer electronics. Through such a further screening process, the final initial matching results will more accurately reflect the user's search intent and improve the relevance and quality of search results.
[0046] In some embodiments, the initial matching results include multiple candidate search terms, and a target search term is obtained based on the search term and the initial matching results, and the target search term is semantically expanded to obtain at least one extended search term, including: calculating the semantic similarity between each candidate search term and the search term, and sorting the candidate search terms according to the calculation results of the semantic similarity; selecting N candidate search terms with the highest semantic similarity as target candidate search terms, where N is a positive integer; concatenating the search term with the target candidate search term to obtain a target search term; and inputting the target search term into a pre-trained large language model for expansion to obtain at least one extended search term output by the large language model.
[0047] Specifically, the initial matching result includes multiple candidate search terms. This example calculates the semantic similarity between each candidate search term and the search term to find the candidate search term that is most relevant to the search term. This makes the search results more accurate and improves search efficiency. Specific semantic similarity calculation methods include but are not limited to the following methods. For example, cosine similarity, Jaccard similarity, or a semantic similarity calculation method based on deep learning can be used.
[0048] Further, according to the calculation results of semantic similarity, the N candidate search terms with the highest semantic similarity are selected as target candidate search terms, and these target candidate search terms are spliced with the original search terms to form target search terms, where N is a positive integer, and the specific number can be set according to demand, which is not specifically limited in this embodiment. The splicing method can be a simple string connection or a more complex combination, such as sentences or phrases generated by natural language processing technology. For example, if the original search term is "smartphone" and the target candidate search terms are "Huawei", "Xiaomi", and "mobile phone", target search terms such as "Huawei's latest mobile phone" and "Xiaomi's latest mobile phone" can be generated.
[0049] Furthermore, the target search terms are input into the pre-trained large language model for expansion, so as to obtain richer and more accurate expanded search terms. The pre-trained large language model can understand the context and generate coherent text, so it can provide high-quality results when expanding the search terms. The pre-trained large language model includes but is not limited to BERT, GPT, etc. For example, for the target search terms "Huawei's latest mobile phone" and "Xiaomi's latest mobile phone", the large language model may output expanded search terms such as "Huawei three-fold mobile phone review", "Huawei three-fold mobile phone price", "Huawei cost-effective smartphone price", etc.
[0050] According to the technical solution provided by the embodiment of the present application, the semantic similarity between each candidate search term and the search term is calculated, and the candidate search terms are sorted according to the calculation results of the semantic similarity; the N candidate search terms with the highest semantic similarity are selected as the target candidate search terms, where N is a positive integer; the search term is spliced with the target candidate search term to obtain the target search term; the target search term is input into the pre-trained large language model for expansion to obtain at least one extended search term output by the large language model. By calculating the semantic similarity between the candidate search term and the search term, and preferentially selecting the candidate term with high similarity for subsequent processing, the search term that best matches the user's needs can be quickly located, thereby greatly improving the efficiency and accuracy of the search. Secondly, the search term is spliced with the screened target candidate search term to form a more complete and specific target search term, which can guide the search engine to understand the user's intention more accurately, and then return search results that are more in line with the needs. Finally, the target search term is expanded using the pre-trained large language model to obtain at least one extended search term. It can enrich the dimensions of the search and help discover more potential information points that users may be interested in.
[0051] In some embodiments, before inputting the target search term into the pre-trained large language model for expansion, the method further includes:
[0052] Extract sample search terms and sample search results corresponding to the sample search terms from historical search data; annotate the sample search results to obtain sample extended search terms corresponding to the sample search terms, wherein the similarity between the sample search terms and the sample extended search terms is greater than or equal to a first preset threshold; form a training sample set with the search terms and the extended search terms, and train a large language model to be trained using the training sample set until the model parameters converge, thereby obtaining a pre-trained large language model, wherein the sample search terms serve as inputs of the large language model to be trained, and the sample extended search terms serve as expected outputs of the large language model to be trained.
[0053] Specifically, the similarity between the sample search term and the sample extended search term is greater than or equal to a first preset threshold value, so as to ensure the quality of the training sample, thereby improving the training effect of the large language model. For example, if the sample search term is "smartphone" and the sample extended search term is "Huawei's latest mobile phone", the similarity between them is high and can be used as effective training samples.
[0054] Furthermore, the training sample set is used to train the large language model to be trained until the model parameters converge to ensure the stability and accuracy of the model. During the training process, a variety of optimization algorithms, such as gradient descent, Adam optimizer, etc., can be used to improve the training efficiency and effect of the model. The pre-trained large language model obtained through the above process can better understand the user's search intent and generate high-quality extended search terms. For example, for the target search term "Huawei's latest mobile phone", the pre-trained large language model may output extended search terms such as "Huawei three-fold mobile phone review", "Huawei three-fold mobile phone price", "Huawei cost-effective smartphone price", etc. These extended search terms are not only related to the original search terms, but also can cover different aspects that users may be interested in, thereby ensuring that the user's intent is accurately understood during the search process and improving the relevance and quality of search results.
[0055] In some embodiments, determining a target search result corresponding to the search term according to the first search result and the second search result includes:
[0056] Obtain historical search terms and historical search results corresponding to the historical search terms, and determine the click-through rate of the historical search results; determine a first weight value for the first search result and a second weight value for the second search result based on the click-through rate of the historical search results; display the first search result and the second search result based on the first weight value and the second weight value to obtain a target search result.
[0057] Specifically, by analyzing historical search data, it can be found that certain search terms have a high click-through rate correlation with specific search results. For example, if historical data shows that users often click on results related to "Huawei's latest mobile phone" when searching for "smartphone", then it can be inferred that "Huawei's latest mobile phone" is a search result that is highly relevant to "smartphone".
[0058] It can be understood that the first search result obtained by searching with the target search term "Huawei mobile phone" may include all Huawei brand mobile phones, while the second search result obtained by searching with at least one extended search term may include "Huawei tri-fold mobile phone review", "Huawei mobile phone review" and other specific brand mobile phone search results. At this time, since users often click on results related to "Huawei's latest mobile phone", the search results related to Huawei mobile phones will have higher weight values, and the remaining search results will have lower weight values. After the weight values are determined, the first search result and the second search result can be displayed to obtain the final target search result. That is, place more search results with higher weight values on a fixed display page. For example, if the weight value of Huawei's latest mobile phone is 0.7, and the weight values of the remaining search results account for 0.3, then 70% of the screen on the fixed display page will be used to display the search results of Huawei mobile phones, and 30% of the screen will be used to display the relevant information of the remaining search results.
[0059] This method ensures that the final target search results are not only highly relevant to the user's search terms, but also reflect the user's actual click behavior in historical searches, thereby improving the relevance and quality of search results. This weight distribution method based on historical data can better meet the user's search needs and improve the user experience.
[0060] In addition, in the display of search results, the target search results can also be adjusted according to the user's geographical location information. For example, if the user is located in China, the system can give priority to displaying matching results of Chinese brand mobile phones related to "smartphones", such as Huawei, Xiaomi, etc., so as to provide search results that better meet the actual needs of users. That is: obtain the user's current geographical location, perform correlation analysis based on the geographical location and the target search results, and adjust the order of the target search results according to the correlation analysis results. In order to give priority to recommending relevant products in the user's current geographical location to the user.
[0061] In some embodiments, the search term is different from the expanded search term, and the semantic similarity between the search term and the expanded search term is greater than or equal to a second preset threshold.
[0062] Specifically, the expanded search terms are different from the original search terms, and the semantic similarity reaches at least a second preset threshold value, so as to ensure the relevance and accuracy of the search results. In this way, not only the search efficiency is improved, but also the user experience is enhanced. Users do not need to spend a lot of time trying different search term combinations to quickly find the information they want. In this way, the search efficiency and search accuracy are improved.
[0063] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the process of the embodiments of the present application.
[0064] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described in detail here.
[0065] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0066] Figure 3 Schematic diagram of a search device provided in an embodiment of the present application. Figure 3 As shown, the device comprises:
[0067] The acquisition module 301 is configured to acquire a search term for searching;
[0068] A matching module 302 is configured to match the search term through a preset database to obtain an initial matching result;
[0069] The expansion module 303 is configured to obtain a target search term according to the search term and the initial matching result, and semantically expand the target search term to obtain at least one expanded search term;
[0070] A search module 304 is configured to perform a search using a target search term and at least one extended search term to obtain a first search result corresponding to the target search term and a second search result corresponding to the at least one extended search term;
[0071] The determination module 305 is configured to determine a target search result corresponding to the search term according to the first search result and the second search result.
[0072] In some embodiments, the matching module 302 is further configured to perform word segmentation on the search term to obtain at least two sub-search terms; for each sub-search term, search for an initial expansion term that has a semantic relationship with each sub-search term from a preset semantic relationship library to obtain an initial expansion term set corresponding to each sub-search term; use a preset database to match the initial expansion term set corresponding to each sub-search term to obtain an initial matching result set; and obtain an initial matching result based on the initial matching result set.
[0073] In some embodiments, the matching module 302 is further configured to determine a target domain corresponding to the search term; and use the target domain corresponding to the search term to filter each matching result in the initial matching result set to obtain an initial matching result.
[0074] In some embodiments, the expansion module 303 is also configured to calculate the semantic similarity between each candidate search term and the search term, and sort the candidate search terms according to the calculation results of the semantic similarity; select the N candidate search terms with the highest semantic similarity as the target candidate search terms, where N is a positive integer; concatenate the search term with the target candidate search term to obtain the target search term; input the target search term into the pre-trained large language model for expansion, and obtain at least one expanded search term output by the large language model.
[0075] In some embodiments, the expansion module 303 is further configured to extract sample search terms and sample search results corresponding to the sample search terms from historical search data; annotate the sample search results to obtain sample extended search terms corresponding to the sample search terms, wherein the similarity between the sample search terms and the sample extended search terms is greater than or equal to a first preset threshold; form a training sample set with the search terms and the extended search terms, and use the training sample set to train the large language model to be trained until the model parameters converge to obtain a pre-trained large language model, wherein the sample search terms serve as the input of the large language model to be trained, and the sample extended search terms serve as the expected output of the large language model to be trained.
[0076] In some embodiments, the determination module 305 is also configured to obtain historical search terms and historical search results corresponding to the historical search terms, and determine the click-through rate of the historical search results; determine the first weight value of the first search result and the second weight value of the second search result based on the click-through rate of the historical search results; display the first search result and the second search result based on the first weight value and the second weight value to obtain the target search result.
[0077] In some embodiments, the determination module 305 is further configured that the search term is different from the expanded search term, and the semantic similarity between the search term and the expanded search term is greater than or equal to a second preset threshold.
[0078] According to the device provided in the embodiment of the present application, a search term for searching is obtained; the search term is matched through a preset database to obtain an initial matching result; a target search term is obtained based on the search term and the initial matching result, and the target search term is semantically expanded to obtain at least one extended search term; the target search term and the at least one extended search term are used to search to obtain a first search result corresponding to the target search term and a second search result corresponding to the at least one extended search term; the target search result corresponding to the search term is determined based on the first search result and the second search result. Through initial semantic matching, semantic expansion and comprehensive analysis, ambiguous search terms can be effectively processed, and accurate and comprehensive search results that meet the user's search intent can be provided to the user, thereby improving the user experience and satisfaction. This avoids the problem in the prior art that when the search term entered by the user is short and ambiguous, the search engine often cannot accurately capture the user's true intent, resulting in low accuracy and relevance of the search results.
[0079] Figure 4 Schematic diagram of an electronic device 4 provided in an embodiment of the present application. Figure 4 As shown, the electronic device 4 of this embodiment includes: a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processor 401. When the processor 401 executes the computer program 403, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 401 executes the computer program 403, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0080] The electronic device 4 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 4 may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will appreciate that Figure 4 The electronic device 4 is merely an example and does not limit the electronic device 4 , and may include more or less components than those shown in the figure, or different components.
[0081] The processor 401 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0082] The memory 402 may be an internal storage unit of the electronic device 4, for example, a hard disk or memory of the electronic device 4. The memory 402 may also be an external storage device of the electronic device 4, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 4. The memory 402 may also include both an internal storage unit and an external storage device of the electronic device 4. The memory 402 is used to store computer programs and other programs and data required by the electronic device.
[0083] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0084] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the present application implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, which may be in source code form, object code form, executable file or some intermediate form. The readable storage medium may include: any entity or device that can carry computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0085] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A search method, characterized in that: include: Get the search term used for the search; Matching the search term through a preset database to obtain an initial matching result; Obtaining a target search term according to the search term and the initial matching result, and semantically expanding the target search term to obtain at least one expanded search term; Searching using the target search term and the at least one extended search term to obtain a first search result corresponding to the target search term and a second search result corresponding to the at least one extended search term; A target search result corresponding to the search term is determined according to the first search result and the second search result.
2. The method according to claim 1, characterized in that The step of matching the search words with a preset database to obtain an initial matching result includes: Performing word segmentation processing on the search term to obtain at least two sub-search terms; For each of the sub-search words, searching a preset semantic relationship library for an initial expansion word that has a semantic relationship with each of the sub-search words, to obtain an initial expansion word set corresponding to each of the sub-search words; Using the preset database to match the initial expansion word set corresponding to each of the sub-search words to obtain an initial matching result set; Based on the initial matching result set, the initial matching result is obtained.
3. The method according to claim 2, characterized in that The obtaining the initial matching result based on the initial matching result set includes: Determine the target field corresponding to the search term; Each matching result in the initial matching result set is screened using the target field corresponding to the search term to obtain the initial matching result.
4. The method according to any one of claims 1 to 3, characterized in that: The initial matching result includes a plurality of candidate search terms, and the target search terms are obtained according to the search terms and the initial matching result, and the target search terms are semantically expanded to obtain at least one expanded search term, including: Calculating the semantic similarity between each candidate search term and the search term, and sorting the candidate search terms according to the calculation results of the semantic similarity; Select N candidate search terms with the highest semantic similarity as target candidate search terms, where N is a positive integer; Concatenate the search term with the target candidate search term to obtain the target search term; The target search term is input into a pre-trained large language model for expansion, to obtain the at least one expanded search term output by the large language model.
5. The method according to claim 4, characterized in that Before inputting the target search term into the pre-trained large language model for expansion, the method further includes: Extracting sample search terms and sample search results corresponding to the sample search terms from historical search data; Annotating the sample search results to obtain a sample extended search term corresponding to the sample search term, wherein a similarity between the sample search term and the sample extended search term is greater than or equal to a first preset threshold; The search terms and the extended search terms are combined into a training sample set, and the large language model to be trained is trained using the training sample set until the model parameters converge, thereby obtaining the pre-trained large language model, wherein the sample search terms serve as inputs of the large language model to be trained, and the sample extended search terms serve as expected outputs of the large language model to be trained.
6. The method according to claim 1, characterized in that Determining a target search result corresponding to the search term according to the first search result and the second search result includes: Obtaining historical search terms and historical search results corresponding to the historical search terms, and determining click rates of the historical search results; Determining a first weight value of the first search result and a second weight value of the second search result according to the click rate of the historical search results; The first search result and the second search result are displayed according to the first weight value and the second weight value to obtain the target search result.
7. The method according to claim 1, characterized in that The search term is different from the extended search term, and a semantic similarity between the search term and the extended search term is greater than or equal to a second preset threshold.
8. A search device, characterized in that: include: An acquisition module, configured to acquire a search term for searching; A matching module, configured to match the search term through a preset database to obtain an initial matching result; an expansion module, configured to obtain a target search term according to the search term and the initial matching result, and semantically expand the target search term to obtain at least one expanded search term; A search module configured to perform a search using the target search term and the at least one extended search term to obtain a first search result corresponding to the target search term and a second search result corresponding to the at least one extended search term; The determination module is configured to determine a target search result corresponding to the search term based on the first search result and the second search result.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A readable storage medium storing 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 7 are implemented.
Citation Information
Cited By
Method, device, equipment and product for generating retrieval result
CN121009187A
Database retrieval method and device based on large language model, equipment and medium
CN121579710A
Memory processing method and device, equipment, storage medium and program product
CN121658621A