Search term recommendation method, device, apparatus, and computer-readable storage medium
By dividing the search term into multiple segments and querying the identifier information in the identifier mapping table, the accuracy problem of the prefix tree under complex search term combinations is solved, and more efficient search term recommendation is achieved.
Patent Information
- Application Number
- CN202111264694.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-28
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2041-10-28
AI Technical Summary
In the prior art, when performing search term recommendations through prefix trees, complex search term combinations cannot be accurately identified and recommended, especially in scenarios where Chinese characters and pinyin are mixed input, resulting in reduced accuracy of search term recommendations.
The search term is segmented into multiple segments, and the identification information is searched in the corresponding identification mapping table according to the preset type to which it belongs. Candidate recommendation terms are obtained through matching and sorting to improve the accuracy of the recommendation.
Through segmentation processing and identification information matching, it is possible to correct complex search word combinations, thereby improving the accuracy and recommendation efficiency of candidate recommendation words.
Smart Images

Figure CN114036371B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a search term recommendation method, apparatus, device, and computer-readable storage medium. Background Art
[0002] The entry point of a search engine corresponds to a search bar. The quality of the recommended search terms directly affects whether the data returned to the user meets their needs. Search term drop-down recommendations refer to the display of related terms in a bar below the search bar when any input is entered. Search term drop-down recommendations can also be understood as auto-completion based on the search term. To reduce input costs during the user search input process, they predict and expand user intent. This is a keyword association service provided by search engines to reduce user input and improve search efficiency.
[0003] In the existing technology, the search engine background needs to maintain a recommended word library, which is stored in the structure of a prefix tree. When the user enters a search term, the search term is matched in the structure of the prefix tree, and the recommended words that match the search term are returned. The recommended words are sorted and displayed in the drop-down recommendation bar.
[0004] However, the method of recommending search terms through prefix trees cannot accurately identify and recommend complex search term combinations, thereby reducing the accuracy of search term recommendations. Summary of the Invention
[0005] An embodiment of the present invention provides a search term recommendation method, apparatus, device and computer-readable storage medium. Through segmentation processing, the search term is segmented into multiple segmentation elements, and the identification information of the segmentation element is queried in the identification mapping table corresponding to the preset type to which the segmentation element belongs, so as to match the candidate recommendation term according to the identification information, and then recommend the search term according to the ranking result of the candidate recommendation term, thereby improving the accuracy of the search term recommendation.
[0006] The technical solution of the embodiment of the present invention is achieved as follows:
[0007] In a first aspect, an embodiment of the present invention provides a search term recommendation method, the method comprising: obtaining a search term; segmenting the search term to obtain a plurality of segmentation elements; querying identification information of each of the plurality of segmentation elements in an identification mapping table corresponding to the preset type according to the preset type to which the plurality of segmentation elements belong; matching in a recommendation table according to the identification information of each of the plurality of segmentation elements to obtain candidate recommendation terms; sorting the candidate recommendation terms according to word frequency information to obtain a sorting result, and making recommendations based on the sorting result.
[0008] In a second aspect, an embodiment of the present invention provides a search term recommendation device, the device comprising: an acquisition module for acquiring search terms; a segmentation module for segmenting the search terms to obtain a plurality of segmentation elements; a query module for querying, according to the preset types to which the plurality of segmentation elements belong, the identification information of each of the plurality of segmentation elements in an identification mapping table corresponding to the preset type; a matching module for matching in a recommendation table according to the identification information of each of the plurality of segmentation elements to obtain candidate recommendation terms; a recommendation module for sorting the candidate recommendation terms according to word frequency information to obtain a sorting result, so as to make recommendations based on the sorting result.
[0009] In a third aspect, an embodiment of the present invention provides a search term recommendation device, which includes a memory for storing executable instructions and a processor for implementing the above-mentioned search term recommendation method when executing the executable instructions stored in the memory.
[0010] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having executable instructions stored thereon for implementing the above-mentioned search term recommendation method when executed by a processor.
[0011] Embodiments of the present invention provide a search term recommendation method, apparatus, device, and computer-readable storage medium. According to the solution provided by the embodiments of the present invention, a search term is obtained and segmented to obtain multiple segmentation elements. Based on the preset types to which the multiple segmentation elements belong, identification information for each of the multiple segmentation elements is queried in an identification mapping table corresponding to the preset types. Through segmentation, complex search term combinations can be segmented into multiple segmentation elements, and identification information for each of the multiple segmentation elements is queried according to different types. This allows for search term error correction for complex search term combinations, thereby improving the accuracy of candidate recommendation terms when subsequently matching candidate recommendation terms. Based on the identification information for each of the multiple segmentation elements, matching is performed in a recommendation table to obtain candidate recommendation terms. The candidate recommendation terms are then ranked based on word frequency information to obtain a ranking result, allowing search term recommendations to be made based on the ranking result. Through segmentation and querying the identification information for each segmentation element in the identification mapping table corresponding to the preset type, candidate recommendation terms are matched based on the identification information, and search term recommendations are made based on the ranking result of the candidate recommendation terms, thereby improving the accuracy of recommended search terms. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 A flowchart of optional steps of a search term recommendation method provided by an embodiment of the present invention;
[0013] Figure 2 A flowchart of optional steps of another search term recommendation method provided by an embodiment of the present invention;
[0014] Figure 3 A flowchart of optional steps of another search term recommendation method provided by an embodiment of the present invention;
[0015] Figure 4 A flowchart of optional steps of a sliding window matching principle provided by an embodiment of the present invention;
[0016] Figure 5 A flowchart of optional steps of another search term recommendation method provided by an embodiment of the present invention;
[0017] Figure 6 An optional system architecture diagram of a search term recommendation method provided by an embodiment of the present invention;
[0018] Figure 7 A flowchart of optional steps of another search term recommendation method provided by an embodiment of the present invention;
[0019] Figure 8 A schematic structural diagram of a search term recommendation device provided by an embodiment of the present invention;
[0020] Figure 9 A schematic diagram of the structure of a search term recommendation device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0021] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. It should be understood that some of the embodiments described here are only used to explain the technical solutions of the present invention and are not used to limit the technical scope of the present invention.
[0022] In order to better understand the search term recommendation method provided in the embodiment of the present invention, before introducing the technical solution of the embodiment of the present invention, the relevant technology is first explained.
[0023] The automatic completion of search terms must be fast and responsive, and the list of recommended words must be updated immediately after the user enters the next character, so that search terms can be quickly recommended to the user. The relevant technical solution adopts the prefix tree method. The prefix tree can be called a word search tree, which is used to store a large number of character strings. The prefix tree is a tree data structure that uses the common prefix of the string to speed up the completion speed. A group of words are arranged in a node tree, and the words are stored along the path from the root node to the leaf node. The level of the tree corresponds to the letter position of the prefix. The completion of the prefix is searched along the path defined by the prefix. For example, the core of the automatic completion based on the prefix tree is a function that accepts the prefix of the search term entered by the user and searches for a list of words that begin with the given prefix. If the path defined by the prefix cannot be found in the tree, it means that the recommended vocabulary does not contain words that begin with the prefix.
[0024] However, when implementing search term recommendation in the way of prefix tree, for complex combinations of search terms, such as the scenario of mixed input of Chinese characters and pinyin, the search terms cannot be accurately recognized and effectively recommended, reducing the accuracy of search term recommendation.
[0025] Based on the disadvantages existing in the related technologies, the present invention provides a search term recommendation method, which can be applied to the dropdown recommendation of search terms in various search engines, can correct search terms for complex combinations of search terms. Exemplarily, it can be applied to the e-commerce field and other scenarios that need to support Chinese, pinyin and English at the same time. As Figure 1 shown, Figure 1 FIG. is a flowchart of steps of a search term recommendation method provided by an embodiment of the present invention. The search term recommendation method includes the following steps:
[0026] S101. Obtain a search term.
[0027] The search term in the embodiment of the present invention represents the word input by the user in the search bar when performing a search. The search term can be a Chinese character, pinyin, initials abbreviation of pinyin, English, English abbreviation, or a combination of any two or more of the above.
[0028] It should be noted that the pinyin in the embodiment of the present invention refers to the syllables composed of various combinations of 23 initials, 24 finals and 16 whole recognition syllables. Exemplarily, there are 410 pinyins.
[0029] S102. Perform segmentation processing on the search term to obtain multiple segmentation elements.
[0030] The search term can be understood as a query string. The search term can include various different types of characters. When performing segmentation processing on the search term, the segmentation method can be appropriately set by those skilled in the art according to actual needs, as long as the search term can be effectively segmented. Exemplarily, a general segmentation method can be adopted. First, 410 pinyins are maintained, and then comparison is performed from front to back, as well as the processing of some special cases, so as to implement the segmentation processing of the search term.
[0031] For a search term composed of a single character, such as "today's weather", "jintiantianqi", "today'sweather", the general segmentation method can be adopted to perform segmentation processing on the search term. Taking "today's weather" as an example, after performing segmentation processing on the search term, four segmentation elements are obtained, and the four segmentation elements include "今", "天", "天" and "气". For complex combinations of search terms, for example, taking the input "京dongj" as an example, after performing segmentation processing on the search term, multiple segmentation elements are obtained, and the multiple segmentation elements include "京", "dong" and "j".
[0032] S103. Query the identification information of each of the multiple segmentation elements in the identification mapping table corresponding to the preset type according to the preset type to which the multiple segmentation elements belong.
[0033] Different segmentation elements belong to different types. Taking the segmentation elements "京", "dong", and "j" as an example, the type of the segmentation element "京" belongs to a character, which can be understood as a Chinese character. The type of the segmentation element "dong" belongs to pinyin, and the type of the segmentation element "j" belongs to the initial letter of pinyin. Correspondingly, the identification mapping table corresponding to the preset type may include a character table and a pinyin table. The character table stores each character and the identification information corresponding to each character. The pinyin table stores each pinyin and the identification information corresponding to each pinyin. Since letters correspond to letters, there is no corresponding identification mapping table for letters. Exemplarily, the identification information represents the unique information of the segmentation element. For example, the identification information may be an identity document number (ID).
[0034] Compared with the solution of recommending search terms through a prefix tree, in the embodiment of the present invention, through segmentation processing, a complex search term combination can be segmented into multiple segmentation elements, and the identification information of the multiple segmentation elements can be queried according to different types, so as to perform search term error correction for the case of a complex search term combination, and correct a search term with a mixed input of Chinese characters and pinyin into a correct word, thereby improving the accuracy of candidate recommended words when performing candidate recommended word matching subsequently.
[0035] S104. Match in the recommendation table according to the identification information of each of the multiple segmentation elements to obtain candidate recommended words.
[0036] For a complex search term combination, the identification information of each of the multiple segmentation elements belongs to different types, and matching needs to be performed in different recommendation tables. The recommendation table in the embodiment of the present invention includes a Chinese recommendation table and an English recommendation table. The embodiment of the present invention matches in the Chinese recommendation table and / or the English recommendation table according to the identification information of each of the multiple segmentation elements, so as to obtain candidate recommended words. The candidate recommended words may be one or more, and the embodiment of the present invention does not limit the number of candidate recommended words.
[0037] S105. Sort the candidate recommended words according to the word frequency information to obtain a sorting result, so as to perform recommendations according to the sorting result.
[0038] Normally, there may be many candidate recommendation words obtained according to S101-S104, but the candidate recommendation words that can be displayed in the user interface are limited. Therefore, it is necessary to display the most frequently searched or most valuable candidate recommendation words. In the embodiment of the present invention, the candidate recommendation words in the recommendation table all correspond to word frequency information. The word frequency information is used to characterize the weight (weight) of the candidate recommendation words, and can also be understood as the recommendation coefficient, importance or number of historical searches, etc. In the embodiment of the present invention, the candidate recommendation words are sorted according to the word frequency information to obtain a sorting result. The sorting result is sorted according to the importance of the candidate recommendation words, which can be used to recommend to users, thereby automatically completing the search words and improving the accuracy of the search word recommendation.
[0039] According to the solution provided by an embodiment of the present invention, a search term is obtained, and the search term is segmented to obtain a plurality of segmentation elements; according to the preset types to which the plurality of segmentation elements belong, the identification information of each of the plurality of segmentation elements is queried in the identification mapping table corresponding to the preset type. Through the segmentation process, a complex search term combination can be segmented into a plurality of segmentation elements, and the identification information of the plurality of segmentation elements is queried according to different types, so that search term errors can be corrected for the case of a complex search term combination, thereby improving the accuracy of the candidate recommendation terms when matching the candidate recommendation terms subsequently. According to the identification information of each of the plurality of segmentation elements, matching is performed in the recommendation table to obtain candidate recommendation terms, and the candidate recommendation terms are sorted according to the word frequency information to obtain a sorting result, so that search term recommendations are made according to the sorting result. Through the segmentation process and the query of the identification information of each segmentation element in the identification mapping table corresponding to the preset type, and then matching the candidate recommendation terms according to the identification information, and then making search term recommendations according to the sorting result of the candidate recommendation terms, the accuracy of the recommended search terms is improved.
[0040] In some embodiments, the preset types include characters, pinyin, and the first letters of pinyin, the identification mapping table includes a character table and a pinyin table, and the identification information includes first identification information, second identification information, and third identification information. The above S103 can be implemented in the following manner, and the types of segmentation elements are described here as characters, pinyin, and the first letters of pinyin. If there is a segmentation element with a preset type of character among multiple segmentation elements, the first identification information of the segmentation element is queried in the character table; if there is a segmentation element with a preset type of pinyin among multiple segmentation elements, the second identification information of the segmentation element is queried in the pinyin table; if there is a segmentation element with a preset type of pinyin among multiple segmentation elements, the third identification information of the segmentation element is the first letter of pinyin itself.
[0041] The search term can be understood as a query string. For complex search term combinations, the segmented elements can be of one or more of the following types: characters, pinyin, and pinyin initials. The query string after segmentation can be understood as an intelligent information (Intelligent Info) data structure.
[0042] The character table stores each character and the identification information corresponding to each character, and the pinyin table stores the pinyin of each character and the identification information corresponding to the pinyin of each character. Taking Chinese characters as an example, the character table stores more than 6,000 Chinese characters and the ID corresponding to each Chinese character, which can also be understood as a mapping of more than 6,000 commonly used Chinese characters to IDs; the pinyin table stores 410 pinyins and the ID corresponding to each pinyin, which can also be understood as a mapping of 410 pinyins to pinyin IDs. The embodiment of the present invention queries the identification information in the corresponding character table or pinyin table according to the type of segmentation element, thereby improving the accuracy of the identification information.
[0043] In some embodiments, the recommendation table in S104 can be generated through S201-S203, such as Figure 2 As shown, Figure 2 A flowchart of optional steps of another search term recommendation method provided by an embodiment of the present invention.
[0044] S201: Obtain a preset vocabulary and a user's historical query vocabulary.
[0045] The preset vocabulary includes multiple recommended words and word frequency information for each recommended word. The word frequency information is used to represent the weight of the candidate recommended words. For example, the recommended words in the preset vocabulary can be high-frequency words selected from a corpus, which can be generated by performing word segmentation and part-of-speech tagging on a preset plain text corpus. The preset vocabulary can be understood as a collection of predefined high-frequency words. High-frequency words can be determined by analyzing the number of searches or search frequencies of a large number of words, as long as they can reflect the search frequency of the words in the preset vocabulary.
[0046] The user's historical query lexicon represents a user's historical search data and can also be understood as a user's query log. It can include multiple search terms and their frequency information. The user's historical query lexicon is related to the user's search terms during searches and can be determined by analyzing a large amount of user search data collected by the search engine, although this is not a limitation in this embodiment of the present invention.
[0047] S202: Based on the user's historical query vocabulary, update the recommended words and the frequency information of the recommended words in the preset vocabulary to generate a recommended vocabulary.
[0048] Embodiments of the present invention can analyze a user's historical query vocabulary, select high-frequency words from the user's historical query vocabulary, and then perform update operations such as adding or deleting recommended words in a preset vocabulary. Furthermore, based on the frequency information of search terms in the user's historical query vocabulary, update operations such as adding or deleting recommended words in the preset vocabulary can be performed to continuously optimize and update the recommended vocabulary, thereby generating a recommended vocabulary. For example, the update frequency of the recommended vocabulary can be adjusted based on the actual application situation, for example, it can be set to update once a day.
[0049] The embodiment of the present invention combines high-frequency words analyzed in the user's historical query vocabulary to update the recommended words in the preset vocabulary and the word frequency information of the recommended words, thereby improving the accuracy of generating the recommended vocabulary.
[0050] The recommended word library comprehensively considers the preset word library and the user's historical query word library. It is a user-personalized recommended word library that is closely related to the user's query habits. When the recommended word library is used to recommend search terms to users, the accuracy of the search term recommendation is improved.
[0051] S203: Generate a recommendation table based on the recommendation vocabulary and the identification mapping table.
[0052] The recommended word library stores multiple recommended words, and the identification mapping table stores each character, the identification information corresponding to each character, the pinyin of each character, and the identification information corresponding to each character's pinyin. Each recommended word in the recommended word library includes one or more characters. Each character and the pinyin of each character in each recommended word are mapped according to the identification mapping table, and the recommendation table is generated by combining the pinyin initials of each character. The recommendation table stores multiple recommended words, the identification information of each character in each recommended word, the identification information corresponding to each character's pinyin, and the pinyin initials of each character.
[0053] In some embodiments, the identification mapping table includes a character table and a pinyin table, the recommended word library includes a Chinese recommended word library and an English recommended word library, and the recommendation table includes a Chinese recommendation table and an English recommendation table. The above S203 can be implemented in the following manner: based on the Chinese recommended word library, the character table and the pinyin table, according to a first preset data structure, a Chinese recommendation table is generated, wherein the first preset data structure includes: first identification information corresponding to each character in the recommended word, second identification information corresponding to the pinyin of each character in the recommended word, and the pinyin initials of the pinyin of each character in the recommended word; based on the English recommended word library, an English recommendation table is generated according to a second preset data structure, wherein the second preset data structure includes: each letter in the recommended word.
[0054] In the embodiment of the present invention, the recommended word library includes a Chinese recommended word library and an English recommended word library, wherein the Chinese recommended word library stores Chinese words and the English recommended word library stores English words. The identifier mapping table includes a character table and a pinyin table.
[0055] When generating a recommendation table, this can be achieved through the following two examples. The first example generates a Chinese recommendation table based on a Chinese recommendation word library, a character table, and a pinyin table, according to a first preset data structure. The Chinese recommendation table stores multiple Chinese recommended words, as well as identification information for each character in each recommended Chinese word, identification information corresponding to the pinyin of each character, and the pinyin initials of each character. The first preset data structure includes: first identification information corresponding to each character in the recommended word, second identification information corresponding to the pinyin of each character in the recommended word, and the pinyin initials of each character in the recommended word. Exemplarily, the first preset data structure is shown in Table 1, which is a schematic diagram of an optional data table format for a Chinese recommendation table provided in an embodiment of the present invention. In Table 1, Field represents different storage structures: word stores multiple recommended words, charact_id stores the id corresponding to each character in the recommended word, phonetic_id stores the id corresponding to the pinyin of each character in the recommended word, and initial_char stores the pinyin initials of each character in the recommended word. Type represents different data types: varchar represents a variable-length string, Smallint represents a short integer, and char represents a letter.
[0056] Table 1
[0057] Field Type word varchar charact_id smallint phonetic_id smallint initial_char char
[0058] In the second example, an English recommendation table is generated according to the English recommendation word library and the second preset data structure. The English recommendation table stores multiple English recommendation words and each letter in each English recommendation word. Among them, the second preset data structure includes: each letter in the recommendation word. Exemplarily, the second preset data structure is shown in Table 2, which is a schematic diagram of an optional data table format of an English recommendation table provided by an embodiment of the present invention. The meaning of the text content in Table 2 is the same as that in Table 1, and will not be repeated here. The difference is that since only letters need to be stored in the English recommendation table, each letter is stored in sequence in initial_char of Table 2.
[0059] Table 2
[0060] Field Type initial_char char
[0061] It should be noted that the first and second in the embodiments of the present invention are only for distinguishing the names and do not represent an order relationship. They cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated, for example, the first identification information, the second identification information, the first preset data structure, and the second preset data structure.
[0062] Table 1 shows all the words in the recommended word library stored in Word, that is, words that may be recommended to users. For example, taking the Chinese recommended word "Jingdong Finance" as an example, that is, the word is "Jingdong Finance", the following is an example of a Chinese recommended word in the Chinese recommendation table.
[0063] word:JD Finance
[0064] charact_id_01:101
[0065] charact_id_02:22
[0066] charact_id_03:5968
[0067] charact_id_04:5162
[0068] phonetic_id_01:23
[0069] phonetic_id_02:14
[0070] phonetic_id_03:22
[0071] phonetic_id_04:265
[0072] initial_char_01:j
[0073] initial_char_02:d
[0074] initial_char_03:j
[0075] initial_char_04:r
[0076] The Chinese recommendation table includes the identification information corresponding to each character in "JD Finance". For example, "京" corresponds to charact_id_01, and its identification information is 101; "东" corresponds to charact_id_02, and its identification information is 22; "金" corresponds to charact_id_03, and its identification information is 5968; "融" corresponds to charact_id_04, and its identification information is 5162. The Chinese recommendation table also includes the identification information corresponding to the pinyin of each character in "JD Finance". For example, "jing" corresponds to phonetic_id_01, and its identification information is 23; "dong" corresponds to phonetic_id_02, and its identification information is 14; "jin" corresponds to phonetic_id_03, and its identification information is 22; "rong" corresponds to phonetic_id_04, and its identification information is 265. The Chinese recommendation table also includes the first letters of the pinyin of each character in "JD Finance". For example, "j" corresponds to initial_char_01, which is "j"; "d" corresponds to initial_char_02, which is "d"; "j" corresponds to initial_char_03, which is "j"; "r" corresponds to initial_char_04, which is "r".
[0077] It should be noted that the above identification information can be set by those skilled in the art according to the actual situation. Here, only "101, 22, 5968, 5162, 23, 14, 22, 265" is used as an example for illustration, and it does not represent the specific content of the identification information in the embodiments of the present invention.
[0078] In some embodiments, the above S104 and S105 can also be implemented through S301 and S302, and it can also be understood that the search term recommendation method provided by the embodiments of the present invention includes S101, S102, S103, S301 and S302. On Figure 1 this basis, as Figure 3 shown Figure 3 is an optional step flow chart of another search term recommendation method provided by the embodiments of the present invention.
[0079] S301. Match in the Chinese recommendation table according to the identification information of each segmentation element to obtain Chinese candidate recommended terms.
[0080] Among them, the candidate recommended terms include Chinese candidate recommended terms, the recommendation table includes the Chinese recommendation table, the Chinese recommendation table is used to store the mapping relationship between the recommended terms and the identification information, as well as the first letters of the pinyin of each character in the recommended terms, and the identification information includes the first identification information corresponding to each character in the recommended terms, and the second identification information corresponding to the pinyin of each character in the recommended terms.
[0081] S302. If the number of Chinese candidate recommended words is a positive integer, sort the Chinese candidate recommended words to obtain a sorting result.
[0082] In the embodiment of the present invention, by performing segmentation processing on the search term to obtain multiple segmentation elements, and then querying the identification information of each segmentation element in the identification mapping table corresponding to the preset type, it is possible to correct the search term for a complex combination of search terms. For example, the search term "jingdongjr" with mixed Chinese characters and pinyin can be corrected into the correct word.
[0083] Since the Chinese recommended table stores the mapping relationship between the recommended words and the identification information, as well as the first letters of the pinyin of each character in the recommended words, the identification information includes the first identification information corresponding to each character in the recommended word and the second identification information corresponding to the pinyin of each character in the recommended word. Therefore, according to the identification information of each segmentation element, matching can be performed in the Chinese recommended table to obtain Chinese candidate recommended words. If the number of Chinese candidate recommended words is not 0, it means that the input search term contains Chinese characters, and it is not considered that the user wants to input English, but a situation like "jingdong" containing pinyin. It is necessary to query the content related to Chinese and recommend Chinese candidate recommended words to the search bar. At this time, there is no need to search in the English recommended table, and the Chinese candidate recommended words are directly sorted according to the word frequency information to obtain a sorting result.
[0084] The search term recommendation method provided by the embodiment of the present invention can not only recommend search terms for regular search terms composed of single characters, but also recommend search terms for complex combinations of search terms, improving the accuracy of recommended search terms. According to the user's input habit, if the first character in the search term is Chinese, the user is likely to search for Chinese. Therefore, if the number of Chinese candidate recommended words matched in the Chinese recommended table according to the identification information of each segmentation element is a positive integer, it means that the user wants to search for Chinese this time, and the Chinese candidate recommended words are sorted to obtain a sorting result, improving the recommendation efficiency.
[0085] In some embodiments, the above S301 can also be implemented in the following manner: According to the identification information of each segmentation element, with the identification information of the first segmentation element as the prefix, perform matching in the Chinese recommended table to obtain the original Chinese candidate recommended words; after sliding the identification information of each segmentation element one or more positions backward in the order of the position of the identification information, perform matching in the Chinese recommended table to obtain the supplementary Chinese candidate recommended words; where the Chinese candidate recommended words include the original Chinese candidate recommended words and the supplementary Chinese candidate recommended words.
[0086] Exemplarily, taking the search term "Jingdongj" as an example, the search term is segmented to obtain multiple segmentation elements "Jing", "dong", and "j", representing three types: character, full pinyin, and initial pinyin letter respectively. Then, the corresponding ids id1 and id2 of "Jing" and "dong" are queried in the character table and pinyin table. Since "j" corresponds to a letter, no query is required. In this example, when matching in the Chinese recommendation table, it can be implemented through the following pseudo-code.
[0087] select word from intelligent_table where charact_id[1]=id1 and phonetic_id[2]=id2 and initial_char[3]="j".
[0088] Through the above pseudo-code, the eligible Chinese candidate recommended words starting with "Jing" can be queried.
[0089] However, the recommended words where "Jing" is in the middle position still cannot be matched. For example, for the recommended word "Rongjingdong Street", it cannot be matched because "Jing" is in the second position instead of the first position. Therefore, the embodiment of the present invention continues to match by sliding the search condition backward, which can be implemented through the following pseudo-code.
[0090]
[0091] Where, N is the maximum word length set in advance, generally set to 8, that is, words longer than 8 characters will not be recommended. len is the word length of the search condition, and doc_set is the supplementary Chinese candidate recommended words matched according to the search term.
[0092] As Figure 4 shown, Figure 4 is an optional step flow chart of a sliding window matching principle provided by the embodiment of the present invention. Figure 4 N in Figure 4 is the maximum word length set in advance. Taking N equal to 8 and the search term being "Jingdongj" as an example for illustration, Figure 4 id1 in
[0093] When I=1, the search condition is shifted right by one position, that is, the respective identification information of the multiple segmentation elements is slid to the right by one identification information position in the order of the positions of the identification information id1 id2 id3, and then matched in the Chinese recommendation table to obtain supplementary Chinese candidate recommendation words. The above-mentioned matching method of supplementary Chinese candidate recommendation words is implemented by the following pseudo code.
[0094] select word from intelligent_table where charact_id[2]=id1 and phonetic_id[3]=id2 and initial_char[4]="j".
[0095] The same applies to other cases. For example, when I = 3, the search condition is shifted right by three positions. That is, the identification information of the multiple segmentation elements is slid to the right by three identification information positions in the order of the position of the identification information id1 id2 id3, and then matched in the Chinese recommendation table to obtain supplementary Chinese candidate recommendation words. The above-mentioned matching method for Chinese candidate recommendation words is implemented by the following pseudo code.
[0096] select word from intelligent_table where charact_id[4]=id1 and phonetic_id[5]=id2 and initial_char[6]="j".
[0097] When making recommendations based on search terms, related technologies, such as prefix trees and DFAs, can only return recommended terms prefixed with the search term, reducing the accuracy and richness of the recommended terms. In an embodiment of the present invention, a sliding window method is used to dynamically adjust the search conditions, specifically adjusting the positions of the identification information of multiple segments in the search term. For example, after sliding one or more identification information backward, matching is performed in the Chinese recommendation table according to the positional order of the identification information. This enriches the matched supplementary Chinese candidate recommendation terms, improves recommendation efficiency, and enhances the accuracy of search term recommendations.
[0098] The embodiment of the present invention can not only return the original Chinese candidate recommendation words with the search word at the prefix of the recommendation word, but also return the supplementary Chinese candidate recommendation words with the search word at the middle part of the recommendation word, thereby improving the richness and accuracy of the Chinese candidate recommendation words.
[0099] In some embodiments, after the above S301 is executed, the embodiment of the present invention may further execute S303-S305, which may also be understood as the search term recommendation method provided by the embodiment of the present invention including S101, S102, S103, S301, S303, S304 and S305. Figure 1 and Figure 3 On the basis of Figure 5 As shown, Figure 5 This is an optional step flow chart of another search term recommendation method provided in an embodiment of the present invention. It should be noted that S302 and S303-S305 are parallel schemes. After S301, S303-S305 can be executed, or S302 can be executed. The specific execution method is determined according to the number of Chinese candidate recommendation words, and this embodiment of the present invention does not limit this.
[0100] S303: If the number of the Chinese candidate recommendation words is zero, perform single letter segmentation processing on the multiple segmentation elements to obtain multiple letters.
[0101] S304: Match multiple letters in the English recommendation table to obtain English candidate recommendation words.
[0102] The candidate recommendation words also include English candidate recommendation words, and the recommendation table also includes an English recommendation table, which is used to store each letter of the recommendation word.
[0103] S305: Sort the English candidate recommendation words to obtain a sorting result.
[0104] If the number of Chinese candidate recommendations is zero when matching multiple segmentation elements against the Chinese recommendation table based on their respective identification information, it indicates that the user is likely searching for English. Therefore, it is necessary to segment the multiple segmentation elements into individual letters to obtain multiple letters. Since the English recommendation table stores each letter of the recommended word, matching multiple letters against the English recommendation table to obtain English candidate recommendations is performed, and then the English candidate recommendations are sorted to obtain the ranking result.
[0105] The embodiment of the present invention matches the Chinese candidate recommendation words in the Chinese recommendation table and the English candidate recommendation words in the English recommendation table according to the number of Chinese candidate recommendation words. Compared with the solution of recommending search words through prefix tree, the accuracy of the matching results is improved.
[0106] It should be noted that for special search terms, for example, the search term entered is "women", it first needs to be split into wo and men according to pinyin, and then matched in the Chinese recommendation table. If the number of Chinese candidate recommendation terms is zero, it is split according to the English recommendation table, that is, split letter by letter, and split into w, o, m, e, and n respectively.
[0107] The following describes an exemplary application of an embodiment of the present invention in a practical application scenario.
[0108] An embodiment of the present invention provides a search term recommendation method, which combines a preset vocabulary and a user's historical query vocabulary to generate a recommended vocabulary, and updates the recommended vocabulary in real time. The recommended vocabulary is converted into a recommendation table with a mapping relationship with identification information such as characters, pinyin, and pinyin initials. The search term input by the user is then segmented, and the identification information of each segmentation element is queried in the corresponding character table or pinyin table according to the preset type to which the segmentation element belongs. This method can correct errors in search terms input with a mixture of Chinese characters and pinyin, thereby improving the accuracy of candidate recommendation terms matched based on the recommendation table. The embodiment of the present invention also provides a sliding window search term recommendation based on the recommendation table, which can not only return search terms with the search term as a prefix, but also return recommended terms with the search term in the middle position, thereby improving the richness and accuracy of the search term recommendation.
[0109] To facilitate understanding of this solution, before introducing the search term recommendation method in detail, we first describe the search term recommendation system. Figure 6 As shown, Figure 6 An optional system architecture diagram of a search term recommendation method provided by an embodiment of the present invention.
[0110] 1. Recommended vocabulary update module.
[0111] The recommended vocabulary update module is used to update the recommended vocabulary based on the preset vocabulary and the user's historical query vocabulary. First, high-frequency words are selected from the corpus as the preset vocabulary. Subsequently, by analyzing the user query logs in the user's historical query vocabulary, high-frequency words are selected, and the preset vocabulary is supplemented with recommended words. The word frequency information of the recommended words in the preset vocabulary is updated, and the preset vocabulary is continuously optimized to obtain the recommended vocabulary. The update frequency of the recommended vocabulary can be adjusted according to the actual situation of the application and can be set to update once a day. The recommended vocabulary is a personalized recommended vocabulary for users, which is closely related to the user's query habits. When the recommended vocabulary is used to recommend search terms to users, the accuracy of the search term recommendations is improved.
[0112] Load and parse all recommended word libraries and build the relevant data structures. Generate recommendation tables based on the recommended word libraries, character tables, and pinyin tables. The recommended word libraries include both Chinese and English recommended word libraries, and the recommendation tables include both Chinese and English recommendation tables.
[0113] 2. Preprocessing module.
[0114] The preprocessing module can be understood as a segmentation module, and the search term can be understood as a query string. The query string input by the user is preprocessed, that is, the segmentation operation is performed according to the type of the query string, and the input query string is divided into three parts: characters, pinyin, and the first letter of the pinyin. The preprocessed query string will be converted into a data structure of the IntelligentInfo type. As shown in the data structure of the IntelligentInfo type in Table 1 above, charact_id stores the id corresponding to each character in the recommended word, phonetic_id stores the id of the pinyin corresponding to each character in the recommended word, and initial_char stores the first letter of the pinyin corresponding to each character in the recommended word.
[0115] 3. Recommendation word matching module.
[0116] The user's query string is matched against the recommendation table, and matching terms are added to a candidate set. The candidate set is then expanded using a sliding window. The candidate recommendation terms in the candidate set are sorted from highest to lowest based on their frequency, and the sorted results are returned to the user. Because the frequency of recommended terms changes dynamically with user queries, the recommended terms also need to be dynamically updated. The candidate set includes one or more of the original Chinese candidate recommendation terms, supplementary Chinese candidate recommendation terms, and English candidate recommendation terms.
[0117] based on Figure 6 The system architecture diagram of the present invention provides a search term recommendation method. The method belongs to the intermediate link between inputting a query and submitting a query, that is, before submitting it to the retrieval system, the query string input by the user is analyzed and processed. After the user enters the search term, the closest candidate recommendation term is provided to the user, thereby improving the recommendation efficiency and the accuracy of the search term. Figure 7 As shown, Figure 7 A flowchart of optional steps of another search term recommendation method provided by an embodiment of the present invention.
[0118] The following is an example in which a query string represents a search term, a query condition represents identification information of each of a plurality of segmentation elements, and a matched word represents a Chinese candidate recommendation word or an English candidate recommendation word.
[0119] 1. Generate Chinese and English recommended word libraries based on the preset word library and the user's historical query word library. During operation, the search word recommendation system first loads and analyzes the recommended word library, combines the character table and the pinyin table, and generates a recommendation table. Since the step of generating the recommendation table can be completed before the search word recommendation stage, Figure 7 This step is not shown in FIG. The recommended word library in this step includes a Chinese recommended word library and an English recommended word library, and the recommendation table includes a Chinese recommendation table and an English recommendation table.
[0120] 2. Preprocess the query string input by the user, that is, split the query string according to the type of the query string, and split the input query string into three parts: characters, pinyin, and the first letter of the pinyin.
[0121] 3. Input the pre-processed query conditions into the Chinese recommendation table for matching, slide the query conditions and match them again, and add all the matched words to the candidate set.
[0122] 4. Determine the number of recommended words in the candidate set. If it is not equal to 0, jump to step 6, otherwise execute step 5.
[0123] 5. If the query condition only contains letters, preprocess the query condition according to the format of the English recommendation table. That is, split the query condition into individual letters, put the preprocessed query condition into the English recommendation table for matching, and add all matched words to the candidate set.
[0124] 6. Sort the candidate recommendation words in the candidate set according to word frequency information and output the sorting results.
[0125] According to the search term recommendation method provided by an embodiment of the present invention, during the initialization phase, the Chinese and English recommendation term libraries are loaded and parsed based on the Chinese and English recommendation term libraries, the character library, and the pinyin library. Data is constructed according to the data table structure shown in Table 1 to generate Chinese and English recommendation tables. A query string input by the user is received and preprocessed, dividing the query string into characters, full pinyin spellings, and initial pinyin letters, completing the process of correcting complex query strings. After preprocessing, matching is performed in the Chinese and English recommendation tables, respectively, and all matched terms are added to a candidate set, thereby improving the accuracy of the candidate set. When matching in the Chinese recommendation table, the query conditions are adjusted based on the sliding window principle, and matching is continued. All matched terms are added to the candidate set, thereby improving the richness and accuracy of the candidate set. The candidate recommendation terms in the candidate set are then sorted in descending order based on their frequency information, and the sorted results are output. The sorted results can be used to recommend search terms to users.
[0126] The search term recommendation method provided by the embodiment of the present invention includes an initialization phase and a search term recommendation phase, which are respectively introduced below.
[0127] During the initialization phase, the recommendation table is constructed. This embodiment of the present invention first establishes a Chinese and English recommended vocabulary library, loads and analyzes the recommended vocabulary library, and combines the character table and pinyin table to construct the Chinese and English recommendation tables, completing the initialization process. The recommended vocabulary library is first generated by extracting high-frequency words from the corpus. Subsequently, high-frequency words are selected and supplemented by analyzing user query logs. This continuously optimizes the recommended vocabulary library, thereby improving the accuracy of the recommendation table.
[0128] During the search term recommendation stage, the embodiment of the present invention divides the query string into characters, pinyin, and the first letters of the pinyin according to the query string input by the user. It can correct errors for search terms input with a mixture of Chinese characters and pinyin, thereby improving the accuracy of search term recommendations. The charact_id corresponding to the query character and the phontic_id corresponding to the pinyin are then queried to obtain the converted query content, i.e., the identification information of each segmentation element in the query string. The converted query content is then matched in the recommendation table, and all matched words are added to the candidate set, thereby improving the accuracy of the candidate set. Among them, when matching in the Chinese recommendation table, search term recommendations are also performed based on the sliding window principle. The recommended terms that can be recommended to the user include not only recommended terms with the search term as a prefix, but also recommended terms with the search term in the middle position, which greatly expands the candidate set and improves the richness and accuracy of the candidate recommended terms.
[0129] Compared to solutions that recommend search terms using prefix trees, the search term recommendation method provided by the embodiments of the present invention not only enhances error correction capabilities for complex search term combinations, but also utilizes a matching method based on the sliding window principle to expand the query string entered by the user. After sorting the candidate recommended terms in the candidate set by term frequency, the recommended terms are returned to the user, helping the user quickly locate the desired content, improving search efficiency, and enhancing the accuracy of search term recommendations.
[0130] In order to implement the search word recommendation method of the embodiment of the present invention, the embodiment of the present invention also provides a search word recommendation device, such as Figure 8 As shown, Figure 8A structural diagram of a search term recommendation device provided in an embodiment of the present invention, the search term recommendation device 80 includes: an acquisition module 801, used to acquire search terms; a segmentation module 802, used to segment the search terms to obtain multiple segmentation elements; a query module 803, used to query the identification information of each of the multiple segmentation elements in an identification mapping table corresponding to the preset type according to the preset type to which the multiple segmentation elements belong; a matching module 804, used to match the identification information of each of the multiple segmentation elements in the recommendation table to obtain candidate recommendation terms; a recommendation module 805, used to sort the candidate recommendation terms according to word frequency information to obtain a sorting result, so that recommendations are made based on the sorting result.
[0131] In some embodiments, the matching module 804 is further used to match in the Chinese recommendation table according to the identification information of each of the multiple segmentation elements to obtain Chinese candidate recommendation words; wherein, the candidate recommendation words include the Chinese candidate recommendation words, the recommendation table includes the Chinese recommendation table, the Chinese recommendation table is used to store the mapping relationship between the recommendation words and the identification information, as well as the pinyin initials of each character in the recommendation words, the identification information includes the first identification information corresponding to each character in the recommendation word, and the second identification information corresponding to the pinyin of each character in the recommendation word; the recommendation module 805 is also used to sort the Chinese candidate recommendation words if the number of the Chinese candidate recommendation words is a positive integer to obtain the sorting result.
[0132] In some embodiments, the segmentation module 802 is further used to segment the multiple segmentation elements into single letters to obtain multiple letters if the number of the Chinese candidate recommendation words is zero; the matching module 804 is further used to match the multiple letters in the English recommendation table to obtain English candidate recommendation words; wherein, the candidate recommendation words also include the English candidate recommendation words, and the recommendation table also includes the English recommendation table, and the English recommendation table is used to store each letter of the recommendation words; the recommendation module 805 is also used to sort the English candidate recommendation words to obtain the sorting result.
[0133] In some embodiments, the matching module 804 is further used to match the identification information of each of the multiple segmentation elements in the Chinese recommendation table with the identification information of the first segmentation element as a prefix to obtain the original Chinese candidate recommendation words; after sliding the identification information of each of the multiple segmentation elements backward by one or more identification information positions in the order of the position of the identification information, match the Chinese recommendation table to obtain the supplementary Chinese candidate recommendation words; wherein, the Chinese candidate recommendation words include the original Chinese candidate recommendation words and the supplementary Chinese candidate recommendation words.
[0134] In some embodiments, the preset types include characters, pinyin and pinyin initials, the identification mapping table includes a character table and a pinyin table, the identification information includes first identification information, second identification information and third identification information, and the query module 803 is also used to query the first identification information of the segmentation element in the character table if there is a segmentation element with a preset type of character among the multiple segmentation elements; query the second identification information of the segmentation element in the pinyin table if there is a segmentation element with a preset type of pinyin among the multiple segmentation elements; and query the third identification information of the segmentation element for the pinyin initials themselves if there is a segmentation element with a preset type of pinyin among the multiple segmentation elements.
[0135] In some embodiments, the search term recommendation device 80 also includes a generation module, which is further used to obtain a preset vocabulary and a user history query vocabulary; based on the user history query vocabulary, the recommended words in the preset vocabulary and the word frequency information of the recommended words are updated to generate a recommended vocabulary; based on the recommended vocabulary and the identification mapping table, the recommendation table is generated.
[0136] In some embodiments, the identification mapping table includes a character table and a pinyin table, the recommended vocabulary includes a Chinese recommended vocabulary and an English recommended vocabulary, and the recommendation table includes a Chinese recommendation table and an English recommendation table. The generation module is also used to generate the Chinese recommendation table according to the Chinese recommended vocabulary, the character table and the pinyin table according to a first preset data structure, wherein the first preset data structure includes: first identification information corresponding to each character in the recommended word, second identification information corresponding to the pinyin of each character in the recommended word, and the pinyin first letter of the pinyin of each character in the recommended word; according to the English recommended vocabulary, the English recommendation table is generated according to a second preset data structure, and the second preset data structure includes: each letter in the recommended word.
[0137] It should be noted that the search term recommendation device provided in the above embodiment only uses the division of the above program modules as an example when performing search term recommendation. In actual applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the device can be divided into different program modules to complete all or part of the processing described above. In addition, the search term recommendation device provided in the above embodiment and the search term recommendation method embodiment belong to the same concept. The specific implementation process and beneficial effects are detailed in the method embodiment and will not be repeated here. For technical details not disclosed in the embodiment of this device, please refer to the description of the method embodiment of the present invention for understanding.
[0138] In an embodiment of the present invention, Figure 9 This is a schematic diagram of the structure of the search term recommendation device proposed in an embodiment of the present invention. Figure 9As shown, the search term recommendation device 90 proposed in an embodiment of the present invention may include a processor 901 and a memory 902, and the memory 902 stores a computer program that can be run on the processor 901. In some embodiments, the search term recommendation device 90 may also include a communication interface 903 and a bus 904 for connecting the processor 901, the memory 902 and the communication interface 903.
[0139] In an embodiment of the present invention, the processor 901 may be at least one of an application-specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a central processing unit (CPU), a controller, a microcontroller, and a microprocessor. It is understood that for different devices, the electronic device used to implement the above-mentioned processor function may also be other, and the embodiment of the present invention does not specifically limit this.
[0140] In an embodiment of the present invention, the memory 902 can be connected to the processor 901, wherein the memory 902 is used to store executable program code and data, the program code includes computer operation instructions, and the memory 902 may include a high-speed RAM memory and may also include a non-volatile memory, for example, at least two disk memories.
[0141] In the embodiment of the present invention, the bus 904 is used to connect the communication interface 903, the processor 901, and the memory 902, as well as to facilitate mutual communication between these devices.
[0142] In an embodiment of the present invention, the processor 901 is configured to obtain a search term; segment the search term to obtain a plurality of segmentation elements; query the identification information of each of the plurality of segmentation elements in an identification mapping table corresponding to the preset type according to the preset type to which the plurality of segmentation elements belong; perform matching in a recommendation table according to the identification information of each of the plurality of segmentation elements to obtain candidate recommendation terms; sort the candidate recommendation terms according to the word frequency information to obtain a sorting result, and make recommendations based on the sorting result.
[0143] In practical applications, the memory 902 may be a volatile memory, such as a random-access memory (RAM); or a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or a combination of the above types of memory, and provide instructions and data to the processor 901.
[0144] In addition, the functional modules in this embodiment may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware or software functional modules.
[0145] If the integrated unit is implemented in the form of a software functional module and is not 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 embodiment, or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method of this embodiment. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0146] An embodiment of the present invention provides a computer-readable storage medium having a program stored thereon. When the program is executed by a processor, the search term recommendation method as described in any of the above embodiments is implemented.
[0147] Exemplarily, the program instructions corresponding to a search term recommendation method in this embodiment can be stored on a storage medium such as a CD, a hard disk, or a USB flash drive. When the program instructions corresponding to a search term recommendation method in the storage medium are read or executed by an electronic device, the search term recommendation method described in any of the above embodiments can be implemented.
[0148] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage and optical storage, etc.) containing computer-usable program code.
[0149] The present invention is described with reference to implementation flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the flowcharts. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0150] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which is implemented in the implementation flow diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0151] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process described in the flowchart. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0152] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention.
Claims
1. A search term recommendation method, characterized in that: The method comprises: Get the search term; Segmenting the search term to obtain multiple segmentation elements; According to the preset types to which the multiple segmentation elements belong, querying the identification information of each of the multiple segmentation elements in the identification mapping table corresponding to the preset type; Matching the Chinese recommendation table according to the identification information of each of the multiple segmentation elements to obtain Chinese candidate recommendation words; The candidate recommendation words include the Chinese candidate recommendation words, the recommendation table includes the Chinese recommendation table, the Chinese recommendation table is used to store a mapping relationship between the recommendation words and identification information, and the pinyin initials of each character in the recommended words, the identification information includes first identification information corresponding to each character in the recommended words, and second identification information corresponding to the pinyin of each character in the recommended words; If the number of the Chinese candidate recommendation words is a positive integer, the Chinese candidate recommendation words are sorted to obtain a sorting result, and recommendations are made according to the sorting result.
2. The method according to claim 1, characterized in that The method further comprises: If the number of the Chinese candidate recommendation words is zero, segmenting the multiple segmentation elements into single letters to obtain multiple letters; Matching the multiple letters in the English recommendation table to obtain English candidate recommendation words; wherein the candidate recommendation words also include the English candidate recommendation words, and the recommendation table also includes the English recommendation table, and the English recommendation table is used to store each letter of the recommendation word; The English candidate recommendation words are sorted to obtain the sorting result.
3. The method according to claim 1, characterized in that The step of matching the identification information of each of the plurality of segmentation elements in the Chinese recommendation table to obtain Chinese candidate recommendation words includes: According to the identification information of each of the multiple segmentation elements, using the identification information of the first segmentation element as a prefix, matching is performed in the Chinese recommendation table to obtain the original Chinese candidate recommendation words; After sliding the identification information of each of the plurality of segmentation elements backward by one or more identification information positions according to the position order of the identification information, matching is performed on the Chinese recommendation table to obtain supplementary Chinese candidate recommendation words; The Chinese candidate recommendation words include the original Chinese candidate recommendation words and the supplementary Chinese candidate recommendation words.
4. The method according to claim 1, wherein The preset types include characters, pinyin, and pinyin initials; the identification mapping table includes a character table and a pinyin table; the identification information includes first identification information, second identification information, and third identification information; and searching the identification information of each of the multiple segmentation elements in the identification mapping table corresponding to the preset type according to the preset types to which the multiple segmentation elements belong, respectively, includes: If there is a segmentation element of the preset type of word among the multiple segmentation elements, query the first identification information of the segmentation element in the word table; If there is a segmentation element of the preset type of pinyin among the multiple segmentation elements, query the pinyin table for the second identification information of the segmentation element; If there is a segmentation element of the preset type of the first pinyin letter among the multiple segmentation elements, the third identification information of the segmentation element is the first pinyin letter itself.
5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: Obtain the preset vocabulary and user historical query vocabulary; Based on the user's historical query vocabulary, the recommended words in the preset vocabulary and the word frequency information of the recommended words are updated to generate a recommended vocabulary; The recommendation table is generated according to the recommendation word library and the identification mapping table.
6. The method according to claim 5, characterized in that The identifier mapping table includes a character table and a pinyin table, the recommended word library includes a Chinese recommended word library and an English recommended word library, and the recommendation table includes a Chinese recommendation table and an English recommendation table. Generating the recommendation table according to the recommended word library and the identifier mapping table includes: generating the Chinese recommendation table according to the Chinese recommendation word library, the character table, and the pinyin table, in accordance with a first preset data structure, wherein the first preset data structure includes: first identification information corresponding to each character in the recommended word, second identification information corresponding to the pinyin of each character in the recommended word, and the pinyin initials of the pinyin of each character in the recommended word; The English recommendation table is generated according to the English recommendation word library and a second preset data structure, wherein the second preset data structure includes: each letter in the recommended word.
7. A search term recommendation device, characterized in that: The device comprises: Acquisition module, used to obtain search terms; A segmentation module, configured to segment the search term to obtain a plurality of segmentation elements; a query module, configured to query identification information of each of the plurality of segmentation elements in an identification mapping table corresponding to a preset type according to the preset types to which the plurality of segmentation elements belong; a matching module, performing matching in a Chinese recommendation table based on the identification information of each of the plurality of segmentation elements to obtain Chinese candidate recommendation words; wherein the candidate recommendation words include the Chinese candidate recommendation words, the recommendation table includes the Chinese recommendation table, the Chinese recommendation table is used to store a mapping relationship between the recommendation words and the identification information, as well as the pinyin initials of each character in the recommended words, the identification information including first identification information corresponding to each character in the recommended words, and second identification information corresponding to the pinyin of each character in the recommended words; The recommendation module sorts the Chinese candidate recommendation words if the number of the Chinese candidate recommendation words is a positive integer to obtain a sorting result, so as to make recommendations based on the sorting result.
8. A search term recommendation device, characterized in that: The device includes a memory and a processor, the memory stores a computer program that can be run on the processor, and the processor implements the steps in the method according to any one of claims 1 to 6 when executing the program.
9. A computer-readable storage medium, characterized in that Executable instructions are stored thereon, which are used to implement the method described in any one of claims 1 to 6 when executed by a processor.
Citation Information
Patent Citations
Method for acquiring polyphone spelling, method for retrieving based on spelling, and corresponding devices
CN103365925A
Information search method and device, storage medium and electronic equipment
CN111581490A