Word completion method and apparatus

By constructing an improved C-Trie tree to store high-probability hot words and combining results from multiple databases, the problem of low efficiency in hot word completion in existing technologies is solved, thereby improving user experience and recommendation accuracy.

CN113946719BActive Publication Date: 2026-03-17HUAWEI TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-15
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

In existing technologies, hot word completion is inefficient when users input incomplete strings, especially when the strings are short, resulting in a poor user experience and making it difficult to determine the timing of hot word completion.

Method used

An improved trie (C-Trie) is constructed, storing hot words with high probability of being completed in the nodes. Recommended words are output by searching for the target node, avoiding prefix matching for excessively short strings. The completion results from multiple hot word databases are combined for recommendation.

Benefits of technology

It improves the efficiency of hot word completion, reduces unnecessary recommendations, enhances user experience, ensures that recommended hot words match user intent, and improves timeliness and relevance by combining POI data and log data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113946719B_ABST
    Figure CN113946719B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a word completion method applied to a search scenario to complete an incomplete word input by a user. The method of the embodiments of the present application is based on an improved dictionary tree, hot words are stored in part nodes of the dictionary tree, in the word completion method, a target node matching the string is searched in the dictionary tree Trie, and at least one completed word is output to the user based on the hot words stored in the target node. The word completion efficiency can be improved, and the user is prevented from being recommended words when inputting a too-short string.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a word completion method and apparatus. Background Technology

[0002] Location search is widely used in various application scenarios such as map navigation, travel, and social communication. Specifically, location search includes functions such as query suggestions, point-of-information (POI) search, and obtaining POI details. Among these, the query suggestion function accounts for 75% of search requests, providing search suggestions based on incomplete query text. This function can automatically complete the query when the user's input is incomplete, providing users with relevant hot keywords (i.e., popular search terms) or popular POIs.

[0003] In existing technologies, when a user inputs an incomplete string, the server typically performs prefix matching on the input string in a hot word database, enumerating all hot words that satisfy the prefix matching. Then, all hot words that satisfy the prefix matching are sorted in descending order according to search popularity, and the top N (Top-N) results are taken as the final hot words recommended to the user.

[0004] Existing hot word completion methods perform prefix matching based on the user-input string to obtain all hot words that satisfy the prefix matching. Usually, the number of hot words that satisfy the prefix matching is huge, especially when the input string is short. Therefore, hot word search efficiency is low and it affects user experience. Summary of the Invention

[0005] This application provides a word completion method to improve word completion efficiency and avoid recommending words to users when the user inputs a short string.

[0006] A first aspect of this application provides a word completion method, comprising: obtaining a string input by a user; searching for a target node matching the string in a Trie (prefix tree) to output at least one word, wherein the Trie includes a plurality of first nodes, the target node is one of the plurality of first nodes, each first node stores at least one word comprising a string consisting of characters traversed on the path from the root node to the first node, and the word stored in the target node includes the at least one word output.

[0007] The word completion method provided in this application constructs an efficient trie structure, which is an improvement on the traditional trie. Hot words are stored in the nodes of the trie, including characters traversed on the path from the root node to that node. The hot words stored in the nodes are those with a high probability of being completed; in other words, hot words prefixed with very short strings generally have a low probability of being completed and are not stored in the trie nodes. In this word completion method, a target node matching the user-input string is searched on the improved trie. The string formed by the characters traversed on the path from the root node to the target node matches the user-input string. Based on the words stored in the target node, at least one word is output as a recommended hot word. Since the completed hot words are only output to the user when the target node stores hot words, and the output is based on the words stored in the target node, it is not necessary to search for hot words that meet the prefix conditions based on the user-input string. Therefore, the efficiency of hot word completion is improved, and the completed hot words presented to the user are more in line with the user's requirements.

[0008] In one possible implementation of the first aspect, the prefix of the at least one word stored in the first node is a string consisting of characters traversed on the path from the root node to the first node.

[0009] In the word completion method provided in this application embodiment, the stored hot words are all hot words prefixed with strings composed of characters passed along the path from the root node to the first node, which conforms to the query logic of the trie and has higher search efficiency.

[0010] In one possible implementation of the first aspect, the Trie includes a plurality of second nodes, which do not store words.

[0011] In the word completion method provided in this application embodiment, the Trie also includes multiple second nodes that do not store hot words. When the string entered by the user matches a second node, the hot word will not be output to the user, which can improve the user experience.

[0012] In one possible implementation of the first aspect, the string comprises first characters to Nth characters arranged in the order of user input; the step of searching for a target node in a trie that matches the string to output at least one word comprises: the method further comprises: searching in the trie in the order of input, wherein the string composed of the first characters to the (N-1)th characters input by the user matches a second node in the trie.

[0013] In the word completion method provided in this application, when the user inputs the string character by character in sequence, the matched node when the first character is input is a second node that does not store hot words, so no recommended hot words are output. Similarly, until the (N-1)th character is input, the matched node of the string composed of the first character to the (N-1)th character is still a second node that does not store hot words, so no recommended hot words are output. Only after the Nth character is input is a first node that stores words matched, which is the target node described above. Therefore, when the user input string is short, not outputting recommended hot words can avoid interfering with the user and improve the user experience.

[0014] In one possible implementation of the first aspect, the string comprises characters from the first to the Nth character arranged in the order of user input, wherein the string composed of the first to the (N-1)th characters input by the user matches a first node in the trie, and the words stored in the first node are the same as or different from the words stored in the target node. In another possible implementation of the first aspect, the first node further stores the completion probability corresponding to each word prefixed by characters from the root node to the first node, wherein the completion probability corresponding to each word indicates the probability of outputting the word when matching the first node. Optionally, the completion probability of a word is the proportion of the word frequency in the database to the total frequency of all words prefixed by characters from the root node to the first node. Optionally, the first node stores multiple hot words, which are arranged in descending order of completion probability.

[0015] In the word completion method provided in this application embodiment, the first node also stores the completion probability of each hot word. Therefore, the order of words recommended to the user can be determined based on the word completion probability, which makes it easier for the user to quickly obtain words with higher completion probabilities and can improve the user experience.

[0016] In one possible implementation of the first aspect, the first node stores data of at least one key-value structure, the key-value structure including a key and a value associated with the key, the key being a word prefixed with characters from the root node to the first node, and the value being the completion probability of the word.

[0017] In the word completion method provided in this application embodiment, the first node stores one or more key-value structure data, which is a convenient and clear storage method. The completion probability of each word can be conveniently sorted for multiple words.

[0018] In one possible implementation of the first aspect, the order of the at least one word in the output is related to the order of the words stored in the target node.

[0019] In the word completion method provided in this application embodiment, the order of words stored in the target node can be varied. Optionally, they can be sorted according to the alphabetical order of the same character position in different hot words; alternatively, they can be sorted according to the pinyin order of the same character position in different hot words; or, they can be sorted according to the word frequency of the hot words. The order of at least one word output can be the same as the order of words stored in the target node, thereby reducing the time required for hot word recommendation and improving the efficiency of hot word recommendation.

[0020] In one possible implementation of the first aspect, the words stored in the plurality of first nodes are derived from Point of Interest (POI) data or user log data.

[0021] In the word completion method provided in this application embodiment, the hot words stored in the first node can be derived from various existing hot word databases, such as POI data or user log data. Different databases can be selected according to the actual application scenario. For example, in map applications, hot words derived from POI data can usually be considered.

[0022] A second aspect of this application provides a word completion method, comprising: obtaining a string input by a user; searching for a target node matching the string in a Trie to output at least one word, wherein the Trie includes a plurality of first nodes, the target node is one of the plurality of first nodes, each first node stores at least one word including the string corresponding to the first node, and the word stored in the target node includes the at least one word output.

[0023] The difference from the first aspect of the embodiments of this application lies in the storage format of the nodes in the trie in this embodiment. Each node corresponds to a string that has one more character than the previous node, including the string corresponding to any node on the path from the root node. In this case, the first node stores at least one word that includes the string corresponding to the first node. The parts other than the storage format of the trie are similar to the first aspect of the embodiments of this application, and will not be described in detail here.

[0024] A third aspect of this application provides a word completion method, comprising: obtaining a string input by a user; searching for a target node matching the string in a first trie constructed based on a first word database to output a first word set, the first word set including at least one word, the first trie including a plurality of first nodes, the target node being one of the plurality of first nodes, each first node storing at least one word comprising a string consisting of characters traversed on the path from the root node to the first node, the words stored in the target node including words in the first word set; outputting a second word set prefixed with the string based on a second word database; and outputting at least one word recommended to the user based on the first word set and the second word set. Optionally, the target node stores at least one word prefixed with a string consisting of characters from the root node to the first node.

[0025] The method provided in this application can combine hot word sources from at least two hot word databases to recommend hot words to users. The nodes of a first trie (prefix tree) constructed based on the first word database store hot words, including characters traversed on the path from the root node to that node. The hot words stored in the nodes are those with a high probability of being completed; in other words, hot words prefixed with very short strings generally have a low probability of being completed and are not stored in the trie nodes. Since the first set of completed words is only output to the user when the target node stores hot words, hot word completion can be avoided in scenarios where the user's input string is short, the intent is unclear, or the probability of hot words being completed is low. Furthermore, combining the first and second word sets to output hot words to the user can improve the accuracy of hot word recommendations.

[0026] In one possible implementation of the third aspect, the first word set includes at least two words arranged in an ordered manner; the second word set includes at least two words arranged in an ordered manner; and the target word set includes the word ranked first in the first word set and the word ranked first in the second word set.

