Product recommendation method, device and electronic equipment
By establishing an 'intermediate path' between short text and candidate products, and using similar word vector sequences, the problem of short text with few feature words is solved, product recommendation based on short text is realized, and the accuracy of recommendation is improved.
Patent Information
- Application Number
- CN202011271633.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-13
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2040-11-13
AI Technical Summary
It is difficult to implement product recommendation based on short text with the existing technology, because the short text has fewer feature words after word segmentation, and it is difficult to establish an effective association with candidate products.
By determining the subject word vector of the target short text and establishing an 'intermediate path' with the feature word vector of the candidate product, the similarity of the word vector sequence in the preset conditions is used to determine the relevance of the candidate product and the target short text, thereby achieving Product recommendations.
Even when the short text has few feature words, the associated products to be recommended can be indirectly determined, realizing product recommendation based on short text and improving the accuracy and feasibility of the recommendation.
Smart Images

Figure CN112330408B
Abstract
Description
Background Art
[0002] At present, most of the text-based product recommendation methods rely on long texts. The reason is that long texts carry more text information, and more feature words can be obtained after word segmentation. Having more feature words is not only conducive to the training of product recommendation models, but also conducive to the prediction of trained product recommendation models.
[0003] However, for short texts, due to the limitation of the text length of the short texts, the feature words that can be obtained after word segmentation are relatively few, so product recommendations based on short texts cannot be implemented at present. Summary of the invention
[0004] Embodiments of the present invention provide a product recommendation method, device, electronic device, and computer-readable storage medium.
[0005] In a first aspect, an embodiment of the present invention provides a product recommendation method, comprising:
[0006] Determine the subject word corresponding to the target short text, and find the target word vector of the subject word in a preset word vector library;
[0007] Calculating the distance between the target word vector and the feature word vector associated with each candidate product in the word vector library;
[0008] When all calculated distances are greater than a preset distance threshold, for each candidate product, if there are N similar word vectors that meet the preset conditions in the word vector library, the candidate product is determined as a product to be recommended associated with the target short text; wherein the set condition is: in the word vector sequence composed of the N similar word vectors, the distance between the first similar word vector and the target word vector, the distance between the last similar word vector and the feature word vector of the candidate product, and the distance between adjacent similar word vectors are all no greater than the distance threshold.
[0009] In a second aspect, an embodiment of the present invention provides a product recommendation device, including:
[0010] A determination unit, used to determine a subject word corresponding to a target short text, and to search for a target word vector of the subject word in a preset word vector library;
[0011] A calculation unit, used to calculate the distance between the target word vector and the feature word vector associated with each candidate product in the word vector library;
[0012] A recommendation unit, for determining, for each candidate product, a product to be recommended associated with the target short text if there are N similar word vectors satisfying a preset condition in the word vector library when all calculated distances are greater than a preset distance threshold; wherein the set condition is that in a word vector sequence formed by the N similar word vectors, the distance between the first similar word vector and the target word vector, the distance between the last similar word vector and the feature word vector of the candidate product, and the distance between adjacent similar word vectors are all no greater than the distance threshold.
[0013] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, and the computer program, when executed by the processor, implements the steps in the aforementioned product recommendation method.
[0014] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps in the aforementioned product recommendation method.
[0015] The method, device, electronic device, and computer-readable storage medium provided by the embodiments of the present invention can further determine whether there are N similar word vectors that meet the set conditions in the word vector library for each candidate product when it is determined that the distance between the target word vector and the feature word vectors associated with all candidate products is less than a preset distance threshold, and if so, determine the candidate product as a product to be recommended associated with the target short text. By establishing an "intermediate path" between the target word vector and the feature word vector associated with the candidate product, even if there are few feature words obtained by word segmentation of the short text and it is difficult to establish an association between the short text and the candidate product, the product to be recommended associated with the short text can be indirectly determined, thereby achieving product recommendation based on short text. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the background technology, the drawings required for use in the embodiments of the present invention or the background technology will be described below.
[0017] Figure 1 A flow chart of a product recommendation method provided by an embodiment of the present invention is shown;
[0018] Figure 2 A flow chart of generating a target topic classification model in a product recommendation method provided by an embodiment of the present invention is shown;
[0019] Figure 3The flowchart of constructing a word vector library in the product recommendation method provided by an embodiment of the present invention is shown;
[0020] Figure 4 The following is a flowchart showing the determination and recommendation of target recommended products in the product recommendation method provided by an embodiment of the present invention;
[0021] Figure 5 A schematic diagram showing the structure of a product recommendation device provided by an embodiment of the present invention is shown;
[0022] Figure 6 A schematic structural diagram of an electronic device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0023] Those skilled in the art should know that the embodiments of the present invention can be implemented as a product recommendation method, device, electronic device, and computer-readable storage medium. Therefore, the embodiments of the present invention can be specifically implemented in the following forms: complete hardware, complete software (including firmware, resident software, microcode, etc.), a combination of hardware and software. In addition, in some embodiments, the embodiments of the present invention can also be implemented in the form of a computer program product in one or more computer-readable storage media, and the computer-readable storage medium contains computer program code.
[0024] The above-mentioned computer-readable storage medium may adopt any combination of one or more computer-readable storage media. Computer-readable storage media include: electrical, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or devices, or any combination of the above. More specific examples of computer-readable storage media include: portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM), flash memories, optical fibers, compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices or any combination of the above. In an embodiment of the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device, or device.
[0025] The computer program code contained in the above-mentioned computer-readable storage medium can be transmitted by any appropriate medium, including: wireless, wire, optical cable, radio frequency (RF) or any suitable combination thereof.
[0026] The computer program code for performing the operation of the embodiments of the present invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as C language or similar programming languages. The computer program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer, partially on a remote computer, and completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer or to an external computer through any type of network, including a local area network (LAN) or a wide area network (WAN).
[0027] The following will describe embodiments of the present invention with reference to flowcharts and / or block diagrams of product recommendation methods, devices, electronic devices, and computer-readable storage media according to embodiments of the present invention.
[0028] It should be understood that each box in the flowchart and / or block diagram and the combination of boxes in the flowchart and / or block diagram can be implemented by computer-readable program instructions. These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine, and these computer-readable program instructions are executed by a computer or other programmable data processing device to produce a device that implements the functions / operations specified by the boxes in the flowchart and / or block diagram.
[0029] These computer-readable program instructions may also be stored in a computer-readable storage medium that enables a computer or other programmable data processing device to work in a specific manner. In this way, the instructions stored in the computer-readable storage medium produce an instruction device product including functions / operations specified in the blocks in the flowchart and / or block diagram.
[0030] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device, so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby enabling the instructions executed on the computer or other programmable data processing apparatus to provide a process for implementing the functions / operations specified in the blocks in the flowchart and / or block diagram.
[0031] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0032] Figure 1FIG. 1 is a flowchart of a product recommendation method provided by an embodiment of the present invention. Figure 1 As shown, the method includes:
[0033] S101, determine the subject word corresponding to the target short text, and search for the target word vector of the subject word in a preset word vector library.
[0034] In the embodiments of the present invention, short text may refer to a character sequence with a relatively short text content, for example, a conversation message in an instant messaging group in an instant messaging software, or a text to be searched entered by a user in a search engine, etc. The present invention does not specifically limit the specific generation scenario and specific content of short text.
[0035] The above-mentioned target short text can be obtained in a variety of ways. As one implementation method of obtaining the target short text, the client can actively collect the conversation messages sent by the user in the instant messaging group and determine them as the target short text. As another implementation method of obtaining the target short text, the client can also actively collect the text to be searched entered by the user in the search engine and determine it as the target short text. Of course, the above only describes two possible implementation methods by way of example. In actual application, other implementation methods can also be selected according to specific circumstances, and the present invention does not limit this.
[0036] Before making product recommendations for the obtained target short text, it is necessary to pre-train a target topic classification model for determining the subject words of the subject to which the above target short text belongs. Based on this, as an embodiment, determining the subject words corresponding to the target short text in this step 101 may include: segmenting the target short text to obtain a set of characteristic words of the target short text; inputting the set of characteristic words of the target short text into the trained target topic classification model to obtain the subject words. It is worth noting that the characteristic words mentioned here are not one or more special words, but refer to each word obtained after the segmentation, and these words are referred to as characteristic words in the art.
[0037] It should be noted that the word segmentation algorithm used in the above word segmentation can be the Jieba word segmentation algorithm, the forward maximum matching algorithm, the reverse maximum matching algorithm, etc., and the present invention does not limit this.
[0038] After obtaining the topic word corresponding to the target short text, the word vector of the topic word (referred to as the target word vector) can be found in the pre-established word vector library to prepare for use in subsequent steps.
[0039] As for how the target topic classification model described above is trained and how the word vector library is constructed, it will be described in detail below and will not be repeated here.
[0040] S102, calculating the distance between the target word vector and the feature word vector associated with each candidate product in the word vector library.
[0041] In the embodiment of the present invention, the process of constructing the word vector library involves the participation of feature words associated with the candidate products, and the word vectors of the feature words associated with the candidate products also exist in the constructed word vector library.
[0042] It is worth noting that the feature word vector associated with each candidate product in the word vector library can be different from the word vector of the feature word associated with the candidate product. Here are two ways to obtain the feature word vector for illustration:
[0043] The first implementation: In this implementation, the feature word vector of any candidate product can be determined in the following way: assign a weight to each feature word in the feature word set of any candidate product based on a preset weight allocation algorithm; sort the feature words of the candidate product in order of weight value from small to large to obtain a feature word sequence, and select the word vector corresponding to the first K feature words in the feature word sequence in the word vector library as the feature word vector of the candidate product. It should be noted that in this implementation, the value of N is less than the value of the feature word.
[0044] It should be noted that the weight allocation algorithm can be selected according to actual conditions, for example, the tf-idf algorithm, and the present invention is not limited to this.
[0045] Second implementation: In this implementation, the feature word vector associated with any candidate product is the word vector of the feature word associated with the candidate product. That is, the feature word vector and the word vector of the feature word have the same meaning.
[0046] The above describes two implementation methods for determining the feature word vector of any candidate product.
[0047] From the above two implementations, it can be seen that the feature word vector associated with the candidate product can be one or more. When the feature word vector associated with the candidate product is one, it is sufficient to calculate the distance between the only feature word vector and the target word vector. When the feature word vector associated with the candidate product is multiple, it is necessary to calculate the distance between each feature word vector and the target word vector.
[0048] It should be noted that when calculating the distance between word vectors, the Euclidean distance algorithm, the cosine distance algorithm, etc. can be used for calculation, and the present invention does not limit this.
[0049] Step S103, determining whether all calculated distances are greater than a preset distance threshold; if so, proceeding to S104; if not, proceeding to S105.
[0050] Before executing this step 103, a distance threshold needs to be set in advance, and the distance threshold is used to indicate the degree of correlation between the subject word corresponding to the target word vector and the candidate product associated with any feature word vector. Based on this, each calculation result obtained by the above calculation can be compared with the preset distance threshold. If the distance between the target word vector and a feature word vector associated with a candidate product is less than the distance threshold, it means that the candidate product is more related to the subject word. On the contrary, if the distance between the target word vector and a feature word vector associated with a candidate product is greater than the distance threshold, it means that the candidate product is less related to the subject word.
[0051] It should be noted that the above-mentioned preset distance threshold can be set according to actual conditions, and the present invention does not limit this.
[0052] S104: For each candidate product, if there are N similar word vectors satisfying a preset condition in the word vector library, the candidate product is determined as a product to be recommended associated with the target short text.
[0053] It should be noted that step 104 is performed on the premise that all distances calculated in step 102 are greater than a preset distance threshold.
[0054] In an embodiment of the present invention, if all distances calculated in step 102 are greater than a preset distance threshold, it means that all candidate products are relatively unrelated to the subject words corresponding to the target short text, and therefore it is necessary to further explore the indirect correlation between the subject words and each candidate product (that is, the intermediate path between the target word vector and the feature word vector).
[0055] As an example, for each candidate product's feature word vector, it may be determined whether there are N similar word vectors that meet preset conditions in the word vector library; if so, the candidate product is determined as a product to be recommended associated with the target short text.
[0056] Optionally, the above-mentioned preset condition may be: in a word vector sequence consisting of N similar word vectors, the distance between the first similar word vector and the target word vector, the distance between the last similar word vector and the feature word vector of the candidate product, and the distance between adjacent similar word vectors are not greater than the distance threshold.
[0057] To explain the above setting conditions more clearly, here is a simple example: suppose the target word vector is A, any feature word vector of a candidate product is B, the distance between the target word vector A and the feature word vector B is greater than the preset threshold T, and N is 3. Then, the relationship between the word vector sequence [N1, N2, N3] composed of 3 similar word vectors (N1, N2, N3) that meet the setting conditions in the word vector library and A and B is: the distance between A and N1, N1 and N2, N2 and N3, and N3 and B is not greater than the set threshold T.
[0058] It should be noted that, when a candidate product is associated with multiple feature word vectors, if for any feature word vector associated with a candidate product, it has been determined that there are N similar word vectors in the word vector library, then the candidate product can be directly determined as the product to be recommended for the associated target short text, without considering whether there are N similar word vectors between the other feature word vectors of the candidate product and the target word vector.
[0059] Optionally, before executing step 104, it is also possible to determine for each candidate product whether the distance calculated above is greater than N times the distance threshold. If less than, execute step 104. If greater than, it means that the distance between the target word vector and the feature word vector of the candidate product is too large, and there will definitely not be N similar word vectors that meet the set conditions in the word vector library, so there is no need to execute step 102, saving the computing resources required during the execution of the embodiment of the present invention.
[0060] S105: If the distance between the feature word vector of any candidate product and the target word vector is less than a distance threshold, the candidate product is determined as a product to be recommended associated with the target short text.
[0061] It should be noted that step 105 is performed under the premise that there is a distance less than a preset distance threshold among all the distances calculated in step 102 .
[0062] As mentioned above, if the distance between the target word vector and a feature word vector associated with a candidate product is less than the distance threshold, it means that the candidate product is relatively related to the subject word. Since the subject word represents the subject to which the target short text belongs, it can be determined that the candidate product is also relatively related to the target short text, so the candidate product can be determined as a product to be recommended associated with the target short text.
[0063] It should be noted that, for any candidate product, if the candidate product is associated with multiple feature word vectors, it is only necessary to determine that there is a feature word vector whose distance with the target word vector is less than the preset distance threshold, so that the candidate product can be determined as the recommended product associated with the target short text, without having to determine that the distances between all feature word vectors and the target word vector are less than the preset distance threshold.
[0064] So far, completed Figure 1 The process shown.
[0065] It can be seen from the above embodiment that when it is determined that the distance between the target word vector and the feature word vectors associated with all candidate products is less than the preset distance threshold, for each candidate product, it is further possible to determine whether there are N similar word vectors that meet the set conditions in the word vector library, and if so, the candidate product is determined as the product to be recommended associated with the target short text. By establishing an "intermediate path" between the target word vector and the feature word vector associated with the candidate product, even if there are few feature words obtained by word segmentation of the short text and it is difficult to establish an association between the short text and the candidate product, it is possible to indirectly determine the product to be recommended associated with the short text, thereby achieving product recommendation based on short text.
[0066] Here are two ways to generate the above target topic classification model:
[0067] The first implementation method: see Figure 2 , Figure 2 FIG. 2 shows a flow chart of generating a target topic classification model in a product recommendation method provided by an embodiment of the present invention. Figure 2 As shown, the process may include:
[0068] Step 201 , for each conversation message in an existing instant messaging group, the conversation message is segmented, and a feature word set obtained by the segmentation is expanded according to the word vector library to obtain a training feature word set.
[0069] In this implementation, the training samples used to train the target topic classification model are several conversation messages in the instant messaging group. In order to ensure that the trained model has a relatively good classification ability, corresponding restrictions can be made on the aforementioned several conversation messages. For example, restrictions can be made in the following two aspects: First, it is necessary to ensure that the number of conversation messages meets the training requirements of the target topic classification model, such as about 10,000 conversation messages. Of course, this is just an example, and the more training samples, the better. Second, for the aforementioned several conversation messages, a more preferred way of obtaining them is to obtain them from multiple instant messaging groups under the brand to which each candidate product belongs, rather than from any instant messaging group. In this way, it can be ensured that most of the conversation messages obtained are related to the candidate products under the brand.
[0070] In the specific implementation, considering the above two limitations, 5 instant messaging groups can be selected under each brand, and the number of users in these 5 instant messaging groups must be greater than 150, and the duration is selected to be within one quarter. In this way, the number of conversation messages in the instant messaging group can be guaranteed, and the content of the conversation messages can also be guaranteed to be mostly related to the candidate products.
[0071] When training the target topic classification model, it is first necessary to segment each conversation message in the existing instant messaging group to obtain a feature word set for each conversation message. However, as mentioned above, since the short text (conversation messages also belong to short texts) carries less text content, the number of feature words obtained by segmentation is also small. A small number of feature words makes it difficult to train the target topic classification model. Therefore, to solve this problem, the embodiment of the present invention uses the constructed word vector library to expand the segmentation results of each conversation message, and then obtains the expanded feature word set (referred to as the training feature word set).
[0072] Optionally, the feature word set of any conversation message can be expanded in the following manner: for any feature word in the feature word set, the word vector of the feature word is found in the word vector library (recorded as the first word vector). After that, the distances between other word vectors except the first word vector and the first word vector are calculated in the word vector library. All distances less than a preset expansion distance threshold are selected from the calculated distance results, and the words corresponding to the word vectors corresponding to these selected distances are added as expansion words to the feature word set.
[0073] Step 202: training all training feature word sets based on a machine learning algorithm to obtain the target topic classification model.
[0074] In this embodiment, there are multiple implementations for training all training feature word sets based on a machine learning algorithm to obtain a target topic classification model. As one implementation, the following steps may be included: obtaining M training feature word sets that have been labeled; training the M training feature word sets that have been labeled, and other training feature word sets that are not labeled in all training feature word sets based on a semi-supervised machine learning algorithm to obtain a topic classification model; if the topic classification model meets a preset convergence condition, the topic classification model is determined as the target topic classification model.
[0075] In the embodiment of the present invention, the semi-supervised machine learning algorithm used is a positive and unlabeled learning algorithm, which is a semi-supervised machine learning algorithm, which means that among the training samples used to train the machine learning model, only part of the training samples are labeled samples, and the rest of the training samples are unlabeled samples, and the unlabeled samples are used to assist the learning process of the labeled samples. The above-mentioned M training feature word sets that have been labeled are labeled samples, and the other training feature word sets that are not labeled in all training feature word sets are unlabeled samples.
[0076] After constructing the labeled samples and the unlabeled samples, these training samples can be trained based on the semi-supervised machine learning algorithm to construct a topic classification model. For the semi-supervised machine learning algorithm, a variety of machine learning strategies can usually be included. For example: typical machine learning strategies include two-stage strategy and cost-sensitive strategy. As for which machine learning strategy is used to construct the topic classification model during the specific implementation, it can be selected according to the actual situation, and the present invention does not make specific limitations on this.
[0077] After the topic classification model is constructed based on the semi-supervised machine learning algorithm, the test sample can be used to test the topic classification model. If the classification result of the topic classification model for the test sample meets the preset model accuracy requirement, it can be considered that the topic classification model meets the preset convergence condition, and the topic classification model is determined as the target topic classification model. If the classification result of the model for the test sample does not meet the preset model accuracy requirement, it can be considered that the topic classification model does not meet the preset convergence condition, and it is necessary to further adjust the ratio between the training feature word set that has been marked with labels and the other training feature word sets that are not marked with labels in all training feature word sets, and re-construct the topic classification model based on the semi-supervised machine learning algorithm until the constructed topic classification model meets the convergence condition and the target topic classification model is obtained.
[0078] As an example, the target topic classification model obtained by training based on the semi-supervised machine learning algorithm can be a KNN (K-Nearest Neighbor) model based on the semi-supervised machine learning algorithm.
[0079] As a second implementation, all conversation messages in the existing instant messaging group can be manually labeled. Afterwards, all labeled conversation messages are used as the entire sample of the topic classification model to obtain the target topic classification model. It can be seen that in this implementation, since there is no need to train the model, the time required for model generation can be reduced to a certain extent. However, the classification accuracy of the target topic classification model obtained in this way is poor.
[0080] It should be noted that the topic classification model in this implementation can be a KNN (K-Nearest Neighbor) model, a K-means (K-means clustering) model, etc., and the present invention is not limited to this.
[0081] The above describes how to generate the target topic classification model. It is understandable that the two implementation methods of generating the target topic classification model described above are only used as examples and are not intended to limit the present invention.
[0082] The following describes the construction process of the above word vector library:
[0083] See also Figure 3 , Figure 3 FIG. 1 shows a flowchart of constructing a word vector library in the product recommendation method provided by an embodiment of the present invention. Figure 3 As shown, the process may include:
[0084] Step 301 : for each candidate product, segment the existing product description information of the candidate product to obtain a feature word set of the candidate product.
[0085] The product information in this step may be descriptive information of the candidate product, such as the instruction manual of the candidate product, the official website introduction of the candidate product, the product introduction of the shopping website, the evaluation or comment of the candidate product by consumers, etc. The above content may be obtained from the Internet by crawling or by manual input, and the present invention is not limited to this.
[0086] Of course, in order to enrich the range of word vectors included in the word vector library, in addition to the product description information of the above-mentioned candidate products, other texts can also be selected as training corpus, for example, information recorded in Wikipedia and Baidu Encyclopedia.
[0087] It should be noted that the word segmentation algorithm used in the above word segmentation can be the Jieba word segmentation algorithm, the forward maximum matching algorithm, the reverse maximum matching algorithm, etc., and the present invention does not limit this.
[0088] Step 302: Input the feature word set of each candidate product into a neural network language model as a training sample, and train to obtain a word vector of each feature word to generate the word vector library.
[0089] As an example, the neural network language model in this step can be a word2vec model. The training process of the word2vec model here can be implemented in a manner well known to those skilled in the art, and since the process of training the word2vec model here is not the focus of improvement of the embodiment of the present invention, it will not be described in detail.
[0090] The above describes the process of constructing the above-mentioned word vector library. It is understandable that the implementation method of constructing the word vector library described above is only used as an example and is not intended to limit the present invention.
[0091] Once the products to be recommended are obtained, target recommended products can be selected from these products to be recommended and recommended. Figure 4 , Figure 4 FIG. 2 shows a flowchart of determining and recommending target recommended products in a product recommendation method provided by an embodiment of the present invention. Figure 4 As shown, the process may include:
[0092] Step 401 : Select a target recommended product from the determined products to be recommended and send it to a target instant messaging group.
[0093] In the embodiments of the present invention, there are multiple implementation methods for selecting target recommended products from the determined products to be recommended. As one implementation method, for each product to be recommended, the minimum value (recorded as the target distance) among the distances between all feature word vectors associated with the product to be recommended and the target word vector can be first determined. Then, the products to be recommended are sorted in ascending order according to the target distances to obtain a sequence of products to be recommended. Finally, the first L products to be recommended in the sequence are selected as target recommended products.
[0094] It should be noted that the above-mentioned M is a positive integer greater than 0. As for the specific value of M, it can be set according to actual conditions, and the present invention does not limit this.
[0095] After the target recommended product is determined, the target recommended product can be sent to the target instant messaging group in the form of a conversation message. The target instant messaging group here is the instant messaging group where the target short text is located when it is a conversation message.
[0096] Optionally, an instant messaging account controlled by the electronic device may be created in advance and added to the target instant messaging group. After the target recommended product is determined, the electronic device may send the target recommended product to the target instant messaging group via the instant messaging account controlled by the electronic device.
[0097] It should be noted that when sending target recommended products to the target instant messaging group, they can be sent in the form of text or in the form of a web link to the target recommended products on the shopping website. The specific form in which the target recommended products are sent can be determined based on actual conditions, and the present invention does not limit this.
[0098] Step 402, after sending the target recommended product to the instant messaging group, collect conversation messages of a preset duration or a preset number, and input them into a preset text sentiment analysis model to obtain the sentiment of users in the instant messaging group towards the target recommended product.
[0099] In order to know whether the sentiment of each user in the target instant messaging group toward the target recommended product is positive, the conversation messages in the target instant messaging group may be analyzed.
[0100] Optionally, after sending the target recommended product to the target instant messaging group, conversation messages of a preset duration or a preset number may be collected. Afterwards, the collected conversation messages are input into an existing text sentiment analysis model to obtain a sentiment analysis result output by the text sentiment analysis model.
[0101] It should be noted that the above-mentioned text sentiment analysis model can be selected according to actual conditions. For example, it can be pre-trained using existing classifiers such as Support Vector Machine (SVM) and Naive Bayesian Model (NBM), or it can be pre-trained using existing classification functions (such as softmax function, etc.).
[0102] The sentiment analysis results output by the above text sentiment analysis model can be used to adjust the aforementioned target topic classification model and word vector library.
[0103] The above describes how to determine and recommend target recommended products.
[0104] The above describes in detail the product recommendation method provided by the embodiment of the present invention. The above method can also be implemented by a corresponding device. The product recommendation device provided by the embodiment of the present invention will be described in detail below.
[0105] Figure 5 FIG. 1 is a schematic diagram showing the structure of a product recommendation device provided by an embodiment of the present invention. Figure 5 As shown, the recommended device for this product includes:
[0106] A determination unit, used to determine a subject word corresponding to a target short text, and to search for a target word vector of the subject word in a preset word vector library;
[0107] A calculation unit, used to calculate the distance between the target word vector and the feature word vector associated with each candidate product in the word vector library;
[0108] A recommendation unit, for determining, for each candidate product, a product to be recommended associated with the target short text if there are N similar word vectors satisfying a preset condition in the word vector library when all calculated distances are greater than a preset distance threshold; wherein the set condition is that in a word vector sequence formed by the N similar word vectors, the distance between the first similar word vector and the target word vector, the distance between the last similar word vector and the feature word vector of the candidate product, and the distance between adjacent similar word vectors are all no greater than the distance threshold.
[0109] As an example, the recommendation unit is further used to: for each candidate product, if the distance between the feature word vector of the candidate product and the target word vector is less than the distance threshold, determine the candidate product as a product to be recommended associated with the target short text.
[0110] As an example, the determination unit determines the subject words corresponding to the target short text, including: segmenting the target short text to obtain a feature word set of the target short text; inputting the feature word set of the target short text into a trained target topic classification model to obtain the subject words.
[0111] As an example, the target topic classification model is trained in the following way: for each conversation message in an existing instant messaging group, the conversation message is segmented, and the feature word set obtained by the segmentation is expanded according to the word vector library to obtain a training feature word set; all training feature word sets are trained based on a machine learning algorithm to obtain the target topic classification model.
[0112] As an example, all training feature word sets are trained based on a machine learning algorithm to obtain the target topic classification model, including: obtaining M training feature word sets that have been labeled with labels; training the M training feature word sets that have been labeled with labels, as well as other training feature word sets that are not labeled in all training feature word sets, based on a semi-supervised machine learning algorithm to obtain a topic classification model; if the topic classification model meets a preset convergence condition, the topic classification model is determined as the target topic classification model.
[0113] As an example, a word vector library is generated in the following manner: for each candidate product, the existing product description information of the candidate product is segmented to obtain a set of feature words for the candidate product; the set of feature words of each candidate product is input into a neural network language model as a training sample, and the word vector of each feature word is obtained through training to generate the word vector library.
[0114] As an example, the feature word vector of any candidate product is determined in the following way: a weight is assigned to each feature word in the feature word set of any candidate product based on a preset weight allocation algorithm; the feature words of the candidate product are sorted in order from small to large according to the weight value to obtain a feature word sequence, and the word vectors corresponding to the first K feature words in the feature word sequence in the word vector library are selected as the feature word vector of the candidate product.
[0115] As an example, if the target text is a conversation message within a target instant messaging group, the recommendation unit is also used to: select a target recommended product from the determined products to be recommended and send it to the target instant messaging group; after sending the target recommended product to the target instant messaging group, collect conversation messages of a preset duration or a preset number, and input them into a preset text sentiment analysis model to obtain the sentiments of users in the target instant messaging group towards the target recommended product.
[0116] The above Figure 5 Recommended devices for the products shown are described.
[0117] In addition, an embodiment of the present invention further provides an electronic device, including a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor. The transceiver, the memory, and the processor are respectively connected via a bus. When the computer program is executed by the processor, each process of the above-mentioned product recommendation method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0118] For details, see Figure 6As shown, an embodiment of the present invention further provides an electronic device, which includes a bus 71, a processor 72, a transceiver 73, a bus interface 74, a memory 75 and a user interface 76.
[0119] The transceiver 73 is used to receive and send data under the control of the processor 72 .
[0120] exist Figure 6 In the figure, a bus architecture (represented by bus 71) is shown, and bus 71 may include any number of interconnected buses and bridges, which connect various circuits including one or more processors represented by processor 72 and memory represented by memory 75.
[0121] Bus 71 represents one or more of any of several types of bus structures, including a memory bus and memory controller, a peripheral bus, an Accelerate Graphical Port (AGP), a processor, or a local bus using any of a variety of bus architectures. By way of example and not limitation, such architectures include: Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA) bus, Video Electronics Standards Association (VESA), Peripheral Component Interconnect (PCI) bus.
[0122] The processor 72 may be an integrated circuit chip having signal processing capabilities. In the implementation process, each step of the above method embodiment may be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processors include: a general-purpose processor, a central processing unit (CPU), a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a complex programmable logic device (CPLD), a programmable logic array (PLA), a microcontroller unit (MCU) or other programmable logic devices, discrete gates, transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention may be implemented or executed. For example, the processor may be a single-core processor or a multi-core processor, and the processor may be integrated into a single chip or located on multiple different chips.
[0123] The processor 72 can be a microprocessor or any conventional processor. The steps of the product recommendation method disclosed in the embodiment of the present invention can be directly executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a readable storage medium known in the art, such as a random access memory (RAM), a flash memory (Flash Memory), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a register, etc. The readable storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0124] The bus 71 may also connect various other circuits such as peripheral devices, voltage regulators or power management circuits, and the bus interface 74 provides an interface between the bus 71 and the transceiver 73, which are well known in the art. Therefore, the embodiment of the present invention will not be further described.
[0125] The transceiver 73 may be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. For example, the transceiver 73 receives external data from other devices, and the transceiver 73 is used to send data processed by the processor 72 to other devices. Depending on the nature of the computer system, a user interface 76 may also be provided, such as a touch screen, a physical keyboard, a display, a mouse, a speaker, a microphone, a trackball, a joystick, or a stylus.
[0126] It should be understood that in an embodiment of the present invention, the memory 75 may further include a memory remotely arranged relative to the processor 72, and these remotely arranged memories may be connected to the server via a network. One or more parts of the above-mentioned network may be an ad hoc network, an intranet, an extranet, a virtual private network (VPN), a local area network (LAN), a wireless local area network (WLAN), a wide area network (WAN), a wireless wide area network (WWAN), a metropolitan area network (MAN), the Internet, a public switched telephone network (PSTN), a plain old telephone service network (POTS), a cellular telephone network, a wireless network, a wireless fidelity (Wi-Fi) network, and a combination of two or more of the above-mentioned networks. For example, the cellular telephone network and the wireless network can be a Global System for Mobile Communications (GSM) system, a Code Division Multiple Access (CDMA) system, a Worldwide Interoperability for Microwave Access (WiMAX) system, a General Packet Radio Service (GPRS) system, a Wideband Code Division Multiple Access (WCDMA) system, a Long Term Evolution (LTE) system, a LTE Frequency Division Duplex (FDD) system, a LTE Time Division Duplex (TDD) system, an Advanced Long Term Evolution (LTE-A) system, a Universal Mobile Telecommunications (UMTS) system, an Enhanced Mobile Broadband (Enhance Mobile Broadband, eMBB) system, a massive Machine Type of Communication (mMTC) system, an Ultra-Reliable Low Latency Communications (UltraReliable Low Latency Communications, uRLLC) system, etc.
[0127] It should be understood that the memory 75 in the embodiment of the present invention may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory includes: Read-Only Memory (ROM), Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM) or Flash Memory.
[0128] Volatile memory includes: Random Access Memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as: Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), Synchronous Link Dynamic Random Access Memory (SLDRAM) and Direct Rambus RAM (DRRAM). The memory 75 of the electronic device described in the embodiment of the present invention includes but is not limited to the above and any other suitable types of memory.
[0129] In the embodiment of the present invention, the memory 75 stores the following elements of the operating system 751 and the application program 752: executable modules, data structures, or subsets thereof, or extended sets thereof.
[0130] Specifically, the operating system 751 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 752 includes various applications, such as a media player (Media Player) and a browser (Browser), which are used to implement various application services. The program for implementing the method of the embodiment of the present invention may be included in the application 752. The application 752 includes applets, objects, components, logic, data structures, and other computer system executable instructions that perform specific tasks or implement specific abstract data types.
[0131] In addition, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned product recommendation method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0132] Computer readable storage media include: permanent and non-permanent, removable and non-removable media, which are tangible devices that can retain and store instructions for use by instruction execution devices. Computer readable storage media include: electronic storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, and any suitable combination of the above. Computer readable storage media include: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), non-volatile random access memory (NVRAM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassette storage, magnetic tape disk storage or other magnetic storage devices, memory sticks, mechanical encoding devices (such as punched cards or raised structures in grooves with instructions recorded thereon) or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined in the embodiments of the present invention, computer-readable storage media do not include temporary signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (such as light pulses passing through fiber optic cables), or electrical signals transmitted through wires.
[0133] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0134] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of the present invention can be implemented by electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer program instructions. The computer program instructions include: assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, integrated circuit configuration data, or source code or object code written in any combination of one or more programming languages, the programming language includes an object-oriented programming language, such as Smalltalk, C++, and a procedural programming language, such as C language or a similar programming language.
[0135] When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated, and the computer may be a computer, a special computer, a computer network or other editable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example: the computer instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired (e.g., coaxial cable, twisted pair, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a magnetic disk, a magnetic tape), an optical medium (e.g., an optical disk) or a semiconductor medium (e.g., a solid-state drive (SSD)), etc. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present invention.
[0136] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments of the present invention, and will not be repeated here.
[0137] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, electronic devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or it can be an electrical, mechanical or other form of connection.
[0138] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, and may be located in one location or distributed on multiple network units. Some or all of the units may be selected according to actual needs to solve the problem to be solved by the embodiments of the present invention.
[0139] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0140] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention is essentially or part of the contribution to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (including: a personal computer, a server, a data center or other network device) to perform all or part of the steps of the method described in each embodiment of the present invention. The above-mentioned storage medium includes various media that can store program codes as listed above.
[0141] The above is only a specific implementation of the embodiment of the present invention, but the protection scope of the embodiment of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the embodiment of the present invention, which should be included in the protection scope of the embodiment of the present invention. Therefore, the protection scope of the embodiment of the present invention should be based on the protection scope of the claims.
Claims
1. A product recommendation method, characterized in that: include: Determine the subject word corresponding to the target short text, and find the target word vector of the subject word in a preset word vector library; Calculating the distance between the target word vector and the feature word vector associated with each candidate product in the word vector library; In the case where all calculated distances are greater than a preset distance threshold, for each candidate product, if there are N similar word vectors that meet a preset condition in the word vector library, the candidate product is determined as a product to be recommended associated with the target short text; wherein the preset condition is: in the word vector sequence composed of the N similar word vectors, the distance between the first similar word vector and the target word vector, the distance between the last similar word vector and the feature word vector of the candidate product, and the distance between adjacent similar word vectors are all not greater than the distance threshold; The determining of the subject words corresponding to the target short text includes: Segmenting the target short text to obtain a set of characteristic words of the target short text; inputting the set of characteristic words of the target short text into a trained target topic classification model to obtain the topic words; When all calculated distances are greater than a preset distance threshold, the method further includes: For each candidate product, if the distance between the feature word vector associated with the candidate product and the target word vector is not greater than N times the distance threshold, then if there are N similar word vectors that meet the preset conditions in the word vector library, the step of determining the candidate product as a product to be recommended associated with the target short text is performed; The method further comprises: For each of the candidate products, if the distance between the feature word vector of the candidate product and the target word vector is less than the distance threshold, the candidate product is determined as a product to be recommended associated with the target short text.
2. The method according to claim 1, characterized in that If the target short text is a conversation message in a target instant messaging group, the method further includes: Sort the products to be recommended in ascending order according to the distance between the feature word vector associated with each product to be recommended and the target word vector, to obtain a sequence of products to be recommended; The first L products to be recommended in the sequence of products to be recommended are selected as target recommended products and sent to the target instant messaging group.
3. The method according to claim 2, characterized in that After sending the target recommended product to the target instant messaging group, the method further includes: Collect conversation messages of a preset duration or a preset number; The collected conversation messages are input into a preset text sentiment analysis model to obtain the sentiment of users in the target instant messaging group towards the target recommended product.
4. The method according to claim 1, characterized in that: The target topic classification model is trained in the following way: For each conversation message in the existing instant messaging group, the conversation message is segmented, and the feature word set obtained by the segmentation is expanded according to the word vector library to obtain a training feature word set; All training feature word sets are trained based on a machine learning algorithm to obtain the target topic classification model.
5. The method according to claim 1, characterized in that The feature word vector of any candidate product is determined in the following way: Assign a weight to each feature word in the feature word set of any candidate product based on a preset weight allocation algorithm; The feature words of the candidate product are sorted in ascending order according to the weight value to obtain a feature word sequence, and the word vectors corresponding to the first K feature words in the feature word sequence in the word vector library are selected as the feature word vectors of the candidate product.
6. An electronic device, comprising a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, wherein: When the computer program is executed by the processor, the steps in the product recommendation method according to any one of claims 1 to 5 are implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in the product recommendation method according to any one of claims 1 to 5 are implemented.
