Music recommendation method, system, electronic device and storage medium
By obtaining user emotional state and analyzing the credibility of song comments, using B-Tree tree structure and social information to judge the credibility of comments, the problem of inaccurate recommendations of new users is solved and more accurate music recommendations are achieved.
Patent Information
- Application Number
- CN202210503862.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-10
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2042-05-10
AI Technical Summary
The prior art cannot accurately recommend songs, especially for new users. The recommendations are inaccurate due to the lack of historical data and the inability to draw user portraits.
By obtaining the user's emotional state, analyzing the highly credible comments and the emotional trends of replies in the song, determining recommended songs that match the user's emotional state, using the B-Tree tree structure and social information to judge the credibility of comments, and generating song tags for recommendations.
Improve the accuracy of song recommendations, and achieve more accurate music recommendations by analyzing the matching of user emotions and the emotional trends of song comments.
Smart Images

Figure CN114860985B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a music recommendation method, system, electronic device and storage medium. Background Art
[0002] With the development of internet technology, both NetEase Cloud Music and Migu Music have developed vast communities of music enthusiasts. Music reviews are a particularly successful platform, allowing many to gain a deeper understanding of songs through reading them. Consequently, reviews often reflect users' current moods and recent experiences, whether joyful or sad. Currently, reviews are typically judged based on user interests, profiles, or audio features, and song recommendations are then made based on these credibility. However, for new users on the platform, the lack of historical data to build user profiles makes accurate song recommendations difficult. Summary of the Invention
[0003] The embodiments of the present application aim to solve the problem of being unable to accurately recommend songs by providing a music recommendation method, system, electronic device and storage medium.
[0004] An embodiment of the present application provides a music recommendation method, comprising:
[0005] Get the user's emotional state;
[0006] Determining, based on the emotional tendency of the songs, recommended songs that match the emotional state; wherein the emotional tendency of the songs is determined based on credible comments on the songs, the credible comments including at least one comment reply, and a matching degree between the emotional tendency of the credible comments and the emotional tendency of the at least one comment reply is greater than a preset threshold;
[0007] The recommended song is sent to the user.
[0008] In one embodiment, before the step of determining a recommended song that matches the emotional state based on the emotional tendency of the song, the method further includes:
[0009] Determining a semantic similarity score between the comment and the at least one comment reply associated with the comment based on a first sentiment trend and a first keyword corresponding to the comment associated with the song, and a second sentiment trend and a second keyword corresponding to at least one comment reply associated with the comment;
[0010] Determining a social information matching score between the song and the comment based on the social information associated with the song and the first keyword;
[0011] Determining the credibility of the comment based on the semantic similarity score and the social information matching score;
[0012] Determine the comments in the song that have credibility according to the credibility of the comments.
[0013] In one embodiment, the step of determining a semantic similarity score between a comment and at least one comment reply associated with the comment based on a first sentiment trend and a first keyword corresponding to a comment associated with the song, and a second sentiment trend and a second keyword corresponding to at least one comment reply associated with the comment, includes:
[0014] Obtaining a first sentiment trend and a first keyword of a comment associated with a song, and obtaining a second sentiment trend and a second keyword of at least one comment reply associated with the comment;
[0015] Determining a first score based on a matching result between the first emotional tendency and the second emotional tendency;
[0016] determining a second score based on a matching result between the first keyword and the second keyword;
[0017] The semantic similarity score is determined according to the first score and the second score.
[0018] In one embodiment, the steps of obtaining a first sentiment trend and a first keyword of a comment associated with a song, and obtaining a second sentiment trend and a second keyword of at least one comment reply associated with the comment include:
[0019] Comparing a comment associated with the song with a first preset comment in a preset dictionary database, and comparing a comment reply associated with the comment with a second preset comment in the preset dictionary database;
[0020] When there is a first preset comment in the preset dictionary database that matches the comment associated with the song, determining a first emotional trend of the comment associated with the song according to a first preset emotional trend associated with the matched first preset comment; and when there is a second preset comment in the preset dictionary database that matches the comment reply associated with the comment, determining a second emotional trend of the comment reply associated with the comment according to a second preset emotional trend associated with the matched second preset comment;
[0021] Determining a first word set corresponding to the comment after semantic extraction processing, word segmentation processing, and stop word processing, and determining a second word set corresponding to the comment reply associated with the comment after semantic extraction processing, word segmentation processing, and stop word processing;
[0022] Determining a first term frequency and a first inverse document frequency corresponding to the first word set, and determining a second term frequency and a second inverse document frequency corresponding to the second word set;
[0023] The first keyword is determined according to the first word frequency and the first inverse document frequency, and the second keyword is determined according to the second word frequency and the second inverse document frequency.
[0024] In one embodiment, obtaining a first sentiment trend of comments associated with a song includes:
[0025] Get the word vectors of the comments associated with the song;
[0026] Determining the cosine similarity between the word vector and a preset word vector in a preset dictionary database;
[0027] The first emotional tendency is determined according to the cosine similarity.
[0028] In one embodiment, the step of determining the second score based on the matching result between the first keyword and the second keyword includes:
[0029] Determining a first synonym set corresponding to the first keyword and a second synonym set corresponding to the second keyword;
[0030] determining a word repetition rate between the first synonym set and the second synonym set;
[0031] The second score is determined based on the word repetition rate.
[0032] In one embodiment, the social information includes at least one of a singer's name, a song's title, lyrics, and a relationship between singers. The step of determining a social information matching score between the song and the comment based on the social information associated with the song and the first keyword includes:
[0033] determining a social keyword set based on the social information;
[0034] The social information matching score is determined according to a repetition rate between the first keyword and the social keyword set.
[0035] In addition, to achieve the above-mentioned purpose, the present invention further provides a music recommendation system, which includes:
[0036] The acquisition module is used to obtain the user's emotional state;
[0037] a matching module for determining, based on the emotional trends of the songs, recommended songs that match the emotional state; wherein the emotional trends of the songs are determined based on credible comments on the songs, the credible comments including at least one comment reply, and the emotional trends of the credible comments and the emotional trends of the at least one comment reply having a matching degree greater than a preset threshold;
[0038] A recommendation module is used to send the recommended songs to the user.
[0039] In addition, to achieve the above-mentioned purpose, the present invention also provides an electronic device, which includes: a memory, a processor, and a music recommendation program stored in the memory and runnable on the processor, and when the music recommendation program is executed by the processor, the steps of the above-mentioned music recommendation method are implemented.
[0040] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium on which a music recommendation program is stored. When the music recommendation program is executed by a processor, the steps of the above-mentioned music recommendation method are implemented.
[0041] A technical solution of a music recommendation method, system, electronic device and storage medium provided in an embodiment of the present application adopts the method of obtaining the emotional state of the user; determining a recommended song that matches the emotional state based on the emotional tendency of the song; wherein the emotional tendency of the song is determined based on credible comments in the song, the credible comments include at least one comment reply, and the matching degree of the emotional tendency of the credible comments and the emotional tendency of the at least one comment reply is greater than a preset threshold; a technical solution of sending the recommended song to the user, since the emotional tendency of the song is determined by the comments under the song and the replies to the comments, the song that matches the emotional tendency is recommended to the user, thereby solving the problem of not being able to recommend songs accurately, and improving the accuracy of recommended songs through the technical solution of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a structural schematic diagram of the electronic device of the present invention;
[0043] Figure 2 This is a flowchart of a first embodiment of the music recommendation method of the present invention;
[0044] Figure 3 This is a functional module diagram of the music recommendation system of the present invention;
[0045] Figure 4 Schematic diagram of the B-Tree structure of the present invention;
[0046] Figure 5 Schematic diagram of judging the social relationship of songs of the present invention.
[0047] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. The above-mentioned drawings are only an embodiment diagram, not the entire invention. DETAILED DESCRIPTION
[0048] This method uses two methods to determine credibility: First, it uses comments and their associated replies to generate a B-Tree structure with the comment as the root node. This structure then recursively determines whether the child nodes have roughly the same semantic and emotional tendencies as their parent nodes to determine the credibility of the comment. Second, it determines the credibility of the comment based on the social information (family, friendship, and love) described in the song.
[0049] To better understand the above technical solutions, exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. Instead, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0050] like Figure 1 As shown, Figure 1 This is a schematic diagram of the structure of the hardware operating environment involved in the embodiment of the present invention.
[0051] It should be noted that Figure 1 This is a structural diagram of the hardware operating environment of the electronic device.
[0052] like Figure 1 As shown, the electronic device may include: a processor 1001, such as a CPU, a memory 1005, a user interface 1003, a network interface 1004, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the user interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may optionally be a storage device independent of the aforementioned processor 1001.
[0053] Those skilled in the art will understand that Figure 1 The electronic device structure shown in the figure does not limit the electronic device and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0054] like Figure 1As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a music recommendation program. The operating system is a program that manages and controls the hardware and software resources of the electronic device, and the music recommendation program and other software or programs are executed.
[0055] exist Figure 1 In the electronic device shown, the user interface 1003 is mainly used to connect to the terminal and communicate data with the terminal; the network interface 1004 is mainly used to communicate data with the background server; the processor 1001 can be used to call the music recommendation program stored in the memory 1005.
[0056] In this embodiment, the electronic device includes: a memory 1005, a processor 1001, and a music recommendation program stored in the memory and executable on the processor, wherein:
[0057] When the processor 1001 calls the music recommendation program stored in the memory 1005, it performs the following operations:
[0058] Get the user's emotional state;
[0059] Determining, based on the emotional tendency of the songs, recommended songs that match the emotional state; wherein the emotional tendency of the songs is determined based on credible comments on the songs, the credible comments including at least one comment reply, and a matching degree between the emotional tendency of the credible comments and the emotional tendency of the at least one comment reply is greater than a preset threshold;
[0060] The recommended song is sent to the user.
[0061] When the processor 1001 calls the music recommendation program stored in the memory 1005, it also performs the following operations:
[0062] Determining a semantic similarity score between the comment and the at least one comment reply associated with the comment based on a first sentiment trend and a first keyword corresponding to the comment associated with the song, and a second sentiment trend and a second keyword corresponding to at least one comment reply associated with the comment;
[0063] Determining a social information matching score between the song and the comment based on the social information associated with the song and the first keyword;
[0064] Determining the credibility of the comment based on the semantic similarity score and the social information matching score;
[0065] Determine the comments in the song that have credibility according to the credibility of the comments.
[0066] When the processor 1001 calls the music recommendation program stored in the memory 1005, it also performs the following operations:
[0067] Obtaining a first sentiment trend and a first keyword of a comment associated with a song, and obtaining a second sentiment trend and a second keyword of at least one comment reply associated with the comment;
[0068] Determining a first score based on a matching result between the first emotional tendency and the second emotional tendency;
[0069] determining a second score based on a matching result between the first keyword and the second keyword;
[0070] The semantic similarity score is determined according to the first score and the second score.
[0071] When the processor 1001 calls the music recommendation program stored in the memory 1005, it also performs the following operations:
[0072] Comparing a comment associated with the song with a first preset comment in a preset dictionary database, and comparing a comment reply associated with the comment with a second preset comment in the preset dictionary database;
[0073] When there is a first preset comment in the preset dictionary database that matches the comment associated with the song, determining a first emotional trend of the comment associated with the song according to a first preset emotional trend associated with the matched first preset comment; and when there is a second preset comment in the preset dictionary database that matches the comment reply associated with the comment, determining a second emotional trend of the comment reply associated with the comment according to a second preset emotional trend associated with the matched second preset comment;
[0074] Determining a first word set corresponding to the comment after semantic extraction processing, word segmentation processing, and stop word processing, and determining a second word set corresponding to the comment reply associated with the comment after semantic extraction processing, word segmentation processing, and stop word processing;
[0075] Determining a first term frequency and a first inverse document frequency corresponding to the first word set, and determining a second term frequency and a second inverse document frequency corresponding to the second word set;
[0076] The first keyword is determined according to the first word frequency and the first inverse document frequency, and the second keyword is determined according to the second word frequency and the second inverse document frequency.
[0077] When the processor 1001 calls the music recommendation program stored in the memory 1005, it also performs the following operations:
[0078] Get the word vectors of the comments associated with the song;
[0079] Determining the cosine similarity between the word vector and a preset word vector in a preset dictionary database;
[0080] The first emotional tendency is determined according to the cosine similarity.
[0081] When the processor 1001 calls the music recommendation program stored in the memory 1005, it also performs the following operations:
[0082] Determining a first synonym set corresponding to the first keyword and a second synonym set corresponding to the second keyword;
[0083] determining a word repetition rate between the first synonym set and the second synonym set;
[0084] The second score is determined based on the word repetition rate.
[0085] When the processor 1001 calls the music recommendation program stored in the memory 1005, it also performs the following operations:
[0086] determining a social keyword set based on the social information;
[0087] The social information matching score is determined according to a repetition rate between the first keyword and the social keyword set.
[0088] The embodiment of the present invention provides an embodiment of a music recommendation method. It should be noted that although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that shown here.
[0089] The technical solutions of this application will be introduced below in the form of embodiments.
[0090] like Figure 2 As shown, in the first embodiment of the present application, the music recommendation method of the present application includes the following steps:
[0091] Step S110, obtaining the user's emotional state;
[0092] Step S120: Determine, based on the emotional trends of the songs, recommended songs that match the emotional state; wherein the emotional trends of the songs are determined based on credible comments about the songs, the credible comments including at least one comment reply, and the emotional trends of the credible comments and the emotional trends of the at least one comment reply have a matching degree greater than a preset threshold;
[0093] Step S130: Send the recommended song to the user.
[0094] In this embodiment, the keyword set of the highly credible comments is obtained as the song tag. The comments and comment replies under each song are used to mine music-related information to obtain the emotional trend and keywords of the music as the music tag.
[0095] In this embodiment, the user's emotional state can be determined based on the user's comments on the song. Specifically, the emotional tendency of the song can be determined based on the user's comments on the song, and then the current user's emotional state can be predicted based on the emotional tendency. Based on the emotional state and the emotional tendency of the song, matching recommended songs are determined.
[0096] In this embodiment, the three different modalities of information, namely audio data, lyrics data, and user comments, of different songs are preprocessed separately, and a data set is constructed based on emotional categories; the emotional categories include nostalgia, sadness, healing, relaxation, loneliness, touching, happiness, and longing. Songs can be recommended based on the similarity of song tags and song emotional trends. At the same time, the user's current comments on the song are obtained in real time, and the current user's emotional state is obtained. Song recommendations are made based on the user's emotional state and the emotional trend of the song. Specifically, by crawling and storing the current user's comments and accurate time in real time, by categorizing the user's comments by time, and obtaining the emotional trend of the user's comments, the current user's emotional state is accurately predicted, and song recommendations are made based on the current user's emotional state.
[0097] Based on the above technical solution, this embodiment obtains users' comments on songs in real time, performs sentiment analysis on the comments, obtains the current user's mood, and makes music recommendations based on the user's mood.
[0098] In one embodiment, before the step of determining a recommended song that matches the emotional state based on the emotional tendency of the song, the method further includes:
[0099] Step S210, determines the semantic similarity score between the comment and at least one comment reply associated with the comment based on the first emotional trend and the first keyword corresponding to the comment associated with the song, and the second emotional trend and the second keyword corresponding to at least one comment reply associated with the comment.
[0100] In this embodiment, the inability to determine the credibility of song reviews will hinder subsequent song recommendations. Therefore, this application proposes a music recommendation method that uses the comments under a song and at least one comment reply associated with the comment to determine whether the semantics and emotional tendencies of the comments are roughly the same, thereby determining whether the comments are credible. At the same time, the credibility of the comments is judged based on the social information described in the song, thereby determining the credibility of the comments.
[0101] In this embodiment, the comments are user comments on a song. The number of comments can be determined based on actual circumstances, and the first sentiment trend and first keyword of each comment can be obtained. The number of comment replies associated with the comment can also be determined based on actual circumstances. For example, the comments can be ranked in the top three by the number of likes for the comment. The second sentiment trend and second keyword of each of the top three comment replies are obtained. The first sentiment trend is the sentiment trend of the comment, which can be negative, positive, or neutral. 0 can represent neutral, 1 represents positive, and -1 represents negative. The second sentiment trend is the sentiment trend of the comment replies. Similar to the first sentiment trend, the second sentiment trend can also include the above three types. The first sentiment trend can be the same as or different from the second sentiment trend. Sentiment analysis can be performed on the comments and comment replies to obtain the corresponding first and second sentiment trends. The first keyword is the keyword of the comment, and the second keyword is the keyword of the comment reply. By analyzing the comments and comment replies, the first keyword of the comment and the second keyword of the comment reply can be determined. The number of first and second keywords can be determined based on the semantics of the comment.
[0102] In this embodiment, after determining the first sentiment trend and the first keyword, and the second sentiment trend and the second keyword, a semantic similarity score is determined based on the first sentiment trend, the first keyword, the second sentiment trend, and the second keyword. Specifically, the first sentiment trend can be compared with the second sentiment trend, and the first keyword can be compared with the second keyword, and the semantic similarity score can be determined based on the comparison results between the two.
[0103] In this embodiment, the Python Selenium library is used to obtain song information and user information, including the song's unique identifier, artist name, and song title. At the same time, the page source code is analyzed in real time. Generally, comments and comment replies belong to the same HTML structure, and the comments associated with the song and the comment replies are obtained. The song information storage structure refers to the following table:
[0104] Field Name Field Type Chinese instructions MusicID Varchar Unique song identifier SongName Varchar Song Title Singer Varchar Singer's name Comments Array Comment UserID Varchar Commentator
[0105] The user information storage structure refers to the following table:
[0106]
[0107] In this example, the credibility of a review is analyzed based on three dimensions: first, the semantic similarity between the comment and the replies; second, the semantic similarity between the comment and the top three most-liked reviews of the song; and finally, the social information based on the song (family, friendship, and love). Each dimension has a maximum score of 20 points, for a total score of 60. A review with a total score of 48 points or above is considered highly credible.
[0108] In one embodiment, determining a semantic similarity score between a comment and at least one comment reply associated with the comment, based on a first sentiment trend and a first keyword corresponding to a comment associated with a song, and a second sentiment trend and a second keyword corresponding to at least one comment reply associated with the comment, specifically includes the following steps:
[0109] Step S211, obtaining a first sentiment trend and a first keyword of a comment associated with the song, and obtaining a second sentiment trend and a second keyword of at least one comment reply associated with the comment;
[0110] In one embodiment, obtaining a first sentiment trend and a first keyword of a comment associated with a song, and obtaining a second sentiment trend and a second keyword of a comment reply associated with the comment specifically include the following steps:
[0111] Step S2111, comparing the comment associated with the song with a first preset comment in a preset dictionary database, and comparing the comment reply associated with the comment with a second preset comment in the preset dictionary database;
[0112] Step S2112, when there is a first preset comment in the preset dictionary database that matches the comment associated with the song, determining a first emotional trend of the comment associated with the song according to a first preset emotional trend associated with the matched first preset comment; and when there is a second preset comment in the preset dictionary database that matches the comment reply associated with the comment, determining a second emotional trend of the comment reply associated with the comment according to a second preset emotional trend associated with the matched second preset comment;
[0113] In this embodiment, since the preset dictionary database stores the sentiment trends associated with comments, the sentiment trend associated with the first preset comment is determined as the first sentiment trend of the comment by matching the comment associated with the song with the corresponding first preset comment in the preset dictionary database. Simultaneously, the sentiment trend associated with the comment reply is determined as the second sentiment trend of the comment reply by matching the comment reply with the corresponding second preset comment in the preset dictionary database.
[0114] Step S2113, determining a first word set corresponding to the comment after semantic extraction processing, word segmentation processing, and stop word processing, and determining a second word set corresponding to the comment reply associated with the comment after semantic extraction processing, word segmentation processing, and stop word processing;
[0115] In this embodiment, after the comments are processed with semantic extraction, word segmentation and stop words, a first word set corresponding to the comments is obtained. Similarly, after the comment replies associated with the comments are processed with semantic extraction, word segmentation and stop words, a second word set corresponding to the comment replies is obtained. Among them, the electronic device uses natural language processing technology to extract keywords from the comments of the song. Specifically, first, Chinese word segmentation technology (such as stuttering word segmentation) is used to perform word segmentation on the comments, and the word segmentation results are saved; then, useless information in the word segmentation results is eliminated. The electronic device uses methods such as establishing a stop word library and regular expressions to remove symbols in the word segmentation results, such as punctuation marks and line breaks, as well as useless information such as useless words, and retains the keywords of the song comments.
[0116] Step S2114, determining a first word frequency and a first inverse document frequency corresponding to the first word set, and determining a second word frequency and a second inverse document frequency corresponding to the second word set;
[0117] In this embodiment, the first keyword of the comment and the second keyword of the comment reply are obtained. Specifically, after obtaining the first word set and the second word set in the above manner, the frequency of occurrence of each word in the first word set and the second word set is determined, that is, the first word frequency of each word in the first word set and the second word frequency of each word in the second word set are determined. At the same time, the first inverse document frequency corresponding to the first word set and the second inverse document frequency corresponding to the second word set are determined.
[0118] Step S2115: determine the first keyword based on the first word frequency and the first inverse document frequency, and determine the second keyword based on the second word frequency and the second inverse document frequency.
[0119] In this embodiment, after determining the first word frequency, the first inverse document frequency, the second word frequency, and the second inverse document frequency in the above manner, the first keyword is determined based on the product of the first word frequency and the first inverse document frequency; and the second keyword is determined based on the product of the second word frequency and the second inverse document frequency. Specifically, the calculation is performed using the following formula:
[0120] TF-IDF = term frequency (TF) * inverse document frequency (IDF).
[0121] For example, we analyze the credibility of comments on the song "Father" and collect the top three highly praised comments under the song. Figure 4 The B-Tree tree structure diagram shown.
[0122] First, we performed a sentiment analysis on the comment "I hope my father lives a long life." The sentiment is categorized into three main categories: positive (optimism), negative (pessimism), and neutral. 0 represents neutral, 1 represents positive, and -1 represents negative. We prepared an existing dataset and built a model training feature to determine the primary sentiment trend of the comments and the secondary sentiment trend of the replies.
[0123] Next, we perform semantic extraction on "I hope my father lives a long life" to obtain the subject (I), predicate (hope), and object (live a long life). At the same time, we perform word segmentation and stop word processing on "I hope my father lives a long life". We use the TF-IDF algorithm to obtain the keyword set of the excellent comments, namely the keywords array:
[0124] Skeywords=[w1,w2,w3,w4,...,wn].
[0125] Finally, recursively traverse each layer of comment reply nodes, perform sentiment analysis and semantic extraction, and update the node's sentiment and keywords to the node object. At the same time, the total score of this dimension is evenly divided into sentiment and keyword similarity.
[0126] The structure of each node is shown in the following figure:
[0127]
[0128] In this embodiment, the technical solution compares comments and replies with pre-set comments in a pre-set dictionary database to determine their corresponding sentiment. TF-IDF is also used to identify keywords corresponding to comments and replies. A B-Tree structure with the comment as the root node is generated using the comments and replies. The credibility of the comment is determined by recursively determining whether the semantics and sentiment of the child nodes are roughly the same as those of the parent node.
[0129] In one embodiment, obtaining a first sentiment trend of comments associated with a song includes:
[0130] Step S3111, obtaining word vectors of comments associated with the song;
[0131] Step S3112, determining the cosine similarity between the word vector and a preset word vector in a preset dictionary database;
[0132] Step S3113: Determine the first emotional trend according to the cosine similarity.
[0133] In this embodiment, a cosine similarity algorithm may also be used to determine the first sentiment trend of the review. The following takes the review of a song as an example to illustrate the process of extracting keywords from the review of the song.
[0134] For example, a song review might read: "As a love song, 'XXX' aims to touch the heart, move the listener's ears, and use emotional composition to allow the listener to hear the voice of the heart. The combination of piano, guitar, and strings feels familiar and reassuring to listeners accustomed to Asian love songs. Behind the poignant atmosphere lies a sense of silent companionship, perhaps the companionship of memories, or the artist's companionship through music." The first keyword of this review is saved as a list as W = [love song, emotion, companionship, combination, comfort, guitar, voice of the heart, strings, sadness, companionship, insomnia, piano, silence, reassurance, breath].
[0135] In this embodiment, the electronic device determines the word vector of the first keyword based on the word embedding Word2Vec model through the Word2Vec model, determines the distance between the keywords, and performs the following operations for each keyword: determines that the distance between the keyword and other keywords is greater than the first preset value, and removes the keyword. Since the distance between two keywords can reflect the similarity between the two, if the distance between a keyword in the text information of a song and other keywords is greater than the first preset value, it can be considered that the keyword is not similar to the other keywords. The reason for this situation may be that the comment text extracted for the keyword is an untrue comment text (such as a deliberately misleading comment text), or the commentator of the comment text corresponding to the keyword made a spelling error in the comment, so the keyword is an interference keyword. The electronic device removes the interference keyword to prevent the word vector of the keyword from interfering with the electronic device's analysis of the music characteristics of the song. Among them, the first preset value can be set according to actual conditions.
[0136] In this embodiment, after obtaining the word vector in the above manner, the cosine similarity between the word vector and the preset word vector in the preset dictionary database is determined, and then the preset emotional tendency associated with the preset word vector with high similarity is determined as the first emotional tendency.
[0137] Similarly, the second sentiment trend of the comment reply can also be determined based on the cosine similarity algorithm. The method is the same as that for the comment, so I will not repeat it here.
[0138] Step S212: determining a first score based on a matching result between the first emotional trend and the second emotional trend;
[0139] In this embodiment, the first emotional tendency is matched with the second emotional tendency, and the first score is determined based on the matching result. For example, by default, neutral (0) is considered to be the same as positive (1) and negative (-1) emotional tendencies. If the first emotional tendency is the same as the second emotional tendency, the emotional tendency score is 10 points. If the first emotional tendency is different from the second emotional tendency, the score is 0. The above scoring rules can be set according to actual conditions.
[0140] Step S213: determining a second score based on the matching result between the first keyword and the second keyword;
[0141] In this embodiment, the first keyword of the comment is matched with the second keyword of the comment reply, and the second score is determined based on the matching results. A matching rule can be set to determine the corresponding score when the matching results are the same, and the corresponding score when the matching results are different.
[0142] In one embodiment, determining the second score according to the matching result between the first keyword and the second keyword includes the following steps:
[0143] Step S2131, determining a first synonym set corresponding to the first keyword, and a second synonym set corresponding to the second keyword;
[0144] Step S2132, determining the word repetition rate between the first synonym set and the second synonym set;
[0145] Step S2133: Determine the second score based on the word repetition rate.
[0146] In this embodiment, the keyword repetition rates are compared and synonym expansion is first performed on the keyword. Otherwise, the two words may be synonymous. Therefore, synonym expansion is performed on the first keyword to obtain a first synonym set. Synonym expansion is also performed on the second keyword to obtain a second synonym set. The first synonym set is compared with the second synonym set to determine the word repetition rate between the first and second synonym sets. After the word repetition rate is obtained, the second score is determined based on the word repetition rate.
[0147] For example, if comment A's keyword set includes the word "dad," and its reply B includes the keyword "father," a direct comparison would be considered inconsistent. By expanding the existing "synonym dictionary," we obtain a synonym set similar to [father, dad, daddy, daddy], and expanding each word in the Skeywords tree structure. Finally, we compare the Wkeywords of comment A and reply B after the synonym expansion. If the word repetition rate is above 80%, the semantics are similar and the score is 10; otherwise, it is 0. The above scoring rules can be set according to actual circumstances.
[0148] In the technical solution of this embodiment, the accuracy of the comparison result is improved by expanding the first keyword and the second keyword and then comparing them.
[0149] Step S214: determining the semantic similarity score according to the first score and the second score.
[0150] In this embodiment, the semantic similarity between the comment and the comment reply is determined by considering whether the sentiment is the same and the repetition rate of the keyword set. Therefore, after obtaining the first score and the second score, the first score and the second score are added together to obtain the semantic similarity score.
[0151] Step S220: Determine a social information matching score between the song and the comment based on the social information associated with the song and the first keyword.
[0152] In this embodiment, the social information associated with a song includes at least one of the artist's name, song title, lyrics, and the artist's relationship. After obtaining the social information associated with the song, a corresponding database is generated based on the social information, such as a database for love, family, or friendship. The first keyword is then matched against the social information in the database to obtain a social information matching score.
[0153] In one embodiment, determining a social information matching score between the song and the comment based on the social information associated with the song and the first keyword includes the following steps:
[0154] Step S221, determining a social keyword set based on the social information;
[0155] Step S222: determining the social information matching score according to the repetition rate between the first keyword and the social keyword set.
[0156] In this embodiment, the social information includes at least one of the singer name, song name, lyrics and singer relationship. Figure 5 Schematic diagram of social relationship judgment. First, if the number of singers in a song is greater than or equal to 2, the specific information about the singers that has been crawled in advance is used for matching to determine whether the singers are lovers or relatives. If no judgment can be made, they are considered friends, and the relationship between the singers is obtained. Secondly, the song title is used to determine whether it contains words describing family, friendship, and love. Finally, the keyword set in the lyrics is obtained and synonym expansion is performed at the same time. Then, it is determined whether any one or more words describing the song (love, family, friendship) appear. Finally, the social information of the song is obtained (praising family, friendship, and love).
[0157] In this embodiment, a determination is made as to whether the first keyword in the obtained review belongs to the social keyword set defined by the family, love, and friendship databases. Specifically, the first keyword is compared with the social keyword set to determine the repetition rate. If the repetition rate reaches 80%, the social information described in the review is considered consistent with the song itself and a score of 10 is awarded; otherwise, a score of 0 is awarded.
[0158] Step S230, determining the credibility of the comment based on the semantic similarity score and the social information matching score;
[0159] Step S240: Determine credible comments in the song based on the credibility of the comments.
[0160] In this embodiment, after obtaining the semantic similarity score and the social information matching score, the credibility of the comment is determined by summing the semantic similarity score and the social information matching score. The credibility of the comment is then used to determine which comments in the song are credible. For example, if the final comment score is greater than or equal to 48, it is considered highly credible, and the final comment is determined to be a credible comment in the song to obtain the final structured song information:
[0161] Field Name Field Type Chinese instructions SongName Varchar Song title Singer Varchar Singer's name Song Tags Array Comment keyword collection Emotional tendencies Number 0 represents neutral, 1 represents positive, and -1 represents negative
[0162] According to the above technical solution, this embodiment adopts the first emotional trend and the first keyword corresponding to the comment associated with the song, and the second emotional trend and the second keyword corresponding to the comment reply associated with the comment, thereby determining the semantic similarity score between the comment and the comment reply; and determining the social information matching score between the song and the comment based on the social information associated with the song and the first keyword; and then determining the credibility of the comment based on the semantic similarity score and the social information matching score. The technical solution for determining credible comments in a song based on the credibility of the comment, determines whether the semantics and emotional trends of the comment are roughly the same through the comments under the song and the reply to the comment, thereby determining whether the comment is credible; at the same time, the credibility of the comment is judged by the social information described in the song, which solves the problem of low credibility of song comments, and realizes verification of the credibility of song comments through the technical solution of this application.
[0163] like Figure 3 As shown, the present application provides a music recommendation system, which includes:
[0164] An acquisition module 10 is used to acquire the user's emotional state;
[0165] Matching module 20, configured to determine, based on the emotional trends of the songs, recommended songs that match the emotional state; wherein the emotional trends of the songs are determined based on credible comments on the songs, the credible comments including at least one comment reply, and the emotional trends of the credible comments and the emotional trends of the at least one comment reply having a matching degree greater than a preset threshold;
[0166] The recommendation module 30 is configured to send the recommended songs to the user.
[0167] In one embodiment, the music recommendation system also includes a module for determining credible comments, which is used to determine a semantic similarity score between the comment and at least one comment reply associated with the comment based on a first emotional trend and a first keyword corresponding to the comment associated with the song, and a second emotional trend and a second keyword corresponding to at least one comment reply associated with the comment; determine a social information matching score between the song and the comment based on the social information associated with the song and the first keyword; determine the credibility of the comment based on the semantic similarity score and the social information matching score; and determine credible comments in the song based on the credibility of the comment.
[0168] In one embodiment, the credibility comment determination module is used to obtain a first emotional trend and a first keyword of a comment associated with a song, and to obtain a second emotional trend and a second keyword of at least one comment reply associated with the comment; determine a first score based on the matching result between the first emotional trend and the second emotional trend; determine a second score based on the matching result between the first keyword and the second keyword; and determine the semantic similarity score based on the first score and the second score.
[0169] In one embodiment, the credibility comment determination module is used to compare the comment associated with the song with a first preset comment in a preset dictionary database, and to compare the comment reply associated with the comment with a second preset comment in the preset dictionary database; when there is a first preset comment matching the comment associated with the song in the preset dictionary database, the first emotional trend of the comment associated with the song is determined according to the first preset emotional trend associated with the matched first preset comment, and when there is a second preset comment matching the comment reply associated with the comment in the preset dictionary database, the second emotional trend of the comment reply associated with the comment is determined according to the second preset emotional trend associated with the matched second preset comment; determine the first word set corresponding to the comment after semantic extraction processing, word segmentation processing and stop word processing, and determine the second word set corresponding to the comment reply associated with the comment after semantic extraction processing, word segmentation processing and stop word processing; determine the first word frequency and first inverse document frequency corresponding to the first word set, and determine the second word frequency and second inverse document frequency corresponding to the second word set; determine the first keyword according to the first word frequency and the first inverse document frequency, and determine the second keyword according to the second word frequency and the second inverse document frequency.
[0170] In one embodiment, the credibility comment determination module is used to obtain a word vector of a comment associated with a song; determine the cosine similarity between the word vector and a preset word vector in a preset dictionary database; and determine the first emotional trend based on the cosine similarity.
[0171] In one embodiment, the credibility review determination module is used to determine a first synonym set corresponding to the first keyword and a second synonym set corresponding to the second keyword; determine a word repetition rate between the first synonym set and the second synonym set; and determine the second score based on the word repetition rate.
[0172] In one embodiment, the credibility review determination module is configured to determine a social keyword set based on the social information; and determine the social information matching score based on a repetition rate between the first keyword and the social keyword set.
[0173] The specific implementation of the music recommendation system of the present invention is basically the same as the various embodiments of the above-mentioned music recommendation method, and will not be repeated here.
[0174] Based on the same inventive concept, an embodiment of the present application also provides a computer-readable storage medium, which stores a music recommendation program. When the music recommendation program is executed by a processor, it implements the various steps of the music recommendation method described above and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0175] Since the storage medium provided in the embodiments of this application is the storage medium used to implement the method of the embodiments of this application, those skilled in the art will be able to understand the specific structure and variations of the storage medium based on the method described in the embodiments of this application, and therefore will not be described in detail here. All storage media used in the method of the embodiments of this application fall within the scope of protection to be provided by this application.
[0176] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0177] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0178] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0179] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0180] It should be noted that in the claims, any reference signs placed between parentheses shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claim. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention can be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third etc. does not indicate any order. These words may be interpreted as names.
[0181] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0182] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.
Claims
1. A music recommendation method, characterized in that: The music recommendation method comprises: Get the user's emotional state; Determining a semantic similarity score between the comment and the at least one comment reply associated with the comment based on a first sentiment trend and a first keyword corresponding to the comment associated with the song, and a second sentiment trend and a second keyword corresponding to at least one comment reply associated with the comment; determining a social information matching score between the song and the comment based on social information associated with the song and the first keyword, the social information including at least one of a singer's name, a song title, lyrics, and a relationship between singers; Determining the credibility of the comment based on the semantic similarity score and the social information matching score; Determining credible comments in the song according to the credibility of the comments; Determining, based on the emotional tendency of the songs, recommended songs that match the emotional state; wherein the emotional tendency of the songs is determined based on credible comments on the songs, the credible comments including at least one comment reply, and a matching degree between the emotional tendency of the credible comments and the emotional tendency of the at least one comment reply is greater than a preset threshold; The recommended song is sent to the user.
2. The music recommendation method according to claim 1, wherein: The step of determining a semantic similarity score between the comment and at least one comment reply associated with the comment based on a first sentiment trend and a first keyword corresponding to the comment associated with the song, and a second sentiment trend and a second keyword corresponding to at least one comment reply associated with the comment, comprises: Obtaining a first sentiment trend and a first keyword of a comment associated with a song, and obtaining a second sentiment trend and a second keyword of at least one comment reply associated with the comment; Determining a first score based on a matching result between the first emotional tendency and the second emotional tendency; determining a second score based on a matching result between the first keyword and the second keyword; The semantic similarity score is determined according to the first score and the second score.
3. The music recommendation method according to claim 2, wherein: The steps of obtaining a first emotional trend and a first keyword of a comment associated with the song, and obtaining a second emotional trend and a second keyword of at least one comment reply associated with the comment include: Comparing a comment associated with the song with a first preset comment in a preset dictionary database, and comparing a comment reply associated with the comment with a second preset comment in the preset dictionary database; When there is a first preset comment in the preset dictionary database that matches the comment associated with the song, determining a first emotional trend of the comment associated with the song according to a first preset emotional trend associated with the matched first preset comment; and when there is a second preset comment in the preset dictionary database that matches the comment reply associated with the comment, determining a second emotional trend of the comment reply associated with the comment according to a second preset emotional trend associated with the matched second preset comment; Determining a first word set corresponding to the comment after semantic extraction processing, word segmentation processing, and stop word processing, and determining a second word set corresponding to the comment reply associated with the comment after semantic extraction processing, word segmentation processing, and stop word processing; Determining a first term frequency and a first inverse document frequency corresponding to the first word set, and determining a second term frequency and a second inverse document frequency corresponding to the second word set; The first keyword is determined according to the first word frequency and the first inverse document frequency, and the second keyword is determined according to the second word frequency and the second inverse document frequency.
4. The music recommendation method according to claim 2, wherein: The first sentiment trend of the comments associated with the song is obtained as follows: Get the word vectors of the comments associated with the song; Determining the cosine similarity between the word vector and a preset word vector in a preset dictionary database; The first emotional tendency is determined according to the cosine similarity.
5. The music recommendation method according to claim 2, wherein: The step of determining the second score according to the matching result between the first keyword and the second keyword includes: Determining a first synonym set corresponding to the first keyword and a second synonym set corresponding to the second keyword; determining a word repetition rate between the first synonym set and the second synonym set; The second score is determined based on the word repetition rate.
6. The music recommendation method according to claim 1, wherein: The step of determining a social information matching score between the song and the comment based on the social information associated with the song and the first keyword includes: determining a social keyword set based on the social information; The social information matching score is determined according to a repetition rate between the first keyword and the social keyword set.
7. A music recommendation system, characterized in that: The music recommendation system includes: The acquisition module is used to obtain the user's emotional state; Determine a semantic similarity score between the comment and the at least one comment reply associated with the comment based on a first sentiment trend and a first keyword corresponding to a comment associated with the song, and a second sentiment trend and a second keyword corresponding to at least one comment reply associated with the comment; determine a social information matching score between the song and the comment based on social information associated with the song and the first keyword, the social information including at least one of a singer's name, a song's title, lyrics, and a relationship between singers; determine the credibility of the comment based on the semantic similarity score and the social information matching score; and determine a credible comment in the song based on the credibility of the comment; a matching module for determining, based on the emotional trends of the songs, recommended songs that match the emotional state; wherein the emotional trends of the songs are determined based on credible comments on the songs, the credible comments including at least one comment reply, and the emotional trends of the credible comments and the emotional trends of the at least one comment reply having a matching degree greater than a preset threshold; A recommendation module is used to send the recommended songs to the user.
8. An electronic device, characterized in that: The electronic device includes: a memory, a processor, and a music recommendation program stored in the memory and executable on the processor. When the music recommendation program is executed by the processor, the steps of the music recommendation method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a music recommendation program, and when the music recommendation program is executed by a processor, the steps of the music recommendation method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Music recommending method and system
CN106202073A