[0027] The method provided in this application provides user-recommended hot words, including the hot word ranked first in the first hot word set and the hot word ranked first in the second hot word set. Compared with the prior art, the recommended hot words are more likely to match the user's intent, which can improve the accuracy of hot word recommendations.

[0028] In one possible implementation of the third aspect, the step of outputting at least one word recommended to the user based on the first word set and the second word set includes: determining the completion probability of each word in the union of the first word set and the second word set based on a preset first weight of the first word set and a second weight of the second word set; and determining the at least one word recommended to the user based on the completion probability.

[0029] The method provided in this application embodiment can set recommendation weights for hot word databases from different data sources according to the actual application scenario of hot word recommendation, such as the type of application for recommendation, in order to calculate the completion probability of each word in the union of the first word set and the second word set, thereby improving the accuracy of hot word recommendation.

[0030] In one possible implementation of the third aspect, the step of outputting a second word set prefixed with the string based on the second word database includes: obtaining the second word set according to a Trie constructed from the user log word database; or, inputting the string into a machine learning algorithm trained based on the user log word database to output the second word set; or, obtaining the second word set according to a hash tree constructed from the user log word database.

[0031] Optionally, the data source for the first word database is the POI database, and the data source for the second word database is the user log database.

[0032] The method provided in this application can obtain a second word set through various existing hot word completion methods. Furthermore, by fusing the completion results from POI data and log data, the timeliness and relevance of the completed hot words to the POIs can be guaranteed.

[0033] A fourth aspect of this application provides a method for constructing a trie, comprising: constructing a trie based on a word database, the trie including a plurality of first nodes, each first node storing at least one word comprising a string of characters traversed on the path from the root node to the first node; deleting words stored in the nodes, retaining words in each node whose completion probability is greater than or equal to a first threshold, the completion probability indicating the probability of outputting a word when the node is matched.

[0034] The method for constructing a trie provided in this application proposes an efficient method for constructing a trie structure, which improves upon the traditional trie. Specifically, hot words are stored in the nodes of the trie. The stored hot words include characters traversed on the path from the root node to that node. The hot words stored in the nodes are words whose probability of being completed is greater than or equal to a first threshold. In other words, hot words prefixed with short strings usually have a low probability of being completed and are not stored in the nodes of the trie. Based on the improved trie, a target node matching the user's input string is found. Based on the words stored in the target node, at least one word is output as a recommended hot word. Since the completed hot words are only output to the user when the target node stores hot words, and the output is based on the words stored in the target node, it is not necessary to search for hot words that meet the prefix conditions based on the user's input string, thus improving the efficiency of hot word completion. In addition, it can avoid triggering hot word completion in scenarios where the user's input string is short, the intent is not obvious, or the probability of hot words being completed is low.

[0035] In one possible implementation of the fourth aspect, the completion probability is the proportion of the word frequency to the sum of the word frequencies of all words prefixed with characters from the root node to the first node.

[0036] In one possible implementation of the fourth aspect, the first threshold is a preset value, ranging from [0.1, 0.2]. By reasonably setting the first threshold, it can be ensured that hot words are recommended to the user at the appropriate time. Under the same conditions, the larger the first threshold, the longer the string that triggers the hot word recommendation, and the greater the possibility that the recommended hot words match the user's intent. However, if the first threshold is too large, it will cause the user to wait for a long time (or enter a lot of characters) before obtaining the recommended hot words, which is not conducive to improving the user experience. Therefore, the value of the first threshold needs to be reasonably set according to the actual hot word completion scenario. It can be preset or adjusted according to the application scenario or user needs.

[0037] In one possible implementation of the fourth aspect, the nodes of the Trie store key-value structure data, the key-value structure including a key and a value associated with the key, the key being a word prefixed with characters from the root node to the node, and the value being the completion probability of the word, the completion probability being the proportion of the word frequency to the sum of the frequencies of all words prefixed with characters from the root node to the first node.

[0038] In one possible implementation of the fourth aspect, the method further includes: the words stored in the nodes of the Trie are arranged in descending order of completion probability.

[0039] A fifth aspect of this application provides a word completion apparatus, characterized in that it includes: an acquisition unit for acquiring a string input by a user; and an output unit for searching a target node in a Trie tree that matches the string to output at least one word, wherein the Trie tree includes a plurality of first nodes, the target node is one of the plurality of first nodes, each first node stores one or more words, and each of the one or more words includes a string composed of characters traversed on the path from the root node of the Trie tree to the first node where the one or more words are located, and the words stored in the target node include the at least one word output.

[0040] In one possible implementation of the fifth aspect, the prefix of the one or more words is a string consisting of characters traversed on the path from the root node of the Trie tree to the first node where the one or more words are located.

[0041] In one possible implementation of the fifth aspect, the Trie includes a plurality of second nodes, each of which does not store a word.

[0042] In one possible implementation of the fifth aspect, the string comprises first characters to Nth characters arranged in the order of the user's input; the output unit is specifically used to: search in the trie according to the input order, wherein the string composed of the first characters to the (N-1)th characters input by the user matches a second node in the trie.

[0043] In one possible implementation of the fifth aspect, the first node further stores the completion probabilities corresponding to each of the one or more words, wherein the completion probability corresponding to each word indicates the probability of outputting the word when it is matched with the first node.

[0044] In one possible implementation of the fifth aspect, the first node stores data of at least one key-value structure, the key-value structure including a key and a value associated with the key, the key being a word prefixed with a string of characters traversed on the path from the root node to the first node, the value being a word completion probability, wherein the completion probability indicates the probability of outputting the key when the first node is matched.

[0045] In one possible implementation of the fifth aspect, the order of the at least one word in the output is related to the order of the words stored in the target node.

[0046] In one possible implementation of the fifth aspect, the words stored in the plurality of first nodes are derived from Point of Interest (POI) data or user log data.

[0047] The sixth aspect of this application provides a word completion device, which differs from the word completion device of the fifth aspect of this application in that the storage format of the nodes in the trie is different. Each node corresponds to a string that has one more character than the previous node, including the string corresponding to any node on the path from the root node. In this case, the first node stores at least one word that includes the string corresponding to the first node. The parts other than the storage format of the trie are similar to those of the fifth aspect of this application, and will not be described in detail here.

[0048] A seventh aspect of this application provides a word completion apparatus, characterized in that it includes: an acquisition unit for acquiring a string input by a user; an output unit for searching for a target node matching the string in a Trie (prefix tree) to output a first word set, the first word set including at least one word, the first Trie including a plurality of first nodes, the target node being one of the plurality of first nodes, each first node storing at least one word comprising a string consisting of characters traversed on the path from the root node of the Trie to the first node, the words stored in the target node including words in the first word set, and the words stored in the plurality of first nodes coming from a first word database; the output unit is further configured to output a second word set prefixed with the string based on a second word database; the output unit is further configured to output at least one word recommended to the user based on the first word set and the second word set.

[0049] In one possible implementation of the seventh aspect, the first word set includes at least two words arranged in an ordered manner; the second word set includes at least two words arranged in an ordered manner; and the target word set includes the word ranked first in the first word set and the word ranked first in the second word set.

[0050] In one possible implementation of the seventh aspect, the output unit is specifically used to: output at least one word recommended by the user based on the probability of each word being output in the union of the first word set and the second word set, wherein the probability of each word being output in the union is determined according to a preset first weight of the first word set and a second weight of the second word set.

[0051] In one possible implementation of the seventh aspect, the output unit is specifically used to: obtain the second word set based on a Trie constructed from the word database of the user logs; or, input the string into a machine learning algorithm trained based on the word database of the user logs to output the second word set; or, obtain the second word set based on a hash tree constructed from the word database of the user logs.

[0052] An eighth aspect of this application provides a trie construction apparatus, comprising: a construction unit for constructing a trie based on a word database, the trie including a plurality of first nodes, each first node storing at least one word comprising a string of characters traversed on the path from the root node to the first node; and a deletion unit for deleting words stored in the nodes, retaining words in each node whose completion probability is greater than or equal to a first threshold, the completion probability indicating the probability of outputting a word when the node is matched.

[0053] In one possible implementation of the eighth aspect, the completion probability is the proportion of the word frequency to the sum of the word frequencies of all words prefixed with characters from the root node to the first node.

[0054] In one possible implementation of the eighth aspect, the first threshold is a preset value, with a value range of [0.1, 0.2].

[0055] In one possible implementation of the eighth aspect, the nodes of the Trie store key-value structure data, the key-value structure including a key and a value associated with the key, the key being a word prefixed with characters from the root node to the node, and the value being the completion probability of the word, the completion probability being the proportion of the word frequency to the sum of the frequencies of all words prefixed with characters from the root node to the first node.

[0056] In one possible implementation of the eighth aspect, the method further includes: the words stored in the nodes of the Trie are arranged in descending order of completion probability.

[0057] A ninth aspect of this application provides a terminal, comprising: one or more processors and a memory; wherein the memory stores computer-readable instructions; the one or more processors read the computer-readable instructions to cause the terminal to perform a method as described in any one of the first to fourth aspects and various possible implementations above.

[0058] A tenth aspect of this application provides a server, comprising: one or more processors and a memory; wherein the memory stores computer-readable instructions; the one or more processors read the computer-readable instructions to cause the terminal to perform the method as described in any one of the first to fourth aspects and various possible implementations above.

