Entity recommendation method and device
By calculating the word vector of the target query request and looking for word vectors with higher similarity, the recommended words are determined, which solves the inaccuracy problem caused by the difference of entity words in traditional entity recommendation and improves the accuracy of recommendation.
Patent Information
- Application Number
- CN201910677886.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-07-25
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2039-07-25
AI Technical Summary
In the traditional entity recommendation method, the entity words of the related query request and the original query request are quite different, resulting in inaccurate recommendation results.
By obtaining the target query request input by the user, the target entity words are extracted, and based on the pre-generated entity word vector set, the word vector of the target query request is calculated, and word vectors with higher similarity are found to determine recommended words and ensure recommendation Correlation between words and target entity words.
It improves the accuracy of entity recommendation, avoids the problem in the prior art that the entity words in the extended query request deviate greatly from the entity words in the original query request, and ensures that the recommendation results are consistent with the user's query intention.
Smart Images

Figure CN112307281B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to an entity recommendation method and device. Background Art
[0002] With the development of Internet technology, users will use search engines to search for content they are interested in. When a user searches for a keyword, related keywords can be recommended to the user so that the user continues to view content related to the keyword. The above keyword recommendation process can be considered as an entity recommendation process.
[0003] In the traditional entity recommendation process, some related query requests can be expanded according to the user query request, and then these related query requests are used for entity recommendation. However, in some cases, the related query request is quite different from the original query request, resulting in poor relevance of the results obtained by using the related query request for entity recommendation with the entity in the original query request, resulting in inaccurate entity recommendation. Summary of the invention
[0004] In view of this, an embodiment of the present application provides an entity recommendation method and device to solve the technical problem of inaccurate entity recommendation in the prior art.
[0005] To solve the above problems, the technical solutions provided in the embodiments of the present application are as follows:
[0006] An entity recommendation method, the method comprising:
[0007] Obtaining a target query request input by a user, and extracting target entity words included in the target query request;
[0008] According to a pre-generated entity word vector set, a word vector of the target entity word is obtained; according to the word vectors of each target entity word included in the target query request, a word vector corresponding to the target query request is determined; the entity word vector set includes word vectors corresponding to entity words, and the entity word vector set is obtained by training based on at least one related entity word set;
[0009] Searching for at least one word vector having a high similarity with the word vector corresponding to the target query request in the entity word vector set, and determining the entity word corresponding to the at least one word vector found as the recommended word corresponding to the target query request;
[0010] The recommended word is recommended to the user.
[0011] In a possible implementation, determining the word vector corresponding to the target query request according to the word vectors of each target entity word included in the target query request includes:
[0012] An average value of the word vectors of all target entity words included in the target query request is calculated, and the average value is determined as the word vector corresponding to the target query request.
[0013] In a possible implementation, determining the entity word corresponding to the at least one found word vector as the recommended word corresponding to the target query request includes:
[0014] Sorting the entity words corresponding to the at least one word vector found according to their relevance to the target query request;
[0015] The entity word corresponding to the word vector whose ranking result meets the preset conditions is determined as the recommended word corresponding to the target query request.
[0016] In a possible implementation, the method further includes:
[0017] Obtain at least one related entity word set;
[0018] A language model is trained according to the at least one related entity word set to obtain a word vector for each entity word to form the entity word vector set.
[0019] In a possible implementation, obtaining at least one set of related entity words includes:
[0020] Obtain at least one query request entered by the same user within a preset time period;
[0021] Extract entity words from each query request;
[0022] Construct a set of related entity words based on the extracted entity words.
[0023] In a possible implementation, constructing a set of related entity words according to the extracted entity words includes:
[0024] Combine entity words extracted from different query requests in pairs to form entity word pairs;
[0025] Determine whether two entity words in the entity word pair are related;
[0026] Entity word pairs in which two entity words are not related are eliminated, and among the remaining entity word pairs, the entity words corresponding to the entity word pairs containing the same entity words are divided into the same related entity word set to construct at least one related entity word set.
[0027] In a possible implementation, determining whether two entity words in the entity word pair are related includes:
[0028] Calculating the relevance value between two entity words in the entity word pair;
[0029] When the relevance value is greater than or equal to a first threshold, there is relevance between the two entity words in the entity word pair;
[0030] When the relevance value is less than the first threshold, there is no relevance between the two entity words in the entity word pair.
[0031] In a possible implementation, determining whether two entity words in the entity word pair are related includes:
[0032] Obtain the number of times two entity words in the entity word pair appear in the same query request;
[0033] When the number is greater than or equal to a second threshold, there is correlation between the two entity words in the entity word pair;
[0034] When the number is less than the second threshold, there is no correlation between the two entity words in the entity word pair.
[0035] In a possible implementation, the method further includes:
[0036] Establish a high-dimensional retrieval tree based on the entity word vector set;
[0037] The searching the entity word vector set for at least one word vector having a high similarity to the word vector corresponding to the query request includes:
[0038] Search the high-dimensional search tree for at least one word vector having a high similarity to the word vector corresponding to the target query request.
[0039] An entity recommendation device, the device comprising:
[0040] An extraction unit, configured to obtain a target query request input by a user, and extract a target entity word included in the target query request;
[0041] A first determining unit is configured to obtain a word vector of the target entity word according to a pre-generated entity word vector set; determine a word vector corresponding to the target query request according to the word vectors of each target entity word included in the target query request; the entity word vector set includes word vectors corresponding to entity words, and the entity word vector set is obtained by training based on at least one related entity word set;
[0042] A search unit, configured to search the entity word vector set for at least one word vector having a high similarity to the word vector corresponding to the target query request;
[0043] A second determining unit, configured to determine the entity word corresponding to the at least one word vector found as a recommended word corresponding to the target query request;
[0044] A recommendation unit is used to recommend the recommendation word to the user.
[0045] In a possible implementation manner, the first determining unit is further configured to:
[0046] An average value of the word vectors of all target entity words included in the target query request is calculated, and the average value is determined as the word vector corresponding to the target query request.
[0047] In a possible implementation manner, the second determining unit includes:
[0048] A sorting subunit, used to sort the entity words corresponding to the at least one word vector found according to the relevance to the target query request;
[0049] The first determination subunit is used to determine the entity word corresponding to the word vector whose ranking result meets the preset condition as the recommended word corresponding to the target query request.
[0050] In a possible implementation manner, the device further includes:
[0051] An acquisition unit, used to acquire at least one set of related entity words;
[0052] A training unit is used to train a language model according to the at least one related entity word set to obtain a word vector of each entity word to form the entity word vector set.
[0053] In a possible implementation, the acquiring unit includes:
[0054] An acquisition subunit, used to acquire at least one query request input by the same user within a preset time period;
[0055] A first extraction subunit, used to extract entity words from each query request;
[0056] The construction subunit is used to construct a set of related entity words based on the extracted entity words.
[0057] In a possible implementation, the construction subunit includes:
[0058] The second extraction subunit is used to combine entity words extracted from different query requests into entity word pairs;
[0059] A second determination subunit is used to determine whether two entity words in the entity word pair are related;
[0060] The partitioning sub-unit is used to remove entity word pairs in which two entity words in the entity word pairs are not related, and among the remaining entity word pairs, the entity words corresponding to the entity word pairs containing the same entity words are divided into the same related entity word set to construct at least one related entity word set.
[0061] In a possible implementation manner, the second determining subunit is specifically configured to:
[0062] Calculate the correlation value between the two entity words in the entity word pair; when the correlation value is greater than or equal to a first threshold, the two entity words in the entity word pair are correlated; when the correlation value is less than the first threshold, the two entity words in the entity word pair are not correlated.
[0063] In a possible implementation manner, the second determining subunit is specifically configured to:
[0064] The number of times the two entity words in the entity word pair appear in the same query request is obtained; when the number is greater than or equal to a second threshold, there is a correlation between the two entity words in the entity word pair; when the number is less than the second threshold, there is no correlation between the two entity words in the entity word pair.
[0065] In a possible implementation manner, the device further includes:
[0066] A building unit is used to build a high-dimensional search tree according to a set of entity word vectors;
[0067] The searching unit is specifically used for:
[0068] Search the high-dimensional search tree for at least one word vector having a high similarity to the word vector corresponding to the target query request.
[0069] A device for entity recommendation includes a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include instructions for performing the following operations:
[0070] Obtaining a target query request input by a user, and extracting target entity words included in the target query request;
[0071] According to a pre-generated entity word vector set, a word vector of the target entity word is obtained; according to the word vectors of each target entity word included in the target query request, a word vector corresponding to the target query request is determined; the entity word vector set includes word vectors corresponding to entity words, and the entity word vector set is obtained by training based on at least one related entity word set;
[0072] Searching for at least one word vector having a high similarity with the word vector corresponding to the target query request in the entity word vector set, and determining the entity word corresponding to the at least one word vector found as the recommended word corresponding to the target query request;
[0073] The recommended word is recommended to the user.
[0074] A computer-readable medium stores instructions which, when executed by one or more processors, enable a device to perform the above-mentioned entity recommendation method.
[0075] It can be seen that the embodiments of the present application have the following beneficial effects:
[0076] In the embodiment of the present application, when the user performs a search query, the server can obtain the target query request input by the user to extract the target entity word included in the target query request. Then, according to the entity word vector set generated by pre-training, the word vector of the target entity word is obtained, and according to the word vectors of each target entity word included in the target query request, the word vector corresponding to the target query request is determined. Then, at least one word vector with a high similarity to the word vector corresponding to the target query request is searched in the entity word vector set, and the entity word corresponding to the at least one word vector found is used as the recommended word corresponding to the target query request, and then the recommended word is recommended to the user. It can be seen that in the embodiment of the present application, when determining the recommended word according to the target query request input by the user, the entity word included in the target query request itself is used to determine the recommended word related to it, which ensures the relevance of the determined recommended word with the target entity word, avoids the large deviation between the entity word in the query request expanded in the prior art and the entity word in the original query request, so that the recommended word with relevance to the target entity word can be recommended to the user, and the accuracy of the recommendation is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] Figure 1 A schematic diagram of a framework of an exemplary application scenario provided in an embodiment of the present application;
[0078] Figure 2 A flowchart of an entity recommendation method provided in an embodiment of the present application;
[0079] Figure 3 A flowchart of a method for obtaining an entity word vector set provided in an embodiment of the present application;
[0080] Figure 4 A flowchart of a method for constructing a set of related entity words provided in an embodiment of the present application;
[0081] Figure 5 A device structure diagram of an entity recommendation method provided in an embodiment of the present application;
[0082] Figure 6 A device structure diagram of another entity recommendation method provided in an embodiment of the present application;
[0083] Figure 7 A schematic diagram of a server device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0084] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0085] The inventor discovered in the study of traditional entity recommendation that traditional entity recommendation is to expand based on user query requests to obtain some related query requests, and then use the related query requests to recommend entities. However, when expanding related query requests, there will be a problem that the entity words in the expanded related query requests deviate greatly from the entity words in the original query request, which in turn causes the problem of inaccurate entity recommendation. For example, the original query request input by the user is "hold a wedding", and the query request expanded by the system is "the wedding is held in a vegetable greenhouse", where "vegetable greenhouse" deviates greatly from the entity "wedding" in the original query request, and then when making recommendations based on "the wedding is held in a vegetable greenhouse", some results related to vegetable greenhouses will be obtained, which are obviously irrelevant to the original query request, affecting the user experience.
[0086] Based on this, an embodiment of the present application provides an entity recommendation method, specifically, when a user performs a search query, a target query request input by the user is obtained, and the target entity words included in the target query request are extracted. Then, according to the pre-generated entity word vector set, the word vector corresponding to each target entity word is obtained, and the word vector corresponding to the target query request is determined according to the word vector corresponding to each target entity word. At least one word vector with a high similarity to the word vector corresponding to the target query request is searched in the entity word vector set, and the entity word corresponding to the at least one word vector found is determined as the recommended word corresponding to the target query request, and then the recommended word is recommended to the user. That is, when determining the recommended word, it is determined based on the target entity word and the entity word vector set included in the target query request. Among them, the entity word vector set is obtained by training based on the relevant entity word set. Since each relevant entity word set includes relevant entity words, the word vectors in the entity word vector set obtained by training based on a large number of relevant entity word sets meet the condition that if the entity words are more relevant, the corresponding word vectors are more similar. After determining the word vector corresponding to the target entity word, the entity word corresponding to the related word vector is determined as the recommended word by searching for the word vector related to the target entity word in the entity word vector set, thereby ensuring that the recommended word is relevant to the target entity word in the target query request, avoiding the deviations existing in the prior art, and improving the accuracy of the recommendation.
[0087] For ease of understanding of the embodiments of this application, see Figure 1 , which is a schematic diagram of a framework of an exemplary application scenario provided by an embodiment of the present application. The entity recommendation method provided by an embodiment of the present application can be applied to a client 10 or a server 20.
[0088] In actual application, the server 20 can obtain the target query request input by the user through the client 10, and extract the target entity word included in the target query request. Then, the word vector corresponding to the target entity word is obtained according to the pre-generated entity word vector set, so as to find the word vector with the highest similarity to the word vector corresponding to the target entity word from the entity word vector set, determine the entity word corresponding to the word vector with the highest similarity as the recommended word, and send the recommended word to the client 10 for recommendation to the user.
[0089] Alternatively, the client 10 obtains the target query request input by the user and extracts the target entity word included in the target query request. Then, the word vector corresponding to the target entity word is obtained according to the entity word vector set, so as to find the word vector with the highest similarity to the word vector corresponding to the target entity word from the entity word vector set, determine the entity word corresponding to the word vector with the highest similarity as the recommended word, and recommend the recommended word to the user.
[0090] Furthermore, the client 10 may also send the recommended word to the server 20 according to the user's triggering operation on the recommended word, so that the server 20 may perform a related search based on the recommended word.
[0091] Those skilled in the art will understand that Figure 1 The framework diagram shown is only an example in which the embodiments of the present application can be implemented. The scope of application of the embodiments of the present application is not limited by any aspect of the framework.
[0092] It should be noted that the client 10 can be carried on a terminal, which can be any user device that is currently available, under development or will be developed in the future and can interact with each other through any form of wired and / or wireless connection (for example, Wi-Fi, LAN, cellular, coaxial cable, etc.), including but not limited to: smart wearable devices, smart phones, non-smart phones, tablet computers, laptop personal computers, desktop personal computers, small computers, medium-sized computers, mainframe computers, etc. that are currently available, under development or will be developed in the future. The implementation of the present application is not limited in this regard. It should also be noted that the server 20 in the embodiment of the present application can be an example of a device that is currently available, under development or will be developed in the future and can provide search services to users. The implementation of the present application is not limited in this regard.
[0093] To facilitate understanding of an entity recommendation method provided in an embodiment of the present application, the method will be described below with reference to the accompanying drawings.
[0094] See also Figure 2 , which is a flow chart of an entity recommendation method provided in an embodiment of the present application. Figure 2 As shown, the method may include:
[0095] S201: Obtain a target query request input by a user, and extract target entity words included in the target query request.
[0096] In this embodiment, when a user performs a search query, a target query request input by the user can be obtained, and the target entity words included in the target query request can be extracted. The target query request is the query request input by the user at the current moment, the target entity words can be all entity words or part of the entity words included in the target query request, and the number of target entity words can be one or more. For example, the target query request input by the user is "Which is better to wear a wedding dress or a wedding gown at a wedding", where "wedding", "wedding dress", and "wedding gown" can be used as target entity words.
[0097] In specific implementation, the target query request may be segmented first, and then the target entity word may be extracted according to the segmentation result. In practical application, the target entity word may be extracted from the target query request using an existing entity word extraction method, which will not be described in detail in this embodiment.
[0098] S202: Obtain a word vector of a target entity word according to a pre-generated set of entity word vectors; and determine a word vector corresponding to the target query request according to the word vectors of each target entity word included in the target query request.
[0099] In this implementation, after extracting the target entity words included in the target query, the word vector of each target entity word can be determined according to the pre-generated entity word vector set, and the word vector corresponding to the target query request can be determined according to the word vectors of each target entity word included in the target query request. The entity word vector set includes the word vectors corresponding to each entity word, and the entity word vector set is obtained by training based on at least one related entity word set.
[0100] The similarity of word vectors in the entity word vector set can be used to reflect the relevance of the corresponding entity words. Since the entity words included in each related entity word set have a certain relevance, the entity word vector set obtained by training a large number of related entity word sets can satisfy the requirement that the more relevant the entity words are, the more similar the corresponding word vectors are. Among them, word vector is a way to mathematize words in a language. As the name implies, it is to represent a word as a vector. The generation of entity word vector sets will be described in detail in subsequent embodiments.
[0101] It is understandable that the mapping relationship between entity words and word vectors can be saved in the entity word vector set. In a possible implementation, after extracting the target entity words, the word vector corresponding to each target entity word can be determined according to the mapping relationship between the entity words and the word vectors in the entity word vector set, and then the word vectors corresponding to all the target entity words included in the target query request can be used together to form the word vector of the target query request. For example, according to the mapping relationship in the entity word vector set, the word vector corresponding to the target entity word "wedding" is a, the word vector corresponding to "wedding dress" is b, and the word vector corresponding to "wedding dress" is c. Then the word vector corresponding to the target query request "Which is better to wear a wedding dress or a wedding dress for a wedding" is {word vector a, word vector b, word vector c}.
[0102] In a possible implementation, another method for determining the word vector corresponding to the target query request is provided, specifically, the average value of the word vectors of all target entity words included in the target query request is calculated, and the average value is determined as the word vector corresponding to the target query request. That is, after obtaining the word vector of each target entity word, the average value of the word vectors of all target entity words can also be calculated, and the average value is determined as the word vector corresponding to the target query request. For example, in the target query request, the word vector corresponding to the target entity word "wedding" is a, the word vector corresponding to "wedding dress" is b, and the word vector corresponding to "wedding dress" is c. Then the word vector corresponding to the target query request "Which is better to wear a wedding dress or a wedding dress for a wedding" is: the average value of word vector a, word vector b, and word vector c.
[0103] S203: Searching for at least one word vector having a high similarity with the word vector corresponding to the target query request in the entity word vector set, and determining the entity word corresponding to the at least one word vector found as the recommended word corresponding to the target query request.
[0104] In this embodiment, after determining the word vector corresponding to the target query request, at least one word vector with a high similarity to the word vector corresponding to the target query request is searched from the entity word vector set, and the entity word corresponding to the at least one word vector found is determined as the recommended word corresponding to the target query request. The high similarity can be: arranging the similarities in descending order and taking the first at least one.
[0105] The word vector similarity can be represented by the distance between two word vectors. The smaller the distance between the two word vectors, the greater the similarity. The distance between the word vectors can be Euclidean distance, cosine distance, etc., which is not limited in this embodiment.
[0106] In specific implementation, the similarity between the word vectors in the entity word vector set and the word vector corresponding to the target query request can be determined by traversing the entity word vector set, and then by similarity comparison, at least one word vector with a higher similarity corresponding to each word vector in the target query request is determined, and the entity word corresponding to the word vector with a higher similarity is determined as the recommended word corresponding to the target query request. For example, the entity word vector set includes word vectors of 100 entity words in total, and the word vectors corresponding to the target query request are word vector a, word vector b, and word vector c. For word vector a, the similarity between a and the 100 word vectors is determined, and the entity word corresponding to at least one word vector with a higher similarity is determined as the recommended word for the target query request; for word vector b, the similarity between b and the 100 word vectors is determined, and the entity word corresponding to at least one word vector with a higher similarity is determined as the recommended word for the target query request; for word vector c, the similarity between c and the 100 word vectors is determined, and the entity word corresponding to at least one word vector with a higher similarity is determined as the recommended word for the target query request, so that multiple recommended words corresponding to the target query request can be determined.
[0107] It should be noted that when the target query request includes only one target entity word, the word vector corresponding to the target query request is the word vector of the target entity word. When searching for at least one word vector with a high similarity to the word vector corresponding to the target query request in the entity word vector set, the word vector corresponding to the target entity word needs to be excluded. That is, when the target query request includes only one target entity word, the recommended words corresponding to the target query request need to exclude the target entity word itself.
[0108] It is understandable that searching for the word vector with the highest similarity to the word vector corresponding to the target query request by traversing will affect the search speed. In the specific implementation, the search can also be performed through a high-dimensional search tree to improve the search speed. Among them, the implementation method of establishing a high-dimensional search tree based on the entity word vector set and using the high-dimensional search tree to search for the word vector with the highest similarity will be described in the subsequent embodiments.
[0109] At least one word vector having a high similarity with the word vector corresponding to the target query request is found. The entity words corresponding to these found word vectors can be considered as entity words related to the target entity words in the target query request. The entity words corresponding to the at least one found word vector can be determined as the recommended words corresponding to the target query request.
[0110] In a specific implementation, when the number of entity words corresponding to at least one word vector found is large, these entity words to be recommended can be screened first. This example provides an implementation method for determining the recommended words corresponding to the target query request, specifically, sorting the entity words corresponding to at least one word vector found according to the relevance to the target query request; determining the entity words corresponding to the word vector whose sorting results meet the preset conditions as the recommended words corresponding to the target query request. That is, in an implementation method, the relevance between the entity words corresponding to each word vector found and the target query request can also be calculated first, and sorted according to the relevance. Then, the entity words corresponding to the word vector whose sorting results meet the preset conditions are determined as the recommended words corresponding to the target query request. Among them, the preset conditions can be set according to the actual sorting situation. For example, when sorting from large to small according to the relevance, the preset conditions can be the first preset number; when sorting from small to large according to the relevance, the preset conditions can be the last preset number. Alternatively, the preset condition can be that the entity words corresponding to the word vector whose relevance is greater than the preset threshold are determined as the recommended words corresponding to the target query request.
[0111] S204: Recommend the recommended words to the user.
[0112] In this embodiment, after the recommended word corresponding to the target query request is determined, the recommended word is recommended to the user, so that the recommended word can be used to recommend content according to the user's selection, thereby improving the accuracy of the recommendation.
[0113] It can be seen from the above description that when a user performs a search query, the server can obtain the target query request input by the user to extract the target entity word included in the target query request. Then, according to the entity word vector set generated by pre-training, the word vector of the target entity word is obtained, and the word vector corresponding to the target query request is determined accordingly. Then, at least one word vector with a high similarity to the word vector corresponding to the target query request is searched in the entity word vector set, and the entity word corresponding to the at least one word vector found is used as the recommended word corresponding to the target query request, and then the recommended word is recommended to the user. It can be seen that in the embodiment of the present application, when determining the recommended word according to the target query request input by the user, the entity words included in the target query request itself are used to determine the recommended words related to it, which ensures the correlation between the determined recommended words and the target entity words, and avoids the large deviation between the entity words in the query request expanded in the prior art and the entity words in the original query request, so that the recommended words with correlation to the target entity words can be recommended to the user, thereby improving the accuracy of the recommendation.
[0114] In a possible implementation of an embodiment of the present application, a method for searching for word vectors using a high-dimensional search tree is provided, specifically, a high-dimensional search tree is established based on a set of entity word vectors; at least one word vector having a high similarity to the word vector corresponding to the target query request is searched in the high-dimensional search tree. That is, a high-dimensional search tree is first established using a set of entity word vectors, and then the high-dimensional search tree is used to search for at least one word vector having the highest similarity to the word vector corresponding to the target query request. Among them, the high-dimensional search tree structure can be a binary tree, and the goal of the high-dimensional search tree is to achieve fast retrieval, that is, to find the nearest neighbor in a high-dimensional space. Because if the entity word vector set is used directly, then the nearest neighbor search needs to traverse each vector, so the query time is O(n), and the query time using a high-dimensional search tree can be shortened to O(logn), where n is the number of entity words in the entity word vector set.
[0115] In practical applications, the idea of constructing a high-dimensional search tree is that two points that are adjacent in the original space also appear to be close to each other in the tree structure. That is, if two points are similar in space, then when the tree structure is established, the two points will be divided into a branch with a high probability. That is, when using the entity word vector set to establish a high-dimensional search tree, if there is a large similarity between two word vectors in the entity word vector set, the two word vectors may be divided into the same direction of the high-dimensional search tree. If the two word vectors are less similar, the two word vectors are divided into different directions of the high-dimensional search tree. When using the high-dimensional search tree to find word vectors that are similar to the word vectors corresponding to the target query request, the search direction can be determined first, and then similar word vectors can be found in a determined direction to improve the search speed.
[0116] It can be seen from the above embodiments that the entity word vector set is obtained by training based on at least one related entity word set. The generation of the entity word vector set will be described below with reference to the accompanying drawings.
[0117] See also Figure 3 , which is a flow chart of a method for generating an entity word vector set provided by an embodiment of the present application, such as Figure 3 As shown,
[0118] S301: Obtain at least one related entity word set.
[0119] In this embodiment, in order to obtain an entity word vector set through training, firstly, training data, that is, a set of related entity words, is obtained, so as to generate an entity word vector set through training using a large number of related entity word sets.
[0120] It is understandable that in order to ensure the richness and diversity of the entity word vector set, when obtaining the relevant entity word set, a large number of relevant entity word sets can be obtained so that the entity word vector set generated by training includes the word vectors corresponding to the required entity words as much as possible. In specific implementation, this embodiment provides an implementation method for obtaining the relevant entity word set, which can be implemented by the following steps:
[0121] 1) Obtain at least one query request input by the same user within a preset time period.
[0122] 2) Extract entity words from each query request.
[0123] In this embodiment, for the same user, one or more query requests input by the user within a preset time period are obtained, so as to extract entity words from each query request. The preset time period can be determined according to actual conditions, for example, the preset time period is 5 minutes, which is not limited in this embodiment.
[0124] For example, user A inputs four query requests within 5 minutes. The entity words a1 and b1 included in query request 1 are extracted; the entity words a2 and b2 included in query request 2 are extracted; the entity words a3 and b3 included in query request 3 are extracted; and the entity words a4 and b4 included in query request 4 are extracted.
[0125] 3) Construct a set of related entity words based on the extracted entity words.
[0126] In this embodiment, it can be considered that the query requests input by the user within a certain period of time may have correlation. After extracting the entity words in each query request from the query request corresponding to the same user, a related entity word set can be constructed based on the extracted entity words. There is a certain correlation between the entity words included in each related entity word set, so when the entity word vector set is generated by training the related entity word set, the word vectors corresponding to the entity words in the related entity word set also have correlation in the entity word vector set. Among them, the specific implementation of constructing the related entity word set using the extracted entity words will be described in the subsequent embodiments.
[0127] S302: Training a language model according to at least one related entity word set to obtain a word vector for each entity word to form the entity word vector set.
[0128] In this embodiment, after obtaining the relevant entity word set, the relevant entity word set is used as training data to train the language model to obtain the word vector of each entity word, so as to form the entity word vector set according to the word vector of each entity word. For example, the relevant entity word set 1 is obtained as [a1b1a2b2] and the relevant entity word set 2 is obtained as [a3b3a4b4]. The language model is trained using the two relevant entity word sets to obtain the word vectors corresponding to each entity word, which are a, b, and c respectively. _ 1, b_1, a_2, b_2, a_3, b_3, a_4, b_4, then the 8 word vectors are combined into an entity word vector set.
[0129] Among them, the language model can be a word vector word2vec model, which is an efficient algorithm model that can represent entity words as real-valued vectors. It uses the idea of deep learning to simplify the processing of entity words into vector operations in a K-dimensional vector space through training, and the similarity in the vector space can be used to represent the similarity between entity words. The core idea of the word2vec model is to map each entity word into a K-dimensional real vector through training, and to judge the semantic similarity between the corresponding entity words by the distance between the word vectors (such as cosine similarity, Euclidean distance, etc.). The shorter the distance between the two word vectors, the greater the similarity, and the greater the similarity of the entity words corresponding to the two word vectors.
[0130] It is understandable that, since there is correlation between entity words in the related entity word set, when the related entity word set is used to train the language model to obtain the word vectors of each entity word, it can be ensured that the word vectors of each entity word in the same related entity word set are also correlated. That is, the more related the entity words are in the entity word vector set, the more similar the word vectors corresponding to the entity words are, so that the similarity of the word vectors can reflect the correlation of the entity words.
[0131] Through the above method, the language model can be trained using the relevant entity word set to obtain the word vector of each entity word, and then obtain the entity word vector set. When entity recommendation is required, the target entity word is extracted from the target query request input by the user, and the word vector corresponding to the target entity word is obtained according to the entity word vector set, and it is used as the word vector corresponding to the target query request. Then, at least one word vector with a high similarity to the word vector corresponding to the target query request is searched in the entity word vector set, so that the entity word corresponding to the at least one word vector with a high similarity is determined as a recommended word to be recommended to the user.
[0132] See also Figure 4 , which is a flow chart of a method for constructing a set of related entity words provided in an embodiment of the present application, such as Figure 4 As shown, the method may include:
[0133] S401: Entity words extracted from different query requests are combined in pairs to form entity word pairs.
[0134] In this embodiment, in a specific implementation, after extracting the entity words included in each of the different query requests, entity word pairs composed of the entity words in the different query requests are obtained in a pairwise combination. It can be understood that the number of entity word pairs is not only related to the number of query requests obtained within a preset time period, but also related to the number of entity words included in each query request.
[0135] For example, a total of four query requests are obtained, among which query request 1 includes m entity words, query request 2 includes n entity words, query request 3 includes p entity words, and query request 4 includes q entity words. Then the number of entity word pairs that can be formed is m*n+m*p+m*q+n*p+n*q+p*q.
[0136] S402: Determine whether two entity words in an entity word pair are related.
[0137] S403: Eliminate entity word pairs in which two entity words have no correlation, and among the remaining entity word pairs, classify the entity words corresponding to the entity word pairs containing the same entity words into the same related entity set to construct at least one related entity set.
[0138] It is understandable that among the query requests input by the user within the preset time length, some query requests may be correlated, while some query requests may not be correlated. When entity word pairs are formed by combining two by two, entity words included in two query requests that are not correlated will form entity word pairs. In order to ensure that there is a correlation between the entity words included in the constructed related entity word set, after obtaining the entity word pairs composed of entity words included in different query requests, it is also necessary to determine whether the two entity words in each entity word pair are correlated. For entity word pairs in which the two entity words included are correlated, the entity words corresponding to the entity word pairs containing the same entity words are divided into the same related entity word set, thereby constructing a related entity word set. When the two entity words included in an entity word pair are not correlated, the entity word pair is eliminated and not included in the related entity word set.
[0139] For example, the user enters four query requests within the preset time. Query request 1 includes entity words a1 and b1; query request 2 includes entity words a2 and b2; query request 3 includes entity words a3 and b3; query request 4 includes entity words a4 and b4. A total of 24 entity word pairs can be formed: [a1a2], [a1b2], [b1a2], [b1b2]; [a1 However, the query requests 1 and 2 entered by the user are both about "wedding", while the query requests 3 and 4 are about "19-year taxation". There is no correlation between the entity words in query request 1 and the entity words in query request 3 or query request 4. In order to avoid irrelevant entity words being classified into the same set of relevant entity words, it is necessary to judge whether the two entity words in each entity word pair are relevant.
[0140] When judging whether two entity words in an entity word pair are related, the entity word pairs to be eliminated and the entity word pairs that can be classified into the same related entity word set can be determined according to the judgment result. Assume that the two entity words included in each entity word pair [a1a2], [a1b2], [b1a2], [b1b2] are related, and the two entity words included in each entity word pair [a3a4], [a3b4], [b3a4], [b3b4] are related. However, the two entity words included in each entity word pair [a1a3], [a1b3], [b1a3], and [b1b3] have no correlation, the two entity words included in each entity word pair [a1a4], [a1b4], [b1a4], and [b1b4] have no correlation, the two entity words included in each entity word pair [a2a3], [a2b3], [b2a3], and [b2b3] have no correlation, and the two entity words included in each entity word pair [a2a4], [a2b4], [b2a4], and [b2b4] have no correlation. In this case, the entity word pairs including irrelevant entity words will be eliminated, and the entity words in the entity word pairs containing the same entity words will be divided into the same set of related entity words. For example, [a1a2] and [a1b2] contain the same entity word a1, [b1a2] and [b1b2] contain the same entity word b1, and a1 and b1 are related by default, so the related entity word set 1 can be established as [a1b1a2b2]. [a3a4] and [a3b4] contain the same entity word a3, [b3a4] and [b3b4] contain the same entity word b3, and a3 and b3 are related by default, so the related entity word set 2 is constructed as [a3b3a4b4], that is, two related entity word sets are established.
[0141] It should be noted that when actually training a language model, it is necessary to obtain a large number of relevant entity word sets corresponding to each user, so as to use a large number of relevant entity word sets for subsequent language model training. The relevant entity word sets corresponding to each user can be obtained by the above method, thereby obtaining a large number of relevant entity word sets.
[0142] In a possible implementation of the embodiment of the present application, two implementation methods for determining whether two entity words in an entity word pair are related are provided, and these two methods will be described below respectively.
[0143] One is to calculate the correlation value between two entity words in an entity word pair. When the correlation value is greater than or equal to a first threshold, the two entity words in the entity word pair are correlated. When the correlation value is less than the first threshold, the two entity words in the entity word pair are not correlated. That is, for each entity word pair, the correlation value between the two entity words is calculated. If the correlation value is greater than or equal to the first threshold, it is determined that there is a correlation between the two entity words in the entity word pair. Otherwise, it is determined that there is no correlation between the two entity words in the entity word pair. Among them, the first threshold can be set according to actual conditions, and this example is not limited here.
[0144] Another is to obtain the number of times two entity words in an entity word pair appear in the same query request. When the number is greater than or equal to the second threshold, there is a correlation between the two entity words in the entity word pair. When the number is less than the second threshold, there is no correlation between the two entity words in the entity word pair. In a specific implementation, it can be considered that the entity words in the same query request are related, and the occurrence of entity word pairs in a large number of query requests from different users can be counted. For an entity word pair, the number of occurrences of the two entity words in the entity word pair in the same query request can be obtained. If the number of occurrences together is greater than or equal to the second threshold, it is determined that there is a correlation between the two entity words in the entity word pair, otherwise there is no correlation. Among them, the second threshold can be determined according to the actual situation, and this embodiment is no longer limited here.
[0145] Through the method provided in this embodiment, the required set of related entity words can be constructed, so that the language model can be trained using the set of related entity words, the word vectors corresponding to each entity word in the set of related entity words can be obtained, and then the entity word vector set can be obtained, so that the entity word vector set can be used for entity recommendation.
[0146] Based on the above method embodiment, the present application also provides an entity recommendation device, which will be described below in conjunction with the device.
[0147] See also Figure 5 , which is a structural diagram of an entity recommendation device provided in an embodiment of the present application, such as Figure 4 As shown, the device may include:
[0148] An extraction unit 501 is used to obtain a target query request input by a user and extract target entity words included in the target query request;
[0149] The first determining unit 502 is used to obtain the word vector of the target entity word according to the pre-generated entity word vector set; determine the word vector corresponding to the target query request according to the word vectors of each target entity word included in the target query request; the entity word vector set includes the word vector corresponding to the entity word, and the entity word vector set is obtained by training based on at least one related entity word set;
[0150] A searching unit 503 is configured to search the entity word vector set for at least one word vector having a high similarity to the word vector corresponding to the target query request;
[0151] A second determining unit 504 is used to determine the entity word corresponding to the at least one word vector found as a recommended word corresponding to the target query request;
[0152] The recommendation unit 505 is used to recommend the recommendation word to the user.
[0153] In a possible implementation manner, the first determining unit is further configured to:
[0154] An average value of the word vectors of all target entity words included in the target query request is calculated, and the average value is determined as the word vector corresponding to the target query request.
[0155] In a possible implementation manner, the second determining unit includes:
[0156] A sorting subunit, used to sort the entity words corresponding to the at least one word vector found according to the relevance to the target query request;
[0157] The first determination subunit is used to determine the entity word corresponding to the word vector whose ranking result meets the preset condition as the recommended word corresponding to the target query request.
[0158] In a possible implementation manner, the device further includes:
[0159] An acquisition unit, used to acquire at least one set of related entity words;
[0160] A training unit is used to train a language model according to the at least one related entity word set to obtain a word vector of each entity word to form an entity word vector set.
[0161] In a possible implementation, the acquiring unit includes:
[0162] An acquisition subunit, used to acquire at least one query request input by the same user within a preset time period;
[0163] A first extraction subunit, used to extract entity words from each query request;
[0164] The construction subunit is used to construct a set of related entity words based on the extracted entity words.
[0165] In a possible implementation, the construction subunit includes:
[0166] The second extraction sub-unit, no wonder, combines entity words extracted from different query requests into entity word pairs;
[0167] A second determination subunit is used to determine whether two entity words in the entity word pair are related;
[0168] The partitioning sub-unit is used to remove entity word pairs in which two entity words in the entity word pairs are not related, and among the remaining entity word pairs, the entity words corresponding to the entity word pairs containing the same entity words are divided into the same related entity word set to construct at least one related entity word set.
[0169] In a possible implementation manner, the second determining subunit is specifically configured to:
[0170] The correlation value between the two entity words in the entity word pair is calculated. When the correlation value is greater than or equal to a first threshold, the two entity words in the entity word pair are correlated. When the correlation value is less than the first threshold, the two entity words in the entity word pair are not correlated.
[0171] In a possible implementation manner, the second determining subunit is specifically configured to:
[0172] The number of times the two entity words in the entity word pair appear in the same query request is obtained; when the number is greater than or equal to a second threshold, there is a correlation between the two entity words in the entity word pair; when the number is less than the second threshold, there is no correlation between the two entity words in the entity word pair.
[0173] In a possible implementation manner, the device further includes:
[0174] A building unit is used to build a high-dimensional search tree according to a set of entity word vectors;
[0175] The searching unit is specifically used for:
[0176] Search the high-dimensional search tree for at least one word vector having a high similarity to the word vector corresponding to the target query request.
[0177] It should be noted that the implementation of each unit in this embodiment can refer to the above method embodiment, and this embodiment will not be repeated here.
[0178] Figure 6A block diagram of an apparatus 600 for implementing entity recommendation is shown. For example, the apparatus 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0179] Reference Figure 6 , the device 600 may include one or more of the following components: a processing component 602 , a memory 604 , a power component 606 , a multimedia component 608 , an audio component 610 , an input / output (I / O) interface 612 , a sensor component 614 , and a communication component 616 .
[0180] The processing component 602 generally controls the overall operation of the device 600, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 602 may include one or more modules to facilitate the interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate the interaction between the multimedia component 608 and the processing component 602.
[0181] The memory 604 is configured to store various types of data to support operations on the device 600. Examples of such data include instructions for any application or method operating on the device 600, contact data, phone book data, messages, pictures, videos, etc. The memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0182] The power supply component 606 provides power to the various components of the device 600. The power supply component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 600.
[0183] The multimedia component 608 includes a screen that provides an output interface between the device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front camera and / or a rear camera. When the device 600 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0184] The audio component 610 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 600 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 604 or sent via the communication component 616. In some embodiments, the audio component 610 also includes a speaker for outputting audio signals.
[0185] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0186] The sensor assembly 614 includes one or more sensors for providing various aspects of status assessment for the device 600. For example, the sensor assembly 614 can detect the open / closed state of the device 600, the relative positioning of components, such as the display and keypad of the device 600, and the sensor assembly 614 can also detect the position change of the device 600 or a component of the device 600, the presence or absence of user contact with the device 600, the orientation or acceleration / deceleration of the device 600, and the temperature change of the device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 614 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0187] The communication component 616 is configured to facilitate wired or wireless communication between the device 600 and other devices. The device 600 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 616 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0188] In an exemplary embodiment, the apparatus 600 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the following methods:
[0189] Obtaining a target query request input by a user, and extracting target entity words included in the target query request;
[0190] According to a pre-generated entity word vector set, a word vector of the target entity word is obtained; according to the word vectors of each target entity word included in the target query request, a word vector corresponding to the target query request is determined; the entity word vector set includes word vectors corresponding to entity words, and the entity word vector set is obtained by training based on at least one related entity word set;
[0191] Searching for at least one word vector having a high similarity with the word vector corresponding to the target query request in the entity word vector set, and determining the entity word corresponding to the at least one word vector found as the recommended word corresponding to the target query request;
[0192] The recommended word is recommended to the user.
[0193] Optionally, determining the word vector corresponding to the target query request according to the word vectors of each target entity word included in the target query request includes:
[0194] An average value of the word vectors of all target entity words included in the target query request is calculated, and the average value is determined as the word vector corresponding to the target query request.
[0195] Optionally, determining the entity word corresponding to the at least one found word vector as the recommended word corresponding to the target query request includes:
[0196] Sorting the entity words corresponding to the at least one word vector found according to their relevance to the target query request;
[0197] The entity word corresponding to the word vector whose ranking result meets the preset conditions is determined as the recommended word corresponding to the target query request.
[0198] Optionally, the method further includes:
[0199] Obtain at least one related entity word set;
[0200] A language model is trained according to the at least one related entity word set to obtain a word vector for each entity word to form the entity word vector set.
[0201] Optionally, obtaining at least one related entity word set includes:
[0202] Obtain at least one query request entered by the same user within a preset time period;
[0203] Extract entity words from each query request;
[0204] Construct a set of related entity words based on the extracted entity words.
[0205] Optionally, constructing a set of related entity words according to the extracted entity words includes:
[0206] Combine entity words extracted from different query requests in pairs to form entity word pairs;
[0207] Determine whether two entity words in the entity word pair are related;
[0208] Entity word pairs in which two entity words are not related are eliminated, and among the remaining entity word pairs, the entity words corresponding to the entity word pairs containing the same entity words are divided into the same related entity word set to construct at least one related entity word set.
[0209] Optionally, determining whether two entity words in the entity word pair are related includes:
[0210] Calculating the relevance value between two entity words in the entity word pair;
[0211] When the relevance value is greater than or equal to a first threshold, there is relevance between the two entity words in the entity word pair;
[0212] When the relevance value is less than the first threshold, there is no relevance between the two entity words in the entity word pair.
[0213] Optionally, determining whether two entity words in the entity word pair are related includes:
[0214] Obtain the number of times two entity words in the entity word pair appear in the same query request;
[0215] When the number is greater than or equal to a second threshold, there is correlation between the two entity words in the entity word pair;
[0216] When the number is less than the second threshold, there is no correlation between the two entity words in the entity word pair.
[0217] Optionally, the method further includes:
[0218] Establish a high-dimensional retrieval tree based on the entity word vector set;
[0219] The searching the entity word vector set for at least one word vector having a high similarity to the word vector corresponding to the query request includes:
[0220] Search the high-dimensional search tree for at least one word vector having a high similarity to the word vector corresponding to the target query request.
[0221] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, and the instructions can be executed by a processor 620 of the device 600 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0222] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a mobile terminal, enables the mobile terminal to perform a method for entity recommendation, the method comprising:
[0223] Obtaining a target query request input by a user, and extracting target entity words included in the target query request;
[0224] According to a pre-generated entity word vector set, a word vector of the target entity word is obtained; according to the word vectors of each target entity word included in the target query request, a word vector corresponding to the target query request is determined; the entity word vector set includes word vectors corresponding to entity words, and the entity word vector set is obtained by training based on at least one related entity word set;
[0225] Searching for at least one word vector having a high similarity with the word vector corresponding to the target query request in the entity word vector set, and determining the entity word corresponding to the at least one word vector found as the recommended word corresponding to the target query request;
[0226] The recommended word is recommended to the user.
[0227] Optionally, determining the word vector corresponding to the target query request according to the word vectors of each target entity word included in the target query request includes:
[0228] An average value of the word vectors of all target entity words included in the target query request is calculated, and the average value is determined as the word vector corresponding to the target query request.
[0229] Optionally, determining the entity word corresponding to the at least one found word vector as the recommended word corresponding to the target query request includes:
[0230] Sorting the entity words corresponding to the at least one word vector found according to their relevance to the target query request;
[0231] The entity word corresponding to the word vector whose ranking result meets the preset conditions is determined as the recommended word corresponding to the target query request.
[0232] Optionally, the method further includes:
[0233] Obtain at least one related entity word set;
[0234] A language model is trained according to the at least one related entity word set to obtain a word vector for each entity word to form the entity word vector set.
[0235] Optionally, obtaining at least one related entity word set includes:
[0236] Obtain at least one query request entered by the same user within a preset time period;
[0237] Extract entity words from each query request;
[0238] Construct a set of related entity words based on the extracted entity words.
[0239] Optionally, constructing a set of related entity words according to the extracted entity words includes:
[0240] Combine entity words extracted from different query requests in pairs to form entity word pairs;
[0241] Determine whether two entity words in the entity word pair are related;
[0242] Entity word pairs in which two entity words are not related are eliminated, and among the remaining entity word pairs, the entity words corresponding to the entity word pairs containing the same entity words are divided into the same related entity word set to construct at least one related entity word set.
[0243] Optionally, determining whether two entity words in the entity word pair are related includes:
[0244] Calculating the relevance value between two entity words in the entity word pair;
[0245] When the relevance value is greater than or equal to a first threshold, there is relevance between the two entity words in the entity word pair;
[0246] When the relevance value is less than the first threshold, there is no relevance between the two entity words in the entity word pair.
[0247] Optionally, determining whether two entity words in the entity word pair are related includes:
[0248] Obtain the number of times two entity words in the entity word pair appear in the same query request;
[0249] When the number is greater than or equal to a second threshold, there is correlation between the two entity words in the entity word pair;
[0250] When the number is less than the second threshold, there is no correlation between the two entity words in the entity word pair.
[0251] Optionally, the method further includes:
[0252] Establish a high-dimensional retrieval tree based on the entity word vector set;
[0253] The searching the entity word vector set for at least one word vector having a high similarity to the word vector corresponding to the query request includes:
[0254] Search the high-dimensional search tree for at least one word vector having a high similarity to the word vector corresponding to the target query request.
[0255] Figure 77 is a schematic diagram of the structure of the server in the embodiment of the present invention. The server 700 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 722 (for example, one or more processors) and memory 732, and one or more storage media 730 (for example, one or more mass storage devices) storing application programs 742 or data 744. Among them, the memory 732 and the storage medium 730 can be temporary storage or permanent storage. The program stored in the storage medium 730 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the server. Furthermore, the central processing unit 722 can be configured to communicate with the storage medium 730 to execute a series of instruction operations in the storage medium 730 on the server 700.
[0256] The terminal 700 may also include one or more power supplies 726, one or more wired or wireless network interfaces 750, one or more input and output interfaces 758, one or more keyboards 756, and / or one or more operating systems 741, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0257] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0258] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0259] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0260] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0261] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An entity recommendation method, characterized in that: The method comprises: Obtaining a target query request input by a user, and extracting target entity words included in the target query request; Based on a pre-generated entity word vector set, and according to a mapping relationship between entity words and word vectors in the entity word vector set, a word vector of the target entity word is obtained; according to the word vectors of each target entity word included in the target query request, a word vector corresponding to the target query request is determined; the entity word vector set includes word vectors corresponding to entity words, and the entity word vector set is obtained by training based on at least one related entity word set; Searching for at least one word vector having a high similarity with the word vector corresponding to the target query request in the entity word vector set, and determining the entity word corresponding to the at least one word vector found as the recommended word corresponding to the target query request; wherein the high similarity is to arrange the word vector similarities in descending order and take the first at least one similarity; recommending the recommendation word to the user; Wherein, determining the word vector corresponding to the target query request according to the word vector of each target entity word included in the target query request includes: An average value of the word vectors of all target entity words included in the target query request is calculated, and the average value is determined as the word vector corresponding to the target query request.
2. The method according to claim 1, characterized in that: The step of determining the entity word corresponding to the at least one word vector found as the recommended word corresponding to the target query request includes: Sorting the entity words corresponding to the at least one word vector found according to their relevance to the target query request; The entity word corresponding to the word vector whose ranking result meets the preset conditions is determined as the recommended word corresponding to the target query request.
3. The method according to claim 1, characterized in that The method further comprises: Obtain at least one related entity word set; A language model is trained according to the at least one related entity word set to obtain a word vector for each entity word to form the entity word vector set.
4. The method according to claim 3, characterized in that The obtaining of at least one related entity word set includes: Obtain at least one query request entered by the same user within a preset time period; Extract entity words from each query request; Construct a set of related entity words based on the extracted entity words.
5. The method according to claim 4, characterized in that The step of constructing a set of related entity words according to the extracted entity words includes: Combine entity words extracted from different query requests in pairs to form entity word pairs; Determine whether two entity words in the entity word pair are related; Entity word pairs in which two entity words are not related are eliminated, and among the remaining entity word pairs, the entity words corresponding to the entity word pairs containing the same entity words are divided into the same related entity word set to construct at least one related entity word set.
6. The method according to claim 5, characterized in that The determining whether two entity words in the entity word pair are related includes: Calculating the relevance value between two entity words in the entity word pair; When the relevance value is greater than or equal to a first threshold, there is relevance between the two entity words in the entity word pair; When the relevance value is less than the first threshold, there is no relevance between the two entity words in the entity word pair.
7. The method according to claim 5, characterized in that The determining whether two entity words in the entity word pair are related includes: Obtain the number of times two entity words in the entity word pair appear in the same query request; When the number is greater than or equal to a second threshold, there is correlation between the two entity words in the entity word pair; When the number is less than the second threshold, there is no correlation between the two entity words in the entity word pair.
8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Establish a high-dimensional retrieval tree based on the entity word vector set; The step of searching the entity word vector set for at least one word vector having a high similarity to the word vector corresponding to the query request further includes: Search the high-dimensional search tree for at least one word vector having a high similarity to the word vector corresponding to the target query request.
9. An entity recommendation device, characterized in that: The device comprises: An extraction unit, configured to obtain a target query request input by a user, and extract a target entity word included in the target query request; A first determination unit is used to obtain the word vector of the target entity word based on a pre-generated entity word vector set and according to a mapping relationship between entity words and word vectors in the entity word vector set; determine the word vector corresponding to the target query request according to the word vectors of each target entity word included in the target query request; the entity word vector set includes word vectors corresponding to entity words, and the entity word vector set is obtained by training based on at least one related entity word set; A search unit, used to search the entity word vector set for at least one word vector having a higher similarity to the word vector corresponding to the target query request; wherein the higher similarity is to arrange the word vector similarities in descending order and take the first at least one similarity; A second determining unit, configured to determine the entity word corresponding to the at least one word vector found as a recommended word corresponding to the target query request; A recommendation unit, configured to recommend the recommendation word to the user; The first determining unit is further configured to: An average value of the word vectors of all target entity words included in the target query request is calculated, and the average value is determined as the word vector corresponding to the target query request.
10. The device according to claim 9, characterized in that The second determining unit includes: A sorting subunit, used to sort the entity words corresponding to the at least one word vector found according to the relevance to the target query request; The first determination subunit is used to determine the entity word corresponding to the word vector whose ranking result meets the preset condition as the recommended word corresponding to the target query request.
11. The device according to claim 9, characterized in that The device also includes: An acquisition unit, used to acquire at least one set of related entity words; A training unit is used to train a language model according to the at least one related entity word set to obtain a word vector of each entity word to form the entity word vector set.
12. The device according to claim 11, characterized in that The acquisition unit comprises: An acquisition subunit, used to acquire at least one query request input by the same user within a preset time period; A first extraction subunit, used to extract entity words from each query request; The construction subunit is used to construct a set of related entity words based on the extracted entity words.
13. The device according to claim 12, characterized in that The construction subunit comprises: The second extraction subunit is used to combine entity words extracted from different query requests into entity word pairs; A second determination subunit is used to determine whether two entity words in the entity word pair are related; The partitioning sub-unit is used to remove entity word pairs in which two entity words in the entity word pairs are not related, and among the remaining entity word pairs, the entity words corresponding to the entity word pairs containing the same entity words are divided into the same related entity word set to construct at least one related entity word set.
14. The device according to claim 13, characterized in that The second determining subunit is specifically used for: Calculating a correlation value between two entity words in the entity word pair; when the correlation value is greater than or equal to a first threshold, the two entity words in the entity word pair are correlated; When the relevance value is less than the first threshold, there is no relevance between the two entity words in the entity word pair.
15. The device according to claim 13, characterized in that The second determining subunit is specifically used for: Obtaining the number of times that two entity words in the entity word pair appear in the same query request; when the number is greater than or equal to a second threshold, the two entity words in the entity word pair are correlated; When the number is less than the second threshold, there is no correlation between the two entity words in the entity word pair.
16. The device according to any one of claims 9 to 15, characterized in that: The device also includes: A building unit is used to build a high-dimensional search tree according to a set of entity word vectors; The searching unit is specifically used for: Search the high-dimensional search tree for at least one word vector having a high similarity to the word vector corresponding to the target query request.
17. A device for entity recommendation, characterized in that: The system comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, wherein the one or more programs include instructions for performing the following operations: Obtaining a target query request input by a user, and extracting target entity words included in the target query request; Based on a pre-generated entity word vector set, and according to the mapping relationship between entity words and word vectors in the entity word vector set, the word vector of the target entity word is obtained; according to the word vectors of each target entity word included in the target query request, the word vector corresponding to the target query request is determined; the entity word vector set includes word vectors corresponding to entity words, and the entity word vector set is obtained by training based on at least one related entity word set; Searching for at least one word vector having a high similarity with the word vector corresponding to the target query request in the entity word vector set, and determining the entity word corresponding to the at least one word vector found as the recommended word corresponding to the target query request; wherein the high similarity is to arrange the word vector similarities in descending order and take the first at least one similarity; recommending the recommendation word to the user; The determining, according to the word vectors of each target entity word included in the target query request, the word vector corresponding to the target query request includes: An average value of the word vectors of all target entity words included in the target query request is calculated, and the average value is determined as the word vector corresponding to the target query request.
18. The device according to claim 17, characterized in that The step of determining the entity word corresponding to the at least one word vector found as the recommended word corresponding to the target query request includes: Sorting the entity words corresponding to the at least one word vector found according to their relevance to the target query request; The entity word corresponding to the word vector whose ranking result meets the preset conditions is determined as the recommended word corresponding to the target query request.
19. The device according to claim 17, characterized in that The processor is further configured to execute the one or more programs including instructions for performing the following operations: Obtain at least one related entity word set; A language model is trained according to the at least one related entity word set to obtain a word vector for each entity word to form the entity word vector set.
20. The device according to claim 19, characterized in that The obtaining of at least one related entity word set includes: Obtain at least one query request entered by the same user within a preset time period; Extract entity words from each query request; Construct a set of related entity words based on the extracted entity words.
21. The device according to claim 20, characterized in that The step of constructing a set of related entity words according to the extracted entity words includes: Combine entity words extracted from different query requests in pairs to form entity word pairs; Determine whether two entity words in the entity word pair are related; Entity word pairs in which two entity words are not related are eliminated, and among the remaining entity word pairs, the entity words corresponding to the entity word pairs containing the same entity words are divided into the same related entity word set to construct at least one related entity word set.
22. The device according to claim 21, characterized in that The determining whether two entity words in the entity word pair are related includes: Calculating the relevance value between two entity words in the entity word pair; When the relevance value is greater than or equal to a first threshold, there is relevance between the two entity words in the entity word pair; When the relevance value is less than the first threshold, there is no relevance between the two entity words in the entity word pair.
23. The device according to claim 21, characterized in that The determining whether two entity words in the entity word pair are related includes: Obtain the number of times two entity words in the entity word pair appear in the same query request; When the number is greater than or equal to a second threshold, there is correlation between the two entity words in the entity word pair; When the number is less than the second threshold, there is no correlation between the two entity words in the entity word pair.
24. The device according to any one of claims 17 to 23, characterized in that The processor is further configured to execute the one or more programs including instructions for performing the following operations: Establish a high-dimensional retrieval tree based on the entity word vector set; The searching the entity word vector set for at least one word vector having a high similarity to the word vector corresponding to the query request includes: Search the high-dimensional search tree for at least one word vector having a high similarity to the word vector corresponding to the target query request.
25. A computer-readable medium having instructions stored thereon, which, when executed by one or more processors, causes a device to perform the entity recommendation method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Related keyword recommending method and device
CN103970748A
Entity recommendation method and apparatus, terminal and readable storage medium
CN108509479A
Recommendation method and device of media content, storage medium, and electronic device
CN108829822A
Information processing method and device and terminal
CN109033156A
Service component search recommendation method based on semantics
CN109165351A
