├── .gitignore
├── .idea
├── .gitignore
├── MinorPrject.iml
├── inspectionProfiles
│ ├── Project_Default.xml
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
└── vcs.xml
├── README.md
├── app.py
├── db.sqlite3
├── static
├── headphone.jpeg
└── styles.css
├── templates
└── index.html
└── textEmotion.py
/.gitignore:
--------------------------------------------------------------------------------
1 | # Project exclude paths
2 | /venv/
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/.idea/MinorPrject.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | **Steps of Run this project in your system:**
2 |
3 |
4 | 1. Download PyCharm from- https://www.jetbrains.com/pycharm/download/#section=windows
5 | 2. Download this project and open it in PyCharm.
6 | 3. Open terminal of PyCharm and install below libraries.
7 | i. pip install flask
8 | ii. pip install chatterbot
9 | iii. pip install textblob
10 | iv. pip install nltk
11 | 4. Open app.py Run this project.
12 | 5. You may face these type problems during run project:-
13 |
14 | problem 1) - AttributeError : module 'time' has no attribute 'clock'
15 |
16 | 
17 |
18 | solution :
19 | Click on last link in terminal. You will get a new open file with name compat.py.
20 | New open file -
21 | 
22 |
23 | Change the statement - "time_func = time.clock" to "time_func = time.process_time() "
24 | according to below image-
25 |
26 | 
27 |
28 |
29 | Run it again .You may get next problem -
30 |
31 | problem 2) - AttributeError : module 'collections' has no attribute 'Hashtable'
32 |
33 |
34 | 
35 |
36 | solution :
37 | Click on last link in terminal. You will get a new open file with name constructor.py .
38 | New open file -
39 |
40 | 
41 |
42 | Change the statement - "if not isinstance(key, collections.Hashable):" to "if not isinstance(key, collections.abc.Hashable):"
43 |
44 | 
45 |
46 |
47 | Run it again.
48 | click below last link :
49 |
50 |
51 | 
52 |
53 |
54 | After click this link you wil get a web page in browser.-
55 |
56 | 
57 |
58 |
59 | Now your project is ready.
60 | Thank You !
61 |
--------------------------------------------------------------------------------
/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask, render_template, request
2 | from chatterbot import ChatBot
3 | from chatterbot.trainers import ChatterBotCorpusTrainer
4 | from textblob import TextBlob
5 | import webbrowser
6 | count = 0
7 |
8 | app = Flask(__name__)
9 |
10 | english_bot = ChatBot("ChatterBot", storage_adaptor="chatterbot.storage.SQLStorageAdaptor")
11 | trainer = ChatterBotCorpusTrainer(english_bot)
12 |
13 | trainer.train("chatterbot.corpus.english")
14 |
15 |
16 | @app.route("/")
17 | def home():
18 | return render_template("index.html")
19 |
20 |
21 | @app.route("/get")
22 | def get_bot_response():
23 | global count
24 | userText = request.args.get('msg')
25 | obj = TextBlob(userText)
26 | sentiment, subjectivity = obj.sentiment
27 | print(obj.sentiment)
28 | if sentiment > 0:
29 | count = count + 1
30 | elif sentiment < 0:
31 | count = count - 1
32 | else:
33 | count = count + 0
34 | print("count", count)
35 |
36 | return str(english_bot.get_response(userText))
37 |
38 |
39 | @app.route("/forward/", methods=['POST'])
40 | def get_song_playlist():
41 | global count
42 | if count > 0:
43 | webbrowser.open_new("https://wynk.in/music/playlist/desi-hip-hop-hits/bb_1491457072469?q=hip+hop")
44 | elif count < 0:
45 | webbrowser.open_new("https://wynk.in/music/playlist/arijit-all-the-way/QVVESU9fQXJpaml0IFNpbmdoIC0gQWxsIFRoZSBXYXlfMjAxNF9zcmNoX2JzYl9oaQ?q=+")
46 | else:
47 | webbrowser.open_new("https://wynk.in/music/playlist/motivational-tunes-hindi/bb_1588754763579?q=motivation")
48 |
49 |
50 | if __name__ == '__main__':
51 | app.run()
52 |
--------------------------------------------------------------------------------
/db.sqlite3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yogsgehlot/Chatbot-Song-Recommender-System/6e30337da873f2b8dd0cee6c466fadc7b34854cf/db.sqlite3
--------------------------------------------------------------------------------
/static/headphone.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yogsgehlot/Chatbot-Song-Recommender-System/6e30337da873f2b8dd0cee6c466fadc7b34854cf/static/headphone.jpeg
--------------------------------------------------------------------------------
/static/styles.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-image: url(headphone.jpeg); /* The image used */
3 | background-color: #cccccc; /* Used if the image is unavailable */
4 | height: 500px; /* You must set a specified height */
5 | background-position: center; /* Center the image */
6 | background-repeat: repeat; /* Do not repeat the image */
7 | background-size: cover; /* Resize the background image to cover the entire container */
8 | font-family: 'Indie Flower', cursive;
9 | }
10 |
11 | h1 {
12 | color: black;
13 | margin-bottom: 0;
14 | margin-top: 0;
15 | text-align: center;
16 | font-size: 40px;
17 | }
18 |
19 | h3 {
20 | color: black;
21 | font-size: 20px;
22 | margin-top: 3px;
23 | text-align: center;
24 | }
25 |
26 | #chatbox {
27 | margin-left: auto;
28 | margin-right: auto;
29 | width: 40%;
30 | margin-top: 60px;
31 | }
32 |
33 | #userInput {
34 | margin-left: auto;
35 | margin-right: auto;
36 | width: 40%;
37 | margin-top: 60px;
38 | }
39 |
40 | #textInput {
41 | width: 87%;
42 | border: none;
43 | border-radius: 5px;
44 | border-bottom: 3px solid #009688;
45 | font-family: 'Indie Flower', cursive;
46 | font-size: 17px;
47 | padding: 2px;
48 | background-color:rgb(48 45 45);
49 | color:white;
50 |
51 |
52 | }
53 |
54 | #getson {
55 | margin:15px;
56 | border-radius: 18px;
57 | font-size: 17px;
58 | }
59 | #getson{
60 | transition-duration:0.5s;
61 | }
62 | #getson:hover{
63 | background-color:rgb(9, 162, 244);
64 | color:black;
65 | }
66 | #buttonInput {
67 | padding: 3px;
68 | font-family: 'Indie Flower', cursive;
69 | border-radius: 10px;
70 | font-size: 16px;
71 | }
72 | #buttonInput{
73 | transition-duration:0.5s;
74 | }
75 | #buttonInput:hover{
76 | background-color:rgb(9, 162, 244);
77 | color:black;
78 | }
79 |
80 | #userText {
81 | color: white;
82 | font-family: 'Indie Flower', cursive;
83 | font-size: 17px;
84 | text-align: right;
85 | line-height: 30px;
86 | display:block;
87 | }
88 |
89 | .userText span {
90 | background-color: #009688;
91 | padding: 10px;
92 | border-radius: 2px;
93 | margin-left:355px;
94 | display:block;
95 | border-radius:15px;
96 | }
97 |
98 | .botText {
99 | color: white;
100 | font-family: 'Indie Flower', cursive;
101 | font-size: 17px;
102 | text-align: left;
103 | line-height: 30px;
104 | }
105 |
106 | .botText span {
107 | background-color: #EF5350;
108 | padding: 10px;
109 | border-radius: 15px;
110 |
111 |
112 | }
113 |
114 | #tidbit {
115 | position: absolute;
116 | bottom: 0;
117 | right: 0;
118 | width: 300px;
119 | }
--------------------------------------------------------------------------------
/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
Hi! I'm Chatterbot.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/textEmotion.py:
--------------------------------------------------------------------------------
1 | import nltk
2 | from textblob import TextBlob
3 | checked = True
4 | while checked:
5 | text = request.args.get('msg')
6 | obj = TextBlob(text)
7 | sentiment, subjectivity = obj.sentiment
8 | print(obj.sentiment)
9 | if sentiment > 0:
10 | count = count+1
11 | elif sentiment < 0:
12 | count = count-1
13 | else:
14 | count = count+0
15 |
16 |
--------------------------------------------------------------------------------