[0059] The eleventh aspect of this application provides a computer program product containing instructions, characterized in that, when run on a computer, it causes the computer to perform the method as described in any one of the first to fourth aspects and various possible implementations above.

[0060] A twelfth aspect of this application provides a computer-readable storage medium including instructions, characterized in that, when the instructions are executed on a computer, the computer performs a method as described in any one of the first to fourth aspects and various possible implementations above.

[0061] A sixth aspect of this application provides a chip including a processor. The processor is used to read and execute a computer program stored in a memory to perform the method described in any one of the first to fourth aspects and various possible implementations. Optionally, the chip includes a memory, and the memory is connected to the processor via a circuit or wire. Further optionally, the chip also includes a communication interface, to which the processor is connected. The communication interface is used to receive data and / or information to be processed, the processor obtains the data and / or information from the communication interface, processes the data and / or information, and outputs the processing result through the communication interface. The communication interface may be an input / output interface.

[0062] The technical effects of any of the implementation methods in aspects five through twelfth can be found in the technical effects of the corresponding implementation methods in aspects one through four, and will not be repeated here.

[0063] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:

[0064] The hot word completion method provided in this application is based on an improved trie for word completion. The improved trie includes multiple first nodes storing words. By searching for target nodes in the improved trie that match the user's input string, at least one word is output as a recommended hot word based on the words stored in that target node. Since the completed hot words are only output to the user when the target node stores hot words, and the output is based on the words stored in that target node, it is not necessary to search for hot words that meet prefix conditions based on the user's input string, thus improving the efficiency of hot word completion.

[0065] Furthermore, this solution uses the completion probability of hot words for filtering. Compared to solutions that strictly limit the timing of hot word completion by setting a minimum trigger length, this solution determines the completion trigger length for each hot word by statistically analyzing the completion probability of hot words prefixed with the corresponding string of the node. This better meets actual completion needs. It avoids triggering hot word completion in scenarios where the user's input string is short, the intent is unclear, or the probability of the hot word being completed is low. By avoiding hot word searches with excessively short strings as prefixes, this solution also effectively improves completion efficiency.

[0066] In addition, this solution outputs the completion results based on the first and second word databases. For example, by combining the completion results of POI data and log data, the timeliness and relevance of the completed hot words can be guaranteed. Attached Figure Description

[0067] Figure 1 A schematic diagram illustrating a basic Trie tree structure;

[0068] Figure 2a A schematic diagram of the interface for completing hot words;

[0069] Figure 2b This is a schematic diagram of the system architecture of the hot word completion method in the embodiments of this application;

[0070] Figure 3a This is a schematic diagram of an embodiment of constructing a C-Trie tree in this application;

[0071] Figure 3b A schematic diagram of the hot word data stored in the nodes of the C-Trie tree in this embodiment of the application;

[0072] Figure 3c This is a schematic diagram of deleting and storing hot word data from nodes of a C-Trie tree in an embodiment of this application.

[0073] Figure 3d Another schematic diagram showing the hot word data stored in the nodes of the C-Trie tree in this application embodiment;

[0074] Figure 4 This is a schematic diagram of one embodiment of the word completion method in this application;

[0075] Figure 5 This is a schematic diagram of another embodiment of the word completion method in this application;

[0076] Figure 6 This is a schematic diagram of the input and output structure of the prediction model in the embodiments of this application;

[0077] Figure 7 This is a schematic diagram of another embodiment of the word completion method in this application;

[0078] Figure 8 This is a schematic diagram of one embodiment of the word completion device in this application.

[0079] Figure 9 This is a schematic diagram of another embodiment of the word completion device in this application;

[0080] Figure 10 This is a schematic diagram of another embodiment of the word completion device in this application;

[0081] Figure 11 This is a schematic diagram of one embodiment of the Trie tree construction apparatus in this application.

[0082] Figure 12 This is a schematic diagram of one embodiment of the terminal in this application;

[0083] Figure 13 This is a schematic diagram of one embodiment of the server in this application. Detailed Implementation

[0084] This application provides a word completion method to improve word completion efficiency and avoid recommending words to users when the user inputs a short string.

[0085] For ease of understanding, the following is a brief introduction to some of the technical terms used in the embodiments of this application:

[0086] 1. Words

[0087] This application involves word completion, and here we will first give a brief introduction to the meaning of "word".

[0088] The word completion method proposed in this application is applied to the search field. Specifically, when a user enters characters one by one in the search bar area, the method predicts the user's expected search term and recommends complete words. Therefore, the user does not need to enter complete words character by character but can directly select from the recommended words, improving search efficiency and user experience. Typically, the data sources for recommended words include historical data such as user logs. After statistical analysis and filtering, combined with the incomplete characters already entered by the user, words are recommended as closely as possible to the user's expectations. Based on this technical background, it is understood that the term "word" mentioned in the embodiments of this application is a broad concept. Based on the user's search language, "word" includes words from different languages; based on the data source of the word, a word can include a single word or a phrase composed of multiple words. Below, examples of Chinese and English words are provided:

[0089] 1) "Supermarket" is a Chinese word, and "supermarket" is a "word" mentioned in this application, consisting of two characters;

[0090] 2) Although “Agricultural Bank of China” includes the words “agriculture” and “bank”, if based on data sources such as user logs, “Agricultural Bank of China” as a whole is a commonly used search term by users, then “Agricultural Bank of China” is also a “word” involved in this application, including four characters;

[0091] 3) "Starbucks" is an English word, which is a "word" covered in this application and consists of 9 characters;

[0092] 4) “burger king”, in a narrow sense, is composed of the two English words “burger” and “king”. However, since “burger king” as a whole is a commonly used search term, it is also a “word” involved in this application. It is worth noting that in this application, “burger king” is regarded as a whole. “burger king” includes 11 characters, that is, the space between “burger” and “king” also occupies one character.

[0093] The "words" recommended to users can be obtained through statistical analysis and filtering of word databases from sources such as user logs. Since these are usually popular search terms with high frequency in the database, they are often referred to as "hot words" in this technical field, i.e., "words" in this application embodiment. This application does not limit the source of word frequency; furthermore, the data source for words can be commonly used hot word databases in the prior art, and this application does not limit this as well. The following embodiments will use "hot words" for description.

[0094] 2. POI

[0095] It is an abbreviation for "Point of Information," which can be translated into Chinese as "information point." In a geographic information system, a POI can be a building, a shop, a mailbox, a bus stop, etc.

[0096] In this application embodiment, POI refers to the location name on the map, such as "Golden Hill Park", "illy Cafe", "New World Apartment", "China Post", etc.

[0097] POI hot words are selected based on POI data. For example, the frequency of each word in the POI data is counted, and a certain percentage of the words with the highest frequency are selected as POI hot words.

[0098] 2. String

[0099] The query text entered by the user in the search box is usually an incomplete word and may include one or more characters, which are collectively referred to as a string in this application embodiment.

[0100] 3. Trie

[0101] A trie, also known as a search tree or prefix tree, is typically used to count, sort, and store large amounts of strings, and is therefore frequently used in search engine systems for text word frequency statistics. Its advantages include: utilizing common prefixes of strings to reduce query time and minimizing unnecessary string comparisons.

[0102] A common approach to incomplete prefix completion is to build a Trie tree for all candidate words and then search the string within the Trie tree to improve query efficiency.

[0103] Please see Figure 1 This is a schematic diagram illustrating a basic Trie tree structure. If we have five strings, "code", "cook", "file", "fat", and "find", the Trie tree structure built for them would look like this: Figure 1 As shown, the method for finding nodes that match a string using a Trie tree starts from the root node. First, it identifies nodes that match the first character of the string. Then, it searches for nodes among the child nodes of that node that match the second character, and so on. A node's child nodes are those directly connected to it downwards. All child nodes of a node must have distinct characters.

[0104] Using a Trie tree to retrieve prefix-matched strings reduces unnecessary string comparisons and improves query efficiency by leveraging common prefixes. For example, when "code" and "cook" share the prefix "co", there's no need to perform two comparisons of the common prefix "co". In practical applications of Trie trees, the frequency of each candidate word is typically stored in the node corresponding to that word, and this frequency is used as the sorting criterion for candidate words with common prefixes.

[0105] The embodiments of this application are described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. As those skilled in the art will recognize, with the development of technology and the emergence of new scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0106] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or modules is not necessarily limited to those explicitly listed, but may include other steps or modules not explicitly listed or inherent to such processes, methods, products, or devices. The naming or numbering of steps appearing in this application does not imply that the steps in the method flow must be performed in the chronological / logical order indicated by the naming or numbering. The execution order of named or numbered process steps can be changed according to the desired technical purpose, as long as the same or similar technical effect is achieved.

[0107] like Figure 2a As shown, when a user enters "star", the server or terminal recommends the hot keyword "starbucks". The user can click on this hot keyword to perform a POI search using it to obtain a more comprehensive and detailed list of search results. It should be noted that the completed hot keywords are usually categories or brand names, such as "hotel" or "Starbucks", rather than pointing to a specific location, such as "Oriental Pearl Tower".

