Resource recommendation method and device, computer device and storage medium
By acquiring valid comments and comment titles from target users, and utilizing word segmentation dictionaries and sentiment value calculation strategies, combined with a sentiment classification model, the problem of inaccurate sentiment preference prediction in traditional resource recommendation technology is solved, thereby improving the accuracy of resource recommendation.
Patent Information
- Application Number
- CN202310846096.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-11
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2043-07-11
AI Technical Summary
Traditional resource recommendation technologies cannot accurately predict the emotional preferences of target users, resulting in low accuracy in resource recommendations.
By acquiring valid comments from target users and their comment titles, and using a pre-defined word segmentation dictionary and sentiment value calculation strategy, the sentiment values of the comment statements and comments are determined. Combined with the target sentiment classification model, the target resources are predicted and recommended.
It improves the accuracy of resource recommendations by combining comment sentiment values and title features to accurately predict the sentiment preferences of target users, thereby enhancing the prediction accuracy of sentiment classification results and the accuracy of resource recommendations.
Smart Images

Figure CN116881556B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence, in particular to a resource recommendation method and device, computer equipment and storage medium. BACKGROUND
[0002] With the development of artificial intelligence technology, resource recommendation technology has emerged. This technology can predict the emotional preference of a target user and make resource recommendations based on the emotional preference of the target user.
[0003] In traditional resource recommendation technology, the emotional preference of a target user is predicted based on the historical resource interaction records of the target user, and resource recommendations are made based on the emotional preference of the target user.
[0004] In fact, the historical resource interaction records of a target user can reflect the target user's interaction with historical resources, but may not accurately reflect the target user's emotional preference for historical resources. For example, if a target user has only interacted with historical resource A once, it is impossible to determine the target user's emotional preference for historical resource A. Since traditional resource recommendation technology cannot accurately predict the emotional preference of a target user, the accuracy of resource recommendations is reduced. SUMMARY
[0005] Therefore, it is necessary to provide a resource recommendation method, device, computer equipment, computer readable storage medium and computer program product that can improve the accuracy of resource recommendations to solve the above technical problems.
[0006] In a first aspect, the present application provides a resource recommendation method. The method comprises:
[0007] obtaining effective comments of a target user on at least one reference resource and comment titles of the effective comments; the effective comments include at least one comment sentence;
[0008] For any comment sentence, determining a sentence emotional value of the comment sentence according to the comment sentence, a preset segmentation dictionary and a preset emotional value calculation strategy;
[0009] For any effective comment, determining a comment emotional value of the effective comment according to the sentence emotional values of the comment sentences included in the effective comment;
[0010] For any reference resource, determining an emotional classification result of the reference resource according to the effective comments, the comment emotional values of the effective comments, the comment titles and a target emotional classification model;
[0011] According to the sentiment classification results of the reference resources, at least one target resource is determined, and each target resource is recommended to the target user; the target resource includes the reference resource and / or an associated resource of the reference resource.
[0012] In one of the embodiments, the obtaining of the valid comments of the target user on the at least one reference resource and the comment titles of the valid comments comprises:
[0013] The comment text of the target user on the at least one reference resource is obtained.
[0014] For any comment text, a comment classification result of the comment text is determined based on a comment classification model and the comment text.
[0015] For any comment text, if the comment classification result of the comment text indicates that the comment text is a valid comment, the comment text is taken as a valid comment.
[0016] The comment title of at least one valid comment is obtained.
[0017] In one of the embodiments, if the comment classification result of the comment text indicates that the comment text is a valid comment, the comment text is taken as a valid comment, which comprises:
[0018] If the comment classification result of the comment text indicates that the comment text is a valid comment, the comment text is taken as an initial valid comment.
[0019] If there are a plurality of initial valid comments corresponding to the reference resource, at least one valid comment is determined from the initial valid comments according to the comment dates of the initial valid comments.
[0020] In one of the embodiments, the determination of the sentence sentiment value of the comment sentence based on the comment sentence, a preset word segmentation dictionary and a preset sentiment value calculation strategy comprises:
[0021] According to the preset word segmentation dictionary, semantic recognition is performed on the comment sentence to determine a target word included in the comment sentence; the part of speech of the target word includes an emotion word, a degree adverb and a negative word;
[0022] The emotion word corresponding to each degree adverb and the emotion word corresponding to each negative word are determined respectively.
[0023] For any emotion word, a target sentiment value of the emotion word is determined according to a sentiment value of the emotion word, a degree weight of each degree adverb corresponding to the emotion word and a negative weight of each negative word corresponding to the emotion word.
[0024] determine a sentence sentiment value of the comment sentence according to a target sentiment value of each sentiment word included in the comment sentence.
[0025] In one of the embodiments, the determining the sentiment classification result of the reference resource according to each of the valid comments, the comment sentiment value of each of the valid comments, each of the comment titles, and the target sentiment classification model comprises:
[0026] In the case that the reference resource corresponds to a plurality of valid comments, determining at least one target valid comment from each of the valid comments corresponding to the reference resource according to a sentence sentiment value and a comment date of each of the valid comments corresponding to the reference resource;
[0027] determining the sentiment classification result of the reference resource according to each of the target valid comments, the comment sentiment value of each of the target valid comments, the comment title of the target valid comment, and the target sentiment classification model.
[0028] In one of the embodiments, the determining the sentiment classification result of the reference resource according to each of the valid comments, the comment sentiment value of each of the valid comments, each of the comment titles, and the target sentiment classification model comprises:
[0029] for any one of the valid comments of the reference resource, determining a text feature of the valid comment according to the valid comment and the comment sentiment value of the valid comment;
[0030] determining a title feature of each of the comment titles;
[0031] constructing a comment feature of the valid comment based on the text feature and the title feature of the valid comment;
[0032] inputting the comment feature of each of the valid comments of the reference resource into the target sentiment classification model to obtain the sentiment classification result of the reference resource.
[0033] In one of the embodiments, the determining at least one target resource according to the sentiment classification result of each of the reference resources and recommending each of the target resources to the target user comprises:
[0034] determining a reference resource category of each of the reference resources;
[0035] for any one of the reference resource categories, determining a target sentiment classification result of the reference resource category according to the sentiment classification result of each of the reference resources under the reference resource category;
[0036] For any of the reference resource categories, according to a target sentiment classification result of the reference resource category, it is determined whether the reference resource category corresponds to a target resource;
[0037] In a case where at least one of the reference resource categories corresponds to a target resource, target resources corresponding to the reference resource categories are recommended to the target user.
[0038] In an embodiment, the target sentiment classification model comprises a multi-kernel support vector machine, and a mapping function of the multi-kernel support vector machine is constructed based on a text mapping function, a text mapping weight, a title mapping function and a title mapping weight; the method further comprises:
[0039] A sample valid comment of each sample user on at least one of the reference resources, a sample comment title of the sample valid comment and an actual sentiment classification result of each sample user are obtained; the sample valid comment comprises at least one sample comment sentence;
[0040] Each first sentiment classification model is determined; the weight values of the text mapping weights and / or the weight values of the title mapping weights in each of the first sentiment classification models are different;
[0041] For any of the first sentiment classification models, according to each of the sample valid comments, the sample comment titles of each of the sample valid comments, the actual sentiment classification results of each of the sample users and the first sentiment classification model, a classification accuracy of the first sentiment classification model is determined;
[0042] According to the classification accuracies of each of the first sentiment classification models, a second sentiment classification model is determined from each of the first sentiment classification models;
[0043] According to each of the sample valid comments, the sample comment titles of each of the sample valid comments and the actual sentiment classification results of each of the sample users, the second sentiment classification model is trained to obtain the target sentiment classification model.
[0044] In an embodiment, the determination of each first sentiment classification model comprises:
[0045] Parameters of a sentiment classification model to be trained except the text mapping weight and the title mapping weight are initialized to obtain a third sentiment classification model;
[0046] According to each of the preset first weight values, each of the preset second weight values and the third sentiment classification model, a plurality of first sentiment classification models are constructed.
[0047] In one of the embodiments, the training of the second sentiment classification model according to the sample effective comments, the sample comment titles of the sample effective comments, and the actual sentiment classification results of the sample users, to obtain the target sentiment classification model, comprises:
[0048] determining the sample sentiment classification results of the sample users corresponding to the second sentiment classification model according to the sample effective comments, the sample comment titles of the sample effective comments, and the second sentiment classification model;
[0049] training the parameters in the second sentiment classification model except the text mapping weight and the title mapping weight according to the sample sentiment classification results of the sample users corresponding to the second sentiment classification model, and the actual sentiment classification results of the sample users, to obtain the target sentiment classification model.
[0050] In a second aspect, the present application further provides a resource recommendation device. The device comprises:
[0051] a first obtaining module, configured to obtain effective comments of a target user on at least one reference resource and comment titles of the effective comments; the effective comments comprise at least one comment sentence;
[0052] a first determining module, configured to determine a sentence sentiment value of any comment sentence according to the comment sentence, a preset word segmentation dictionary, and a preset sentiment value calculation strategy;
[0053] a second determining module, configured to determine a comment sentiment value of any effective comment according to the sentence sentiment values of the comment sentences included in the effective comment;
[0054] a third determining module, configured to determine a sentiment classification result of any reference resource according to the effective comments, the comment sentiment values of the effective comments, the comment titles, and a target sentiment classification model;
[0055] a fourth determining module, configured to determine at least one target resource according to the sentiment classification results of the reference resources, and recommend the target user with the target resources; the target resources comprise the reference resources and / or associated resources of the reference resources.
[0056] In one of the embodiments, the first obtaining module is specifically configured to:
[0057] obtain comment texts of a target user on at least one reference resource;
[0058] For any of the comment texts, a comment classification result of the comment text is determined based on a comment classification model and the comment text;
[0059] For any of the comment texts, in a case where the comment classification result of the comment text indicates that the comment text is a valid comment, the comment text is taken as a valid comment;
[0060] A comment title of at least one of the valid comments is obtained.
[0061] In one of the embodiments, the first obtaining module is specifically configured to include:
[0062] In a case where the comment classification result of the comment text indicates that the comment text is a valid comment, the comment text is taken as an initial valid comment;
[0063] In a case where the reference resource corresponds to a plurality of initial valid comments, at least one valid comment is determined from the initial valid comments according to comment dates of the initial valid comments.
[0064] In one of the embodiments, the first determining module is specifically configured to include:
[0065] According to a preset segmentation dictionary, semantic recognition is performed on the comment sentence to determine a target word included in the comment sentence; a part of speech of the target word includes an emotion word, a degree adverb, and a negative word;
[0066] Each of the degree adverbs corresponds to an emotion word, and each of the negative words corresponds to an emotion word;
[0067] For any of the emotion words, a target emotion value of the emotion word is determined according to an emotion value of the emotion word, a degree weight of each of the degree adverbs corresponding to the emotion word, and a negative weight of each of the negative words corresponding to the emotion word;
[0068] According to the target emotion values of the emotion words included in the comment sentence, a sentence emotion value of the comment sentence is determined.
[0069] In one of the embodiments, the determining of the emotion classification result of the reference resource according to the valid comments, the comment emotion values of the valid comments, the comment titles, and a target emotion classification model includes:
[0070] In a case where the reference resource corresponds to a plurality of valid comments, at least one target valid comment is determined from the valid comments corresponding to the reference resource according to sentence emotion values and comment dates of the valid comments corresponding to the reference resource;
[0071] According to the target effective comment, the comment sentiment value of the target effective comment, the comment title of the target effective comment, and the target sentiment classification model, a sentiment classification result of the reference resource is determined.
[0072] In one of the embodiments, the third determining module is specifically configured to:
[0073] According to the effective comment and the comment sentiment value of the effective comment, a text feature of the effective comment is determined for any of the effective comments of the reference resource.
[0074] A title feature of each of the comment titles is determined.
[0075] Based on the text feature and the title feature of the effective comment, a comment feature of the effective comment is constructed.
[0076] The comment features of each of the effective comments of the reference resource are input into the target sentiment classification model to obtain the sentiment classification result of the reference resource.
[0077] In one of the embodiments, the fourth determining module is specifically configured to:
[0078] Reference resource categories of each of the reference resources are determined.
[0079] According to the sentiment classification result of each of the reference resources under the reference resource category, a target sentiment classification result of the reference resource category is determined for any of the reference resource categories.
[0080] According to the target sentiment classification result of the reference resource category, it is determined whether the reference resource category corresponds to a target resource for any of the reference resource categories.
[0081] In the case where at least one of the reference resource categories corresponds to a target resource, target resources corresponding to each of the reference resource categories are recommended to the target user.
[0082] In one of the embodiments, the target sentiment classification model includes a multi-kernel support vector machine, a mapping function of the multi-kernel support vector machine is constructed based on a text mapping function, a text mapping weight, a title mapping function, and a title mapping weight; and the resource recommendation device further includes:
[0083] A second obtaining module is configured to obtain sample effective comments of at least one of the reference resources by each of the sample users, sample comment titles of the sample effective comments, and actual sentiment classification results of each of the sample users; at least one sample comment sentence is included in the sample effective comment.
[0084] a fifth determining module configured to determine a plurality of first sentiment classification models, wherein the weight values of the text mapping weights and / or the weight values of the title mapping weights in the first sentiment classification models are different;
[0085] a sixth determining module configured to determine, for any of the first sentiment classification models, a classification accuracy of the first sentiment classification model according to the sample effective comments, the sample comment titles of the sample effective comments, the actual sentiment classification results of the sample users, and the first sentiment classification model;
[0086] a seventh determining module configured to determine a second sentiment classification model from the first sentiment classification models according to the classification accuracies of the first sentiment classification models;
[0087] a training module configured to train the second sentiment classification model according to the sample effective comments, the sample comment titles of the sample effective comments, and the actual sentiment classification results of the sample users, to obtain the target sentiment classification model.
[0088] In one of the embodiments, the fifth determining module is specifically configured to:
[0089] initialize parameters of the sentiment classification model to be trained except the text mapping weights and the title mapping weights, to obtain a third sentiment classification model;
[0090] construct a plurality of first sentiment classification models according to the preset first weight values, the preset second weight values, and the third sentiment classification model.
[0091] In one of the embodiments, the training module is specifically configured to:
[0092] determine sample sentiment classification results of the sample users corresponding to the second sentiment classification model based on the sample effective comments, the sample comment titles of the sample effective comments, and the second sentiment classification model;
[0093] train parameters of the second sentiment classification model except the text mapping weights and the title mapping weights according to the sample sentiment classification results of the sample users corresponding to the second sentiment classification model, and the actual sentiment classification results of the sample users, to obtain the target sentiment classification model.
[0094] In a third aspect, the present application further provides a computer device. The computer device comprises a memory and a processor, the memory stores a computer program, and the processor implements the steps of the first aspect when executing the computer program.
[0095] In a fourth aspect, the present application provides a computer readable storage medium. The computer readable storage medium has a computer program stored thereon, and the computer program, when executed by a processor, implements the steps of the first aspect.
[0096] In a fifth aspect, the present application provides a computer program product. The computer program product comprises a computer program, and the computer program, when executed by a processor, implements the steps of the first aspect.
[0097] The resource recommendation method, device, computer device, storage medium and computer program product described above, by obtaining the effective comments of the target user on at least one reference resource and the comment titles of the effective comments, the effective comments comprising at least one comment sentence, determining, for any comment sentence, a sentence sentiment value of the comment sentence according to the comment sentence, a preset segmentation dictionary and a preset sentiment value calculation strategy, determining, for any effective comment, a comment sentiment value of the effective comment according to the sentence sentiment values of the comment sentences included in the effective comment, determining, for any reference resource, a sentiment classification result of the reference resource according to the effective comments, the comment sentiment values of the effective comments, the comment titles and a target sentiment classification model, determining at least one target resource according to the sentiment classification results of the reference resources, and recommending the target resources to the target user, the target resources comprising the reference resources and / or associated resources of the reference resources. In the method described above, the sentiment classification result of the target user is predicted according to the effective comments of the reference resources, the comment sentiment values of the effective comments, the comment titles of the effective comments and the target sentiment classification model. It can be understood that the comment sentiment values of the effective comments can represent the emotional preference of the target user for the reference resources, and thus the prediction accuracy of the sentiment classification result determined based on the comment sentiment values is improved. In addition, it is easy to know that the comment titles of the effective comments can also reflect the emotional preference of the target user for the reference resources, and thus, by combining the effective comments, the comment sentiment values of the effective comments and the comment titles of the effective comments to determine the sentiment classification result, the prediction accuracy of the sentiment classification result can be further improved, and thus the recommendation accuracy of the target resources determined based on the sentiment classification result is improved. BRIEF DESCRIPTION OF DRAWINGS
[0098] Figure 1 A flowchart of a resource recommendation method in an embodiment is shown;
[0099] Figure 2 A flowchart of a method for determining a sentence sentiment value in an embodiment is shown;
[0100] Figure 3 A flowchart of a method for determining a sentiment classification result in an embodiment is shown;
[0101] Figure 4A flowchart of a training method of a target emotion classification model in an embodiment;
[0102] Figure 5 A schematic diagram of a hyperplane reaching an optimum in an objective function in an embodiment;
[0103] Figure 6 A structural block diagram of a resource recommendation device in an embodiment;
[0104] Figure 7 An internal structural diagram of a computer device in an embodiment. DETAILED DESCRIPTION
[0105] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.
[0106] In an embodiment, as shown in Figure 1 , a resource recommendation method is provided, and the embodiment is exemplified by applying the method to a terminal. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction of the terminal and the server. In the embodiment, the method includes the following steps:
[0107] Step 102, obtaining valid comments of a target user on at least one reference resource and comment titles of the valid comments.
[0108] Among the valid comments, at least one comment sentence is included.
[0109] In the embodiment of the present application, the terminal obtains at least one valid comment of the target user and the comment titles of the valid comments, wherein the valid comment is a valid comment of the target user on the reference resource. It can be understood that the valid comments obtained by the terminal can include valid comments corresponding to different reference resources, or can include multiple valid comments corresponding to the same reference resource. Among the valid comments, there are comments including, but not limited to, comments on the use experience of the reference resource.
[0110] Step 104, for any comment sentence, determining a sentence sentiment value of the comment sentence according to the comment sentence, a preset segmentation dictionary and a preset sentiment value calculation strategy.
[0111] The preset segmentation dictionary includes a network language dictionary, an emotion dictionary, and a Jieba dictionary. The Jieba dictionary refers to a dictionary obtained by performing segmentation on a Jieba library. The emotion dictionary includes an emotion dictionary corresponding to a target domain, and the target domain includes a domain to which the reference resource belongs and a domain to which an associated resource of the reference resource belongs. In an embodiment, the emotion dictionary can be a dictionary constructed by an expert in the target domain. The network language dictionary includes, but is not limited to, network language, network emoticons, and network emoticons.
[0112] In an embodiment of the present application, for any comment sentence, the terminal performs semantic recognition on the comment sentence according to the preset segmentation dictionary, to obtain a target word included in the comment sentence. It can be understood that after performing semantic recognition on a comment sentence that does not include a target word, the target word included in the comment sentence is not obtained, and accordingly, the sentence sentiment value of the comment sentence is a default value. In an embodiment, the default value can be 0. If the sentence sentiment value of the comment sentence is the default value, it indicates that the target user maintains a neutral sentiment towards the reference resource corresponding to the comment sentence. For any comment sentence, in the case where the comment sentence includes a target word, the terminal calculates the sentence sentiment value of the comment sentence according to at least one target word included in the comment sentence. Specifically, refer to steps 202 to 208.
[0113] Step 106, for any valid comment, according to the sentence sentiment values of each comment sentence included in the valid comment, determine the comment sentiment value of the valid comment.
[0114] In an embodiment of the present application, for any valid comment, the terminal statistics the sentence sentiment values of each comment sentence included in the valid comment, to obtain the comment sentiment value of the valid comment. The comment sentiment value of the valid comment is equal to the sum of the sentence sentiment values of each comment sentence included in the valid comment.
[0115] Step 108, for any reference resource, according to each valid comment, the comment sentiment value of each valid comment, each comment title, and a target emotion classification model, determine the sentiment classification result of the reference resource.
[0116] In the embodiments of the present application, for any reference resource, the terminal determines the comment feature corresponding to the reference resource according to the valid comments corresponding to the reference resource, the comment sentiment values of the valid comments corresponding to the reference resource, and the comment titles.
[0117] In step 110, at least one target resource is determined according to the sentiment classification results of the reference resources, and each target resource is recommended to the target user.
[0118] The target resource includes the reference resource and / or the associated resource of the reference resource.
[0119] In the embodiments of the present application, the terminal determines at least one target resource according to the sentiment classification results of the reference resources, and recommends each target resource to the target user. It can be understood that for a single reference resource, the number of target resources corresponding to the reference resource is positively correlated with the degree of love of the target user for the reference resource. When the sentiment classification result of a reference resource indicates that the degree of love of the target user for the reference resource is 0, the reference resource can have no corresponding target resource. For example, assuming that the sentiment classification result 1 of the reference resource 1 is "emotion 1", the reference resource 1 has no corresponding target resource 1.
[0120] In the above resource recommendation method, the sentiment classification result of the target user is predicted according to the valid comments of each reference resource, the comment sentiment values of the valid comments, the comment titles of the valid comments, and the target sentiment classification model. It can be understood that the comment sentiment value of the valid comment can represent the sentiment preference of the target user for the reference resource, thereby improving the prediction accuracy of the sentiment classification result determined based on the comment sentiment value. In addition, it is easy to know that the comment title of the valid comment can also reflect the sentiment preference of the target user for the reference resource, therefore, the sentiment classification result is determined by combining the valid comment, the comment sentiment value of the valid comment, and the comment title of the valid comment, which can further improve the prediction accuracy of the sentiment classification result, thereby improving the recommendation accuracy of the target resource determined based on the sentiment classification result.
[0121] In one embodiment, the valid comments of the target user for at least one reference resource and the comment titles of the valid comments are obtained, including:
[0122] obtaining a comment text of the target user on the at least one reference resource; determining, for any comment text, a comment classification result of the comment text based on the comment classification model and the comment text; in a case where the comment classification result of any comment text indicates that the comment text is a valid comment, taking the comment text as a valid comment; and obtaining a comment title of the at least one valid comment.
[0123] In the embodiment of the present application, the terminal obtains a comment text of the target user on the at least one reference resource. In an embodiment, the data source of the comment text includes but is not limited to a resource application (such as a mobile bank) for recommending the reference resource, a medium (such as a public account media) for introducing relevant resource information of the reference resource, and a relevant platform (such as an online forum) for discussing the use experience of the reference resource. For any comment text, the terminal inputs the comment text into the comment classification model, and outputs a comment classification result of the comment text. The comment classification result includes a valid comment or an invalid comment, and the invalid comment includes but is not limited to a comment not containing the use experience of the reference resource, and an exemplary comment only for the service quality. In an embodiment, the comment classification model can be a pre-trained random forest model. In a case where the comment classification result of any comment text indicates that the comment text is a valid comment, the terminal takes the comment text as a valid comment. For any valid comment, the terminal obtains a comment title of the valid comment.
[0124] In the embodiment, the valid comment of the reference resource is determined according to the comment text of the reference resource and the comment classification model, and then the comment title of the valid comment is obtained, thereby providing a prerequisite for a method of determining the sentiment classification result of the reference resource based on the valid comment and the comment title of the valid comment. In addition, only the valid comment is used in the determination of the sentiment classification result, so that the error of the sentiment classification result caused by the invalid comment in the comment text can be avoided, and the accuracy of the sentiment classification result is improved.
[0125] In an embodiment, in a case where the comment classification result of the comment text indicates that the comment text is a valid comment, the comment text is taken as a valid comment, including:
[0126] In a case where the comment classification result of the comment text indicates that the comment text is a valid comment, the comment text is taken as an initial valid comment; in a case where the reference resource corresponds to a plurality of initial valid comments, at least one valid comment is determined from the initial valid comments according to the comment dates of the initial valid comments.
[0127] In the embodiment of the present application, in the case that the comment classification result of the comment text represents that the comment text is a valid comment, the terminal takes the comment text as an initial valid comment. In the case that the reference resource corresponds to multiple initial valid comments, the terminal determines at least one valid comment from the initial valid comments according to the comment dates of the initial valid comments. In one embodiment, the terminal takes the initial valid comments corresponding to the preset number of latest comment dates in the initial valid comments as valid comments. For example, the preset number is 2, the reference resource 1 corresponds to three initial valid comments {initial valid comment a, initial valid comment b, and initial valid comment c}, the comment date of the initial valid comment a is January 3, 2020, the comment date of the initial valid comment b is June 1, 2021, and the comment date of the initial valid comment c is August 10, 2021. Then, the valid comments corresponding to the reference resource 1 include the initial valid comment b and the initial valid comment c.
[0128] In the embodiment, the valid comments are selected from the initial valid comments according to the comment dates of the initial valid comments corresponding to the reference resource. It can be understood that the valid comments selected according to the comment dates can represent the latest use experience of the target user on the reference resource, that is, the valid comments have more reference value, and therefore, the sentiment classification result with higher accuracy can be obtained based on the valid comments.
[0129] In one embodiment, as shown in Figure 2 the sentence sentiment value of the comment sentence is determined according to the comment sentence, the preset word segmentation dictionary, and the preset sentiment value calculation strategy, including:
[0130] In step 202, the semantic recognition of the comment sentence is performed according to the preset word segmentation dictionary, and the target words included in the comment sentence are determined.
[0131] The part-of-speech of the target word includes sentiment words, degree adverbs, and negative words.
[0132] In the embodiment of the present application, for any comment sentence, the terminal performs semantic recognition on the comment sentence according to the preset word segmentation dictionary, and determines the target words included in the comment sentence.
[0133] In step 204, the sentiment words corresponding to each degree adverb and the sentiment words corresponding to each negative word are determined respectively.
[0134] In the embodiment of the present application, for any comment sentence, the terminal calculates the word distance between each degree adverb and each sentiment word, and determines the sentiment word corresponding to each degree adverb. For the convenience of distinction, for any degree adverb, the sentiment word corresponding to the degree adverb is referred to as a target sentiment word, and the sentiment word not corresponding to the degree adverb is referred to as another sentiment word. Among them, for any degree adverb, the word distance between the degree adverb and the target sentiment word of the degree adverb is less than the word distance between the degree adverb and the other sentiment word of the degree adverb. It can be understood that the degree adverb and the sentiment word corresponding to the degree adverb belong to the same comment sentence.
[0135] For any comment sentence, the terminal calculates the word distance between each negative word and each sentiment word, and determines the sentiment word corresponding to each negative word. For the convenience of distinction, for any negative word, the sentiment word corresponding to the negative word is referred to as a target sentiment word, and the sentiment word not corresponding to the negative word is referred to as another sentiment word. Among them, for any negative word, the word distance between the negative word and the target sentiment word of the negative word is less than the word distance between the negative word and the other sentiment word of the negative word. It can be understood that the negative word and the sentiment word corresponding to the negative word belong to the same comment sentence.
[0136] Step 206, for any sentiment word, according to the sentiment value of the sentiment word, the degree weight of each degree adverb corresponding to the sentiment word, and the negative weight of each negative word corresponding to the sentiment word, the target sentiment value of the sentiment word is determined.
[0137] In the embodiment of the present application, a sentiment value list recording the sentiment values of each sentiment word is set in advance, and the terminal queries the sentiment values of each sentiment word according to the sentiment value list. In one embodiment, the sentiment values of each sentiment word are all the same constant. A degree weight list recording the degree weights of each degree adverb is set in advance, and the terminal queries the degree weights of each degree adverb according to the degree weight list. The negative weight of the negative word is set in advance as -1. For any sentiment word, the terminal calculates the sum of the degree weights of each degree adverb corresponding to the sentiment word, and obtains the target degree weight corresponding to the sentiment word. For any sentiment word, the terminal calculates the product of the sentiment value of the sentiment word, the target degree weight corresponding to the sentiment word, and the negative weight of each negative word corresponding to the sentiment word, and obtains the target sentiment value of the sentiment word.
[0138] Step 208, according to the target sentiment values of each sentiment word included in the comment sentence, the sentence sentiment value of the comment sentence is determined.
[0139] In the embodiment of the present application, for any comment sentence, the terminal calculates the sum of the target sentiment values of each sentiment word included in the comment sentence, and obtains the sentence sentiment value of the comment sentence.
[0140] In the embodiment, the degree adverbs and the negations corresponding to each sentiment word are determined, the target sentiment value of each sentiment word is calculated, and finally the sentence sentiment value of the review sentence is calculated. For any sentiment word, the sentiment word, the at least one degree adverb corresponding to the sentiment word, and the at least one negation corresponding to the sentiment word are in the same review sentence. Therefore, the situation that a degree adverb (or a negation) is incorrectly matched to a sentiment word belonging to a different review sentence is reduced, and the matching accuracy of the degree adverb and the negation to the sentiment word is improved, thereby improving the accuracy of the target sentiment value of the sentiment word.
[0141] In one embodiment, the sentiment classification result of the reference resource is determined according to the valid reviews, the review sentiment values of the valid reviews, the review titles, and the target sentiment classification model, and includes:
[0142] In the case that the reference resource corresponds to multiple valid reviews, at least one target valid review is determined from the valid reviews corresponding to the reference resource according to the sentence sentiment values and the review dates of the valid reviews corresponding to the reference resource; and the sentiment classification result of the reference resource is determined according to the target valid reviews, the review sentiment values of the target valid reviews, the review titles of the target valid reviews, and the target sentiment classification model.
[0143] In the embodiments of the present application, in the case that the reference resource corresponds to multiple valid reviews, the terminal determines at least one target valid review from the valid reviews corresponding to the reference resource according to the sentence sentiment values and the review dates of the valid reviews corresponding to the reference resource. Specifically, in the case that the reference resource corresponds to multiple valid reviews, the terminal counts the number of valid reviews with a sentence sentiment value greater than a default value (for the sake of convenience, referred to as the number of love sentiment) and the number of valid reviews with a sentence sentiment value less than the default value (for the sake of convenience, referred to as the number of hate sentiment) in the valid reviews corresponding to the reference resource. The terminal compares the number of love sentiment with the number of hate sentiment to obtain a comparison result, and determines a first valid review according to the comparison result. Specifically, in the case that the number of love sentiment is greater than the number of hate sentiment, the terminal takes the valid review with a sentence sentiment value greater than the default value in the valid reviews corresponding to the reference resource as the first valid review of the reference resource. In the case that the number of love sentiment is less than the number of hate sentiment, the terminal takes the valid review with a sentence sentiment value less than the default value in the valid reviews corresponding to the reference resource as the first valid review of the reference resource.
[0144] In the case where the reference resource corresponds to multiple valid comments, the terminal determines at least one target valid comment from the first valid comment of the reference resource according to the comment date of the first valid comment of the reference resource. It can be understood that the method of determining the target valid comment according to the comment date of the first valid comment is similar to the method of determining the target valid comment according to the comment date of the initial valid comment, which will not be repeated here.
[0145] For any reference resource, the terminal determines the comment feature corresponding to the reference resource according to the target valid comment corresponding to the reference resource, the comment sentiment value of the target valid comment corresponding to the reference resource, and the comment title. For any reference resource, the terminal inputs the comment feature corresponding to the reference resource into the target sentiment classification model, and outputs the sentiment classification result of the reference resource. The terminal determines at least one target resource according to the sentiment classification result of each reference resource, and recommends each target resource to the user. It can be understood that the method of determining the sentiment classification result of the reference resource according to the target valid comment is similar to step 108, which will not be repeated here.
[0146] In this embodiment, at least one target valid comment is determined from the valid comments corresponding to the reference resource according to the sentence sentiment value and the comment date of each valid comment corresponding to the reference resource. Therefore, the target valid comment that can better represent the use experience of the reference resource can be further screened out, that is, the target valid comment has more reference value, and therefore, the sentiment classification result based on the target valid comment has higher accuracy.
[0147] In one embodiment, as shown in Figure 3 The sentiment classification result of the reference resource is determined according to the valid comment, the comment sentiment value of the valid comment, the comment title, and the target sentiment classification model, including:
[0148] In step 302, for any valid comment of the reference resource, the text feature of the valid comment is determined according to the valid comment and the comment sentiment value of the valid comment.
[0149] In the embodiment of the present application, for any valid comment of the reference resource, the terminal extracts features from the valid comment and the comment sentiment value of the valid comment to obtain the text feature of the valid comment. In one embodiment, the text feature is a feature vector. For example, for any valid comment of the reference resource, the terminal inputs the valid comment and the comment sentiment value of the valid comment into a pre-trained feature extraction neural network to output the text feature of the valid comment.
[0150] In step 304, the title feature of each comment title is determined.
[0151] In the embodiment of the present application, for any comment title, the terminal extracts features of the comment title to obtain title features of the comment title. For example, for any comment title, the terminal inputs the comment title into the pre-trained feature extraction neural network to output the title features of the comment title.
[0152] In step 306, the comment features of the effective comments are constructed based on the text features and the title features of the effective comments.
[0153] In the embodiment of the present application, for any effective comment of the reference resource, the terminal constructs the comment features of the effective comment based on the text features and the title features of the effective comment.
[0154] In step 308, the comment features of each effective comment of the reference resource are input into the target emotion classification model to obtain the emotion classification result of the reference resource.
[0155] In the embodiment of the present application, the terminal inputs the comment features of each effective comment of the reference resource into the target emotion classification model to obtain the emotion classification result of the reference resource. In one embodiment, the target emotion classification model includes a multi-kernel support vector machine.
[0156] In the embodiment, the text features are determined according to the effective comments and the comment emotion values of the effective comments, the title features are determined according to the comment titles, and the comment features of the effective comments are constructed based on the text features and the title features. Since the comment features of the effective comments include multi-dimensional features, the features of the effective comments can be more accurately and comprehensively represented, thereby improving the prediction accuracy of the emotion classification result determined based on the features of the effective comments, and further improving the recommendation accuracy of the target resource determined based on the emotion classification result.
[0157] In one embodiment, at least one target resource is determined according to the emotion classification results of each reference resource, and each target resource is recommended to the target user, including:
[0158] The reference resource categories of each reference resource are determined; for any reference resource category, the target emotion classification result of the reference resource category is determined according to the emotion classification results of each reference resource under the reference resource category; for any reference resource category, it is determined whether the reference resource category corresponds to a target resource according to the target emotion classification result of the reference resource category; and in the case that at least one reference resource category corresponds to a target resource, the target resources corresponding to each reference resource category are recommended to the target user.
[0159] In this embodiment, the terminal determines the reference resource category of each reference resource. For any reference resource category, the terminal statistically analyzes the sentiment classification results of each reference resource under that category, and uses the mode of the sentiment classification results as the target sentiment classification result for that reference resource category. The target sentiment classification result characterizes the target user's liking for the reference resource category. For any reference resource category, the terminal determines whether there is a corresponding target resource based on the target sentiment classification result. Specifically, for any reference resource category, the terminal searches for the target resource corresponding to the target sentiment classification result based on the preset correspondence between classification results and target resources, and the target sentiment classification result. If at least one target resource corresponding to the target sentiment classification result is found, then at least one target resource is used as the target resource corresponding to the reference resource category. If no target resource corresponding to the target sentiment classification result is found, then the reference resource category does not have a corresponding target resource. If at least one reference resource category corresponds to a target resource, the terminal recommends the target resources corresponding to each reference resource category to the target user. The resource category to which the target resource belongs, as referred to by the resource category, includes the reference resource category or the resource category associated with the reference resource category.
[0160] In this embodiment, by first statistically analyzing the sentiment classification results of each reference resource within the same reference resource category, the target sentiment classification result corresponding to the reference resource category is determined, thereby determining whether the reference resource category corresponds to a target resource. Therefore, compared to the sentiment classification result of a single reference resource, the target sentiment classification result can more accurately reflect the target user's liking for the reference resource category, thus improving the accuracy of the target resource determined based on the target sentiment classification result.
[0161] In one embodiment, such as Figure 4 As shown, the target sentiment classification model includes a multi-kernel support vector machine (SVM). The mapping function of the multi-kernel SVM is constructed based on the text mapping function, text mapping weights, title mapping function, and title mapping weights. The method also includes:
[0162] Step 402: Obtain the sample valid comments of each sample user on at least one reference resource, the sample comment titles of the sample valid comments, and the actual sentiment classification results of each sample user.
[0163] Among them, the valid sample comments include at least one sample comment statement.
[0164] In the embodiments of the present application, the terminal obtains sample valid comments of at least one reference resource of each sample user, sample comment titles of the sample valid comments, and actual sentiment classification results of each sample user. The method for obtaining the sample valid comments is similar to the method for obtaining the valid comments described above, and will not be described here.
[0165] In step 404, each first sentiment classification model is determined.
[0166] In each first sentiment classification model, the weight values of the text mapping weights and / or the weight values of the title mapping weights are different. In one embodiment, the first sentiment classification model includes a least square support vector machine, and an exemplary first sentiment classification model is a multi-kernel least square support vector machine.
[0167] In the embodiments of the present application, the terminal constructs each first sentiment classification model based on each preset first weight value and each preset second weight value. It can be understood that the first weight value and the second weight value can be the same or different, and the first weight value and the second weight value are pre-set according to human experience. The first weight value is used to determine the weight value of the text mapping weight, and the second weight value is used to determine the weight value of the title mapping weight. In one embodiment, the weight value of the text mapping weight of each first sentiment classification model is 1, and the weight value of the text mapping weight of each first sentiment classification model is γ, where γ ∈ {0.25, 0.5, 0.75, 1.0, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0}, and specifically, as shown in the following formula (1).
[0168] φ(x i , γ) = γφ t (x i ) + φ b (x i ) Formula (1)
[0169] In the formula, φ(x i , γ) represents a mapping function of the first sentiment classification model, φ t (x i ) represents a title mapping function of the first sentiment classification model, φ b (x i ) represents a text mapping function of the first sentiment classification model, γ represents a title mapping weight, and x i represents an i-th input vector (including comment features) of the first sentiment classification model.
[0170] In step 406, for any first sentiment classification model, the classification accuracy of the first sentiment classification model is determined according to each sample valid comment, the sample comment title of each sample valid comment, the actual sentiment classification result of each sample user, and the first sentiment classification model.
[0171] In the embodiments of the present application, for any first emotion classification model, the terminal determines the first emotion classification result of each reference resource according to each sample valid comment, the sample comment title of each sample valid comment, and the first emotion classification model. It can be understood that the determination method of the first emotion classification result is similar to the determination method of the emotion classification result described above, which will not be described here. For any first emotion classification model, the terminal calculates the classification accuracy of the first emotion classification model according to each first emotion classification result output by the first emotion classification model, each actual emotion classification result, and the loss function.
[0172] Step 408, determining the second emotion classification model from each first emotion classification model according to the classification accuracy of each first emotion classification model.
[0173] In the embodiments of the present application, the terminal compares the classification accuracy according to each first emotion classification model, and determines the second emotion classification model from each first emotion classification model according to the comparison result. Among them, the classification accuracy of the second emotion classification model is the highest in each first emotion classification model.
[0174] Step 410, training the second emotion classification model according to each sample valid comment, the sample comment title of each sample valid comment, and the actual emotion classification result of each sample user, to obtain a target emotion classification model.
[0175] In the embodiments of the present application, the terminal determines each second emotion classification result according to each sample valid comment, the sample comment title of each sample valid comment, and the second emotion classification model. The terminal trains the second emotion classification model based on each second emotion classification result, the actual emotion classification result, and the loss function, to obtain the trained second emotion classification model (i.e. the target emotion classification model). Among them, the text mapping weight and the title mapping weight in the mapping function of the target emotion classification model are determined in step 408, that is, the text mapping weight in the mapping function of the target emotion classification model is the text mapping weight in the mapping function of the second emotion classification model, and the title mapping weight in the mapping function of the target emotion classification model is the title mapping weight in the mapping function of the second emotion classification model. Specifically, the objective function of the second emotion classification model is shown in the following formula (2), and the constraint condition of the second emotion classification model is shown in the following formula (3).
[0176]
[0177] s.t.y i [ω T φ(x i , γ) + b] = 1 - ε i (i = 1, 2, 3, …, n) formula (3)
[0178] where ω represents a normal vector of the hyperplane, C represents a penalty coefficient, and ε represents a slack variable. i where yi represents the i-th relaxed variable, y i where yi represents the i-th output result of the second sentiment classification model, and b represents an intercept of the hyperplane. Specifically, as shown in the following formula (3). Figure 5
[0179] Specifically, the Lagrange function of the second sentiment classification model is obtained based on the formula (2) and the formula (3), as shown in the following formula (4).
[0180]
[0181] where L(ω, b, ε, a) represents the Lagrange function of the second sentiment classification model, a i represents the i-th Lagrange multiplier.
[0182] The terminal solves the formula (4) by using the least square method to obtain a and b, and specifically, as shown in the following formula (5) and formula (6).
[0183]
[0184]
[0185] where E is a unit matrix, and Ω=y i y j φ T (x i , γ) φ(x i , γ) = y i y j K(x i , x j ), K(x i , x j ) is a kernel function, and specifically, as shown in the following formula (7), wherein the constraint condition of the kernel function is shown in the following formula (8).
[0186]
[0187]
[0188] where α p , b m are parameters of the kernel function K(x, x i ), α p , K m represents a sub-kernel function, H=ZL 1 / 2 , Z ij ∈{0, 1} n×k , and L is a k-order diagonal matrix. α p is determined based on the Lagrange multiplier a, b m is determined based on the intercept b of the hyperplane, and specific determination methods can refer to related technologies, which are not described herein.
[0189] In this embodiment, first, the first sentiment classification models are constructed, and the second sentiment classification model is determined from the first sentiment classification models, that is, the text mapping weight and the title mapping weight in the target sentiment classification model are determined. Then, the second sentiment classification model is trained to obtain the target sentiment classification model, that is, the parameters in the target sentiment classification model except the text mapping weight and the title mapping weight are determined. That is, the text mapping weight and the title mapping weight are equivalent to the hyperparameters of the second sentiment classification model when the second sentiment classification model is trained, that is, only the parameters except the text mapping weight and the title mapping weight need to be trained, thereby improving the training efficiency of the model.
[0190] In one embodiment, the first sentiment classification models are determined, including:
[0191] The parameters in the sentiment classification model to be trained except the text mapping weight and the title mapping weight are initialized to obtain a third sentiment classification model, and the first sentiment classification models are constructed based on the preset first weight values, the preset second weight values, and the third sentiment classification model.
[0192] In the embodiment of the present application, the terminal initializes the parameters in the sentiment classification model to be trained except the text mapping weight and the title mapping weight to obtain a third sentiment classification model. The terminal constructs the first sentiment classification models based on the preset first weight values, the preset second weight values, and the third sentiment classification model. It can be understood that for the third sentiment classification model, the parameters except the text mapping weight and the title mapping weight are all hyperparameters.
[0193] In this embodiment, the parameters in the sentiment classification model to be trained except the text mapping weight and the title mapping weight are initialized, and then the first sentiment classification models are constructed based on the preset first weight values and the preset second weight values. Therefore, the method provides a prerequisite for subsequently determining the second sentiment classification model based on the first sentiment classification model.
[0194] In one embodiment, the second sentiment classification model is trained based on the sample effective comments, the sample comment titles of the sample effective comments, and the actual sentiment classification results of the sample users to obtain the target sentiment classification model, including:
[0195] The sample sentiment classification results of the sample users corresponding to the second sentiment classification model are determined based on the sample effective comments, the sample comment titles of the sample effective comments, and the second sentiment classification model; and the parameters in the second sentiment classification model except the text mapping weight and the title mapping weight are trained based on the sample sentiment classification results of the sample users corresponding to the second sentiment classification model and the actual sentiment classification results of the sample users, to obtain the target sentiment classification model.
[0196] In the embodiments of the present application, the terminal determines the second sentiment classification results based on the sample effective comments, the sample comment titles of the sample effective comments, and the second sentiment classification model. The terminal trains the parameters in the second sentiment classification model except the text mapping weight and the title mapping weight based on the sample sentiment classification results of the sample users corresponding to the second sentiment classification model, the actual sentiment classification results of the sample users, and the loss function, to obtain the target sentiment classification model. It can be understood that, for the second sentiment classification model, the text mapping weight and the title mapping weight are hyperparameters.
[0197] In the embodiments of the present application, the sample sentiment classification results of the sample users corresponding to the second sentiment classification model are determined based on the sample effective comments, the sample comment titles of the sample effective comments, and the second sentiment classification model. The terminal trains the parameters in the second sentiment classification model except the text mapping weight and the title mapping weight based on the sample sentiment classification results of the sample users corresponding to the second sentiment classification model, the actual sentiment classification results of the sample users, and the loss function, to obtain the target sentiment classification model. It can be understood that, for the second sentiment classification model, the text mapping weight and the title mapping weight are hyperparameters.
[0198] It should be understood that, although each step in the flowchart involved in each of the above embodiments is displayed in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, at least part of the steps in the flowchart involved in each of the above embodiments can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be alternately executed with at least part of other steps or steps or stages in other steps.
[0199] Based on the same inventive concept, the embodiments of the present application also provide a resource recommendation device for implementing the above-mentioned resource recommendation method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so the specific limitations in one or more resource recommendation device embodiments provided below can refer to the limitations of the resource recommendation method described above, and will not be described here.
[0200] In one embodiment, asFigure 6 As shown, a resource recommendation apparatus is provided, comprising:
[0201] The first obtaining module 602 is configured to obtain valid comments of a target user on at least one reference resource and comment titles of the valid comments; the valid comments include at least one comment sentence;
[0202] The first determining module 604 is configured to, for any comment sentence, determine a sentence sentiment value of the comment sentence according to the comment sentence, a preset segmentation dictionary and a preset sentiment value calculation strategy;
[0203] The second determining module 606 is configured to, for any valid comment, determine a comment sentiment value of the valid comment according to the sentence sentiment values of the comment sentences included in the valid comment;
[0204] The third determining module 608 is configured to, for any reference resource, determine a sentiment classification result of the reference resource according to the valid comments, the comment sentiment values of the valid comments, the comment titles and a target sentiment classification model;
[0205] The fourth determining module 610 is configured to determine at least one target resource according to the sentiment classification results of the reference resources, and recommend the target resources to the target user; the target resources include the reference resources and / or associated resources of the reference resources.
[0206] In the above resource recommendation apparatus, the sentiment classification result of the target user is predicted according to the valid comments of the reference resources, the comment sentiment values of the valid comments, the comment titles of the valid comments and the target sentiment classification model. It can be understood that the comment sentiment value of the valid comment can represent the sentiment preference of the target user for the reference resource, thereby improving the prediction accuracy of the sentiment classification result determined based on the comment sentiment value. In addition, it is easy to know that the comment title of the valid comment can also reflect the sentiment preference of the target user for the reference resource, therefore, the sentiment classification result is determined in combination with the valid comment, the comment sentiment value of the valid comment and the comment title of the valid comment, which can further improve the prediction accuracy of the sentiment classification result, thereby improving the recommendation accuracy of the target resource determined based on the sentiment classification result.
[0207] In one embodiment, the first obtaining module 602 is specifically configured to:
[0208] obtain comment texts of the target user on the at least one reference resource;
[0209] determine a comment classification result of any comment text based on a comment classification model and the comment text;
[0210] in a case where the comment classification result of the comment text represents that the comment text is a valid comment, take the comment text as the valid comment;
[0211] obtaining a comment title of the at least one valid comment.
[0212] In an embodiment, the first obtaining module 602 is specifically configured to include the following steps.
[0213] In a case where the comment classification result of the comment text indicates that the comment text is a valid comment, taking the comment text as an initial valid comment;
[0214] In a case where the reference resource corresponds to a plurality of initial valid comments, determining the at least one valid comment from the initial valid comments according to comment dates of the initial valid comments.
[0215] In an embodiment, the first determining module 604 is specifically configured to include the following steps.
[0216] According to a preset segmentation dictionary, performing semantic recognition on the comment sentence to determine a target word included in the comment sentence; the part of speech of the target word includes an emotion word, a degree adverb and a negative word;
[0217] respectively determining emotion words corresponding to each degree adverb and emotion words corresponding to each negative word;
[0218] For any emotion word, determining a target emotion value of the emotion word according to an emotion value of the emotion word, a degree weight of each degree adverb corresponding to the emotion word, and a negative weight of each negative word corresponding to the emotion word;
[0219] According to the target emotion value of each emotion word included in the comment sentence, determining a sentence emotion value of the comment sentence.
[0220] In an embodiment, determining the emotion classification result of the reference resource according to the valid comments, the comment emotion values of the valid comments, the comment titles and the target emotion classification model includes the following steps.
[0221] In a case where the reference resource corresponds to a plurality of valid comments, determining the at least one target valid comment from the valid comments corresponding to the reference resource according to the sentence emotion values and the comment dates of the valid comments corresponding to the reference resource;
[0222] According to the target valid comments, the comment emotion values of the target valid comments, the comment titles of the target valid comments and the target emotion classification model, determining the emotion classification result of the reference resource.
[0223] In an embodiment, the third determining module 608 is specifically configured to include the following steps.
[0224] For any valid comment of the reference resource, determining a text feature of the valid comment according to the valid comment and the comment emotion value of the valid comment;
[0225] determine title features of the comment titles;
[0226] construct comment features of the effective comments based on the text features and the title features of the effective comments;
[0227] input the comment features of the effective comments of the reference resources into the target sentiment classification model to obtain sentiment classification results of the reference resources.
[0228] In an embodiment, the fourth determination module 610 is specifically configured to:
[0229] determine reference resource categories of the reference resources;
[0230] for any reference resource category, determine a target sentiment classification result of the reference resource category according to sentiment classification results of the reference resources under the reference resource category;
[0231] for any reference resource category, determine whether the reference resource category corresponds to a target resource according to the target sentiment classification result of the reference resource category;
[0232] in a case where at least one reference resource category corresponds to a target resource, recommend target resources corresponding to the reference resource categories to the target user.
[0233] In an embodiment, the target sentiment classification model includes a multi-kernel support vector machine, a mapping function of the multi-kernel support vector machine is constructed based on a text mapping function, a text mapping weight, a title mapping function and a title mapping weight; and the resource recommendation apparatus further includes:
[0234] the second acquisition module is configured to acquire sample effective comments of at least one reference resource, sample comment titles of the sample effective comments and actual sentiment classification results of sample users; and the sample effective comments include at least one sample comment sentence;
[0235] the fifth determination module is configured to determine the first sentiment classification models; the weight values of the text mapping weights and / or the weight values of the title mapping weights in the first sentiment classification models are different;
[0236] the sixth determination module is configured to, for any first sentiment classification model, determine a classification accuracy of the first sentiment classification model according to the sample effective comments, the sample comment titles of the sample effective comments, the actual sentiment classification results of the sample users and the first sentiment classification model;
[0237] the seventh determination module is configured to determine the second sentiment classification model from the first sentiment classification models according to the classification accuracies of the first sentiment classification models;
[0238] The training module is configured to train the second sentiment classification model according to the sample valid comments, the sample comment titles of the sample valid comments, and the actual sentiment classification results of the sample users, and obtain a target sentiment classification model.
[0239] In one embodiment, the fifth determining module is specifically configured to:
[0240] initializing parameters in the sentiment classification model to be trained except for the body mapping weight and the title mapping weight, and obtaining a third sentiment classification model;
[0241] constructing a plurality of first sentiment classification models according to the plurality of preset first weight values, the plurality of preset second weight values, and the third sentiment classification model.
[0242] In one embodiment, the training module is specifically configured to:
[0243] determining sample sentiment classification results of the sample users corresponding to the second sentiment classification model based on the sample valid comments, the sample comment titles of the sample valid comments, and the second sentiment classification model;
[0244] training parameters in the second sentiment classification model except for the body mapping weight and the title mapping weight based on the sample sentiment classification results of the sample users corresponding to the second sentiment classification model and the actual sentiment classification results of the sample users, and obtaining a target sentiment classification model.
[0245] The modules in the resource recommendation apparatus can be all or partially implemented by software, hardware, or a combination thereof. The modules can be embedded in or independent of a processor in a computer device in a hardware form, or stored in a memory in a computer device in a software form, so as to be called and executed by a processor.
[0246] In one embodiment, a computer device is provided, which can be a terminal, and an internal structure diagram of the computer device can be as shown in Figure 7The computer device shown in the figure includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capability. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner. The wireless manner can be realized through WIFI, mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by the processor to realize a resource recommendation method. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball or touchpad arranged on the shell of the computer device, or an external keyboard, touchpad or mouse, etc.
[0247] Those skilled in the art can understand that, Figure 7 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0248] In one embodiment, a computer device is also provided, including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to realize the steps in each of the above method embodiments.
[0249] In one embodiment, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to realize the steps in each of the above method embodiments.
[0250] In one embodiment, a computer program product is provided, including a computer program, and the computer program is executed by a processor to realize the steps in each of the above method embodiments.
[0251] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of the country and region.
[0252] It can be understood by those skilled in the art that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments of each method. In the embodiments provided in the present application, any reference to memory, database or other medium can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetic variable memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric memory (Ferroelectric Random Access Memory, FRAM), phase change memory (Phase Change Memory, PCM), graphene memory, etc. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.
[0253] The technical features of the above embodiments can be combined in any way. In order to make the description simple, not all possible combinations of the technical features in the above embodiments are described, but as long as the combination of the technical features does not exist contradictory, it should be considered as the scope of the present application.
[0254] The above-described embodiments are merely illustrative of several embodiments of the present application, and the description is relatively specific and detailed, but should not be understood as a limitation on the scope of the patent. It should be noted that for those skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of protection of the present application should be subject to the appended claims.
Claims
1. A resource recommendation method, characterized by, The method comprises: obtaining effective comments of a target user on at least one reference resource and comment titles of the effective comments; the effective comments include at least one comment sentence; for any comment sentence, determining a sentence sentiment value of the comment sentence according to the comment sentence, a preset segmentation dictionary and a preset sentiment value calculation strategy; for any effective comment, determining a comment sentiment value of the effective comment according to the sentence sentiment values of the comment sentences included in the effective comment; for any reference resource, determining a sentiment classification result of the reference resource according to the effective comments, the comment sentiment values of the effective comments, the comment titles and a target sentiment classification model; determining at least one target resource according to the sentiment classification results of the reference resources, and recommending the target resources to the target user; the target resources include the reference resources and / or associated resources of the reference resources; the target sentiment classification model comprises a multi-kernel support vector machine, a mapping function of the multi-kernel support vector machine is constructed based on a text mapping function, a text mapping weight, a title mapping function and a title mapping weight; the method further comprises: obtaining sample effective comments of sample users on at least one reference resource, sample comment titles of the sample effective comments and actual sentiment classification results of the sample users; the sample effective comments include at least one sample comment sentence; determining a plurality of first sentiment classification models; the text mapping weights in the first sentiment classification models are different in weight value and / or the title mapping weights are different in weight value; for any first sentiment classification model, determining a classification accuracy of the first sentiment classification model according to the sample effective comments, the sample comment titles of the sample effective comments, the actual sentiment classification results of the sample users and the first sentiment classification model; determining a second sentiment classification model from the first sentiment classification models according to the classification accuracies of the first sentiment classification models; training the second sentiment classification model according to the sample effective comments, the sample comment titles of the sample effective comments and the actual sentiment classification results of the sample users, to obtain the target sentiment classification model; the determining a plurality of first sentiment classification models comprises: initializing parameters of a sentiment classification model to be trained except the text mapping weight and the title mapping weight, to obtain a third sentiment classification model; constructing a plurality of first sentiment classification models according to the preset first weight values, the preset second weight values and the third sentiment classification model; the training the second sentiment classification model according to the sample effective comments, the sample comment titles of the sample effective comments and the actual sentiment classification results of the sample users, to obtain the target sentiment classification model, comprises: Determine sample sentiment classification results of each of the sample users corresponding to the second sentiment classification model based on the valid comments of each of the samples, the sample comment titles of each of the samples, and the second sentiment classification model; Train parameters in the second sentiment classification model except the text mapping weight and the title mapping weight based on the sample sentiment classification results of each of the sample users corresponding to the second sentiment classification model and the actual sentiment classification results of each of the sample users, to obtain the target sentiment classification model.
2. The method of claim 1, wherein, The obtaining of the valid comments of the target user on at least one reference resource and the comment titles of each of the valid comments comprises: Obtaining comment texts of the target user on at least one reference resource; For any of the comment texts, determining a comment classification result of the comment text based on a comment classification model and the comment text; For any of the comment texts, in a case where the comment classification result of the comment text indicates that the comment text is a valid comment, taking the comment text as a valid comment; Obtaining a comment title of at least one of the valid comments.
3. The method of claim 2, wherein, The taking of the comment text as a valid comment in the case where the comment classification result of the comment text indicates that the comment text is a valid comment comprises: In the case where the comment classification result of the comment text indicates that the comment text is a valid comment, taking the comment text as an initial valid comment; In a case where there are a plurality of initial valid comments corresponding to the reference resource, determining at least one valid comment from each of the initial valid comments according to a comment date of each of the initial valid comments.
4. The method according to any one of claims 1 to 3, characterized in that, The determining of the sentence sentiment value of the comment sentence based on the comment sentence, a preset word segmentation dictionary, and a preset sentiment value calculation strategy comprises: According to a preset word segmentation dictionary, performing semantic recognition on the comment sentence to determine a target word included in the comment sentence; the part of speech of the target word comprises an emotion word, a degree adverb, and a negative word; Determine the emotion word corresponding to each of the degree adverbs and the emotion word corresponding to each of the negative words respectively; For any of the emotion words, determine a target sentiment value of the emotion word according to a sentiment value of the emotion word, a degree weight of each of the degree adverbs corresponding to the emotion word, and a negative weight of each of the negative words corresponding to the emotion word; Determine the sentence sentiment value of the comment sentence according to the target sentiment value of each of the emotion words included in the comment sentence.
5. The method according to claim 1 or 2, characterized in that, The determining of the sentiment classification result of the reference resource based on each of the valid comments, the comment sentiment values of each of the valid comments, the comment titles of each of the valid comments, and a target sentiment classification model comprises: In a case where there are a plurality of valid comments corresponding to the reference resource, determine at least one target valid comment from each of the valid comments corresponding to the reference resource according to a sentence sentiment value and a comment date of each of the valid comments corresponding to the reference resource; Determine the sentiment classification result of the reference resource according to each of the target valid comments, the comment sentiment values of each of the target valid comments, the comment titles of the target valid comments, and a target sentiment classification model.
6. The method according to any one of claims 1 to 3, characterized in that, The sentiment classification result of the reference resource is determined according to each of the effective comments, the comment sentiment value of each of the effective comments, each of the comment titles, and a target sentiment classification model. For any of the effective comments of the reference resource, the text feature of the effective comment is determined according to the effective comment and the comment sentiment value of the effective comment. The title feature of each of the comment titles is determined. The comment feature of the effective comment is constructed based on the text feature and the title feature of the effective comment. The comment feature of each of the effective comments of the reference resource is input into the target sentiment classification model to obtain the sentiment classification result of the reference resource.
7. The method according to any one of claims 1 to 3, characterized in that, The target resource is determined according to the sentiment classification result of each of the reference resources, and each of the target resources is recommended to the target user, which includes: The reference resource category of each of the reference resources is determined. For any of the reference resource categories, the target sentiment classification result of the reference resource category is determined according to the sentiment classification result of each of the reference resources under the reference resource category. For any of the reference resource categories, whether the target resource corresponds to the reference resource category is determined according to the target sentiment classification result of the reference resource category. In the case that at least one of the reference resource categories corresponds to the target resource, the target resource corresponding to each of the reference resource categories is recommended to the target user.
8. A resource recommendation apparatus characterized by comprising: The device includes: The first acquisition module is configured to acquire the effective comments of at least one reference resource by a target user and the comment titles of each of the effective comments. The effective comments include at least one comment sentence. The first determination module is configured to determine the sentence sentiment value of any of the comment sentences according to the comment sentence, a preset segmentation dictionary, and a preset sentiment value calculation strategy. The second determination module is configured to determine the comment sentiment value of any of the effective comments according to the sentence sentiment value of each of the comment sentences included in the effective comment. The third determination module is configured to determine the sentiment classification result of the reference resource according to each of the effective comments, the comment sentiment value of each of the effective comments, each of the comment titles, and a target sentiment classification model. The fourth determination module is configured to determine at least one target resource according to the sentiment classification result of each of the reference resources, and to recommend each of the target resources to the target user. The target resource includes the reference resource and / or an associated resource of the reference resource. The target sentiment classification model comprises a multi-kernel support vector machine, and a mapping function of the multi-kernel support vector machine is constructed based on a body mapping function, a body mapping weight, a title mapping function and a title mapping weight; the device further comprises: a second acquisition module configured to acquire sample valid comments of at least one reference resource of each sample user, sample comment titles of the sample valid comments and actual sentiment classification results of each sample user; the sample valid comments comprise at least one sample comment sentence; a fifth determination module configured to determine each first sentiment classification model; the body mapping weight and / or the title mapping weight in each first sentiment classification model is different; a sixth determination module configured to determine, for any first sentiment classification model, a classification accuracy of the first sentiment classification model according to each sample valid comment, each sample comment title of the sample valid comments, actual sentiment classification results of each sample user and the first sentiment classification model; a seventh determination module configured to determine a second sentiment classification model from each first sentiment classification model according to the classification accuracy of each first sentiment classification model; and a training module configured to train the second sentiment classification model according to each sample valid comment, each sample comment title of the sample valid comments and actual sentiment classification results of each sample user, and obtain the target sentiment classification model; The fifth determination module is specifically configured to initialize parameters of a sentiment classification model to be trained except the body mapping weight and the title mapping weight, and obtain a third sentiment classification model; and construct a plurality of first sentiment classification models according to each preset first weight value, each preset second weight value and the third sentiment classification model. The training module is specifically configured to determine sample sentiment classification results of each sample user corresponding to the second sentiment classification model based on each sample valid comment, each sample comment title of the sample valid comments and the second sentiment classification model; and train parameters of the second sentiment classification model except the body mapping weight and the title mapping weight based on the sample sentiment classification results of each sample user corresponding to the second sentiment classification model and actual sentiment classification results of each sample user, and obtain the target sentiment classification model. 9.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-8 when the computer program is executed by the processor. The processor executes the computer program to implement the steps of the method in any one of claims 1 to 7.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 7.
11. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 7. The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 7.
Citation Information
Patent Citations
Multi-kernel-learning-based multi-mode emotion identification method
CN106250855A
Method and device for generating comment summary by fusing user information
CN109190109A