Search Method, Device, Server, Medium and Product
By constructing an association graph to find keyword chains and generate keyword combinations, the problem of inaccurate search results in the existing technology is solved, and a more accurate search result set is achieved.
Patent Information
- Application Number
- CN202110990256.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-26
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2041-08-26
AI Technical Summary
In the prior art, when searching based on the search keywords contained in the query statement input by the user, the knowledge points obtained are inaccurate and cannot meet the actual needs of the user.
By constructing a pre-associated graph, search for keyword chains containing search keywords, generate multiple keyword combinations based on the keyword chain, and search separately to improve the accuracy of search results.
Searching through the generated keyword combinations significantly improves the accuracy of search results, making the search result set displayed by the client more likely to be the knowledge points needed by users.
Smart Images

Figure CN113609372B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data retrieval, and more specifically, to a search method, device, server, medium, and product. Background Art
[0002] With the development of the Internet, users can input query statements through electronic devices. The server can search for knowledge points from a database based on the retrieval keywords included in the query statements and feedback them to the electronic devices. The knowledge points can include at least one of text, pictures, and videos.
[0003] Currently, the knowledge points obtained by searching based on the retrieval keywords included in the query statements input by users are very likely not the knowledge points that users need, that is, the search results are inaccurate. Summary of the Invention
[0004] In view of this, this application provides a search method, device, server, medium, and product.
[0005] To achieve the above object, this application provides the following technical solutions:
[0006] According to a first aspect of an embodiment of the present disclosure, a search method is provided, including:
[0007] Receiving a query statement sent by a client;
[0008] Obtaining retrieval keywords from the query statement;
[0009] Searching in a pre-constructed association graph for a keyword chain that includes the retrieval keyword. The association graph includes multiple keywords. If any two keywords included in the association graph appear simultaneously in at least one historical query statement, there is an edge between the two keywords, and the weight of the edge connecting the two keywords is the number of historical query statements that include the two keywords; the keywords included in the keyword chain are directly or indirectly connected to the retrieval keyword, and the weight of the edge between any two keywords included in the keyword chain is greater than or equal to a first threshold;
[0010] Based on the keyword chain, obtaining multiple keyword combinations, where the keyword combinations include the retrieval keyword and at least one keyword other than the retrieval keyword in the keyword chain, and the keywords included in different keyword combinations are not exactly the same;
[0011] Obtaining retrieval results corresponding to the multiple keyword combinations respectively;
[0012] Obtaining a search result set from the multiple retrieval results;
[0013] Sending the search result set to the client.
[0014] According to a second aspect of the embodiments of the present disclosure, a search device is provided, including:
[0015] A receiving module, configured to receive a query statement sent by a client;
[0016] A first obtaining module, configured to obtain a retrieval keyword from the query statement;
[0017] A searching module, configured to search, from a pre-constructed association graph, for a keyword chain that includes the retrieval keyword, where the association graph includes multiple keywords, and for any two keywords included in the association graph, if they appear simultaneously in at least one historical query statement, there is an edge between the two keywords, and the weight of the edge connecting the two keywords is the number of historical query statements that include the two keywords; the keywords included in the keyword chain are directly or indirectly connected to the retrieval keyword, and the weight of the edge between any two keywords included in the keyword chain is greater than or equal to a first threshold;
[0018] A second obtaining module, configured to obtain, based on the keyword chain, multiple keyword combinations, where the keyword combinations include the retrieval keyword and at least one keyword other than the retrieval keyword in the keyword chain, and the keywords included in different keyword combinations are not completely the same;
[0019] A third obtaining module, configured to obtain retrieval results corresponding to the multiple keyword combinations respectively;
[0020] A fourth obtaining module, configured to obtain a search result set from the multiple retrieval results;
[0021] A sending module, configured to send the search result set to the client.
[0022] According to a third aspect of the embodiments of the present disclosure, a server is provided, including:
[0023] A processor;
[0024] A memory for storing instructions executable by the processor;
[0025] Wherein, the processor is configured to execute the instructions to implement the search method as described in the first aspect.
[0026] According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, and when the instructions in the storage medium are executed by a processor of a server, the server is enabled to execute the search method as described in the first aspect.
[0027] According to a fifth aspect of the embodiments of the present disclosure, a computer program product is provided. It can be directly loaded into the internal memory of a computer, such as the memory included in the server described in the third aspect, and contains software code. After being loaded and executed by the computer, this computer program can implement the search method described in the first aspect.
[0028] As can be seen from the above technical solutions, in the search method provided by this application, a query statement sent by a client is received; a retrieval keyword is obtained from the query statement; and a keyword chain containing the retrieval keyword is searched from a pre-constructed association graph. The association graph includes multiple keywords. If any two keywords included in the association graph appear simultaneously in at least one historical query statement, there is an edge between the two keywords, and the weight of the edge connecting the two keywords is the number of historical query statements containing the two keywords. Therefore, the association graph can reflect the association relationship between keywords, that is, through the association graph, some keywords that the user subconsciously wants to input but actually does not input when the user inputs a retrieval keyword can be obtained. Since the keywords included in the keyword chain are directly or indirectly connected to the retrieval keyword, and the weight of the edge between any two keywords included in the keyword chain is greater than or equal to a first threshold, the keywords included in the keyword chain are some keywords that the user subconsciously wants to input but actually does not input when the user inputs a retrieval keyword. Based on the keyword chain, multiple keyword combinations are obtained. The keyword combinations include the retrieval keyword and at least one keyword other than the retrieval keyword in the keyword chain, and the keywords included in different keyword combinations are not completely the same. Retrieval results corresponding to the multiple keyword combinations are obtained. Compared with the retrieval results obtained by retrieving only based on the retrieval keyword, the retrieval results obtained based on the keyword combinations provided by the embodiments of this application are more accurate. A search result set is obtained from the multiple retrieval results; and the search result set is sent to the client. Since the retrieval results are more accurate, the search result set is more accurate, so that the search result set displayed by the client is very likely to be the knowledge points required by the user. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.
[0030] Figure 1 It is an architecture diagram of the hardware architecture related to the embodiments of the present application;
[0031] Figure 2 It is a flowchart of the search method provided by the embodiments of the present application;
[0032] Figure 3 A schematic diagram of an implementation manner of the association graph provided by the embodiment of the present application;
[0033] Figure 4 A schematic diagram of an implementation manner of the keyword chain provided by the embodiment of the present application;
[0034] Figure 5 The structural diagram of the search device provided by the embodiment of the present application;
[0035] Figure 6 It is a block diagram of a device for a server shown according to an exemplary embodiment. Specific embodiments
[0036] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0037] The embodiments of the present application provide a search method, device, server, medium and product. Before introducing the technical solutions provided by the embodiments of the present application, the hardware architecture involved in the embodiments of the present application will be described first.
[0038] Figure 1 It is the architecture diagram of the hardware architecture involved in the embodiments of the present application. The hardware architecture includes: a server 11 and at least one electronic device 12.
[0039] Exemplarily, the electronic device 12 and the server 11 can establish a connection and communicate through a wireless network.
[0040] Exemplarily, the electronic device 12 can be any electronic product that can perform human-computer interaction with the user through one or more of a keyboard, touchpad, touch screen, remote control, voice interaction, or handwriting device. For example, a mobile phone, a tablet computer, a palm computer, a personal computer, a wearable device, a smart TV, etc.
[0041] Exemplarily, a client is run in the electronic device 12, and the user can input a query statement based on the client.
[0042] If the client is an application client, then the electronic device 12 can install the client; if the client is a web version client, then the electronic device 12 can display the web version client through a browser.
[0043] Exemplarily, the server 11 may be a single server, a server cluster composed of multiple servers, or a cloud computing service center. The server 11 may include a processor, a memory, a network interface, etc.
[0044] Exemplarily, the database stores multiple knowledge points.
[0045] Exemplarily, the server 11 receives a query statement from the electronic device 12, executes the search method provided by the embodiments of the present application, obtains a search result set, and sends the search result set to the electronic device 12. The electronic device 12 may display the search result set.
[0046] Exemplarily, the above database may be independent of the server 11 or located in the server 11.
[0047] Figure 1 Merely an example, Figure 1 One electronic device 12 is shown. In actual applications, the number of electronic devices 12 can be set according to actual needs, and the embodiments of the present disclosure do not limit the number of electronic devices 12.
[0048] Those skilled in the art should understand that the above electronic devices and servers are only examples. Other existing or future possible electronic devices or servers that can be applied to the present disclosure should also be included within the protection scope of the present disclosure and are hereby incorporated by reference.
[0049] The search method provided by the embodiments of the present application will be described below in conjunction with the above hardware architecture.
[0050] As Figure 2 shown, it is a flowchart of the search method provided by the embodiments of the present application. This method can be applied to Figure 1 the server shown. The method involves the following steps S21 to S27 during implementation.
[0051] Step S21: Receive a query statement sent by the client.
[0052] Step S22: Obtain a retrieval keyword from the query statement.
[0053] Exemplarily, the number of retrieval keywords obtained from the query statement is one or more.
[0054] In an optional embodiment, the query statement may be voice, text, or a picture. If the query statement is voice, the voice needs to be converted into text. If the query statement is a picture, the text in the picture can be recognized through OCR (Optical Character Recognition).
[0055] Optionally, the embodiments of the present invention provide, but are not limited to, the following methods for obtaining the retrieval keywords included in the query statement.
[0056] The first method for obtaining the retrieval keywords included in the query statement includes:
[0057] Step A1: Divide the query statement to obtain multiple words.
[0058] Optionally, if the query statement is "loan contract for customer's house purchase", then the words included in the query statement are: customer, house purchase, of, loan contract.
[0059] Step A2: Obtain the retrieval keywords from the multiple words according to the preset rules.
[0060] Optionally, the preset rules may include: synonym replacement and / or stop word filtering. For example, remove the words that belong to stop words from the multiple words obtained in Step A1. Assume that the stop words include: of, de, le, ma, ba, zai, zhong, etc. Then, the retrieval keywords obtained through Step A2 include: customer, house purchase, loan contract.
[0061] The second method for obtaining the retrieval keywords included in the query statement includes: a retrieval keyword extraction method based on statistical features.
[0062] The retrieval keyword extraction algorithm based on statistical features extracts the retrieval keywords of the query statement by using the statistical information of the words in the query statement.
[0063] The third method for obtaining the retrieval keywords included in the query statement includes: a retrieval keyword extraction algorithm based on a word graph model, such as the TextRank algorithm.
[0064] For the retrieval keyword extraction algorithm based on a word graph model, first, a language network graph of the query statement needs to be constructed, and then the language network graph is analyzed to find the words or phrases that play an important role on the language network graph. These phrases are the retrieval keywords of the query statement.
[0065] The fourth method for obtaining the retrieval keywords included in the query statement includes: a retrieval keyword extraction algorithm based on a topic model, such as the LDA algorithm.
[0066] The retrieval keyword extraction algorithm based on a topic model mainly extracts the retrieval keywords by using the properties of the topic distribution in the topic model.
[0067] Step S23: From the pre-constructed association graph, search for the keyword chain that contains the retrieval keyword.
[0068] The associated graph includes multiple keywords. If any two keywords included in the associated graph appear simultaneously in at least one historical query statement, there is an edge between the two keywords, and the weight of the edge connecting the two keywords is the number of historical query statements containing the two keywords; the keywords included in the keyword chain are directly or indirectly connected to the retrieval keyword, and the weight of the edge between any two keywords included in the keyword chain is greater than or equal to a first threshold.
[0069] Exemplarily, the first threshold can be determined based on the actual situation and is not limited here.
[0070] Exemplarily, the associated graph can be obtained based on the search logs within a preset time period. Exemplarily, the preset time period can be determined based on the actual situation and is not limited here. Exemplarily, the preset time period is [current time - preset duration, current time]. As time goes by, the current time is constantly changing, so the preset time period is constantly changing. The search logs for different preset time periods may be different, so the associated graph is constantly updated as time goes by.
[0071] Exemplarily, it can be understood that for the same user, within different preset time periods, the user's needs may change, and the query statements input by the user may change. The associated graphs of the same user within different preset time periods may be different. The associated graphs of different users within the same preset time period may also be different.
[0072] Exemplarily, for each user, the method for constructing the associated graph includes the following steps A11 to A13.
[0073] Step A11: Obtain multiple historical query statements input by the user from the search logs within the preset time period.
[0074] Exemplarily, the relevance of the knowledge points corresponding to the multiple historical query statements is higher than or equal to a threshold 1.
[0075] Exemplarily, the hit knowledge point is the knowledge point accessed by the user. Or, the hit knowledge point is the knowledge point accessed by the user, and the access duration is higher than or equal to a threshold 2.
[0076] Exemplarily, the knowledge points corresponding to the multiple historical query statements belong to the same application scenario. For example, the ETC (Electronic Toll Collection) application scenario; Exemplarily, the knowledge points corresponding to the multiple historical query statements have no association.
[0077] Step A12: Obtain the keyword sets corresponding to the multiple historical query statements respectively.
[0078] The keyword set corresponding to the historical query statement includes the keywords obtained from the historical query statement. For the process of obtaining the keyword set from the historical query statement, please refer to the process of obtaining the retrieval keywords from the query statement, which will not be elaborated here.
[0079] Exemplarily, the number of keywords included in the keyword sets corresponding to different historical query statements may be the same or different.
[0080] Step A13: For any two keywords included in multiple keyword sets, if the two keywords appear simultaneously in at least one keyword set, then establish an edge connecting the two keywords; the weight of this edge is the number of keyword sets containing the two keywords, so as to obtain an association graph.
[0081] The following is an example to illustrate the construction process of the above association graph.
[0082] Exemplarily, if the user inputs historical query statement 1, historical query statement 2, historical query statement 3, historical query statement 4, and historical query statement 5 respectively within a preset time period. And the keyword set corresponding to historical query statement 1 is {keyword 1, keyword 2, keyword 3}, the keyword set corresponding to historical query statement 2 is {keyword 2, keyword 3}, the keyword set corresponding to historical query statement 3 is {keyword 4, keyword 5, keyword 2}, the keyword set corresponding to historical query statement 4 is {keyword 1, keyword 2}, and the keyword set corresponding to historical query statement 5 is {keyword 1, keyword 5, keyword 3}.
[0083] Since keyword 1 and keyword 2 appear simultaneously in two keyword sets, there is an edge between keyword 1 and keyword 2, and the weight of the edge is 2. By analogy, the association graph as shown in Figure 3 is obtained.
[0084] Assume that the retrieval keyword is keyword 1 and the first threshold is 2, then the keyword chain obtained from the Figure 3 shown association graph is: keyword 1—keyword 2—keyword 3.
[0085] Among them, keyword 2 is directly connected to keyword 1, and keyword 3 is indirectly connected to keyword 1 through keyword 2.
[0086] It can be understood that the association graph can reflect the association relationship between keywords, that is, through the association graph, some keywords that the user subconsciously wants to input but actually does not input when the user inputs a certain retrieval keyword can be obtained.
[0087] Step S24: Based on the keyword chain, obtain a plurality of keyword combinations, where each keyword combination includes the retrieval keyword and at least one keyword in the keyword chain other than the retrieval keyword, and the keywords included in different keyword combinations are not exactly the same.
[0088] Exemplarily, there are multiple implementation manners for step S24. The embodiments of the present application provide but are not limited to the following two.
[0089] The first implementation manner of step S24 includes the following steps B11 to B13.
[0090] Step B11: Obtain each keyword in the keyword chain other than the retrieval keyword to obtain a candidate keyword set.
[0091] Still taking the keyword chain of keyword 1-keyword 2-keyword 3 as an example for illustration, if the retrieval keyword is keyword 1, the candidate keyword set is {keyword 2, keyword 3}.
[0092] Step B12: Take out 1 keyword, 2 keywords,..., M keywords from the candidate keyword set respectively for combination to obtain a plurality of candidate keyword combinations. M is the number of keywords included in the candidate keyword set.
[0093] Combination means taking out a specified number of keywords from the candidate keyword set without considering the order.
[0094] Taking the candidate keyword set as {keyword 2, keyword 3} as an example for illustration. Then the obtained plurality of candidate keyword combinations are {keyword 2}, {keyword 3}, {keyword 2, keyword 3}.
[0095] Step B13: Add the retrieval keyword to each candidate keyword combination to obtain a plurality of keyword combinations.
[0096] If the plurality of candidate keyword combinations are {keyword 2}, {keyword 3}, {keyword 2, keyword 3}, then the plurality of keyword combinations are {keyword 2, keyword 1}, {keyword 3, keyword 1}, {keyword 2, keyword 3, keyword 1}.
[0097] The second implementation manner of step S24 includes the following steps C11 to C13.
[0098] Step C11: Obtain the connection relationship between each keyword in the keyword chain and the retrieval keyword. The connection relationship between the keyword and the retrieval keyword includes: whether the keyword is directly or indirectly connected to the retrieval keyword, and if the keyword is indirectly connected to the retrieval keyword, the keywords separated between the keyword and the retrieval keyword.
[0099] Step C12: For each keyword in the keyword chain, if the connection relationship between the keyword and the retrieval keyword indicates that the keyword is directly connected to the retrieval keyword, obtain the keyword combination that includes the keyword and the retrieval keyword.
[0100] Step C13: For each keyword in the keyword chain, if the connection relationship between the keyword and the retrieval keyword indicates that the keyword is indirectly connected to the retrieval keyword, and the keyword(s) between the keyword and the retrieval keyword is / are target keyword(s), obtain the keyword combination that includes the keyword, the target keyword(s), and the retrieval keyword.
[0101] Exemplarily, the number of target keywords can be one or more.
[0102] Still taking the keyword chain of keyword 1-keyword 2-keyword 3 as an example for illustration, if the retrieval keyword is keyword 1, since keyword 2 is directly connected to keyword 1, the obtained keyword combination is {keyword 1, keyword 2}; since keyword 3 is indirectly connected to keyword 1, and the target keyword between keyword 3 and keyword 1 is keyword 2, the obtained keyword combination is {keyword 1, keyword 2, keyword 3}.
[0103] It can be understood that by comparing the first implementation manner of step S24 and the second implementation manner of step S24, the keyword combinations obtained by the second implementation manner of step S24 are more accurate. Because in the process of obtaining the keyword combinations by the second implementation manner of step S24, the connection relationships between the keywords are considered, and the connection relationships between the keywords are the habits of the user's input keywords.
[0104] Step S25: Obtain the retrieval results corresponding to the multiple keyword combinations respectively.
[0105] Exemplarily, the retrieval results related to the i-th keyword combination include the knowledge points whose relevance to the i-th keyword combination is higher than or equal to the second threshold. i is a positive integer greater than or equal to 1.
[0106] Exemplarily, a search can be performed in the database based on each keyword combination to obtain the retrieval results.
[0107] The embodiments of the present application do not limit the method for obtaining the retrieval results corresponding to the keyword combinations.
[0108] Step S26: Obtain a search result set from the multiple retrieval results.
[0109] Exemplarily, all the retrieval results can be merged and de-duplicated to obtain the search result set.
[0110] Exemplarily, the first preset number of knowledge points in all retrieval results can be merged and de-duplicated to obtain a search result set.
[0111] Step S27: Send the search result set to the client.
[0112] In the search method provided by this application, a query statement sent by a client is received; a retrieval keyword is obtained from the query statement; and a keyword chain containing the retrieval keyword is found from a pre-constructed association graph. The association graph includes multiple keywords. If any two keywords included in the association graph appear simultaneously in at least one historical query statement, there is an edge between the two keywords, and the weight of the edge connecting the two keywords is the number of historical query statements containing the two keywords. Therefore, the association graph can reflect the association relationship between each keyword, that is, through the association graph, some keywords that the user subconsciously wants to input but actually does not input when the user inputs the retrieval keyword can be obtained. Since the keywords included in the keyword chain are directly or indirectly connected to the retrieval keyword, and the weight of the edge between any two keywords included in the keyword chain is greater than or equal to the first threshold, the keywords included in the keyword chain are some keywords that the user subconsciously wants to input but actually does not input when the user inputs the retrieval keyword. Based on the keyword chain, multiple keyword combinations are obtained. The keyword combination includes the retrieval keyword and at least one keyword other than the retrieval keyword in the keyword chain, and the keywords included in different keyword combinations are not completely the same. The retrieval results corresponding to the multiple keyword combinations are obtained. Compared with the retrieval results obtained only based on the retrieval keyword, the retrieval results obtained based on the keyword combination provided by the embodiment of this application are more accurate. A search result set is obtained from the multiple retrieval results; and the search result set is sent to the client. Since the retrieval results are more accurate, the search result set is more accurate, so that the search result set displayed by the client is very likely to be the knowledge points required by the user.
[0113] In an optional implementation manner, there are multiple implementation manners for step S26. The embodiments of this application provide but are not limited to the following manner, and this implementation manner includes the following steps D11 to D13.
[0114] Step D11: Sort the keywords included in the keyword chain based on the primary sorting rule and the secondary sorting rule to obtain a sorting result. The primary sorting rule refers to sorting in ascending order according to the number of keywords between the keyword and the retrieval keyword, and the secondary sorting rule refers to sorting in descending order according to the weight of the edge directly or indirectly connecting the keyword and the retrieval keyword.
[0115] First, sort according to the primary sorting rule. If, after sorting according to the primary sorting rule, the number of keywords in the same sorting order is multiple, then sort the multiple keywords in the same sorting order according to the secondary sorting rule.
[0116] Suppose the keyword chain is as Figure 4 shown, and the retrieved keyword is keyword 1. The number of keywords between keyword 5 and keyword 2 and the retrieved keyword is 0 respectively, and the number of keywords between keyword 3 and keyword 4 and the retrieved keyword is 1 respectively. Sorting according to the primary sorting rule gives: {keyword 5, keyword 2}, {keyword 3, keyword 4}; there are two keywords in the first sorting order: keyword 5 and keyword 2. Then, sort keyword 5 and keyword 2 according to the secondary sorting rule. Since the weight of the edge between keyword 5 and the retrieved keyword 1 is greater than the weight of the edge between keyword 2 and the retrieved keyword 1, keyword 5 is before keyword 2. There are two keywords in the second sorting order: keyword 3 and keyword 4. Then, it is necessary to sort keyword 3 and keyword 4 according to the secondary sorting rule. Since the weight of the edge between keyword 4 and keyword 2 is greater than the weight of the edge between keyword 3 and keyword 2, keyword 4 is before keyword 3, that is, the sorting result after sorting according to the primary sorting rule and the secondary sorting rule is: keyword 5, keyword 2, keyword 4, keyword 3.
[0117] Step D12: For each of the multiple keyword combinations, determine the maximum order of the keywords included in the keyword combination in the sorting result as the sorting order of the keyword combination.
[0118] As Figure 4 shown, suppose the acquisition process of the keyword combination is the implementation method of the second step S24, then the multiple keyword combinations are: {keyword 1, keyword 2}, {keyword 1, keyword 2, keyword 4}, {keyword 1, keyword 2, keyword 3}, {keyword 1, keyword 5}.
[0119] If the maximum order of the keywords included in the keyword combination {keyword1, keyword2} in the sorting result is the sorting order corresponding to keyword2, i.e., the second sorting order, then the keyword combination is in the second sorting order; if the maximum order of the keywords included in the keyword combination {keyword1, keyword2, keyword4} in the sorting result is the sorting order corresponding to keyword4, i.e., the third sorting order, then the keyword combination is in the third sorting order; if the maximum order of the keywords included in the keyword combination {keyword1, keyword2, keyword3} in the sorting result is the sorting order corresponding to keyword3, i.e., the fourth sorting order, then the keyword combination is in the fourth sorting order; if the maximum order of the keywords included in the keyword combination {keyword1, keyword5} in the sorting result is the sorting order corresponding to keyword5, i.e., the first sorting order, then the keyword combination is in the first sorting order.
[0120] In summary, the sorting order of the above 4 keyword combinations is as follows: {keyword1, keyword5}, {keyword1, keyword2}, {keyword1, keyword2, keyword4}, {keyword1, keyword2, keyword3}.
[0121] Step D13: For each of the keyword combinations, store the first set number of target knowledge points in the retrieval result corresponding to the keyword combination at the position corresponding to the target sorting order in the search result set, where the target sorting order is the sorting order of the keyword combination, to obtain the search result set.
[0122] It can be understood that the higher the sorting position of the keyword combination, the more it indicates that this keyword combination is the most commonly used combination by the user, that is, the keywords included in the keyword combination are the keywords that the user most wants to input subconsciously but actually does not input when entering the retrieval keywords. Therefore, the higher the sorting position of the keyword combination, the more accurate the retrieval result obtained. Therefore, it is necessary to combine the retrieval results corresponding to the keyword combinations according to the sorting order of the keyword combinations.
[0123] Exemplarily, the set numbers corresponding to different keyword combinations are the same.
[0124] Exemplarily, the set numbers corresponding to different keyword combinations are different. Exemplarily, the set numbers corresponding to different keyword combinations can be set randomly.
[0125] Exemplarily, the step of "storing the top set number of target knowledge points in the retrieval results corresponding to the keyword combination to the position corresponding to the target sorting order in the search result set" in step D13 includes: finding the set number corresponding to the target sorting order from the pre-set corresponding relationship between the sorting order and the set number; obtaining the top set number of target knowledge points corresponding to the target sorting order from the keyword combination; and storing each target knowledge point to the position corresponding to the target sorting order in the search result set.
[0126] Exemplarily, since the higher the sorting position of the keyword combination, the more accurate the obtained retrieval result, the larger the set number corresponding to the keyword combination with a higher sorting order. That is, the set number and the sorting order in the pre-set corresponding relationship between the sorting order and the set number are negatively correlated.
[0127] In the above embodiments disclosed in the present application, the method is described in detail. The method of the present application can be implemented by various forms of devices. Therefore, the present application also discloses a device, and specific embodiments are given below for detailed description.
[0128] As Figure 5 shown, it is a structural diagram of a search device provided by an embodiment of the present application. The search device includes: a receiving module 51, a first obtaining module 52, a searching module 53, a second obtaining module 54, a third obtaining module 55, a fourth obtaining module 56, and a sending module 57, where:
[0129] The receiving module 51 is configured to receive a query statement sent by a client;
[0130] The first obtaining module 52 is configured to obtain retrieval keywords from the query statement;
[0131] The searching module 53 is configured to search for a keyword chain including the retrieval keywords from a pre-constructed association graph. The association graph includes multiple keywords. If any two keywords included in the association graph appear in at least one historical query statement at the same time, there is an edge between the two keywords, and the weight of the edge connecting the two keywords is the number of historical query statements including the two keywords; the keywords included in the keyword chain are directly or indirectly connected to the retrieval keywords, and the weight of the edge between any two keywords included in the keyword chain is greater than or equal to a first threshold;
[0132] The second obtaining module 54 is configured to obtain multiple keyword combinations based on the keyword chain. The keyword combination includes the retrieval keywords and at least one keyword other than the retrieval keywords in the keyword chain, and the keywords included in different keyword combinations are not completely the same;
[0133] A third acquisition module 55, configured to obtain retrieval results respectively corresponding to the multiple keyword combinations;
[0134] A fourth acquisition module 56, configured to obtain a search result set from the multiple retrieval results;
[0135] A sending module 57, configured to send the search result set to the client.
[0136] In an optional implementation manner, the fourth acquisition module includes:
[0137] A sorting unit, configured to sort the keywords included in the keyword chain based on a primary sorting rule and a secondary sorting rule to obtain a sorting result, where the primary sorting rule is to sort in ascending order according to the number of keywords between the keyword and the retrieval keyword, and the secondary sorting rule is to sort in descending order according to the weight of the edge directly or indirectly connected between the keyword and the retrieval keyword;
[0138] A determining unit, configured to, for each keyword combination among the multiple keyword combinations, determine the maximum order of the keywords included in the keyword combination in the sorting result as the sorting order of the keyword combination;
[0139] A storage unit, configured to, for each keyword combination, store the first set number of target knowledge points in the retrieval result corresponding to the keyword combination at the position corresponding to the target sorting order in the search result set, where the target sorting order is the sorting order of the keyword combination, to obtain the search result set.
[0140] In an optional implementation manner, the storage unit includes:
[0141] A searching subunit, configured to search for the set number corresponding to the target sorting order from a pre-set correspondence between the sorting order and the set number;
[0142] An obtaining subunit, configured to obtain the first set number of target knowledge points corresponding to the target sorting order from the keyword combination;
[0143] A storing subunit, configured to store each target knowledge point at the position corresponding to the target sorting order in the search result set.
[0144] In an optional implementation manner, the set number in the pre-set correspondence between the sorting order and the set number is negatively correlated with the sorting order.
[0145] In an optional implementation manner, the second acquisition module includes:
[0146] A first acquisition unit, configured to obtain the connection relationships between each keyword in the keyword chain and the retrieval keyword, where the connection relationship between the keyword and the retrieval keyword includes: whether the keyword is directly or indirectly connected to the retrieval keyword, and if the keyword is indirectly connected to the retrieval keyword, the keywords intervening between the keyword and the retrieval keyword;
[0147] A second acquisition unit, configured to, for each keyword in the keyword chain, if the connection relationship between the keyword and the retrieval keyword indicates that the keyword is directly connected to the retrieval keyword, obtain the keyword combination including the keyword and the retrieval keyword;
[0148] A third acquisition unit, configured to, for each keyword in the keyword chain, if the connection relationship between the keyword and the retrieval keyword indicates that the keyword is indirectly connected to the retrieval keyword and the keyword intervening between the keyword and the retrieval keyword is a target keyword, obtain the keyword combination including the keyword, the target keyword, and the retrieval keyword.
[0149] Regarding the device in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated herein.
[0150] Figure 6 is a block diagram of a device for a server shown according to an exemplary embodiment.
[0151] The server includes but is not limited to: a processor 61, a memory 62, a network interface 63, an I / O controller 64, and a communication bus 65.
[0152] It should be noted that those skilled in the art can understand that Figure 6 the structure of the server shown in Figure 6 does not constitute a limitation on the server, and the server may include more or fewer components than
[0153] shown, or combine certain components, or have different component arrangements. Figure 6 The following specifically introduces each component of the server in combination with
[0154] The processor 61 is the control center of the server, connecting various parts of the entire server through various interfaces and lines. By running or executing software programs and / or modules stored in the memory 62, and invoking the data stored in the memory 62, it executes various functions of the server and processes data, thereby monitoring the server as a whole. The processor 61 may include one or more processing units; for example, the processor 61 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor may not be integrated into the processor 61 either.
[0155] The processor 61 may be a central processing unit (CPU), or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present invention, etc.;
[0156] The memory 62 may include internal memory, such as a high-speed random access memory (RAM) 621 and a read-only memory (ROM) 622, and may also include a large-capacity storage device 623, such as at least one disk memory, etc. Of course, the server may also include other hardware required for other services.
[0157] Among them, the above-mentioned memory 62 is used to store executable instructions of the above-mentioned processor 61. The above-mentioned processor 61 has the following functions: receiving a query statement sent by a client;
[0158] obtaining a retrieval keyword from the query statement;
[0159] searching, from a pre-constructed association graph, for a keyword chain containing the retrieval keyword. The association graph includes multiple keywords. If any two keywords included in the association graph appear simultaneously in at least one historical query statement, there is an edge between the two keywords, and the weight of the edge connecting the two keywords is the number of historical query statements containing the two keywords; the keywords included in the keyword chain are directly or indirectly connected to the retrieval keyword, and the weight of the edge between any two keywords included in the keyword chain is greater than or equal to a first threshold;
[0160] obtaining multiple keyword combinations based on the keyword chain. The keyword combinations include the retrieval keyword and at least one keyword other than the retrieval keyword in the keyword chain, and the keywords included in different keyword combinations are not exactly the same;
[0161] Obtain the retrieval results corresponding to the multiple keyword combinations respectively;
[0162] Obtain a search result set from the multiple retrieval results;
[0163] Send the search result set to the client.
[0164] A wired or wireless network interface 63 is configured to connect the server to the network.
[0165] The processor 61, the memory 62, the network interface 63, and the I / O controller 64 can be interconnected through a communication bus 65, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc.
[0166] In an exemplary embodiment, the server can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components, and is used to execute the search method between the above knowledge points.
[0167] In an exemplary embodiment, the present disclosure provides a storage medium including instructions, such as the memory 62 including instructions, and the above instructions can be executed by the processor 61 of the server to complete the above method. Optionally, the storage medium can be a non-transitory computer-readable storage medium. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0168] In an exemplary embodiment, there is also provided a computer-readable storage medium that can be directly loaded into the internal memory of a computer, such as the above memory 62, and contains software code. After being loaded and executed by the computer, the computer program can implement the steps shown in any embodiment of the above search method.
[0169] In an exemplary embodiment, a computer program product is further provided, which can be directly loaded into the internal memory of a computer, such as the memory included in the server, and contains software code. After being loaded and executed by the computer, the computer program can implement the steps shown in any of the above-described search method embodiments.
[0170] It should be noted that the search method, device, server, medium, and product provided by the present invention can be used in the financial field or other fields. For example, it can be used in the retrieval application scenarios in the financial field. The other fields are any fields other than the financial field. For example, it can be used in the retrieval application scenarios in the power field. The above are only examples and do not limit the application fields of the search method, device, server, medium, and product provided by the present invention.
[0171] It should be noted that the features described in the respective embodiments in this specification can be replaced or combined with each other. For device or system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiments.
[0172] It should also be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element.
[0173] The steps of the method or algorithm described in combination with the embodiments disclosed in this article can be directly implemented by hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the technical field.
[0174] The foregoing description of the disclosed embodiments enables those skilled in the art to practice or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A search method, characterized in that, it includes: Receiving a query statement sent by a client; Obtaining a retrieval keyword from the query statement; Searching, from a pre-constructed association graph, for a keyword chain that includes the retrieval keyword, where the association graph includes multiple keywords, and for any two keywords included in the association graph, if they appear simultaneously in at least one historical query statement, there is an edge between the two keywords, and the weight of the edge connecting the two keywords is the number of historical query statements that include the two keywords; the keywords included in the keyword chain are directly or indirectly connected to the retrieval keyword, and the weight of the edge between any two keywords included in the keyword chain is greater than or equal to a first threshold; Based on the keyword chain, obtaining multiple keyword combinations, where the keyword combinations include the retrieval keyword and at least one keyword other than the retrieval keyword in the keyword chain, and the keywords included in different keyword combinations are not exactly the same; Obtaining retrieval results corresponding to the multiple keyword combinations respectively; Obtaining a search result set from the multiple retrieval results; Sending the search result set to the client; The step of obtaining a search result set from the multiple retrieval results includes: Sorting the keywords included in the keyword chain based on a primary sorting rule and a secondary sorting rule to obtain a sorting result, where the primary sorting rule is to sort in ascending order according to the number of keywords between a keyword and the retrieval keyword, and the secondary sorting rule is to sort in descending order according to the weight of the edge directly or indirectly connecting a keyword and the retrieval keyword; For each keyword combination among the multiple keyword combinations, determining the maximum order of the keywords included in the keyword combination in the sorting result as the sorting order of the keyword combination; For each keyword combination, storing the first set number of target knowledge points in the retrieval result corresponding to the keyword combination at the position corresponding to the target sorting order in the search result set, where the target sorting order is the sorting order of the keyword combination, to obtain the search result set.
2. The search method according to claim 1, characterized in that, The step of storing the first set number of target knowledge points in the retrieval result corresponding to the keyword combination at the position corresponding to the target sorting order in the search result set includes: Searching for the set number corresponding to the target sorting order from a pre-set correspondence between the sorting order and the set number; Obtaining the first set number of target knowledge points corresponding to the target sorting order from the keyword combination; Storing each target knowledge point at the position corresponding to the target sorting order in the search result set.
3. The search method according to claim 2, characterized in that, In the pre-set correspondence between the sorting order and the set number, the sorting order and the set number are negatively correlated.
4. The search method according to any one of claims 1 to 3, characterized in that, The step of obtaining multiple keyword combinations based on the keyword chain includes: Obtain the connection relationships between each keyword in the keyword chain and the retrieval keyword. The connection relationship between the keyword and the retrieval keyword includes: whether the keyword is directly or indirectly connected to the retrieval keyword. If the keyword is indirectly connected to the retrieval keyword, the keywords intervening between the keyword and the retrieval keyword. For each keyword in the keyword chain, if the connection relationship between the keyword and the retrieval keyword indicates that the keyword is directly connected to the retrieval keyword, obtain the keyword combination including the keyword and the retrieval keyword. For each keyword in the keyword chain, if the connection relationship between the keyword and the retrieval keyword indicates that the keyword is indirectly connected to the retrieval keyword, and the keyword intervening between the keyword and the retrieval keyword is the target keyword, obtain the keyword combination including the keyword, the target keyword, and the retrieval keyword.
5. A search device Characterized in that Comprising: A receiving module, configured to receive a query statement sent by a client; A first obtaining module, configured to obtain a retrieval keyword from the query statement; A searching module, configured to search, from a pre-constructed association graph, for a keyword chain including the retrieval keyword. The association graph includes multiple keywords. If any two keywords included in the association graph appear simultaneously in at least one historical query statement, there is an edge between the two keywords, and the weight of the edge connecting the two keywords is the number of historical query statements including the two keywords; the keywords included in the keyword chain are directly or indirectly connected to the retrieval keyword, and the weight of the edge between any two keywords included in the keyword chain is greater than or equal to a first threshold; A second obtaining module, configured to obtain, based on the keyword chain, multiple keyword combinations. The keyword combination includes the retrieval keyword and at least one keyword other than the retrieval keyword in the keyword chain, and the keywords included in different keyword combinations are not completely the same; A third obtaining module, configured to obtain the retrieval results corresponding to the multiple keyword combinations respectively; A fourth obtaining module, configured to obtain a search result set from the multiple retrieval results; A sending module, configured to send the search result set to the client; The fourth obtaining module includes: A sorting unit, configured to sort the keywords included in the keyword chain based on a primary sorting rule and a secondary sorting rule to obtain a sorting result. The primary sorting rule is to sort in ascending order according to the number of keywords intervening between the keyword and the retrieval keyword, and the secondary sorting rule is to sort in descending order according to the weight of the edge directly or indirectly connecting the keyword and the retrieval keyword; A determining unit, configured to, for each keyword combination in the multiple keyword combinations, determine the maximum order of the keywords included in the keyword combination in the sorting result as the sorting order of the keyword combination. A storage unit, for each of the keyword combinations, stores the top set number of target knowledge points in the retrieval results corresponding to the keyword combination at the position corresponding to the target sorting order in the search result set, where the target sorting order is the sorting order of the keyword combination, so as to obtain the search result set.
6. A server, characterized in that, comprising: a processor; a memory for storing executable instructions of the processor; wherein, the processor is configured to execute the instructions to implement the search method according to any one of claims 1 to 4.
7. A computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a server, enables the server to execute the search method according to any one of claims 1 to 4.
8. A computer program product, which can be directly loaded into the internal memory of a computer, the memory is the memory included in the server according to claim 6 above, and contains software code, and the computer program can implement the search method according to any one of claims 1 to 4 after being loaded and executed by the computer.
Citation Information
Patent Citations
Search push method and device for mining user demands
CN104063454A
Searching method and device
CN106294618A