[0108] In existing technologies, when a user inputs an incomplete string, prefix matching is typically performed on all hot words, enumerating all hot words that satisfy the prefix match. Next, these hot words are sorted in descending order based on search popularity or the relevance of the string to the hot words, and the Top-N results are used as the final hot words recommended to the user. This method is concise and effective in incomplete text completion scenarios, but in practical applications, it still has the following technical problems: the number of hot words that satisfy prefix matching is usually huge, especially when the string is short, resulting in low search efficiency; the timing of completion triggering for different hot words is difficult to determine. When the user input string is too short, such as only 1 to 2 letters, the user's search intent is not yet clear, and the number of hot words that satisfy prefix matching is huge. Recommending popular search terms to the user in this case may affect the user experience and interfere with non-hot word search scenarios. For example, in a map scenario, inputting 1 to 2 letters usually returns important nearby administrative regions.

[0109] To address the aforementioned issues with hot word completion technology, this invention constructs a Trie tree structure. Thanks to the unique structure of C-Trie, it is possible to conditionally filter and sort candidate hot words and perform additional storage, thereby greatly improving the performance of hot word completion.

[0110] Furthermore, by integrating the completion results based on POI data and the completion results based on search logs, the timeliness of the completed hot words and their relevance to the POI data can be ensured simultaneously.

[0111] The system architecture of the method in this application is briefly described below. Please refer to [link / reference]. Figure 2b This is a schematic diagram of the system architecture of the hot word completion method in the embodiments of this application.

[0112] The system architecture includes users, terminals, and servers, with terminals and servers communicating with each other through various communication links.

[0113] Typically, users input strings through the terminal's input module to perform searches. The terminal then searches locally based on the user's input and displays recommended keywords to the user through the terminal's display module.

[0114] Alternatively, the terminal sends the request input by the user to the server. The server performs hot word completion based on the string input by the user and sends the output hot words to the terminal. The terminal receives the hot words sent by the server and outputs them to the user through the output module.

[0115] It can be seen that the hot word completion method provided by the embodiments of the present application can be executed by the terminal or by a network device, such as a server, without specific limitation.

[0116] In the hot word completion method of the present application, the traditional Trie tree is improved. Only the hot words that meet the conditions are stored on some nodes of the Trie tree. Therefore, in the embodiments of the present application, the improved Trie tree is called a conditional dictionary tree, abbreviated as C-Trie tree. It can be understood that as long as the Trie tree stores hot words that meet certain conditions on some nodes of the Trie tree, it belongs to the improved Trie tree in the embodiments of the present application. The present application does not limit the name of the improved Trie tree.

[0117] In one implementation, a data structure of a key-value (K-V) structure is added to some nodes of the ordinary Trie tree in the C-Trie tree. Among them, the Key is a certain hot word with the string represented by the node as the prefix. For example, if the string represented by the node is "wine", the Key of a K-V structure data stored in this node is "hotel", and the Value is the proportion of the word frequency of this hot word (that is, the hot word corresponding to the key) in the total word frequency of all hot words with this node as the prefix, that is, the probability of this hot word being completed, which is called the "completion probability" in the embodiments of the present application. For example, there are two hot words, "hotel" and "bar", with "wine" as the prefix. The word frequency of "hotel" is 70, and the word frequency of "bar" is 30. Then the Value corresponding to "hotel" as the Key is 70%. Optionally, the K-V structure data on each node is sorted in descending order according to the Value value. Of course, other forms of data formats can also be used to store hot words and completion probabilities on some nodes of the C-Trie tree, such as a mapping table, a linked list, etc., which are not limited in the present application.

[0118] The construction method of the C-Trie tree is introduced below:

[0119] Step 1: Build an ordinary Trie tree based on the hot word database;

[0120] Optionally, for easy understanding, each node in this figure shows the string represented by this node, including all characters connected by the characters passed through the path from the root node to this node. Alternatively, each node can also directly represent Figure 3a , and for easy understanding, each node in this figure shows the string represented by this node, including all characters connected by the characters passed through the path from the root node to this node. Or, each node can also directly represent Figure 3aThe string shown. The hot word database can be any existing hot word database, such as a hot word database based on user logs or a POI hot word database, etc., and there are no specific restrictions here.

[0121] Step 2: Store hot words on multiple nodes of the Trie tree;

[0122] Each node stores hot words, including at least one word from a string consisting of characters traversed on the path from the root node to the node. Optionally, each node stores hot words, including at least one word prefixed with a string consisting of characters traversed on the path from the root node to the node. The source of the words can be the hot word database used to construct the Trie tree in step 1, or it can be another hot word database with a different source than the hot word database used to construct the Trie tree in step 1. The source of the stored hot words is not limited here.

[0123] It should be noted that since the Trie tree structure itself is a data structure that stores hot words according to the same prefix, for each node, words whose prefixes are the characters traversed on the path from the root node to that node can be obtained one by one by querying the child nodes of that node. That is, the Trie tree structure itself can obtain all words whose prefixes are the characters traversed on the path from the root node to that node. However, in this embodiment, storing hot words at a node does not mean obtaining hot words by querying the Trie tree, but rather storing hot words directly at that node. During the use of the solution, after obtaining the target node, the hot words stored in the target node can be obtained directly without needing to query through the Trie tree structure.

[0124] Optionally, each node also stores the completion probability corresponding to the hot word, which indicates the probability of outputting the hot word when the node is matched.

[0125] Optionally, the hot words stored on the nodes are key-value (KV) structured data, and each node may store one or more KV structured data. The key is a hot word prefixed with the string represented by the node, and the value is the completion probability of that hot word. Optionally, the completion probability is the proportion of the hot word's frequency to the total frequency of all hot words prefixed with the string represented by that node. In other words, among all hot words prefixed with that node, the proportion of the hot word's frequency to the total frequency of all hot words is the value corresponding to that hot word, i.e., the probability that the hot word is completed. The completion probability is the proportion of the frequency of a hot word prefixed with characters from the root node to that node to the total frequency of all hot words prefixed with characters from the root node to that node.

[0126] For example, such as Figure 3bAs shown, the hot words prefixed with "st" include "starbucks", "state", "start", and "stir". Using these hot words as keys, the probability of each hot word being completed is calculated. The completion probability for "starbucks" is 0.012, for "state" it is 0.0012, for "start" it is 0.002, and for "stir" it is 0.0004.

[0127] Similarly, hot word data in a key-value structure is added to each node of the Trie tree.

[0128] It should be noted that steps 1 and 2 can be executed simultaneously, that is, while constructing each node of the trie tree, hot words are stored for each node.

[0129] Step 3: Reduce the number of hot words stored in each node.

[0130] Based on a first threshold, hot words stored in each node are reduced. Optionally, key-value (KV) structure data is reduced.

[0131] Optionally, if the value in a key-value structure stored in a node is less than a specified first threshold, the key-value structure is deleted. For example... Figure 3c As shown, assuming a threshold of 0.1, the probability of all candidate hot words in the "st" and "sta" nodes does not meet the threshold condition, and they are all deleted. It should be noted that the first threshold is a number between (0, 1), and the specific value is not limited. For example, the range of the first threshold is [0.1, 0.2], such as 0.1, 0.12, 0.15, 0.18, or 0.2. It is understandable that by reasonably setting the first threshold, hot words can be recommended to the user at the appropriate time. Under the same conditions, the larger the first threshold, the longer the string triggering the hot word recommendation, and the greater the probability that the recommended hot words match the user's intent. However, if the first threshold is too large, users will have to wait a long time (or input many characters) to get the recommended hot words, which is not conducive to improving the user experience. Therefore, the value of the first threshold needs to be reasonably set according to the actual hot word completion scenario. It can be preset or adjusted according to the application scenario or user needs.

[0132] It should be noted that steps 1, 2 and 3 can be executed simultaneously. That is, while constructing each node of the trie tree, hot words are stored for each node, and hot words are deleted simultaneously.

[0133] Step 4: Sort the hot words stored on the nodes;

[0134] The hot words stored on the nodes can be arranged in an ordered manner. The sorting rules are not limited here. For example, for English hot words, they can be sorted according to the order of the first letter, and if the first letter is the same, the order of the second letter is compared, and so on. For Chinese hot words, they can be sorted according to the order of the pinyin of the characters. Alternatively, they can be sorted according to the frequency of the hot words.

[0135] Optionally, the remaining key-value (KV) keyword data that has not been removed from each node are sorted in descending order by their value. For example... Figure 3d As shown, the hot words stored in the node "star" are sorted in descending order of their completion probability.

[0136] It should be noted that step 4 is an optional step; it can be performed or not.

[0137] It is understandable that the execution order of step 4 and step 3 is not limited.

[0138] Based on the above steps, the C-Trie tree involved in the embodiments of this application is constructed. It can be seen that the main features of the C-Trie tree are:

[0139] (1) A node may not be associated with data in a KV structure, or it may be associated with one or more pairs of KV structures;

[0140] (2) Each pair of KV structure data is used to indicate the probability that a hot word prefixed with the string represented by that node will be completed;

[0141] (3) In the KV structure data stored in the node, the probability of indicating hot words being completed is greater than or equal to the first threshold.

[0142] (4) The KV structure data stored in a node are sorted in descending order of the completion probability of hot words.

[0143] In another possible implementation, the C-Trie tree can remove some nodes that do not store hot words, which will not be elaborated here.

[0144] Since some nodes in the C-Trie tree store words, by searching for target nodes in the improved C-Trie tree that match the user's input string, at least one word is output to the user as a recommended hot word based on the words stored in that target node. Because the completed hot word is only output to the user when a target node storing hot words is matched, and the output is based on the words stored in that target node, it eliminates the need to search for hot words that match the prefix conditions based on the user's input string, thus improving the efficiency of hot word completion.

[0145] Please see Figure 4 This is a schematic diagram of an embodiment of the hot word completion method in this application.

