Recommendation word display method and device, electronic equipment and storage medium
By obtaining and analyzing the characteristic information of the recommended words, determining their importance and displaying relevant recommended words to users, the problem of mismatching search suggestions and user needs is solved, and search efficiency is improved.
Patent Information
- Application Number
- CN202510189954.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-20
- Publication Date
- 2025-06-10
AI Technical Summary
In the prior art, the search suggestions do not match the actual search needs of the user, which reduces the search efficiency of the user.
By obtaining the feature information of the recommended words corresponding to the input text information, characterizing their classification ability, and determining the importance of the recommended words based on the feature information, and then displaying the recommended words related to the input text to the user.
Improve users' search efficiency and ensure that the recommended words are more consistent with users' actual needs.
Smart Images

Figure CN120123610A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular, to a method, apparatus, electronic device, and storage medium for displaying recommended words. Background Art
[0002] In search engines and intelligent search systems, search query suggestions are a very important function. When a user enters a search query, it can provide a series of possible search suggestions to help the user quickly locate the content they want.
[0003] In related technologies, the server can obtain search suggestions related to the search query from the user's search history data, and these search suggestions are related to the user's recent search content.
[0004] However, the above search suggestions may not match the user's actual search needs, which will reduce the user's search efficiency. Summary of the Invention
[0005] The present application provides a method, apparatus, electronic device, and storage medium for displaying recommended words, which solves the technical problem that the search suggestions in related technologies do not match the user's actual search needs and reduce the user's search efficiency.
[0006] In a first aspect, the present application provides a method for displaying recommended words, including: in response to input text information, obtaining feature information of each of at least one recommended word corresponding to the text information, where the feature information of each recommended word is used to characterize the classification ability of each recommended word; based on the feature information of each recommended word, determining the importance level of each recommended word; and displaying each recommended word based on the importance level of each recommended word.
[0007] In a second aspect, the present application provides a device for displaying recommended words, including: an obtaining module, a determining module, and a displaying module; the obtaining module is configured to, in response to input text information, obtain feature information of each of at least one recommended word corresponding to the text information, where the feature information of each recommended word is used to characterize the classification ability of each recommended word; the determining module is configured to determine the importance level of each recommended word based on the feature information of each recommended word; and the displaying module is configured to display each recommended word based on the importance level of each recommended word.
[0008] In a third aspect, the present application provides an electronic device, including: a processor and a memory configured to store processor-executable instructions; wherein, the processor is configured to execute the instructions to implement any of the optional methods for displaying recommended words in the first aspect above.
[0009] Fourthly, the present application provides a computer-readable storage medium with instructions stored thereon. When the instructions in the computer-readable storage medium are executed by an electronic device, the electronic device can execute any of the optional recommended word display methods in the first aspect above.
[0010] Fifthly, the present application provides a computer program product, including a computer program or instructions. When the computer program or instructions run on an electronic device, the electronic device executes any of the optional recommended word display methods in the first aspect above.
[0011] For the recommended word display method, device, electronic device and storage medium provided by the present application, since the characteristic information of the recommended word is used to characterize the classification ability of the recommended word, and the classification ability of the recommended word is associated with the semantic information of the recommended word. In this way, the electronic device can accurately and effectively determine the importance level of the recommended word according to the classification ability of the recommended word. Thus, the electronic device can display recommended words related to the text information input by the user for the user according to the importance level of the recommended word, improving the user's search efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art.
[0013] Figure 1 It is a schematic flowchart of a recommended word display method provided by an embodiment of the present application;
[0014] Figure 2 It is a schematic flowchart of another recommended word display method provided by an embodiment of the present application;
[0015] Figure 3 It is a schematic flowchart of another recommended word display method provided by an embodiment of the present application;
[0016] Figure 4 It is a schematic diagram of the scenario of a recommended word display method provided by an embodiment of the present application;
[0017] Figure 5 It is a schematic flowchart of another recommended word display method provided by an embodiment of the present application;
[0018] Figure 6 It is a schematic diagram of the scenario of another recommended word display method provided by an embodiment of the present application;
[0019] Figure 7 It is a schematic structural diagram of a recommended word display device provided by an embodiment of the present application;
[0020] Figure 8This is a schematic structural diagram of another recommended word display device provided by an embodiment of the present application. Detailed implementation manners
[0021] Next, the recommended word display method, device, electronic device, and storage medium provided by the embodiments of the present application will be described in detail with reference to the accompanying drawings.
[0022] In the description of the present application, terms such as "first" and "second" in the specification and drawings are used to distinguish different objects, rather than to describe a specific order of the objects. For example, the first importance level and the second importance level are used to distinguish different importance levels, rather than to describe a specific order of the importance levels.
[0023] In addition, the terms "including" and "having" and any variations thereof mentioned in the description of the present application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes other steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products, or devices.
[0024] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to represent examples, illustrations, or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary" or "for example" is intended to present relevant concepts in a specific manner.
[0025] In the present application, the term "and / or" includes any one of the two methods or the simultaneous use of both methods.
[0026] In the description of the present application, unless otherwise specified, the meaning of "a plurality of" refers to two or more.
[0027] In search engines and intelligent search systems, search dropdown words are a very important function. When a user enters a search recommended word, it can provide a series of possible search suggestions, thereby helping the user quickly locate the content they want to search for. This function not only improves the search efficiency but also improves the user experience. Traditional search dropdown word recommendation systems mainly rely on a large amount of user search history data to construct a candidate word library. These systems perform high-frequency search word statistics based on historical user search terms, and then generate a search dropdown word candidate list.
[0028] However, in private knowledge base scenarios (such as corporate knowledge bases, personal knowledge bases, etc.), this approach of relying on massive user search history data faces many challenges. First, the number of users in private knowledge bases is relatively small, and search history data is difficult to enrich, resulting in the inability to directly apply traditional methods to enrich enough candidate search drop-down terms. Second, the content of private knowledge bases is often domain-specific and professional, and traditional methods based on extensive user search history may not accurately reflect the knowledge structure and industry needs of these specific fields.
[0029] Therefore, for private knowledge base scenarios, a new method is needed that does not rely on massive user search history data, but is based on the knowledge base content itself to perform search drop-down word mining, database construction, and retrieval ranking. This method needs to be able to automatically mine core words from the knowledge base content, build an initial drop-down word library, and be able to continuously optimize and expand based on the user's limited search history data.
[0030] In some embodiments, drop-down word recommendations can be made based on user search behavior. Specifically, the server can obtain the search word input by the user from the user search history data and generate a search drop-down word recommendation candidate set. The user's search behavior data is then obtained, and a set of associated words is generated based on the user's search behavior data. These associated words are related to the user's recent search content. The initial drop-down word recommendation candidate set is adjusted based on the associated word set to generate a final drop-down word recommendation candidate set. This embodiment can be based on user search history data, but cannot be effectively applied in scenarios where user search history data is insufficient and a private knowledge base is used.
[0031] In other embodiments, drop-down word recommendations can be made based on drop-down word capture: the drop-down words of general search engines are automatically captured by tools. By inputting a recommended word, the relevant search content of the recommended word is automatically obtained to generate a candidate set of search drop-down word recommendations. This method uses the general search engine drop-down word data, but because it cannot be combined with a private knowledge base, it is difficult to achieve accurate recommendations under the knowledge base based on the proprietary knowledge information of the industry knowledge base.
[0032] As described in the background art, in the related art, the server can obtain search suggestions related to the search recommendation words from the historical data of user searches, and these search suggestions are related to the user's recent search content. However, these search suggestions may not match the user's actual search needs, which will reduce the user's search efficiency. Based on this, the embodiments of the present application provide a method, device, electronic device, and storage medium for displaying recommendation words. Since the feature information of the recommendation words is used to characterize the classification ability of the recommendation words, and the classification ability of the recommendation words is associated with the semantic information of the recommendation words. In this way, the electronic device can accurately and effectively determine the importance level of the recommendation words according to the classification ability of the recommendation words. Thus, the electronic device can display recommendation words related to the text information input by the user according to the importance level of the recommendation words, improving the user's search efficiency.
[0033] Exemplarily, the electronic device that executes the recommendation word display method provided by the embodiments of the present application may be a mobile phone, a tablet computer, a desktop type, a laptop, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, as well as a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) / virtual reality (VR) device. The embodiments of the present application do not impose special restrictions on the specific form of the electronic device. It can perform human-computer interaction with the user through one or more of a keyboard, a touchpad, a touch screen, a remote control, voice interaction, or a handwriting device.
[0034] Optionally, the above-mentioned electronic device may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, network acceleration services (content delivery network, CDN), as well as big data and artificial intelligence platforms.
[0035] As Figure 1 shown, the recommendation word display method provided by the embodiments of the present application may include S101-S103.
[0036] S101. The electronic device responds to the input text information and obtains the feature information of each of at least one recommendation word corresponding to the text information.
[0037] Wherein, the feature information of each recommendation word is used to characterize the classification ability of each recommendation word.
[0038] Optionally, the recommended words in the embodiments of the present application may be text core words, and the text core words include at least one of entity words, keyword words, and high-frequency text segmentation words.
[0039] Optionally, at least one of the above-mentioned recommended words may be a recommended word (or core word) output by a large language model (LLM). The electronic device may screen and sort the recommended words output by the LLM, remove duplicates and irrelevant items, and retain valuable core words such as entity words, keyword words, and high-frequency text segmentation words.
[0040] S102. The electronic device determines the importance level of each recommended word based on the feature information of each recommended word.
[0041] It should be understood that since the feature information of a recommended word can characterize the classification ability of the recommended word, the importance level of each recommended word can be accurately and effectively determined based on the classification ability of each recommended word. Alternatively, it can also be understood that the electronic device can determine that the recommended word with a higher classification ability has a higher importance level, and the recommended word with a lower classification ability has a lower importance level.
[0042] S103. The electronic device displays each recommended word based on the importance level of each recommended word.
[0043] Optionally, the electronic device may display each recommended word in descending order of the importance level of each recommended word.
[0044] The technical solutions provided in the above embodiments can at least bring the following beneficial effects: As can be seen from S101-S103: Since the feature information of the recommended word is used to characterize the classification ability of the recommended word, and the classification ability of the recommended word is associated with the semantic information of the recommended word. In this way, the electronic device can accurately and effectively determine the importance level of the recommended word according to the classification ability of the recommended word. Thus, the electronic device can display the recommended words related to the text information input by the user for the user according to the importance level of the recommended words, improving the user's search efficiency.
[0045] In one implementation manner of the embodiments of the present application, the feature information of each of the above-mentioned recommended words includes at least one of the following information: the inverse document frequency (IDF) of each recommended word, the word frequency of each recommended word, and the length of each recommended word.
[0046] Optionally, for a recommended word, the IDF of the recommended word and the word frequency of the recommended word can be used to determine the term frequency–inverse document frequency (TF-IDF) of the recommended word. The electronic device can also determine the importance of each recommended word according to the TF-IDF, word frequency, and length of each recommended word.
[0047] In an optional implementation, the feature information of each of the above-mentioned recommended words includes the word frequency of each recommended word. Combining Figure 1 , as Figure 2 shown, the above-mentioned electronic device determines the importance of each recommended word based on the feature information of each recommended word, specifically including S1021-S1022.
[0048] S1021. When the word frequency of the first recommended word is higher than or equal to the word frequency threshold, the electronic device determines that the importance of the first recommended word is the first importance level.
[0049] Wherein, the first recommended word is any one of the at least one recommended word.
[0050] S1022. When the word frequency of the first recommended word is lower than the word frequency threshold, the electronic device determines that the importance of the first recommended word is the second importance level.
[0051] Wherein, the second importance level is lower than the first importance level.
[0052] It should be understood that when the word frequency of the first recommended word is higher than or equal to the word frequency threshold, it indicates that the word frequency of the first recommended word is relatively high. At this time, the electronic device can determine that the first recommended word has a relatively high importance level, that is, the importance level of the first recommended word is the first importance level. When the word frequency of the first recommended word is lower than the word frequency threshold, it indicates that the word frequency of the first recommended word is relatively low. At this time, the electronic device can determine that the first recommended word has a relatively low importance level, that is, the importance level of the first recommended word is the second importance level.
[0053] Optionally, when the word frequency of the first recommended word is higher than the word frequencies of other recommended words, the electronic device determines that the importance of the first recommended word is higher than the importance levels of other recommended words.
[0054] In an implementation of the embodiment of the present application, the at least one recommended word is a recommended word included in the retrieval library. Combining Figure 1 , as Figure 3 shown, the recommended word display method provided by the embodiment of the present application may further include S104-S106.
[0055] S104. The electronic device obtains the historical behavior information of the user.
[0056] Among them, the historical behavior information includes historical recommended words input by the user in a historical time period.
[0057] S105. The electronic device generates extended recommended words corresponding to the historical recommended words based on the historical recommended words.
[0058] Among them, the similarity between the extended recommended words and the historical recommended words is greater than or equal to a similarity threshold.
[0059] S106. The electronic device obtains a retrieval library based on the historical recommended words and the extended recommended words.
[0060] Exemplarily, as Figure 4 shown, after the user inputs text information through the search box, the electronic device can perform an online search. Specifically, the electronic device first obtains the real-time input of the search box, then obtains candidate dropdown words from the dropdown word retrieval library and obtains the arrangement order of the dropdown words. Finally, after performing processes such as reordering and deduplication on the dropdown words, it can obtain and display the dropdown words (i.e., each recommended word in the embodiments of the present application).
[0061] Among them, the candidate dropdown words (or dropdown word candidate set) can be obtained by the electronic device based on the knowledge base text and the LLM. In this LLM, functions such as entity word extraction, keyword extraction, and text tokenization can be implemented.
[0062] And the arrangement order of the dropdown words is calculated according to the importance degree of the dropdown words. This calculation process can specifically cover TF-IDF statistics, word frequency statistics, and word length statistics of the dropdown words.
[0063] In addition, the generation (or library building) process of the retrieval library (or dropdown word retrieval library) can include preprocessing such as pinyin transcription, TRIE / DATRIE tree construction, and sorting index library building.
[0064] Specifically, the electronic device can perform pinyin transcription on Chinese words to respectively construct Chinese and pinyin dropdown word libraries, so as to realize real-time retrieval of Chinese and pinyin.
[0065] Optionally, the DATRIE double-array trie, which consists of two arrays, base[] and check[], can be abbreviated as a double array. Through compressed storage and common prefix sharing, an efficient trie data structure can be realized.
[0066] In an implementation manner of the embodiments of the present application, in combination with Figure 3 , as Figure 5 shown, the above-mentioned electronic device generates extended recommended words corresponding to the historical recommended words based on the historical recommended words, which can specifically include S1051 - S1052.
[0067] S1051. The electronic device inputs the historical recommended words into the feature extraction network in the text generation model that has been trained, and obtains the input features of the historical recommended words.
[0068] Among them, the input features are used to represent the semantic information of the historical recommended words.
[0069] It should be understood that the text generation model in the embodiments of this application is a neural network model.
[0070] S1052. The electronic device inputs the input features of the historical recommended words into the diffusion model in the text generation model, and obtains the extended recommended words.
[0071] In the embodiments of this application, the electronic device can be automatically extended based on the recommended words (or queries, queries) of the diffusion model (or text diffusion model). Using the historical recommended words (or the user's search history query) as the seed query, the diffusion model is used for automatic query expansion. By controlling the noise addition and denoising of the expansion model, the seed query is expanded and rewritten to generate a query, and through energy constraint, it is ensured that there is not too much deviation between the extended recommended words (or extended query) and the seed query in the semantic feature space.
[0072] Specifically, for any historical recommended word or seed query, the electronic device can select a pre-trained language model such as Ernie (i.e., the feature extraction network) to generate an initial text language representation vector. For each historical recommended word (or seed query), the electronic device can input it into the text vectorization model (i.e., the feature extraction network) to obtain the corresponding vector representation, which is the input feature of the historical recommended word.
[0073] After that, the electronic device can embed the input features (or semantic representation vectors) of the historical recommended words into the diffusion model. The diffusion model can map the input features (or semantic representation vectors) to a series of representation vectors in the hidden space through an L (L is a positive integer)-layer neural network, and embed the semantically pre-trained semantic representation vector into the first hidden space. Then, for a data set containing N (N is a positive integer) samples, x i can represent the input features of sample i, and z i can represent the representation vector (or process vector) of sample i. Then the diffusion model follows the diffusion process in the following formula.
[0074]
[0075] Among them, x i represents the input features of the i-th sample, represents the process vector of the i-th sample in the (L - 1)-th network layer, denotes the recommended words corresponding to the i-th sample (or the output result of the diffusion model), N is the number of samples included in the sample set, L is the number of network layers included in the diffusion model, and L, N, and i are positive integers, where 1 ≤ i ≤ N.
[0076] In addition, the diffusion differential equation satisfies the following formula:
[0077]
[0078] where z j (t) represents the process vector of the j-th sample at the t-th moment, and z i (t) represents the process vector of the i-th sample at the t-th moment, and S ij (Z(t), t) is the diffusion rate, which represents the influence of the process vector of the j-th sample at the t-th moment on the process vector of the i-th sample at the t-th moment. Here, i, j, t, and N are positive integers, with 1 ≤ i ≤ N, 1 ≤ j ≤ N, and i ≠ j.
[0079] Using the explicit Euler method to expand the above differential equation into an iterative update form, introducing a step size to discretize continuous time, we obtain the following formula:
[0080]
[0081] where k represents the k-th network layer in the diffusion model, τ represents the step size, represents the process vector of the i-th sample at the k-th network layer, represents the process vector of the j-th sample at the k-th network layer, represents the influence of the process vector of the j-th sample at the k-th network layer on the process vector of the i-th sample at the k-th network layer. Here, i, j, and k are positive integers, 0 ≤ τ ≤ 1, 1 ≤ i ≤ N, 1 ≤ j ≤ N, i ≠ j, and 1 ≤ k < L.
[0082] By introducing an energy function, it is ensured that there is consistency between the query representation (i.e., the process vector) and the original semantic query representation (i.e., the input feature) during the iterative process. The evolution direction of the node signals during the diffusion process is guided by minimizing the energy. For the sample feature (or process vector) its corresponding energy function can be defined as the following formula:
[0083]
[0084] where Z represents the set of process vectors from the i-th sample to the N-th sample, k represents the k-th network layer in the text diffusion model, and Z (k) represents the set of process vectors of N samples at the k-th network layer, δ represents the penalty function, F represents the norm, λ represents the parameter, and zi denotes the process vector of the i-th sample, z j denotes the process vector of the j-th sample, where i, j, k, N are positive integers, 1 ≤ i ≤ N, 1 ≤ j ≤ N, i ≠ j, 1 ≤ k < L, and λ is a positive number.
[0085] Consider a diffusion process with energy constraints, and we hope that the node representation at each step given by it can make the overall energy of the system decrease. Specifically, the diffusion process with energy constraints can be formally described by the following formula:
[0086]
[0087] where k represents the k-th network layer in the diffusion model, and τ represents the step size. denotes the process vector of the i-th sample at the k-th network layer. denotes the process vector of the j-th sample at the k-th network layer. denotes the influence of the process vector of the j-th sample at the k-th network layer on the process vector of the i-th sample at the k-th network layer. denotes the process vector of the i-th sample at the 0-th network layer, x i denotes the input feature of the i-th sample, Z (k+1) denotes the set of process vectors of N samples at the k + 1-th network layer, Z (k) denotes the set of process vectors of N samples at the k-th network layer, δ represents the penalty function, and i, j, k, N are positive integers, 1 ≤ i ≤ N, 1 ≤ j ≤ N, i ≠ j, 1 ≤ k < L.
[0088] In an implementation manner of the embodiment of the present application, the above-mentioned recommended word display method may further include steps A - D.
[0089] Step A: The electronic device obtains the original recommended word.
[0090] Step B: The electronic device inputs the original recommended word into the feature extraction network in the initial text generation model to obtain the input feature of the original recommended word.
[0091] where the input feature of the original recommended word is used to represent the semantic information of the original recommended word.
[0092] Step C: The electronic device inputs the semantic information of the original recommended word into the initial text diffusion model to obtain the extended recommended word corresponding to the original recommended word.
[0093] It should be understood that the process by which the electronic device obtains the extended recommended word corresponding to the original recommended word can refer to the above-mentioned embodiment and will not be elaborated here.
[0094] Step D: The electronic device trains the initial text diffusion model based on the original recommendation word and the extended recommendation word corresponding to the original recommendation word to obtain a trained text generation model.
[0095] Optionally, the above-mentioned electronic device trains the initial text diffusion model based on the original recommendation word and the extended recommendation word corresponding to the original recommendation word to obtain a trained text generation model, which may specifically include Step D 1 - Step D 3 。
[0096] Step D 1 The electronic device obtains the first loss and the second loss.
[0097] Among them, the first loss is used to represent the degree of inconsistency between the predicted type of the extended recommendation word corresponding to the original recommendation word and the target type, and the target type is the type of the original recommendation word. The second loss is used to represent the degree of inconsistency between the input feature of the original recommendation word and the input feature of the extended recommendation word corresponding to the original recommendation word.
[0098] Step D 2 The electronic device determines the target loss based on the first loss and the second loss.
[0099] Optionally, the electronic device may determine the sum of the first loss and the second loss as the target loss.
[0100] Step D 3 The electronic device updates the parameters in the initial text diffusion model based on the target loss to obtain a trained text generation model.
[0101] In an optional implementation manner, the above-mentioned second loss may be an auxiliary loss. The electronic device may adjust the learning method of the diffusion model of the semantic representation embedding based on the auxiliary loss. By using the auxiliary loss for model learning, it is constrained that the seed query (i.e., the historical recommendation word) and the extended query (i.e., the extended recommendation word corresponding to the historical recommendation word) do not deviate violently in the text representation space during the model training process, so that the representation spaces before and after training are comparable. Therefore, the text representation can continue to be used for similarity calculation for importance calculation.
[0102] The auxiliary loss jointly trains the diffusion process and the embedding process, that is, the learned embeddings are all very close to each other, forming an isotropic embedding space. By introducing a new loss (i.e., the following formula) into the objective function to better learn the mapping relationship between ω (i.e., the extended recommendation word, the output of the model) and x 0 (i.e., the input feature of the historical recommendation word, that is, the input of the model).
[0103] where p θ (ωx 0 ) is the softmax distribution on the vocabulary list.
[0104] L round = -logp θ (ωx 0 )
[0105] where L round represents the auxiliary loss, x 0 represents the input feature of the 0th sample, and ω represents the output result of the 0th sample.
[0106] It should be understood that the diffusion model is a type of latent variable model, consisting of a forward and backward Markov process. Among them, the forward process q(xt|xt- 1 ) gradually disrupts the original data x 0 with random noise. θ (x t-1 |x t ) gradually restores a random noise to the expected data sample through a denoising network f θ .
[0107] Specifically, given the data sample x 0 , the forward process samples a series of latent variables x 1 ,......, x T from the following distribution:
[0108]
[0109] where β t is the noise scale, which can be determined according to a pre-defined noise schedule. β t increases with time and finally disrupts x 0 into random noise.
[0110] It should be understood that the simplified training objective can be defined as:
[0111]
[0112] where Ε q represents the diffusion from x to z through the q diffusion process (i.e., from the input feature to the process vector), μ t is the mean of the posterior distribution, μ θ represents the parameter in the text diffusion model, x 1 represents the input feature of the 1st sample, t 1 represents t 1 at the moment, x0 Denote the input feature of the 0th sample as x t Denote the input feature of the tth sample.
[0113] In addition, on the simplified training objective, add the optimization of word embeddings and auxiliary losses. The following formula can be obtained:
[0114]
[0115] Among them, L' simple Denote the overall loss function, Ε q Denote the diffusion from x to z (i.e., from the input feature to the process vector) through the diffusion process q. EMB(ω) represents the embedding function of the text diffusion model that combines general semantic representations, which is used to map the text to the semantic feature space; μ θ Denote the parameters in the text diffusion model, x 1 Denote the input feature of the 1st sample, t 1 Denote t 1 At time t, x 0 Denote the input feature of the 0th sample, and ω denotes the output result of the 0th sample.
[0116] Specifically, Ε in the formula represents a distribution, and the subscript q of Ε represents a diffusion process, that is, after obtaining the input feature x of the ith sample i through the diffusion process q, various process vectors are obtained, including
[0117] Based on this training method, we can obtain the embedding function of the diffusion model that combines general semantic representations. This function ensures the consistency of the seed query (i.e., the historical recommended word) and the extended query (i.e., the extended recommended word corresponding to the historical recommended word) in the text representation space during the training process. Therefore, we can calculate the similarity between the seed query and the extended query in this representation space and introduce non-linearity when calculating the similarity to improve the expression ability of the model to learn complex structures.
[0118] Among them, the similarity between the extended recommended word corresponding to the ith sample and the extended recommended word corresponding to the jth sample satisfies the following formula:
[0119]
[0120] Among them, Denote the similarity between the extended recommended word corresponding to the ith sample and the extended recommended word corresponding to the jth sample, Denote the process vector of the ith sample at the kth network layer, It represents the process vector of the j-th sample in the k-th network layer, where i, j, and k are positive integers, 1 ≤ i ≤ N, 1 ≤ j ≤ N, i ≠ j, and 1 ≤ k < L.
[0121] In an implementation manner of the embodiment of the present application, after the electronic device obtains the extended recommendation words corresponding to the historical recommendation words, it can be merged with the cold start dropdown words to obtain the retrieval library in the above embodiment. The process of building the generalization dropdown word library is the same as or similar to the process of building the cold start dropdown word library.
[0122] Specifically, in terms of sorting and re-ranking algorithms, optimize for the extended query (or generalization query, expansion word), and perform comprehensive sorting in combination with the retrieval volume and relevance indicators, which comprehensively reflects the user's search history frequency (retrieval volume indicator) and the importance of the internal knowledge in the knowledge base (relevance indicator).
[0123] Sorting: The generalization dropdown words adopt different sorting indicators from the cold start dropdown words, and are sorted based on the length of the dropdown words first. When the lengths are the same, the electronic device can sort based on the relevance * seed query retrieval volume. The sorting method combining relevance and retrieval volume comprehensively considers the importance of the dropdown words and the similarity between the generalized query and the seed query.
[0124] Re-ranking: Since there is a large similarity between the generalization queries, re-ranking is required to ensure the diversity of the dropdown words.
[0125] Use the dispersion of weight distribution, group the queries in combination with the seed query information, and take the seed query and its extended query as a group. Assign weights W to the candidate queries according to the group i Then the score of the dispersion re-ranking is the following formula:
[0126]
[0127] Among them, f(x) represents the re-ranking score of the i-th sample, and W i represents the weight of the candidate query group to which the i-th sample belongs, and i is a positive integer.
[0128] Specifically, in a single retrieval process, the candidate queries between different seed query groups can be re-ranked by dispersion first, and then the duplicates are removed among the multiple generalization queries under the same seed query, and only the query with the highest similarity is retained. At the same time, the generalization queries and the cold start queries are dispersed to ensure that under a certain candidate word window, both the generalization queries and the cold start queries exist.
[0129] Exemplarily, such as Figure 6As shown, according to the input content of the user in the search box within the historical time period, search history collection can be performed. The collected content includes the user's search query history and the user's display and click history, and these contents can jointly form the user's search history.
[0130] After that, the electronic device can perform query expansion and query rewriting based on the user's search history, the knowledge base text, and the text diffusion model. Then, the electronic device calculates the importance of the dropdown words. The calculation process includes query relevance calculation and seed query retrieval volume statistics, so as to build a dropdown word library.
[0131] Among them, the above-mentioned text diffusion model can generate a dropdown word candidate set, and the dropdown word importance calculation is used to obtain the dropdown word sorting index.
[0132] Embodiments of the present application can divide functional modules for an electronic device and the like according to the above method examples. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of a software functional module. It should be noted that the division of modules in the embodiments of the present application is illustrative, only a logical function division, and there may be other division methods in actual implementation.
[0133] In the case of dividing each functional module corresponding to each function, Figure 7 shows a possible structural schematic diagram of the recommended word display device involved in the above embodiment, as Figure 7 shown, the recommended word display device 10 may include: an acquisition module 101, a determination module 102, and a display module 103.
[0134] The acquisition module 101 is configured to obtain the feature information of each recommended word corresponding to the input text information. The feature information of each recommended word is used to characterize the classification ability of each recommended word.
[0135] The determination module 102 is configured to determine the importance degree of each recommended word based on the feature information of each recommended word.
[0136] The display module 103 is configured to display each recommended word based on the importance degree of each recommended word.
[0137] Optionally, the feature information of each recommended word includes at least one of the following information: the IDF of each recommended word, the word frequency of each recommended word, and the length of each recommended word.
[0138] Optionally, the feature information of each recommended word includes the word frequency of each recommended word.
[0139] A determination module 102, specifically configured to determine that the importance level of the first recommended word is the first importance level when the word frequency of the first recommended word is higher than or equal to the word frequency threshold, where the first recommended word is any one of the at least one recommended word.
[0140] The determination module 102 is further specifically configured to determine that the importance level of the first recommended word is the second importance level when the word frequency of the first recommended word is lower than the word frequency threshold, and the second importance level is lower than the first importance level.
[0141] Optionally, the at least one recommended word is a recommended word included in the retrieval library, and the recommended word display device 10 may further include a processing module 104.
[0142] The acquisition module 101 is further configured to acquire the historical behavior information of the user, where the historical behavior information includes the historical recommended words input by the user in the historical time period.
[0143] The processing module 104 is configured to generate an extended recommended word corresponding to the historical recommended word based on the historical recommended word, and the similarity between the extended recommended word and the historical recommended word is greater than or equal to the similarity threshold.
[0144] The processing module 104 is further configured to obtain the retrieval library based on the historical recommended word and the extended recommended word.
[0145] Optionally, the processing module 104 is specifically configured to input the historical recommended word into a feature extraction network in a trained text generation model to obtain an input feature of the historical recommended word, and the input feature is used to represent the semantic information of the historical recommended word.
[0146] The processing module 104 is further specifically configured to input the input feature into a text diffusion model in the text generation model to obtain the extended recommended word.
[0147] Optionally, the acquisition module 101 is further configured to acquire an original recommended word.
[0148] The processing module 104 is further specifically configured to input the original recommended word into a feature extraction network in an initial text generation model to obtain an input feature of the original recommended word, and the input feature of the original recommended word is used to represent the semantic information of the original recommended word.
[0149] The processing module 104 is further specifically configured to input the semantic information of the original recommended word into the initial text diffusion model to obtain an extended recommended word corresponding to the original recommended word.
[0150] The processing module 104 is further specifically configured to train the initial text diffusion model based on the original recommendation word and the extended recommendation word corresponding to the original recommendation word, so as to obtain the trained text generation model.
[0151] Optionally, the obtaining module 101 is further configured to obtain a first loss and a second loss. The first loss is used to characterize the degree of inconsistency between the predicted type of the extended recommendation word corresponding to the original recommendation word and the target type, where the target type is the type of the original recommendation word, and the second loss is used to characterize the degree of inconsistency between the input feature of the original recommendation word and the input feature of the extended recommendation word corresponding to the original recommendation word.
[0152] The determining module 102 is further configured to determine a target loss based on the first loss and the second loss.
[0153] The processing module 104 is further specifically configured to update the parameters in the initial text diffusion model based on the target loss, so as to obtain the trained text generation model.
[0154] In the case of adopting an integrated unit, Figure 8 FIG. shows a possible structural schematic diagram of the recommendation word display device involved in the above embodiment. As Figure 8 shown, the recommendation word display device 20 may include: a processing module 201 and a communication module 202. The processing module 201 may be used to control and manage the actions of the recommendation word display device 20. The communication module 202 may be used to support the communication between the recommendation word display device 20 and other entities. Optionally, as Figure 8 shown, the recommendation word display device 20 may further include a storage module 203 for storing the program code and data of the recommendation word display device 20.
[0155] Among them, the processing module 201 may be a processor or a controller. The communication module 202 may be a transceiver, a transceiver circuit, or a communication interface, etc. The storage module 203 may be a memory.
[0156] Among them, when the processing module 201 is a processor, the communication module 202 is a transceiver, and the storage module 203 is a memory, the processor, the transceiver, and the memory may be connected through a bus. The bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc.
[0157] It should be understood that in various embodiments of the present application, the magnitudes of the serial numbers of the above processes do not imply the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
[0158] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the present application.
[0159] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0160] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0161] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, Digital Subscriber Line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more media integrated therein. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a Solid State Disk (SSD)), etc.
[0162] As described above, the above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed in the present application can easily think of changes or substitutions, which should all be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for displaying recommended words, characterized in that: The method comprises: In response to the input text information, acquiring feature information of each recommended word in at least one recommended word corresponding to the text information, wherein the feature information of each recommended word is used to characterize the classification ability of each recommended word; Determining the importance of each recommended word based on the feature information of each recommended word; Each of the recommended words is displayed based on the importance of each of the recommended words.
2. The method according to claim 1, characterized in that The feature information of each recommended word includes at least one of the following information: an inverse text frequency index IDF of each recommended word, a word frequency of each recommended word, and a length of each recommended word.
3. The method according to claim 1, characterized in that The feature information of each recommended word includes the frequency of each recommended word, and determining the importance of each recommended word based on the feature information of each recommended word includes: When the word frequency of the first recommended word is higher than or equal to the word frequency threshold, determining that the importance of the first recommended word is a first importance, and the first recommended word is any one of the at least one recommended word; When the word frequency of the first recommended word is lower than the word frequency threshold, the importance of the first recommended word is determined to be a second importance, and the second importance is lower than the first importance.
4. The method according to claim 1, characterized in that: The at least one recommended word is a recommended word included in the search library, and the method further includes: Acquire historical behavior information of the user, the historical behavior information including historical recommendation words input by the user in a historical time period; Based on the historical recommendation word, generating an extended recommendation word corresponding to the historical recommendation word, wherein the similarity between the extended recommendation word and the historical recommendation word is greater than or equal to a similarity threshold; The search library is obtained based on the historical recommendation words and the extended recommendation words.
5. The method according to claim 4, characterized in that The step of generating, based on the historical recommendation word, an extended recommendation word corresponding to the historical recommendation word comprises: Inputting the historical recommendation word into a feature extraction network in a trained text generation model to obtain input features of the historical recommendation word, wherein the input features are used to represent semantic information of the historical recommendation word; The input features are input into a text diffusion model in the text generation model to obtain the extended recommended words.
6. The method according to claim 5, characterized in that The method further comprises: Get the original recommendation words; Inputting the original recommended word into a feature extraction network in an initial text generation model to obtain input features of the original recommended word, wherein the input features of the original recommended word are used to represent semantic information of the original recommended word; Inputting the semantic information of the original recommended word into the initial text diffusion model to obtain the extended recommended word corresponding to the original recommended word; Based on the original recommended words and the extended recommended words corresponding to the original recommended words, the initial text diffusion model is trained to obtain the trained text generation model.
7. The method according to claim 6, characterized in that The training of the initial text diffusion model based on the original recommended word and the extended recommended word corresponding to the original recommended word to obtain the trained text generation model includes: Obtaining a first loss and a second loss, wherein the first loss is used to characterize the degree of inconsistency between a predicted type of an extended recommended word corresponding to the original recommended word and a target type, wherein the target type is the type of the original recommended word, and the second loss is used to characterize the degree of inconsistency between an input feature of the original recommended word and an input feature of the extended recommended word corresponding to the original recommended word; determining a target loss based on the first loss and the second loss; The parameters in the initial text diffusion model are updated based on the target loss to obtain the trained text generation model.
8. A recommended word display device, characterized in that: include: Acquisition module, determination module and display module; The acquisition module is used to acquire, in response to the input text information, feature information of each recommended word in at least one recommended word corresponding to the text information, wherein the feature information of each recommended word is used to characterize the classification ability of each recommended word; The determination module is used to determine the importance of each recommended word based on the feature information of each recommended word; The display module displays each recommended word based on the importance of each recommended word.
9. An electronic device, characterized in that: The electronic device comprises: processor; a memory configured to store instructions executable by the processor; The processor is configured to execute the instructions to implement the recommendation word display method as described in any one of claims 1-7.
10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions in the computer-readable storage medium are executed by an electronic device, the electronic device is enabled to execute the recommendation word display method according to any one of claims 1 to 7.
11. A computer program product comprising instructions, characterized in that When the instruction is executed on an electronic device, the electronic device executes the recommendation word display method as described in any one of claims 1 to 7.