The Design of Knowledge-Based Sentiment Analysis to Detect Depression Based on Youths' Song Listening Behaviour: A Preliminary Study

Depression has become one of the significant social issues that have arisen in society. According to the World Health Organization (WHO), depression is now a common mental disorder affecting 264 million people worldwide. Depression can cause disability around the world and contributes significantly to the global burden of disease. There are several ways to treat depression, and most of them are related emotionally. Music therapy has been widely encouraged as an effective treatment for depression and anxiety. This is because music has always been a way to attach sentimentally to human feelings. Many studies have been carried out to show how songs can help treat depression, but there are no clear studies that show how songs can indicate or detect depression. This study aims to analyse the sentiments of songs users listen to and monitor their mood for fourteen days consecutively to detect depressive mood using a knowledge-based depression detector. An inspirational message to calm the user will be displayed if depression is detected to avoid a severe level. The design and implementation of the software are tested by two academic staff and is found to be correctly developed, and the functionalities are as intended in the specifications and design.


Introduction
According to the World Health Organization (WHO), depression is now a common mental disorder affecting 264 million people worldwide (WHO, 2020). Depression is one of the leading causes of illness and disability among adolescents, and suicide is the third leading cause of death in people aged 15-19 years (WHO, 2020). This scenario can cause disability around the world and contributes significantly to the global burden of disease. Some known causes of depression among adolescents are social changes such as peer pressure, family crisis, living in a violent household, being bullied, or having a chronic disease. In addition, the lack of a support system can lead to a high risk of depression (Cheah, 2019). A study by (Shahril et al., 2019) indicated that the prevalence of mild, moderate, and severe depression among adolescents is 16.6%, 12.8%, and 3.8%, with females having 32% more risk of having more severe depression than males.
Depression is becoming a major social issue that is often overlooked by society. This scenario of neglecting the problem makes it severe where the number of suicides has increased. Depression is referred to as sadness for a week or months (Telloian, 2020). Depression is not an occasional feeling, but the person might feel it from time to time (Scully, 2019). The level of depression can be calculated according to the period they experience the symptoms of sadness. This was supported by (Telloian, 2020), where he mentioned the severity could be detected by experiencing the symptoms every day for at least two weeks. This shows that time plays a vital role in detecting depression.
Depression can sometimes be difficult to spot. However, some common emotional, physical, or behavioural changes indicate the signs of depression, such as having trouble concentrating, having sleeping problems, eating too little or too much, or feeling sad, tearful, moody, or worthless. There are many ways for youths with depression to seek help, such as school counsellors, psychologists, or doctors. Prevention and early treatment of mental issues are essential for youth to achieve their full potential. As the generation that is increasingly familiar with technology, some youths prefer to seek therapy online as they would not involve parents or family members for their mental health problems. Since technological development has made humans build close relationships with their smartphones, developing an application to detect depressive moods can be one of the ways to lessen depression. A few software or applications have been developed to manage depression, for example, a chatbot that allows chat back and forth with an intelligent assistant to make users understand their emotional well-being called Youper (http://www.youper.ai). Sanvello (http://www.sanvello.com) is a mindfulness application that can help identify users' feelings and provides helpful techniques such as visualisation, mindfulness meditation and muscle relaxation. TalkLife (http://www.talklife.com), BetterHelp (http://www.betterhelp.com), and ReGain (http://www.regain.us) are some of the popular software that offers online community support through group therapy.
There are several ways to treat depression where most of them are related to emotion. Music therapy is widely encouraged as it is known as an effective treatment for depression and anxiety. This is because music has always been a way to attach sentimentally to human feelings. Reachout.com (2021) stated that music released dopamine in the brain, with dopamine levels increasing up to 9% higher when volunteers listened to music they enjoyed. Another study by (Leubner and Thilo, 2017) has shown that music is a potential treatment option to improve depression symptoms and quality of life.
The studies mentioned above have shown how songs or music can help treat depression; nonetheless, there are no clear studies to show how songs can detect or identify someone in a depressive mood. Thus, this study aims to analyse the sentiment of songs to determine the daily mood of the users and detect potential depression based on their song listening behaviour using a depression detector application. Furthermore, a motivational message will be displayed if a depressive mood is detected. It is hoped the motivational message can make the users feel less alone and misunderstood and lift their mood to manage their mental health better.

Related Works
Depression is a feeling of sadness or loss of interest in activities you once enjoyed for a specific duration, usually lasting for a week or months (Telloian, 2020). Depression is not an occasional feeling, but the person might feel it from time to time (Scully, 2019). Therefore, the level of depression can be calculated according to the period they experience the symptoms of sadness. This was supported by (Telloian, 2020), where he mentioned the severity could be detected by experiencing the symptoms every day for at least two weeks. This shows that the time plays a vital role in detecting the depression level.
There are several ways to treat depression where most of them are related emotionally. Music therapy is widely encouraged as it is known as an effective treatment for depression and anxiety. This is because music has always been a way to attach sentimentally to human feelings. According to (Yang and Liu, 2013), music is considered to be communicative, expressive and social functions and is mainly used to regulate mood daily. This emotional regulation can be negative, positive or boredom mood management. Music is known to be a second tool to regulate mood apart from sharing one's situation with friends (Goethem and Sloboda, 2011). Users' music listening behaviour has also changed over the introduction of technologies such as smartphones, MP3 players and related applications (Fabio et al., 2019). The authors (Fabio et al., 2019) further mentioned that digitisation has allowed more interactivity without constraints and allow them to get greater control over their music experience.
Furthermore, the above scenario has proved that music listening through mobile helps them to get connected emotionally. A few studies (Carlson et al., 2015;Tang et al., 2020) have used music therapy to treat mood disorders. Tang et al. (2020) exhibited that music-based intervention reduces depression among people aged 50 to 65 with severe mental disease and depression. The study used receptive music therapy, which includes music-assisted relation, guided imagery and music, and lyrics analysis yielded a superior effect on reducing depression. Carlson et al (2015) used music listening strategies concerning mental health. The study found that males used music to express negative emotions while females used music to divert from negative emotions. The results suggest that the use of music to express negative feelings can be associated with maladaptive patterns of emotional regulation and may even have long-term adverse effects on mental health. Another study by (Papinczak et al., 2015) conducted a study to identify the relationships between adolescents' use of music and well-being. A sample of 107 adolescents revealed that music listening was significantly related to relation-building, modifying emotions, modifying cognitions and emotional immersion.
Some people listen to sad music to allow them to vent their own negative emotions. Emotions that are regarded as negative are usually associated with unpleasantness (Colombetti, 2005). Authors (Garrido and Schubert, 2011) carried out a qualitative study by face-to-face interview (Sobh and Perry, 2006) to know why people listen to music that evokes negative emotions. This study indicates that people willingly seek sad music, which can make them cry when they do not want to cry in real life. The reason was proposed earlier by (Schubert, 1996) that listening to songs that evoke negative emotions are associated with some displeasure or traumatic events which separated them from reality. This type of people temporarily set reality aside to associate with imagination (Eissen and Lynn, 2001). This shows that negative emotions lead to listening to songs related to them and eventually creates imaginary reality. On the other hand, the author in (Bartel, 2013) researched to know people's music listening behaviour which showed that the most common reason to listen to music is to deal with a difficult time. The author also indicated that difficult times are often associated with depressive music.
The author in (Cano, 2018) used sentiment analysis to identify and categorise emotions through text from songs. His definition shows that emotions can be analysed from lyrics which is a form of text. The author used a corpus-based approach that utilised mood annotated lyrics for training models using deep learning. The terms in the songs are categorised into four types of emotions: happy, angry, sad, and relaxed. The examples of words in each category are bright, joyous, and cheerful for happy; fiery, tense, and rebellious for angry; bitter, depressing, and gloomy for sad; and tender, soft, and quiet for relaxed. A study by (Jamdar et al., 2015) also highlighted that words in a song could better express a person's emotions. Musical aspects not only play a vital role, yet they also support the lyrical theme. This shows that the lyrics of a song can be data to analyse a person's positive or negative mood.
The studies above have shown how songs can help reduce depression; however, to the best of our knowledge, there are no studies that identify depressive mood through users' song listening behaviour. Thus, this study aims to design a knowledge-based sentiment analyser that analyses the sentiment of songs, detects users' depressive moods based on their daily song listening behaviour, and provides motivational messages to lift users' mood and move ahead in daily lives.

Methodology
This study performed an initial survey with twenty bachelor students from the Faculty of Computer Science and Information Technology, Universiti Putra Malaysia (UPM), to know if music is correlated with an individual's positive or negative sentiment. Based on a simple survey related to music listening, the following responses are obtained, as shown in Table 1. Apart from the existing studies, the responses below strongly support that music affects emotional behaviour and mood. Listening to sad and emotional songs when feeling sad 14 Our work focuses on the functionalities where users can use the knowledge-based software to identify their mood as positive or negative and detect possible depression based on their song listening behaviour for two weeks. The sentiment analyser monitors the users' everyday song listening behaviour and analyses the lyrics to identify the songs' sentiment. Following the user-oriented approach, we design the software based on the functionalities as depicted in Figure 1.

Figure 1: Use case diagram of the Depression Detector System
The knowledge-based software or depression detector monitors the users' everyday song listening behaviour and analyses the lyrics to know their sentiment. The software provides a list of songs for the users to listen to, and it will store all songs the user listens to every day. The software also contains a sentiment analyser to analyse the lyrics of songs, indicating whether they are positive or negative. The depression detector will monitor the users' song listening behaviour for two weeks consecutively before concluding that the user is in a depressive mood. The time frame of depression detection is based on the calculation of having negative feelings for a long time, which was supported by (Telloian, 2020). He mentioned that severity could be detected by experiencing negative emotions every day for at least two weeks.
We performed data pre-processing using the Natural Language Toolkit (NLTK) libraries in Python for cleaning and removal of stop words which may be unnecessary for sentiment analysis. All duplicated and unwanted attributes such as extra spaces or symbols are removed in the data cleaning phase. To analyse the sentiment of the songs' lyrics, we applied a Python library known as VADER (Valence Aware Dictionary and sEntiment Reasoner) into the sentiment analyser. VADER, a fully open-sourced under the MIT license, is a lexicon and rulebased sentiment analysis tool specifically attuned to sentiments expressed in social media and works well on texts from other domains (Hutto and Gilbert, 2014). In addition, Google Firebase is used for data storage, and it also provides a simplified and secured registration facility through its Firebase Authentication. The songs with their lyrics and motivational messages are stored using JSON format in Firebase.
In this preliminary study, we selected songs randomly from kaggle.com dataset for the user to listen to. The lyrics of the songs are stored in the Firebase storage to be used to detect the listener's mood every day. The mood calculation will be automatically done at midnight daily to identify the absolute sentiment of the user's mood, either as positive or negative. To conclude the user's mood as being depressive, the negative sentiments are recorded for 14 days continuously. In between the 14 days, if there is a day with a positive sentiment, the total days will be reset to 0, and the process of counting days starts again. Thus, if the total number of days of being in a negative mood is 14 days consecutively, the software detects the user as being in a depressive mood. As a consequence of the result, motivational messages are automatically generated and sent to the user every morning. The purpose of motivational messages is to lift users' moods and motivate them to move ahead in their daily activities.

Results and Discussion
In this section, the design of the software is further elaborated, and the results from the implementation are discussed. Figure 2 below shows the overview of the system flow. Firstly, the user has to create an account to subscribe to the application. Once the process is done, the software provides a list of songs for the user to listen to. Every time a new song is selected from the list, the sentiment analyser will analyse the song's lyrics and indicate the song's sentiment. The song and its sentiment are kept in a database, and a counter is given to track the number of positive or negative sentiments of the songs. Then, the software will count the number of songs with respect to their sentiments and identify the dominant sentiment to know the user's daily mood. The system will continue to analyse users' song listening behaviour for 14 days consecutively to detect depression. If a depressive mood is detected, the system will prompt some motivating messages to the user. The software will continue providing inspirational messages for a week to calm down the level of depression. If a depressive mood is not detected, the system will continue to monitor the users' song listening behaviour and the cycle repeats. Figure 2: An activity diagram that shows the overview of the software operation.
As mentioned earlier, for all songs listened to in a day, each song will be analysed for its sentiment, and the result will be kept in a database. Figure 3 below shows the activities for analysing daily mood. The user clicks on any song, and the software will fetch the song from the database. The lyrics of the songs will be analysed for their sentiment, and the system will note if the sentiment is positive or negative. This process will repeat for every new song the user listens to. A system scheduler will be automatically triggered at midnight daily to calculate the final user's mood for the day. If the total negative sentiments are more than total positive sentiments, the user's mood for the day is stated as negative, and it will be saved in the database. The software will keep monitoring users' song listening behaviour for 14 days in consequence. If the users' mood is negative for 14 consequence days, the software detects depression and motivational messages are generated automatically to be displayed on users' screen; otherwise, the system will keep monitoring users listening behaviour. The motivational messages will be prompted daily for a week, and the system will continue the process of monitoring. If there is a day or more in the period of 14 days that the users have a positive mood, the count of days will be reset to 0, and the system will continue monitoring. Figure 4 below shows the process of detecting depression. Once depression is detected, the system will start displaying motivational messages for the next seven days. The messages are retrieved randomly from the database. The figure below shows the process of retrieving the messages. The software will keep monitoring the user's music listening behaviour and identifying his daily sentiment. Thus, the process of detecting depression will be repeated, as shown in figures 4 and 5. Figure 6 below shows the interface of the software.
(a) (b) (c) (d) Figure 6: (a) List of songs; (b) Song player page with play, stop, rewind and back wind features; (c) Notification panel will appear if a user is found to be in a negative mood for 14 days consecutively; and (d) Motivational message appears when user clicks on the notification in (c) Some tests were conducted during the initial cycle, with the main testing conducted at the end of the prototype cycle. In addition, the software went through unit testing that aimed to test every available function in the software. As a result, the software performed all the intended functions and displayed error messages when any unexpected input was entered.
In the final phase of the development, all the functionalities built-in previous prototypes were integrated and tested to ensure the integration was completed. In addition, the software was connected to the local database and tested to ensure that all data from the database were accurate. Upon completion of the software integration and testing, the software is tested by two academic staff. The list of test cases in Table 2 shows the features to be tested with their estimated risk level. The risk level indicates the importance of the features and must ensure that they are free of errors and function as intended. Each academic staff is allowed to use the software following the flow of events listed in the use case description. For brevity, a sample of the use case description (out of six use cases) from the function ID F003 is depicted in Table 3.  Table 3: A sample of use case description for function ID F003 Analyse the mood for the whole day (UC3) 1.UC-3 2. Objective-To analyse the mood of the user on the day 3. Priority-High 4. Source-System 5. Actor-Depression Analyser 6. Flow of events 6.1 Basic flow 6.1.1 The software fetches out the sentiment of the song the database 6.1.2 The software keeps count of the sentiment 6.1.3 The software triggers the calculation of mood at 12 am 6.1.4 The software calculates the average sentiment 6.1.5 The software detects the sentiment of mood. 6.1.6 The software finalises the mood of the user 7. Includes -None 8. Preconditions-The user clicks the song 9. Postconditions-The system finalise the mood of the user 10. Noted/Issues-None At the end of the testing phase, both academic staffs agreed that the software was correctly developed and the functionalities were as intended in the specifications and design. This shows that the software can perform sentiment analysis for every song the user listens to and monitor the user's song listening behaviour for fourteen days to detect any depressive mood.

Conclusion
Depression has been one of the most common health issues in youths, and it is more likely to persist into adulthood if left untreated. Depression is a real condition that can interfere with daily life, such as feeling hopeless, lack of energy, lack of interest in activities that once excited the youth, difficulty to sleep, and many more, which eventually may lead to suicidal thoughts and behaviour.
There have been studies that used songs to help treat depression; however, to the best of our knowledge, there are no studies that can detect depressive mood through users' song listening behaviour. The design and development of our work can be a minor effort to help users identify their mental health early to seek help if necessary. Some adolescents have not realised that they are experiencing mental health problems; thus, the software may encourage them to seek early treatment. Furthermore, the system demonstrates that it can identify users' daily sentiment and monitor users' song listening behaviour for 14 days consecutively before concluding users' mood as depressive.
There are several suggestions for future improvement. Firstly, the software can be tested with a significant number of songs stored in subscribed cloud data. Second, the software should also be tested with real users having a mental health condition, certified psychologists or therapists to validate the correctness of depression detection. Thirdly, this work can be integrated with the medical domain to produce a comprehensive system that helps to reduce mental health problems among youths. Finally, this work can be improved by adding virtual assistance or a virtual psychologist to help youths with their depression issues.