[0146] 401. Obtain the string input by the user;

[0147] The server or terminal obtains the search text input by the user. Since the user needs to input one character at a time, the search text is usually an incomplete string. At the appropriate time, intelligent completion based on the user's input string as a prefix can save the user's input time and improve the user experience.

[0148] 402. Search for the target node that matches the string in the pre-defined Trie, and output at least one word;

[0149] The output hot words are used to recommend words to users. Users can choose words that match their expectations from at least one of the output words, so they don't have to enter the complete word. This helps users in scenarios where they have difficulty spelling the words they want to enter or have partially forgotten them, thereby improving the user experience.

[0150] The string corresponding to a node is the string formed by concatenating the characters along the path from the root node to that node in sequence. The Trie tree in this embodiment is the C-Trie tree described in the previous embodiments. As can be seen from the C-Trie tree construction method, the strings represented by the nodes in a C-Trie tree are the same as those in a regular Trie tree, formed by concatenating the characters along the path from the root node to that node in sequence. The difference lies in that some nodes in a C-Trie tree store hot words. For ease of description, the node storing hot words can be called the first node, and a C-Trie tree includes multiple first nodes. Optionally, the hot words stored in the first node of the C-Trie tree include the string formed by concatenating the characters along the path from the root node to that first node in sequence. For example, if the string formed by concatenating the characters along the path from the root node to that first node is "rea", the hot words stored in the first node include words prefixed with "rea", such as "read"; and may also include words containing "rea", such as "entreat". Optionally, the hot words stored in the first node of the C-Trie tree are hot words prefixed with the string obtained by concatenating the characters in the path from the root node to the node in the correct order. For example, if the string obtained by concatenating the characters in the path from the root node to the first node is "rea", the hot words stored in the first node are ready, rear, really, etc.

[0151] Optionally, the nodes of the C-Trie tree store key-value (KV) structured data, where K represents the hot words prefixed by the string represented by that node, and V represents the completion probability of that hot word, i.e., the proportion of the frequency of that hot word to the total frequency of all hot words prefixed by the string represented by that node. The completion probability indicates the probability of outputting that hot word when matching the first node. As can be seen from the C-Trie tree construction process, the completion probability of retained hot words is greater than or equal to a first threshold; that is, hot words with completion probabilities less than the first threshold are removed. Optionally, since the completion probabilities of multiple hot words prefixed by the string corresponding to a node are all less than the first threshold, some nodes in the C-Trie tree may not have associated KV structure data. This situation is common in scenarios where the string corresponding to a node is too short. Optionally, among the multiple hot words prefixed by the string corresponding to a node, some hot words are deleted because their completion probabilities are less than the first threshold, while others are retained because their completion probabilities are greater than or equal to the first threshold. Therefore, this node stores some hot words and belongs to the first node. Optionally, if the completion probabilities of multiple hot words prefixed by the string corresponding to a node are all greater than or equal to the first threshold, all of them are retained. This node stores hot words and belongs to the first node. For ease of description, nodes that do not store hot words are called second nodes, and the C-Trie tree includes multiple second nodes.

[0152] A first node of a C-Trie tree may be associated with a pair of key-value (KV) structure data, including a node with only one hot word whose prefix is ​​a key word, or a key word whose completion probability is greater than or equal to a first threshold. A first node of a C-Trie tree may also be associated with multiple pairs of key-value (KV) structure data. The specific number of key-value (KV) structure data is not limited, and it can be reduced according to the completion probability, retaining a preset number of key-value (KV) structure data corresponding to hot words with a high completion probability.

[0153] Optionally, when constructing the C-Trie tree in this application embodiment, hot word databases from different sources can be used. For example, the hot word database can be a user's log hot word database, where log hot words are popular search terms obtained by filtering log data; the hot word database can also be a POI hot word database, where POI hot words are obtained by statistically analyzing the word frequency of each word in the map POI data and taking a certain proportion of words with the highest word frequency.

[0154] The server or terminal can search the C-Trie tree based on the string to determine the target node that matches the string, that is, the string represented by the target node is consistent with the string.

[0155] If the target node stores hot word data, then at least one hot word prefixed with that string is output based on the stored hot word data.

[0156] If the target node stores hot word data, then at least one hot word will be output as a recommended hot word based on the stored hot words. The number of recommended hot words is usually limited and can be preset by the server or set according to user needs; the specific number of recommended hot words is not limited. If the set number of recommended hot words is less than the number of hot words stored on the target node, then the output hot words will be a subset of all hot words stored on the target node.

[0157] The hot words stored on the nodes can be arranged in an ordered manner, with no specific sorting rule specified here. For example, for English hot words, they can be sorted alphabetically by their first letter, comparing the order of the second letter for words with the same first letter, and so on. For Chinese hot words, they can be sorted alphabetically by their pinyin order; or, they can be sorted by word frequency. Optionally, the remaining KV structure hot word data on each node that has not been pruned can be sorted in descending order by their value. Figure 3d As shown, the hot words stored in the node "star" are sorted in descending order of their completion probability.

[0158] Optionally, the order of at least one word in the output depends on the order of the hot words stored in the target node. For example, it can be directly based on the order of the hot words stored in the target node, belonging to the top N hot words, where N is the preset number of hot word recommendations.

[0159] The hot word completion method provided in this application embodiment can also combine the improved Trie tree with existing hot word completion methods to recommend hot words to users. This will be described in detail below. Please refer to [link / reference]. Figure 5 This is a schematic diagram of another embodiment of the hot word completion method in this application.

[0160] 501. Obtain the string input by the user;

[0161] Either a server or a terminal can serve as the execution entity for this solution. The following explanation uses a server as an example. The server obtains the search text input by the user. Since the user needs to input character by character, the search text is usually an incomplete string. Intelligent completion based on the user's input string as a prefix at appropriate times can save the user's input time and improve the user experience.

[0162] 502. Search for the target node that matches the string in the preset C-Trie tree to output the first set of hot words;

[0163] The server searches a pre-built C-Trie tree based on the string to determine the target node that matches it. The string corresponding to a node is obtained by concatenating the characters along the path from the root node to a given node in sequence. The string corresponding to the target node that matches the string is the same as the string entered by the user.

[0164] The C-Trie tree in this embodiment is constructed based on the POI hot word database. For the specific process of constructing the C-Trie tree, please refer to the previous embodiment. The details will not be repeated here.

[0165] If the target node stores hot word data, then output the first set of hot words with the string as a prefix based on the hot word data;

[0166] If the target node stores hot word data, the output can be the hot words with the string as a prefix stored in the database. Optionally, the N hot words with the highest completion probability can be selected from the hot word data stored in the target node.

[0167] The output N hot words constitute the first hot word set, where N is an integer greater than or equal to 1. N is a preset value, and its specific value is not limited here; optionally, for example, N can be 3. It is understandable that if there are fewer than N hot words with this string as a prefix, all hot words should be output as the hot words in the first hot word set.

[0168] For example, taking "st" as an example, when the user inputs "st", there is no key-value structure stored on the corresponding node, so hot word completion is not triggered. When the user inputs "star", there is a key-value structure stored on the corresponding node, and the Top-N hot words are selected according to their completion probability. Assuming N=3, the C-Trie tree hot word completion result, i.e., the first set of hot words, is: starbucks, starhub, starhotel.

[0169] 503. Input the string into the generation model to obtain the second set of hot words;

[0170] Based on the user log hot word database, a second hot word set is output with the string as a prefix, and the second hot word set includes at least one hot word.

[0171] There are several ways to output a second set of hot words prefixed with the given string, based on a user log hot word database.

[0172] Optionally, based on the user log hot word database, a user log hot word Trie is constructed to complete the hot words and obtain the second hot word set;

[0173] Optionally, the string is input into a machine learning algorithm trained based on the user log hot word database to output the second hot word set. The machine learning algorithm includes recurrent neural network (RNN), long short-term memory network (LSTM), gated recurrent unit (GRU) or support vector machine (SVM), etc. The specific algorithm is not limited here. In this embodiment, the machine learning algorithm is also referred to as a generative model or a predictive model.

[0174] Optionally, based on the user log hot word database, a user log hot word hash tree is constructed to complete the hot words and obtain the second hot word set.

[0175] The following section introduces a solution for hot word completion using machine learning algorithms based on a user log hot word database:

[0176] If the hot word completion condition is met, the prediction model predicts the hot word results for the user-input string, and the Top-N results are taken as the second hot word set.

[0177] For example, the prediction model used in this embodiment is GRU. The internal structure and principle of GRU will not be described in detail, but its general input-output structure is as follows: Figure 6 As shown. The time-series model GRU has an input character X at the current time step. t And the hidden state h passed down from the previous moment t-1 This hidden state contains information about previous nodes. Combined with X t and h t-1 The GRU will obtain the output y at the current time. t and the hidden state h passed to the next time step t This process continues until the output 'y' is the end-of-line character. By concatenating all the predicted 'y' characters into the user-input string, the final predicted hot words are obtained.

[0178] For example, using 'star' as the model input, each column represents the input and output at a certain time. The predicted Top-3 results are starbucks, starhub, and starstreet, with completion probabilities of 0.77, 0.15, and 0.08, respectively.

[0179] It should be noted that the machine learning algorithm deployed on the server can be trained on hot words in user logs through online learning, which can reflect changes in user log data in real time and ensure the timeliness of hot word completion.

[0180] 504. Based on the first set of hot words and the second set of hot words, determine at least one hot word to recommend to the user.

