A keyword prompting method, device, computer equipment and storage medium
By building an order tree in search engines, the problem of how to reduce storage space and cover long-tail keywords while meeting real-time requirements is solved, and a fast, real-time and efficient keyword prompt service is achieved. .
Patent Information
- Application Number
- CN202011134797.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-21
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2040-10-21
AI Technical Summary
In the pull-down prompt for keywords, how to reduce the storage space for keyword error correction while meeting real-time requirements and cover the problem of long-tail keywords.
By building an ordered tree, nodes represent characters and associated keywords for search, receive the client's current search character, search for characters identical or similar to the character, form the target string, and query the prefixed string Keywords, extract some candidate keywords as target keywords and send them to the client.
It realizes a fast search service, which can prompt the target keyword before the user enters the next character, reduces the storage requirement for user error input, covers long-tail keywords, and ensures real-time push.
Smart Images

Figure CN112364126B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of search, and in particular to a keyword prompting method, device, computer equipment and storage medium. Background Art
[0002] In scenarios such as short videos, news, and shopping, users usually enter keywords to search for related information. At this time, the search engine usually provides a drop-down prompt (Query suggestion) for keywords, that is, based on the keywords currently entered by the user, a candidate list of keywords is automatically provided for the user to choose from, helping the user to clarify the search intention, simplifying the user's input operation and saving search time.
[0003] In order to meet the real-time requirements, the keyword drop-down prompt often pre-builds a list of popular keywords under each prefix. When the characters requested by the user arrive, the popular keywords corresponding to the characters input by the user are directly returned.
[0004] However, in order to correct the keywords input by users, it is often necessary to pre-store possible wrong input forms of users, which consumes a huge storage space. At the same time, some long tail keywords do not have wrong input forms set, resulting in the inability to correct errors. Summary of the invention
[0005] The embodiment of the present invention proposes a keyword prompting method, device, computer equipment and storage medium to solve the problem of how to reduce the storage space occupied by keyword error correction and cover long-tail keywords when the drop-down prompt of the keyword meets the real-time requirements.
[0006] In a first aspect, an embodiment of the present invention provides a keyword prompting method, comprising:
[0007] Determine an ordered tree, wherein nodes in the ordered tree represent characters and are associated with keywords for search, wherein the keywords are prefixed with characters between a root node and the node;
[0008] Receive the characters currently used for searching sent by the client as the original string;
[0009] Searching the ordered tree for characters identical to and / or similar to the original character string to form a target character string;
[0010] Searching the ordered tree for keywords prefixed with the target character string as candidate keywords;
[0011] extracting some of the candidate keywords as target keywords;
[0012] The target keyword is sent to the client for display.
[0013] In a second aspect, an embodiment of the present invention further provides a keyword prompting device, comprising:
[0014] An ordered tree determination module, used to determine an ordered tree, wherein nodes in the ordered tree represent characters and are associated with keywords for search, wherein the keywords are prefixed with characters between a root node and the node;
[0015] The original string receiving module is used to receive the characters currently used for searching sent by the client as the original string;
[0016] A target string search module, used for searching the ordered tree for characters identical and / or similar to the original string to form a target string;
[0017] A candidate keyword query module, used to query the ordered tree for keywords prefixed with the target character string as candidate keywords;
[0018] A target keyword extraction module, used to extract some of the candidate keywords as target keywords;
[0019] The target keyword push module is used to send the target keyword to the client for display.
[0020] In a third aspect, an embodiment of the present invention further provides a computer device, the computer device comprising:
[0021] one or more processors;
[0022] a memory for storing one or more programs,
[0023] When the one or more programs are executed by the one or more processors, the one or more processors implement the keyword prompting method as described in the first aspect.
[0024] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the keyword prompting method as described by the first party is implemented.
[0025] In this embodiment, an ordered tree is determined, and the nodes in the ordered tree represent characters and associated keywords for search. The keywords are prefixed with characters from the root node to the node. The characters currently used for search sent by the client are received as the original string. The ordered tree is searched for characters identical and / or similar to the original string to form a target string. The ordered tree is queried for keywords prefixed with the target string as candidate keywords, and some candidate keywords are extracted as target keywords. The target keywords are sent to the client for display. On the one hand, the ordered tree carries the characters of the keywords, and the original string requested by the user can be quickly matched. The ordered tree provides a fast search service, can quickly locate the target string, can ensure the real-time nature of the push, and the average response speed can be within 5ms. The target keyword can be prompted before the user enters the next character. On the other hand, the target string similar to the original string is searched in the ordered tree and pushed to the client, and the user's erroneous input can be corrected. The target string is composed of the characters of the keyword and has been recorded in the ordered tree. There is no need to store the form of the user's erroneous input in advance, which reduces the storage space occupied. At the same time, some long-tail keywords can be covered and corrected. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 A flowchart of a keyword prompting method provided in Embodiment 1 of the present invention;
[0027] Figure 2 An example diagram of an ordered tree provided in Embodiment 1 of the present invention;
[0028] Figure 3 is a flow chart of a keyword prompting method provided by Embodiment 2 of the present invention;
[0029] Figure 4 This is an example diagram of displaying keywords provided by the second embodiment of the present invention;
[0030] Figure 5 A schematic diagram of the structure of a keyword prompting device provided in Embodiment 3 of the present invention;
[0031] Figure 6 A schematic diagram of the structure of a computer device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0032] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0033] Embodiment 1
[0034] Figure 1 This is a flowchart of a keyword prompting method provided in Embodiment 1 of the present invention. This embodiment is applicable to the case where an ordered tree is generated for keywords. The method can be executed by a keyword prompting device. The keyword prompting device can be implemented by software and / or hardware and can be configured in a computer device, such as a server, a workstation, a personal computer, etc., and specifically includes the following steps:
[0035] Step 101: Obtain keywords for searching.
[0036] Currently, users can access search engines from a variety of electronic devices, which may include mobile devices such as mobile phones, PDAs (Personal Digital Assistants), laptop computers, PDAs, smart wearable devices (such as smart watches, smart glasses), etc., and may also include fixed devices such as personal computers, smart TVs, etc.
[0037] These electronic devices can support operating systems including Android, IOS, Windows, etc., and can usually run browsers that access web pages through the Internet or applications with built-in browsing components (such as WebView), for example, short video applications, live broadcast applications, shopping applications, blog applications, etc.
[0038] In one case, a user may open a web page where the search engine is located in a browser or an application with a built-in browsing component. The web page usually includes a search box, in which the user may enter keywords and request the search engine to search for business information related to the keywords (such as web pages, short videos, anchors, live broadcasts, blogs, etc.).
[0039] In another case, a search plug-in is installed in the browser or the application of the built-in browsing component. The search plug-in can interact with the search engine to add a search function to the browser or the application of the built-in browsing component. The search plug-in provides a search box in which the user can enter keywords and request the search engine to search for business information related to the keyword (such as web pages, short videos, anchors, live programs, blogs, etc.).
[0040] Among them, search engines rely on web crawler technology, retrieval and ranking technology, web page processing technology, big data processing technology, natural language processing technology and other technologies to provide users with fast and highly relevant information search services, that is, searching for relevant business information from the Internet and feeding it back to users.
[0041] Some search engines are comprehensive and horizontal searches. While they satisfy the large amount of search information, they find it difficult to balance the quality of search accuracy and relevance, and it is difficult to meet the pursuit of precise personalized and professional search needs.
[0042] Therefore, some search engines are vertical searches, that is, professional search engines targeting a certain business field, such as searching for short videos, live broadcasts, product information, etc. Vertical search is a subdivision and extension of search engines. It integrates a certain type of special information in the web page library, extracts relevant business information in a targeted manner, and returns it to users.
[0043] In this embodiment, relevant information generated when a user requests a search engine to search may be recorded in a log file, thereby extracting keywords from log files of different users.
[0044] It should be noted that the keyword may include words, phrases, symbols, audio data, etc. in various languages, and this embodiment does not limit this.
[0045] Step 102: Determine a node representing a character in the ordered tree.
[0046] A keyword contains one or more characters, which are the smallest components of the keyword. For example, for English, the characters are letters "a"-"z", "A"-"Z", for Arabic, the characters are "0"-"9", for Chinese, the characters can be a single Chinese character, and so on.
[0047] To apply this embodiment, an ordered tree can be generated for the keyword. The ordered tree has multiple nodes, and the edges between the nodes are directed edges. The nodes in the ordered tree are used to carry each character in the keyword according to the directed edges, that is, a node in the ordered tree is used to represent a character of the keyword, and the directed edges of the node represent the order of the characters.
[0048] Generally speaking, in an ordered tree, there is only one node that is the root node. The root node does not represent a character, and there is no directed edge pointing to the node. Any node except the root node can be used to represent a character, and there is only one directed edge pointing to this node, that is, there is a directed path from the root node to any non-root node.
[0049] In different business scenarios, ordered trees are implemented in different ways. To enable those skilled in the art to better understand the embodiments of the present invention, in this specification, a Tire tree (also known as a prefix tree or a dictionary tree) is described as an example of an ordered tree.
[0050] Trie tree is an index structure, which is actually a deterministic finite automaton (DFA). In the structure of Trie tree, each node corresponds to a DFA state, and each marked edge from the parent node to the child node (directed) corresponds to a DFA transition.
[0051] In a specific implementation, each character in the keyword is extracted in sequence, and the node representing the character is searched for in the order of directed edges starting from the root node.
[0052] If the character is found, continue to the next character. If not found, insert a node representing the character under the current node, generate a directed edge from the current node to the node, and continue to the next character until all characters of the keyword are traversed.
[0053] Step 103: Associate the keyword with the node.
[0054] In this embodiment, each node is located in a heap structure. If the characters of the keyword match a node (i.e., the content is the same and the order is the same), the keyword can be recorded in the heap structure of the node, so that the nodes in the ordered tree can not only represent characters but also be associated with keywords for search, and the keyword is prefixed with the characters between the root node and the node.
[0055] For example, Figure 2 As shown, assuming that a certain keyword is "news", you can start from the root node (R), search for the node representing "n" along the direction indicated by the root node (R), and when the node representing "n" is found, associate "news" with the heap structure of the node representing "n", search for the node representing "e" along the direction indicated by the node representing "n", and when the node representing "e" is found, associate "news" with the heap structure of the node representing "e", search for the node representing "w" along the direction indicated by the node representing "e", and when the node representing "w" is found, associate "news" with the heap structure of the node representing "w", search for the node representing "s" along the direction indicated by the node representing "w", and when the node representing "s" is not found, generate a node representing "s", point to the node representing "s" along the node representing "w", and associate "news" with the heap structure of the node representing "s".
[0056] In one embodiment of the present invention, step 103 may include the following steps:
[0057] Step 1031, query the channel used when searching for the recalled keyword as the recall channel.
[0058] The channel used by the client to search for a keyword in the log file is queried. For easy distinction, this channel can be called a recall channel.
[0059] Among them, a channel is an abstraction of one or more features in the process of recalling keywords.
[0060] In one example, the channel may include the geographical location of the client. In this example, the geographical location from which the keyword is searched may be queried as the recall channel.
[0061] Among them, the geographic location can be divided into granularities according to the needs of the business scenario, which can include country or region, province, city, town, etc. For example, if the application serves users of different languages, the geographic location can be divided by language as a dimension, so that users in the same geographic location use the same language. Since keywords are likely to have different search intents for different languages, using geographic location as a recall channel can distinguish different search intents, thereby improving the accuracy of subsequent keyword push.
[0062] Of course, the above recall channels are only used as examples. When implementing the embodiments of the present invention, other recall channels can be set according to actual conditions, such as the version of the client, the system platform where the client is located, the ISP (Internet Service Provider) connected by the client, etc., and the embodiments of the present invention do not limit this. In addition, in addition to the above judgment and processing methods, those skilled in the art can also adopt other judgment and processing methods according to actual needs, and the embodiments of the present invention do not limit this.
[0063] Step 1032: Using the recall channel as a statistical dimension, statistics are collected on user behaviors in response to keyword feedback to obtain search indicators.
[0064] If the search engine finds business information related to the keyword, the business information is sent to the client as the search result for display, and the user can trigger corresponding user behavior on the client with respect to the business information.
[0065] In this embodiment, for keywords with the same recall channel, one or more user behaviors fed back by the client for the keyword in the recall channel may be counted, and the value itself or the fused value may be set as the search index.
[0066] Generally speaking, the user behaviors counted in this embodiment express positive behaviors. For example, geographic location can be used as a statistical dimension, and the number of business information corresponding to clicks on keywords (i.e., click volume) can be counted as a search indicator. The operation of counting click volume is relatively simple, which can save computing resources. In addition, the click volume can more comprehensively express the quality of business information searched for the keyword in the search engine. If subsequent users use the pushed keywords to search, they can quickly locate high-quality business information.
[0067] Of course, the above search indexes are only examples. When implementing the embodiments of the present invention, other search indexes may be set according to actual conditions, such as browsing time, frequency of searching the keyword, conversion rate, etc., and the embodiments of the present invention do not limit this. In addition, in addition to the above search indexes, those skilled in the art may also use other search indexes according to actual needs, and the embodiments of the present invention do not limit this.
[0068] Step 1033: insert the keyword into the recall channel under the node.
[0069] like Figure 2 As shown, in the ordered tree, the heap structure of the non-root node includes a recall channel (such as channel A, channel B, etc.), and the keyword is inserted into the corresponding recall channel of the current node.
[0070] Step 1034: Under the recall channel, apply the m keywords with the highest search indexes.
[0071] like Figure 2 As shown, the keywords of each recall channel in the node are sorted according to the search index, and the m (m is a positive integer) keywords with the highest search index are taken into effect, so that the m (m is a positive integer) keywords with the highest search index are applied to the process of pushing to the client, and other keywords are retained in the heap structure of the node, but are not deleted, but are not applied to the process of pushing to the client.
[0072] In this embodiment, the recall channel is used as a statistical dimension to count user behaviors in response to keyword feedback, obtain search indices, and insert keywords into the recall channel under the node. In the recall channel, the m keywords with the highest search indices are applied to ensure the search quality of the keywords in the recall channel, thereby increasing the probability of the keyword being selected by the user when it is pushed, and reducing the operating cost of the user entering keywords for search.
[0073] Embodiment 2
[0074] Figure 3 This is a flowchart of a keyword prompting method provided in the second embodiment of the present invention. This embodiment is applicable to the case where ordered tree fuzzy search for keywords is applied, and specifically includes the following steps:
[0075] Step 301: Determine an ordered tree.
[0076] In this embodiment, an ordered tree, such as a Trie tree, may be generated offline, and the ordered tree may be loaded when keywords are pushed to the client online.
[0077] The nodes in the ordered tree represent characters and associated keywords for search, and the keywords are prefixed with the characters between the root node and the node.
[0078] Step 302: Receive the characters currently used for searching sent by the client as the original character string.
[0079] A search bar is provided in the pages of clients such as browsers and applications with built-in browsing components. The user moves the cursor into the search bar through mouse, touch, etc., and then calls the input method to enter characters in the search bar. When the user confirms the search, the client sends the characters as keywords to the search engine.
[0080] When the user is inputting characters, the client detects the characters in the search bar in real time. If the characters change, such as adding characters, deleting characters, modifying characters, etc., the characters in the current search bar can be uploaded. For easy distinction, the characters can be called the original string.
[0081] For example, Figure 4 As shown, if the user enters "new" in the search bar in sequence, the client can upload "n", "ne", and "new" in sequence.
[0082] Step 303: Search the ordered tree for characters that are identical and / or similar to the original character string to form a target character string.
[0083] To support fuzzy search, each node in the ordered tree can be traversed in the order of directed edges to search for characters that are identical and / or similar to the original string, and these searched characters can form the target string.
[0084] The traversal starts from the root node, from head to tail, and the next state is determined by each character of the original string. The edges marked with the same character are selected for movement. Each such movement consumes a character from the original string and moves to the next node of the ordered tree until each character of the original string is traversed.
[0085] If the node representing a character in the original string does not exist, you can traverse the adjacent branches to find similar characters.
[0086] In one embodiment of the present invention, step 303 may include the following steps:
[0087] Step 3031: In the ordered tree, determine the next node pointed to by the current node.
[0088] Step 3032: Match the next node with the original string.
[0089] In this embodiment, a finite state automaton, such as LA (Levenshtein Automata, LA, edit distance automaton), may be created, and two parameters are maintained in advance, one is a state set, and the other is a state transition matrix.
[0090] The state set includes a matchable state and a non-matching state. The matchable state may indicate continuing to wander in the ordered tree, and the non-matching state may indicate stopping wandering in the ordered tree.
[0091] The state transition matrix describes how a state can jump to another state through a certain character.
[0092] For an ordered tree, all possible state sets and all possible jumps of each state can be traversed in advance and stored in the state transition matrix.
[0093] When traversing the ordered tree for the original string, each node of the ordered tree is input into a finite state automaton (such as LA) to jump to the next node, the characters from the root node to the next node are combined into a candidate string, and the edit distance between the original string and the candidate string is calculated.
[0094] The edit distance may refer to the minimum number of changes (such as insertion, deletion, substitution, etc.) required to transform a candidate string into the original string.
[0095] For example, if the candidate string is "abcd" and the original string is "acdf", then delete "b" from "abcd" to get "acd", and insert "f" into "acd" to get "acdf", so the edit distance between "abcd" and "acdf" is 2.
[0096] Generally, to improve the accuracy of matching, the edit distance between the original string currently being matched and the candidate string at the same number of digits can be calculated. For example, if the original string is "acdf", "acd" is currently being matched, and the candidate string is "abc", the edit distance between "acd" and "abc" can be calculated.
[0097] If the edit distance is less than or equal to the preset threshold, it is determined that the next node matches the original string successfully.
[0098] If the edit distance is greater than a preset threshold, it is determined that the next node fails to match the original string.
[0099] Of course, the above matching method is only used as an example. When implementing the embodiment of the present invention, other matching methods can be set according to actual conditions, for example, the Hamming distance between the original string and the candidate string is calculated. When the Hamming distance is less than or equal to a preset threshold, it is determined that the next node matches the original string successfully, otherwise, it is determined that the next node fails to match the original string; or, the cosine value between the word vector of the original string and the word vector of the candidate string is calculated. When the cosine value is greater than or equal to a preset threshold, it is determined that the next node matches the original string successfully, otherwise, it is determined that the next node fails to match the original string, etc., and the embodiment of the present invention does not limit this. In addition, in addition to the above matching methods, those skilled in the art can also adopt other matching methods according to actual needs, and the embodiment of the present invention does not limit this.
[0100] Step 3033: If the match is successful, jump from the current node to the next node and return to execute step 3031.
[0101] If the finite state automaton (such as LA) determines that the next node is successfully matched with the original string and outputs the state of the next node as a matchable state, the search can continue.
[0102] Step 3034: If the match fails, determine that the characters between the root node and the current node are identical and / or similar to the original string and use them as the target string.
[0103] If the finite state automaton (such as LA) determines that the next node fails to match the original string and outputs the state of the next node as a non-matching state, the search can be stopped and the current character is output as the target string.
[0104] The process of walking in the ordered tree is a fuzzy search, so the original string entered by the user can be corrected.
[0105] For example, assuming the distance threshold is 1, and the original string input by the user is "nes", Figure 2 By walking in the ordered tree shown in the figure, the candidate string "new" is searched out. Since the edit distance between "new" and "nes" is 1, that is, the edit distance is equal to the distance threshold, the candidate string "new" can be identified as the target string.
[0106] Step 304: Search the ordered tree for keywords prefixed with the target character string as candidate keywords.
[0107] The associated keyword is searched in the heap structure of the node that successfully matches the ordered tree. The keyword is prefixed with the target string. For easy distinction, the keyword can be called a candidate keyword.
[0108] In one embodiment of the present invention, if keywords are distinguished by recall channels, the last character in the target character string can be searched as the target character, and in the heap structure of the target character, keywords in all recall channels associated with the target character are extracted as candidate keywords.
[0109] Among them, extracting keywords of all recall channels can avoid the situation that a certain recall channel does not have keywords and does not return keywords, thereby ensuring the number of keywords.
[0110] Step 305: extract some candidate keywords as target keywords.
[0111] Since there are a large number of candidate keywords and the area displayed on the client is limited, when pushing keywords to the client, different recall strategies can be used to recall some keywords from the candidate keywords as target keywords according to different business needs (such as recalling high-quality keywords, recalling keywords that meet the user's personalized needs, etc.).
[0112] In specific implementations, the recall strategy includes but is not limited to:
[0113] Subscription recall (recall keywords related to the columns subscribed by the user (such as a game, restaurant, etc.)), same-geographic location recall (recall keywords with the same geographic location as the user), same-language recall (recall keywords with the same language as the user), collaborative filtering recall (recall keywords using collaborative filtering algorithms), and preference recall (recall keywords with the same preferences as the user).
[0114] In one embodiment of the present invention, step 305 includes the following steps:
[0115] Step 3051: Determine the similarity between the original character string and the candidate keyword.
[0116] In this embodiment, the similarity between the original string and the candidate keyword can be directly calculated by Hamming distance, edit distance, etc., or the similarity between the original string and the candidate string to which the candidate keyword belongs can be reused to save computing resources, which is not limited in this embodiment.
[0117] In a specific implementation, the candidate character string to which the candidate keyword belongs is queried, the edit distance between the candidate character string and the original character string is queried, and the edit distance is set as the similarity between the original character string and the candidate keyword.
[0118] Step 3052: Calculate a quality value for the candidate character string based at least on the similarity.
[0119] In this embodiment, similarity may be used as a calculation parameter to calculate a quality value of the candidate character string, and the quality value indicates the quality of the candidate character string for the search.
[0120] Generally speaking, the quality value is positively correlated with the similarity, that is, the higher the similarity, the greater the quality value, and conversely, the lower the similarity, the smaller the quality value.
[0121] In one example, similarity is represented by edit distance, and a quality value can be calculated for the candidate character string based at least on the similarity, wherein the quality value is negatively correlated with the edit distance, that is, the smaller the edit distance, the higher the similarity and the larger the quality value; conversely, the larger the edit distance, the lower the similarity and the smaller the quality value.
[0122] Furthermore, if the recall channel records keywords when generating the ordered tree, and the keywords are validated according to the search index, the recall channel and search index (such as click volume) of the target keyword can be queried in the ordered tree.
[0123] The channel to which the client belongs (such as geographic location, etc.) is queried from the client's current request as the target channel.
[0124] The recall channel is compared with the target channel to configure a channel weight for the target keyword, wherein the channel weight when the recall channel is the same as the target channel is greater than the channel weight when the recall channel is different from the target channel.
[0125] Therefore, when calculating the quality value, the quality value of the candidate character string can be calculated based on the search index, similarity and channel weight. In addition to maintaining the positive correlation between the quality value and the similarity, the quality value is positively correlated with the search index and the channel weight. That is, the higher the search index and the higher the channel weight, the greater the quality value. Conversely, the lower the search index and the lower the channel weight, the smaller the quality value.
[0126] In an example, the quality score is calculated as follows:
[0127] score=log(click+1.0)+alpha*log(edit_distance+1.0)+region_boost.
[0128] Among them, log() is a logarithmic function, click is a search indicator (such as click volume), alpha is a penalty coefficient, which is a constant, edit_distance is a similarity (such as edit distance), and region_boost is a channel weight.
[0129] It should be noted that when generating an ordered tree, the keywords entered by the user may be corrected or not, that is, the keywords entered by the user may be maintained. This embodiment does not limit this. When the keywords entered by the user are maintained, since the keywords are incorrectly entered, search indicators such as click volume may be low, thereby making the quality value of the keyword low, and it may not be pushed to the client for display later.
[0130] Step 3053: Select a target keyword from the candidate keywords according to the quality value.
[0131] In this embodiment, some keywords are selected from the candidate keywords with the quality value as a reference as the target keywords.
[0132] In one method of selecting target keywords, the candidate keywords can be sorted in descending order according to the quality value, that is, the higher the quality value, the higher the ranking, and vice versa, the lower the quality value, the lower the ranking, and the highest ranked k (k is a positive integer and is an adjustable parameter, such as 8) candidate keywords are selected as target keywords
[0133] Of course, in addition to selecting the k candidate keywords with the highest quality values, other methods can also be used to select target keywords, for example, selecting candidate keywords whose quality values are greater than or equal to a preset quality threshold as target keywords, filtering out candidate keywords whose quality values are lower than the preset quality threshold, and selecting the k candidate keywords with the highest quality values from the retained candidate keywords as target keywords, and so on. This embodiment does not limit this.
[0134] Step 306: Send the target keyword to the client for display.
[0135] After the target keyword is determined, the target keyword may be sent to the client, and the client displays the target keyword on a page.
[0136] In general, if Figure 2 As shown, the client can display the target keywords below the search bar to facilitate users to browse the target keywords and select the required target keywords.
[0137] If the user clicks on a target keyword, the search bar can be cleared and the target keyword can be written into the search bar.
[0138] Furthermore, since the user inputting keywords is a dynamic process, the input characters will change in real time, such as adding characters, deleting characters, modifying characters, etc. Therefore, in the process of inputting keywords, the client may send multiple original strings. In order to keep the pushed target keyword matching the characters currently input by the user, the timestamp can be carried when pushing the target keyword.
[0139] When receiving the target keyword, the client compares the timestamps and displays the target keyword corresponding to the latest timestamp (ie, the largest value).
[0140] In this embodiment, an ordered tree is determined, and the nodes in the ordered tree represent characters and associated keywords for search. The keywords are prefixed with characters from the root node to the node. The characters currently used for search sent by the client are received as the original string. The ordered tree is searched for characters identical and / or similar to the original string to form a target string. The ordered tree is queried for keywords prefixed with the target string as candidate keywords, and some candidate keywords are extracted as target keywords. The target keywords are sent to the client for display. On the one hand, the ordered tree carries the characters of the keywords, and the original string requested by the user can be quickly matched. The ordered tree provides a fast search service, can quickly locate the target string, can ensure the real-time nature of the push, and the average response speed can be within 5ms. The target keyword can be prompted before the user enters the next character. On the other hand, the target string similar to the original string is searched in the ordered tree and pushed to the client, and the user's erroneous input can be corrected. The target string is composed of the characters of the keyword and has been recorded in the ordered tree. There is no need to store the form of the user's erroneous input in advance, which reduces the storage space occupied. At the same time, some long-tail keywords can be covered and corrected.
[0141] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0142] Embodiment 3
[0143] Figure 5 This is a structural block diagram of a keyword prompting device provided in Embodiment 3 of the present invention, which may specifically include the following modules:
[0144] An ordered tree determination module 501 is used to determine an ordered tree, wherein nodes in the ordered tree represent characters and are associated with keywords for search, wherein the keywords are prefixed with characters between a root node and the node;
[0145] The original character string receiving module 502 is used to receive the characters currently used for searching sent by the client as the original character string;
[0146] A target string search module 503 is used to search the ordered tree for characters that are identical and / or similar to the original string to form a target string;
[0147] A candidate keyword query module 504 is used to query the ordered tree for keywords prefixed with the target character string as candidate keywords;
[0148] A target keyword extraction module 505 is used to extract some of the candidate keywords as target keywords;
[0149] The target keyword push module 506 is used to send the target keyword to the client for display.
[0150] In one embodiment of the present invention, the ordered tree determination module 501 includes:
[0151] A keyword acquisition submodule, used to acquire a keyword for search, wherein the keyword includes one or more characters;
[0152] A node determination submodule, used for determining a node representing the character in the ordered tree;
[0153] The keyword association submodule is used to associate the keyword with the node.
[0154] In one embodiment of the present invention, the keyword association submodule includes:
[0155] A recall channel query unit, used to query the channel when recalling the keyword for searching, as the recall channel;
[0156] A search index statistics unit, configured to use the recall channel as a statistical dimension to count user behaviors for feedback on the keyword and obtain a search index;
[0157] A keyword insertion unit, used for inserting the keyword into the recall channel under the node;
[0158] A keyword application unit is used to apply the m keywords with the highest search indexes in the recall channel.
[0159] In one embodiment of the present invention, the recall channel query unit includes:
[0160] A geographic location query subunit, used to query the geographic location of the keyword when searching, as a recall channel;
[0161] The search index statistical unit includes:
[0162] The click volume statistics subunit is used to use the geographic location as a statistical dimension to count the number of clicks on the business information corresponding to the keyword as a search indicator.
[0163] In one embodiment of the present invention, the target string search module 503 includes:
[0164] A pointing determination submodule, used for determining, in the ordered tree, the next node to which the current node points;
[0165] A node matching submodule, used for matching the next node with the original string;
[0166] A node jump submodule, used for jumping from the current node to the next node if the match is successful, and returning to the direction determination submodule;
[0167] The target string output submodule is used to determine, if the match fails, that the characters between the root node and the current node are identical and / or similar to the original string as the target string.
[0168] In one embodiment of the present invention, the node matching submodule includes:
[0169] A candidate character string composition unit, used to compose a candidate character string from the root node to the next node;
[0170] An edit distance calculation unit, used to calculate the edit distance between the original character string and the candidate character string;
[0171] A successful match determination unit, configured to determine that the next node successfully matches the original string if the edit distance is less than or equal to a preset threshold;
[0172] The match failure determination unit is used to determine that the next node fails to match the original character string if the edit distance is greater than a preset threshold.
[0173] In one embodiment of the present invention, the candidate keyword query module 504 includes:
[0174] A target character search submodule is used to search for the last character in the target character string as the target character;
[0175] The recall channel extraction submodule is used to extract the keywords in all the recall channels associated with the target character as candidate keywords.
[0176] In one embodiment of the present invention, the target keyword extraction module 505 includes:
[0177] A similarity determination submodule, used to determine the similarity between the original character string and the candidate keyword;
[0178] A quality value calculation submodule, configured to calculate a quality value for the candidate character string based at least on the similarity, wherein the quality value is positively correlated with the similarity;
[0179] The quality value selection submodule is used to select a target keyword from the candidate keywords according to the quality value.
[0180] In one embodiment of the present invention, the similarity determination submodule includes:
[0181] A candidate character string query unit, used to query the candidate character string to which the candidate keyword belongs;
[0182] An edit distance query unit, used to query the edit distance between the candidate character string and the original character string;
[0183] An edit distance setting unit, used to set the edit distance to the similarity between the original character string and the candidate keyword;
[0184] Accordingly, the quality value calculation submodule is also used for:
[0185] A quality value is calculated for the candidate character string based at least on the edit distance, wherein the quality value is negatively correlated with the edit distance.
[0186] In one embodiment of the present invention, the target keyword extraction module 505 further includes:
[0187] A search parameter query submodule, used to query the recall channel and search index of the target keyword in the ordered tree;
[0188] A target channel query submodule, used to query the channel to which the client belongs as the target channel;
[0189] A channel weight configuration submodule, used for comparing the recall channel with the target channel to configure a channel weight for the target keyword, wherein the channel weight when the recall channel is the same as the target channel is greater than the channel weight when the recall channel is different from the target channel;
[0190] Accordingly, the quality value calculation submodule is also used for:
[0191] A quality value is calculated for the candidate character string based on the search index, the similarity and the channel weight, wherein the quality value is positively correlated with the search index and the channel weight.
[0192] In one embodiment of the present invention, the quality value selection submodule includes:
[0193] A keyword sorting unit, used to sort the candidate keywords in descending order according to the quality values;
[0194] The ranking selection unit is used to select the k candidate keywords with the highest ranking as target keywords.
[0195] The keyword prompting device provided in the embodiment of the present invention can execute the keyword prompting method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0196] Embodiment 4
[0197] Figure 6 A schematic diagram of the structure of a computer device provided in Embodiment 4 of the present invention. Figure 6 A block diagram of an exemplary computer device 12 suitable for use in implementing embodiments of the present invention is shown. Figure 6 The computer device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0198] like Figure 6 As shown, the computer device 12 is in the form of a general-purpose computing device. The components of the computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).
[0199] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0200] The computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 12, including volatile and non-volatile media, removable and non-removable media.
[0201] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 6 not shown, usually called a "hard drive"). Although Figure 6 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.
[0202] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0203] The computer device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may communicate with one or more devices that enable a user to interact with the computer device 12, and / or may communicate with any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the computer device 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the computer device 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the computer device 12, including, but not limited to, microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0204] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the keyword prompting method provided in the embodiment of the present invention.
[0205] Embodiment 5
[0206] Embodiment 5 of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned keyword prompting method are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0207] Among them, computer-readable storage media may include, for example, but are not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or device.
[0208] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A keyword prompting method, characterized in that: include: Determine an ordered tree, wherein nodes in the ordered tree represent characters and are associated with keywords for search, wherein the keywords are prefixed with characters between a root node and the node; Receive the characters currently used for searching sent by the client as the original string; Searching the ordered tree for characters identical to or similar to the original character string to form a target character string; Searching the ordered tree for keywords prefixed with the target character string as candidate keywords; Extracting some of the candidate keywords as target keywords; Sending the target keyword to the client for display; The extracting of the candidate keywords as target keywords includes: Determine the similarity between the original character string and the candidate keyword; wherein, determining the similarity between the original character string and the candidate keyword comprises: querying the candidate character string to which the candidate keyword belongs; Calculating a quality value for the candidate character string based at least on the similarity, the quality value being positively correlated with the similarity; selecting a target keyword from the candidate keywords according to the quality value; The extracting part of the candidate keywords as target keywords also includes: Querying the recall channel and search index of the target keyword in the ordered tree; Query the channel to which the client belongs as the target channel; Comparing the recall channel with the target channel to configure a channel weight for the target keyword, wherein the channel weight when the recall channel is the same as the target channel is greater than the channel weight when the recall channel is different from the target channel; The calculating the quality value of the candidate character string at least based on the similarity comprises: A quality value is calculated for the candidate character string based on the search index, the similarity and the channel weight, wherein the quality value is positively correlated with the search index and the channel weight.
2. The method according to claim 1, characterized in that The determined ordered tree comprises: Obtain a keyword for searching, wherein the keyword includes one or more characters; Determining a node representing the character in the ordered tree; The keyword is associated with the node.
3. The method according to claim 2, characterized in that The associating the keyword with the node comprises: Query the channel when recalling the keyword for search, as the recall channel; Taking the recall channel as a statistical dimension, statistics are collected on user behaviors for feedback on the keyword to obtain search indicators; Inserting the keyword into the recall channel under the node; In the recall channel, the m keywords with the highest search index are applied.
4. The method according to claim 3, characterized in that The channel for querying the keyword during the search, as a recall channel, includes: Query the geographical location of the keyword when searching, as a recall channel; The recall channel is used as a statistical dimension to count user behaviors for the keyword feedback to obtain search indicators, including: The geographic location is used as a statistical dimension, and the number of clicks on the business information corresponding to the keyword is counted as a search indicator.
5. The method according to any one of claims 1 to 4, characterized in that: The step of searching the ordered tree for characters identical to or similar to the original character string to form a target character string comprises: In the ordered tree, determining the next node pointed to by the current node; Matching the next node with the original string; If the match is successful, jump from the current node to the next node, return to the ordered tree, and determine the next node pointed to by the current node; If the match fails, the characters between the root node and the current node are determined to be identical and similar to the original string and used as the target string.
6. The method according to claim 5, characterized in that The matching of the next node with the original string includes: The characters from the root node to the next node form a candidate string; Calculating the edit distance between the original character string and the candidate character string; If the edit distance is less than or equal to a preset threshold, determining that the next node matches the original string successfully; If the edit distance is greater than a preset threshold, it is determined that the next node fails to match the original character string.
7. The method according to any one of claims 1 to 4, characterized in that: The step of searching the ordered tree for keywords prefixed with the target character string as candidate keywords includes: Searching for the last character in the target character string as the target character; The keywords in all the recalled channels associated with the target character are extracted as candidate keywords.
8. The method according to claim 1, characterized in that The determining of the similarity between the original character string and the candidate keyword further includes: Querying the edit distance between the candidate character string and the original character string; Setting the edit distance to the similarity between the original character string and the candidate keyword; The calculating the quality value of the candidate character string at least based on the similarity comprises: A quality value is calculated for the candidate character string based at least on the edit distance, wherein the quality value is negatively correlated with the edit distance.
9. The method according to claim 1, characterized in that: The selecting a target keyword from the candidate keywords according to the quality value includes: Sorting the candidate keywords in descending order according to the quality values; The k candidate keywords with the highest ranking are selected as target keywords.
10. A keyword prompting device, characterized in that: include: An ordered tree determination module, used to determine an ordered tree, wherein nodes in the ordered tree represent characters and are associated with keywords for search, wherein the keywords are prefixed with characters between a root node and the node; The original string receiving module is used to receive the characters currently used for searching sent by the client as the original string; A target string search module, used for searching the ordered tree for characters identical or similar to the original string to form a target string; A candidate keyword query module, used to query the ordered tree for keywords prefixed with the target character string as candidate keywords; A target keyword extraction module, used to extract some of the candidate keywords as target keywords; A target keyword push module, used to send the target keyword to the client for display; The target keyword extraction module includes: A similarity determination submodule, used to determine the similarity between the original character string and the candidate keyword; The similarity determination submodule includes: A candidate character string query unit, used to query the candidate character string to which the candidate keyword belongs; A quality value calculation submodule, configured to calculate a quality value for the candidate character string based at least on the similarity, wherein the quality value is positively correlated with the similarity; A quality value selection submodule, configured to select a target keyword from the candidate keywords according to the quality value; The target keyword extraction module also includes: A search parameter query submodule, used to query the recall channel and search index of the target keyword in the ordered tree; A target channel query submodule, used to query the channel to which the client belongs as the target channel; A channel weight configuration submodule, used for comparing the recall channel with the target channel to configure a channel weight for the target keyword, wherein the channel weight when the recall channel is the same as the target channel is greater than the channel weight when the recall channel is different from the target channel; Accordingly, the quality value calculation submodule is also used for: A quality value is calculated for the candidate character string based on the search index, the similarity and the channel weight, wherein the quality value is positively correlated with the search index and the channel weight.
11. A computer device, characterized in that: The computer device comprises: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the keyword prompting method as described in any one of claims 1-9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for prompting keywords according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Search engine-oriented error correction method and system of Chinese and English mixed querying
CN107193921A
Associational word recommendation method and apparatus, electronic device, and storage medium
CN108446316A
Dictionary tree-based search processing method,device and equipment,and storage medium
CN110851722A