[0181] The server determines at least one hot word to recommend to the user based on the first hot word set and the second hot word set, and sends it to the terminal. The terminal then displays the recommended hot word to the user through a display device. Alternatively, the terminal determines at least one hot word to recommend to the user based on the first hot word set and the second hot word set, and displays it to the user.

[0182] The server can combine the candidate results with higher confidence and re-rank them based on the candidate result set of the two sets of hot words mentioned above, and recommend the Top-N hot word results.

[0183] Optionally, at least one of the recommended hot words may all belong to the hot words in the first set of hot words; or all belong to the hot words in the second set of hot words; or may include hot words from both the first and second sets of hot words. No specific limitation is made here.

[0184] Optionally, based on the two sets of candidate result sets mentioned above, firstly, the top 1 hot words from both the POI hot word completion candidate set and the log hot word completion candidate set are selected and added to the hot word completion result set. The two top 1s are then deduplicated to obtain K hot words (K = 1 or 2). Next, the remaining 2N-2 candidate results are weighted, summed, and sorted. The weights are adjusted according to the business scenario, and the top (NK) results are added to the hot word completion result set. Finally, the hot word completion result set is reordered to obtain the final hot word completion result.

[0185] For example, 1. Select the top 1 hot word from the POI hot word completion candidate set and the log hot word completion candidate set, respectively, which are "starbucks" and "starbucks". After deduplication, obtain 1 hot word "starbucks" and add it to the result set.

[0186] 2. Sum and sort the remaining results by weight, setting the weight of POI hot word completion to 3 and the weight of log hot word completion to 1. Add the Top (3-1) results "starhub" and "starhotel" to the result set.

[0187] The results of weighted summation and sorting of the remaining results are shown in Table 1:

[0188] Table 1

[0189] starhub 0.60 starhotel 0.33 starstreet 0.08

[0190] 3. Reorder the completed result set to obtain the final hot word completion results: "starbucks", "starhub", "starhotel".

[0191] This application's embodiments use POI data to construct a C-Trie tree, performing conditional filtering on hot words with common prefixes to filter out hot words with excessively low probabilities, reducing the number of candidate hot words for prefixes, and storing the candidate hot words in an orderly manner. Compared to existing technologies that start hot word completion from the first letter entered by the user, this application's embodiment determines whether to trigger hot word completion based on the C-trie tree. This avoids triggering hot word completion when the user's input is too short or the search intent is not yet clear, thus preventing interference with non-hot word search logic. It solves the problems of triggering hot word completion when the input is too short and the low efficiency of hot word completion, effectively improving the performance of hot word completion.

[0192] Furthermore, if the hot word completion method only considers user search logs, the relevance between the completed hot words and POI data cannot be guaranteed, and POI searches using hot words may return no results. The hot word completion method provided in this application integrates the POI hot word database and the user log hot word database, which can improve the relevance between recommended hot words and POI data and reduce the occurrence of no results when searching POIs based on recommended hot words.

[0193] Please see Figure 7 This is a schematic diagram of another embodiment of the hot word completion method in this application.

[0194] S1: Filter POI hot words based on POI data. Calculate the word frequency of each word in the POI data, and select a certain percentage of words with the highest frequency as POI hot words.

[0195] S2: Construct a C-Trie tree based on the selected POI hot words. The specific process for constructing the C-Trie tree is detailed in the preceding embodiments and will not be repeated here.

[0196] S3: Filter hot keywords based on log data. Statistically analyze the frequency of each search term in the log data, and select a certain percentage of words with the highest frequency as hot keywords.

[0197] S4: Based on the filtered hot words in the logs, a character-level generation model is trained to predict and complete incomplete strings. The prediction model includes, but is not limited to, commonly used sequential models such as RNN and LSTM. The model's input is an incomplete string, and its output is the predicted complete hot words.

[0198] S5: For the user-input string, determine whether it meets the hot word completion condition in the C-Trie tree. The determination is based on whether the corresponding node in the C-Trie tree stores key-value (KV) structure data. If the corresponding node does not contain KV structure data, hot word completion is not triggered; if the corresponding node contains KV structure data, hot word completion is triggered. When the hot word completion condition is met, select the Top-N results from the KV structure data of the corresponding node of the string in descending order of completion probability, and use them as the candidate set of hot word completion based on POI data.

[0199] S6: When the hot word completion condition is met, the character-level generation model trained based on log data is used to predict the hot word results of the user input. Similarly, the Top-N results are taken as the hot word completion candidate set based on log data.

[0200] S7: Based on the two candidate result sets mentioned above, firstly, select the top 1 hot word from each of the POI hot word completion candidate set and the log hot word completion candidate set, add them to the hot word completion result set, and remove duplicates to obtain K hot words (K=1 or 2). Then, perform a weighted summation and sorting on the remaining 2N-2K candidate results, adjusting the weights according to the business scenario, and add the top (NK) results to the hot word completion result set. Finally, re-sort the hot word completion result set to obtain the final hot word completion result.

[0201] The word completion method provided in this application has been described above. The word completion device that implements this method is described below. Please refer to [link / reference]. Figure 8 This is a schematic diagram of one embodiment of the word completion device in this application.

[0202] Figure 8 One or more of the various modules can be implemented using software, hardware, firmware, or a combination thereof. The software or firmware includes, but is not limited to, computer program instructions or code, and can be executed by a hardware processor. The hardware includes, but is not limited to, various integrated circuits, such as a central processing unit (CPU), a digital signal processor (DSP), a field-programmable gate array (FPGA), or an application-specific integrated circuit (ASIC).

[0203] The word completion mechanism includes:

[0204] Unit 801 is used to obtain the string input by the user;

[0205] Output unit 802 is used to find a target node in a Trie tree that matches the string in order to output at least one word. The Trie tree includes a plurality of first nodes, and the target node is one of the plurality of first nodes. Each first node stores one or more words. The one or more words all include a string consisting of characters traversed on the path from the root node of the Trie tree to the first node where the one or more words are located. The words stored in the target node include the at least one word to be output.

[0206] Optionally, the prefix of the one or more words is a string consisting of characters along the path from the root node of the Trie tree to the first node where the one or more words are located.

[0207] Optionally, the Trie includes a plurality of second nodes, each of which does not store a word.

[0208] Optionally, the string includes the first character to the Nth character arranged in the order of the user's input; the output unit 802 is specifically used to: search in the trie according to the input order, wherein the string composed of the first character to the (N-1)th character input by the user matches a second node in the trie.

[0209] Optionally, the first node further stores the completion probabilities corresponding to each of the one or more words, wherein the completion probability corresponding to each word indicates the probability of outputting the word when it is matched with the first node.

[0210] Optionally, the first node stores data of at least one key-value structure, the key-value structure including a key and a value associated with the key, the key being a word prefixed with a string of characters traversed on the path from the root node to the first node, and the value being the word completion probability, wherein the completion probability indicates the probability of outputting the key when the first node is matched.

[0211] Optionally, the order of the at least one word in the output is related to the order of the words stored in the target node.

[0212] Optionally, the words stored in the plurality of first nodes are derived from Point of Interest (POI) data or user log data.

[0213] It should be noted that in another possible implementation of the word completion device, the storage format of the nodes in the trie differs from that in this embodiment. Each node corresponds to a string that has one more character than the previous node, including the string corresponding to any node on the path from the root node. In this case, the first node stores at least one word that includes the string corresponding to the first node. The parts other than the storage format of the trie are similar to those in this embodiment, and will not be described in detail here.

[0214] The word completion device in this embodiment can be used to execute the word completion method provided in the foregoing embodiments. It improves upon the traditional trie by storing hot words in the nodes of the improved trie. These hot words include characters traversed on the path from the root node to that node. The hot words stored in the nodes are those with a high probability of being completed; in other words, hot words prefixed with excessively short strings generally have a low probability of being completed and are not stored in the trie nodes. The word completion device obtains the user-input string through an acquisition unit, and an output unit searches for a target node in the improved trie that matches the user-input string, outputting at least one word as a recommended hot word. Since the completed hot words are only output to the user when the target node stores hot words, and the output is based on the words stored in the target node, without needing to search for hot words matching the prefix condition based on the user-input string, the word completion device provided in this embodiment can improve the efficiency of hot word completion and make the completed hot words presented to the user more in line with the user's requirements.

[0215] Please see Figure 9 This is a schematic diagram of another embodiment of the word completion device in this application.

[0216] Figure 9 One or more of the various modules can be implemented using software, hardware, firmware, or a combination thereof. The software or firmware includes, but is not limited to, computer program instructions or code, and can be executed by a hardware processor. The hardware includes, but is not limited to, various integrated circuits, such as a central processing unit (CPU), a digital signal processor (DSP), a field-programmable gate array (FPGA), or an application-specific integrated circuit (ASIC).

[0217] The word completion mechanism includes:

[0218] Unit 901 is used to obtain the string input by the user;

[0219] Output unit 902 is used to search for a target node that matches the string in a Trie to output a first word set, the first word set including at least one word, the first Trie including a plurality of first nodes, the target node being one of the plurality of first nodes, each first node storing at least one word of a string consisting of characters traversed on the path from the root node of the Trie to the first node, the words stored in the target node including words in the first word set, and the words stored in the plurality of first nodes coming from a first word database;

[0220] The output unit 902 is further configured to output a second set of words with the string as a prefix, based on the second word database;

[0221] The output unit 902 is further configured to output at least one word recommended to the user based on the first word set and the second word set.

[0222] Optionally, the first word set includes at least two words arranged in an ordered manner; the second word set includes at least two words arranged in an ordered manner; and the target word set includes the word ranked first in the first word set and the word ranked first in the second word set.

[0223] Optionally, the output unit 902 is specifically used to: output at least one word recommended by the user based on the probability of each word being output in the union of the first word set and the second word set, wherein the probability of each word being output in the union is determined according to a preset first weight of the first word set and a second weight of the second word set.

[0224] Optionally, the output unit 902 is specifically used to: obtain the second word set based on a Trie constructed from the word database of the user logs; or, input the string into a machine learning algorithm trained based on the word database of the user logs to output the second word set; or, obtain the second word set based on a hash tree constructed from the word database of the user logs.

[0225] The word completion device in this embodiment can be used to execute the word completion method provided in the foregoing embodiments. It combines hot word sources from at least two hot word databases to recommend hot words to the user. The nodes of a first trie (prefix tree) constructed based on the first word database store hot words, including characters traversed on the path from the root node to that node. The hot words stored in the nodes are those with a high probability of being completed; in other words, hot words prefixed with very short strings generally have a low probability of being completed and are not stored in the trie nodes. Since the first set of completed words is only output to the user when the target node stores hot words, the word completion device provided in this embodiment can avoid triggering hot word completion in scenarios where the user's input string is short, the intent is unclear, or the probability of hot words being completed is low. Furthermore, combining the first and second word sets to output hot words to the user can improve the accuracy of hot word recommendations.

[0226] Please see Figure 10 This is a schematic diagram of another embodiment of the word completion device in this application.

[0227] This word completion device can be implemented as a software system, which, after deployment, provides services externally via a remote interface. The word completion device includes two modules: an offline module 1001 and an online module 1002, wherein:

[0228] The main task of offline module 1001 is to process data from different data sources into specific data structures or models;

[0229] Online module 1002 is primarily responsible for responding to user query requests.

[0230] Please see Figure 11 This is a schematic diagram of an embodiment of the Trie tree construction device in this application.

[0231] The device for constructing the trie includes: a construction unit 1101, configured to construct a trie based on a word database, the trie including a plurality of first nodes, each first node storing at least one word consisting of a string of characters traversed on the path from the root node to the first node; and a deletion unit 1102, configured to delete words stored in the nodes, retaining words in each node whose completion probability is greater than or equal to a first threshold, the completion probability indicating the probability of outputting a word when the node is matched.

[0232] Optionally, the completion probability is the proportion of the word frequency of the word to the sum of the word frequencies of all words prefixed with characters from the root node to the first node.

[0233] Optionally, the first threshold is a preset value, with a value range of [0.1, 0.2].

[0234] Optionally, the nodes of the Trie store key-value structure data, the key-value structure including a key and a value associated with the key, the key being a word prefixed with characters from the root node to the node, and the value being the completion probability of the word, the completion probability of the word being the proportion of the word frequency to the sum of the word frequencies of all words prefixed with characters from the root node to the first node.

[0235] Optionally, the method further includes: the words stored in the nodes of the Trie are arranged in descending order of completion probability.

[0236] The trie construction apparatus provided in this application embodiment is used to construct the improved Trie tree, i.e., the C-Trie tree, provided in this application embodiment. It improves upon the traditional trie tree by storing hot words in the nodes. The stored hot words include characters traversed on the path from the root node to that node. The hot words stored in the nodes are words whose probability of being completed is greater than or equal to a first threshold. In other words, hot words prefixed with excessively short strings generally have a low probability of being completed and are not stored in the trie tree nodes. Based on the improved trie tree, a target node matching the user's input string is found. Based on the words stored in that target node, at least one word is output as a recommended hot word. Since the completed hot word is only output to the user when the target node stores hot words, and the output is based on the words stored in the target node, it is not necessary to search for hot words that meet the prefix conditions based on the user's input string, thus improving the efficiency of hot word completion. Furthermore, it can avoid triggering hot word completion in scenarios where the user's input string is short, the intent is unclear, or the probability of hot words being completed is low.

[0237] For ease of understanding, the structure of the terminal 100 provided in the embodiments of this application will be illustrated below. See also Figure 12 , Figure 12 This is a schematic diagram of the terminal structure provided in the embodiments of this application.

[0238] like Figure 12As shown, terminal 100 may include processor 110, external memory interface 120, internal memory 121, universal serial bus (USB) interface 130, charging management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0239] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the terminal 100. In other embodiments of this application, the terminal 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0240] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0241] The controller can serve as the central nervous system and command center of the terminal 100. The controller can generate operation control signals based on the instruction opcode and timing signals to control the fetching and execution of instructions. In this application, the controller can implement the word completion method provided in the embodiments of this application based on the instructions.

[0242] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system. Optionally, the memory stores a pre-built Trie tree.

[0243] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I1C) interface, an inter-integrated circuit sound (I1S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0244] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the terminal 100. In other embodiments of this application, the terminal 100 may also adopt different interface connection methods or a combination of multiple interface connection methods as described in the above embodiments.

[0245] The charging management module 140 is used to receive charging input from the charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from the wired charger via the USB interface 130.

[0246] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, internal memory 121, external memory, display 194, camera 193, and wireless communication module 160, etc.

[0247] The wireless communication function of terminal 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.

[0248] In some feasible implementations, terminal 100 can use wireless communication functions to communicate with other devices. For example, terminal 100 can communicate with a second electronic device, establish a screen projection connection with the second electronic device, and output screen projection data to the second electronic device. The screen projection data output by terminal 100 can be audio or video data.

[0249] Antennas 1 and 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.

[0250] The mobile communication module 150 can provide solutions for wireless communication applications including 1G / 3G / 4G / 5G on the terminal 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low-noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 2. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device. The terminal can communicate with the server through the mobile communication module.

[0251] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 170A, receiver 170B, etc.) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.

[0252] The wireless communication module 160 can provide solutions for wireless communication applications on the terminal 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 1, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0253] In some embodiments, antenna 1 of terminal 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling terminal 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).

[0254] Terminal 100 implements display functions through a GPU, display screen 194, and application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0255] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, terminal 100 may include one or N displays 194, where N is a positive integer greater than 1. Specifically, display screen 194 can display output words to the user. Touch-type displays can also acquire strings input by the user.

[0256] In some feasible implementations, the display screen 194 can be used to display various interfaces output by the system of the terminal 100. The various interfaces output by the terminal 100 can be found in the relevant descriptions of subsequent embodiments.

[0257] Terminal 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.

[0258] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimization of image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.

[0259] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, terminal 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0260] A digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals.

[0261] Video codecs are used to compress or decompress digital video. Terminal 100 may support one or more video codecs. Thus, terminal 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG1, MPEG3, MPEG4, etc.

[0262] NPU stands for Neural Network (NN) Computing Processor. By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs can enable intelligent cognitive applications in terminals, such as image recognition, facial recognition, speech recognition, and text understanding.

[0263] The external storage interface 120 can be used to connect an external storage card, such as a Micro SD card, to expand the storage capacity of the terminal 100. The external storage card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external storage card.

[0264] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of terminal 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of terminal 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.

[0265] Terminal 100 can implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, and an application processor. Examples include music playback and recording. In some feasible implementations, the audio module 170 can be used to play sound corresponding to a video. For example, when the display screen 194 shows a video playback screen, the audio module 170 outputs the sound of the video playback.

[0266] The audio module 170 is used to convert digital audio information into analog audio signal output, and also to convert analog audio input into digital audio signal.

[0267] The loudspeaker 170A, also known as a "loudspeaker", is used to convert audio electrical signals into sound signals.

[0268] The receiver 170B, also known as the "earpiece", is used to convert audio electrical signals into sound signals.

[0269] The microphone 170C, also known as a "microphone" or "voice transducer," is used to convert sound signals into electrical signals.

[0270] The 170D headphone jack is used to connect wired headphones. The 170D headphone jack can be a USB 130 interface or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface, a CTIA (Cellular Telecommunications Industry Association of the USA) standard interface.

[0271] Pressure sensor 180A is used to sense pressure signals and can convert the pressure signals into electrical signals. In some embodiments, pressure sensor 180A may be disposed on display screen 194. Gyroscope sensor 180B can be used to determine the motion posture of terminal 100. Barometric pressure sensor 180C is used to measure barometric pressure.

[0272] The accelerometer 180E can detect the magnitude of acceleration of terminal 100 in various directions (including three-axis or six-axis). When terminal 100 is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the terminal's posture and can be applied to applications such as screen orientation switching and pedometers.

[0273] Distance sensor 180F is used to measure distance.

[0274] The 180L ambient light sensor is used to detect ambient light intensity.

[0275] The fingerprint sensor 180H is used to collect fingerprints.

[0276] The 180J temperature sensor is used to detect temperature.

[0277] Touch sensor 180K, also known as a "touch panel," can be located on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a "touchscreen." Touch sensor 180K detects touch operations applied to or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 194. In other embodiments, touch sensor 180K may also be located on the surface of terminal 100, in a different position than display screen 194.

[0278] Buttons 190 include a power button, volume buttons, etc. Buttons 190 can be mechanical buttons or touch-sensitive buttons. Terminal 100 can receive button input and generate key signal inputs related to user settings and function control of terminal 100.

[0279] Motor 191 can generate vibration alerts.

[0280] Indicator 192 can be an indicator light, used to indicate charging status, power changes, or to indicate messages, missed calls, notifications, etc.

[0281] The SIM card interface 195 is used to connect the SIM card.

[0282] Please see Figure 13 This is a schematic diagram of one embodiment of the server in this application.

[0283] The server 1300 provided in this embodiment may vary considerably due to different configurations or performance. It may include one or more processors 1301 and memory 1302, in which programs or data are stored.

[0284] The memory 1302 can be volatile or non-volatile. Optionally, the processor 1301 is one or more central processing units (CPUs), which can be single-core or multi-core CPUs. The processor 1301 can communicate with the memory 1302 and execute a series of instructions stored in the memory 1302 on the server 1300.

[0285] The server 1300 also includes one or more wired or wireless network interfaces 1303, such as Ethernet interfaces.

[0286] Optionally, although Figure 13 As not shown in the diagram, server 1300 may also include one or more power supplies; one or more input / output interfaces, which can be used to connect to monitors, mice, keyboards, touch screen devices or sensing devices, etc. Input / output interfaces are optional components and may or may not be present, and are not limited here.

[0287] The process executed by the processor 1301 in the server 1300 in this embodiment can refer to the method flow described in the foregoing method embodiment, and will not be repeated here.

[0288] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0289] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0290] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0291] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0292] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0293] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method of word completion, characterized by, The method comprises: obtaining a character string input by a user, the character string comprising first characters to Nth characters arranged in an input order of the user; finding a target node matching the character string in a dictionary tree (Trie) to output at least one word; the finding the target node matching the character string in the dictionary tree (Trie) to output the at least one word comprises finding in the Trie according to the input order, wherein the character string consisting of the first characters to N-1th characters input by the user matches a second node in the Trie, the character string consisting of the first characters to Nth characters input by the user matches a first node in the Trie, the Trie comprises a plurality of first nodes and a plurality of second nodes, the target node is one of the first nodes, each of the first nodes stores one or more words, each of the one or more words comprises a character string consisting of characters passing through a path from a root node of the Trie to a first node where the one or more words are located, the target node stores the at least one word to be output, and each of the second nodes does not store a word, and no word is output when the first characters to N-1th characters input by the user match a second node in the dictionary tree.

2. The method of claim 1, wherein a prefix of the one or more words is a character string consisting of characters passing through a path from a root node of the Trie to a first node where the one or more words are located.

3. The method of any one of claims 1 to 2, wherein the first node further stores a completion probability corresponding to each of the one or more words, wherein the completion probability corresponding to each of the words indicates a probability of outputting the word in a case of matching the first node.

4. The method of any one of claims 1 to 2, wherein the first node stores data of at least one key-value structure, the key-value structure comprising a key and a value associated with the key, the key being a word having a prefix of a character string consisting of characters passing through a path from a root node to the first node, and the value being a completion probability of the word, wherein the completion probability indicates a probability of outputting the key in a case of matching the first node.

5. The method of any one of claims 1 to 2, wherein an order of the at least one word to be output is related to an arrangement order of words stored in the target node.

6. The method of any one of claims 1 to 2, wherein words stored in the plurality of first nodes are derived from point of information (POI) data or user log data.

7. A method of word completion, characterized by, The method comprises: obtaining a character string input by a user, the character string comprising first characters to Nth characters arranged in an input order of the user; finding a target node matching the character string in a dictionary tree (Trie) to output a first word set; The method comprises: searching the Trie according to the input order, wherein the string composed of the first character to the N-1th character input by the user matches a second node in the Trie, the string composed of the first character to the Nth character input by the user matches a first node in the Trie, the first word set comprises at least one word, the Trie comprises a plurality of first nodes and a plurality of second nodes, the target node is one of the plurality of first nodes, each first node stores at least one word comprising a string of characters passed on a path from a root node of the Trie to the first node, the word stored in the target node comprises a word in the first word set, the words stored in the plurality of first nodes are from a first word database, and each second node does not store a word; outputting a second word set prefixed by the string based on a second word database; outputting at least one word recommended for the user according to the first word set and the second word set; when the first character to the N-1th character input by the user matches a second node in the Trie, no word is outputted.

8. The method of claim 7, wherein: the first word set comprises at least two words arranged in order; the second word set comprises at least two words arranged in order; the target word set comprises a word ranked first in the first word set and a word ranked first in the second word set.

9. The method of claim 7, wherein: the outputting at least one word recommended for the user according to the first word set and the second word set comprises: outputting at least one word recommended for the user according to a probability of each word in a union set of the first word set and the second word set being outputted, the probability of each word in the union set being outputted being determined according to a first weight of the first word set and a second weight of the second word set.

10. The method of any one of claims 7 to 9, wherein: the outputting a second word set prefixed by the string based on a second word database comprises: obtaining the second word set according to a Trie constructed based on a word database of the user log; or inputting the string into a machine learning algorithm trained based on a word database of the user log to output the second word set; or obtaining the second word set according to a hash tree constructed based on a word database of the user log.

11. A word completion device, characterized by comprising: comprises: an obtaining unit configured to obtain a string input by a user, the string comprising a first character to an Nth character arranged in an input order of the user; an outputting unit configured to search a target node matching the string in a Trie to output at least one word. The output unit is specifically configured to search in the Trie according to the input order, wherein the string composed of the first character to the N-1th character input by the user matches a second node in the Trie, the string composed of the first character to the Nth character input by the user matches a first node in the Trie, the Trie comprises a plurality of first nodes and a plurality of second nodes, the target node is one of the plurality of first nodes, each first node stores one or more words, the one or more words each comprise a string of characters passing through a path from a root node of the Trie tree to a first node at which the one or more words are located, the target node stores the at least one word to be output among the words, and each second node does not store a word, and no word is output when the string composed of the first character to the N-1th character input by the user matches a second node in the Trie.

12. The apparatus of claim 11, wherein, a prefix of the one or more words is a string of characters passing through a path from a root node of the Trie tree to a first node at which the one or more words are located.

13. The apparatus of any one of claims 11 to 12, wherein, the first node further stores a completion probability corresponding to each of the one or more words, and the completion probability corresponding to each word indicates a probability of outputting the word in a case of matching the first node.

14. The apparatus of any one of claims 11 to 12, wherein, the first node stores data of at least one key-value structure, the key-value structure comprising a key and a value associated with the key, the key being a word prefixed with a string of characters passing through a path from a root node to the first node, and the value being a completion probability of the word, wherein the completion probability indicates a probability of outputting the key in a case of matching the first node.

15. The apparatus of any one of claims 11 to 12, wherein, an order of the at least one word to be output is related to an arrangement order of the words stored in the target node.

16. The apparatus of any one of claims 11 to 12, wherein, the words stored in the plurality of first nodes are derived from point of information (POI) data or user log data.

17. A word completion device, comprising: comprises: an acquisition unit configured to acquire a string input by a user, the string comprising a first character to an Nth character arranged in an input order of the user; an output unit configured to search for a target node matching the string in a Trie, and output a first word set. The output unit is specifically configured to search in the Trie according to the input order, wherein the string composed of the first character to the N-1th character input by the user matches a second node in the Trie, the string composed of the first character to the Nth character input by the user matches a first node in the Trie, the first word set includes at least one word, the Trie includes a plurality of first nodes and a plurality of second nodes, the target node is one of the plurality of first nodes, each first node stores at least one word including a string composed of characters on a path from a root node of the Trie to the first node, the target node stores a word included in the first word set, the plurality of first nodes store words from a first word database, and each second node does not store a word. The output unit is further configured to output a second word set prefixed by the string based on a second word database. The output unit is further configured to output at least one word recommended for the user according to the first word set and the second word set. The output unit is further configured to not output a word when the string composed of the first character to the N-1th character input by the user matches a second node in the Trie.

18. The apparatus of claim 17, wherein the first word set includes at least two words arranged in order; the second word set includes at least two words arranged in order; and the target word set includes a word ranked first in the first word set and a word ranked first in the second word set.

19. The apparatus of claim 17, wherein the output unit is specifically configured to: output at least one word recommended for the user according to a probability of each word in a union of the first word set and the second word set being output, the probability of each word in the union being output being determined according to a first weight of the first word set and a second weight of the second word set.

20. The apparatus of any one of claims 17 to 19, wherein the output unit is specifically configured to: obtain the second word set according to a Trie constructed based on a word database of the user log; or input the string into a machine learning algorithm trained based on the word database of the user log to output the second word set; or obtain the second word set according to a hash tree constructed based on the word database of the user log.

21. A server, comprising: comprising: one or more processors and a memory; wherein the memory has stored therein computer readable instructions; the one or more processors read the computer readable instructions to cause the server to implement the method of any one of claims 1 to 10.

22. A terminal, characterized by comprising: one or more processors and a memory; wherein the memory has stored therein computer readable instructions; the one or more processors read the computer readable instructions to cause the server to implement the method of any one of claims 1 to 10.

23. A computer program product, characterised in that, Computer-readable instructions comprising, when run on a computer, cause the computer to perform the method of any one of claims 1 to 10.

24. A computer-readable storage medium, characterized in that, Computer-readable instructions comprising, when run on a computer, cause the computer to perform the method of any one of claims 1 to 10.

Citation Information

Patent Citations

  • Method and system for storage word library, and method and system for searching words

    CN101727499A

  • Word processing method and system for search services

    CN107665217A

  • Search method and device and storage medium

    CN110597956A

  • Dictionary tree-based search processing method,device and equipment,and storage medium

    CN110851722A