|
a |
|
b/.ipynb_checkpoints/Vanisri-Trial-checkpoint.ipynb |
|
|
1 |
{ |
|
|
2 |
"cells": [ |
|
|
3 |
{ |
|
|
4 |
"cell_type": "code", |
|
|
5 |
"execution_count": 6, |
|
|
6 |
"metadata": { |
|
|
7 |
"scrolled": true |
|
|
8 |
}, |
|
|
9 |
"outputs": [ |
|
|
10 |
{ |
|
|
11 |
"name": "stdout", |
|
|
12 |
"output_type": "stream", |
|
|
13 |
"text": [ |
|
|
14 |
"Requirement already satisfied: Flask==0.12.3 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from -r requirements.txt (line 4)) (0.12.3)\n", |
|
|
15 |
"Collecting chatterbot==0.8.4\n", |
|
|
16 |
" Using cached ChatterBot-0.8.4-py2.py3-none-any.whl (72 kB)\n", |
|
|
17 |
"Requirement already satisfied: SQLAlchemy==1.2 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from -r requirements.txt (line 6)) (1.2.0)\n", |
|
|
18 |
"Requirement already satisfied: Werkzeug>=0.7 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from Flask==0.12.3->-r requirements.txt (line 4)) (1.0.0)\n", |
|
|
19 |
"Requirement already satisfied: itsdangerous>=0.21 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from Flask==0.12.3->-r requirements.txt (line 4)) (1.1.0)\n", |
|
|
20 |
"Requirement already satisfied: click>=2.0 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from Flask==0.12.3->-r requirements.txt (line 4)) (7.0)\n", |
|
|
21 |
"Requirement already satisfied: Jinja2>=2.4 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from Flask==0.12.3->-r requirements.txt (line 4)) (2.11.1)\n", |
|
|
22 |
"Collecting chatterbot-corpus<1.2,>=1.1\n", |
|
|
23 |
" Using cached chatterbot_corpus-1.1.4-py2.py3-none-any.whl (117 kB)\n", |
|
|
24 |
"Requirement already satisfied: python-twitter<4.0,>=3.0 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from chatterbot==0.8.4->-r requirements.txt (line 5)) (3.5)\n", |
|
|
25 |
"Requirement already satisfied: mathparse<0.2,>=0.1 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from chatterbot==0.8.4->-r requirements.txt (line 5)) (0.1.2)\n", |
|
|
26 |
"Requirement already satisfied: python-dateutil<2.7,>=2.6 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from chatterbot==0.8.4->-r requirements.txt (line 5)) (2.6.1)\n", |
|
|
27 |
"Requirement already satisfied: pymongo<4.0,>=3.3 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from chatterbot==0.8.4->-r requirements.txt (line 5)) (3.10.1)\n", |
|
|
28 |
"Requirement already satisfied: nltk<4.0,>=3.2 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from chatterbot==0.8.4->-r requirements.txt (line 5)) (3.4.5)\n", |
|
|
29 |
"Requirement already satisfied: MarkupSafe>=0.23 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from Jinja2>=2.4->Flask==0.12.3->-r requirements.txt (line 4)) (1.1.1)\n", |
|
|
30 |
"Collecting PyYAML<4.0,>=3.12\n", |
|
|
31 |
" Using cached PyYAML-3.13-cp37-cp37m-win_amd64.whl (206 kB)\n", |
|
|
32 |
"Requirement already satisfied: requests-oauthlib in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from python-twitter<4.0,>=3.0->chatterbot==0.8.4->-r requirements.txt (line 5)) (1.3.0)\n", |
|
|
33 |
"Requirement already satisfied: future in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from python-twitter<4.0,>=3.0->chatterbot==0.8.4->-r requirements.txt (line 5)) (0.18.2)\n", |
|
|
34 |
"Requirement already satisfied: requests in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from python-twitter<4.0,>=3.0->chatterbot==0.8.4->-r requirements.txt (line 5)) (2.22.0)\n", |
|
|
35 |
"Requirement already satisfied: six>=1.5 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from python-dateutil<2.7,>=2.6->chatterbot==0.8.4->-r requirements.txt (line 5)) (1.14.0)\n", |
|
|
36 |
"Requirement already satisfied: oauthlib>=3.0.0 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests-oauthlib->python-twitter<4.0,>=3.0->chatterbot==0.8.4->-r requirements.txt (line 5)) (3.1.0)\n", |
|
|
37 |
"Requirement already satisfied: idna<2.9,>=2.5 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests->python-twitter<4.0,>=3.0->chatterbot==0.8.4->-r requirements.txt (line 5)) (2.8)\n", |
|
|
38 |
"Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests->python-twitter<4.0,>=3.0->chatterbot==0.8.4->-r requirements.txt (line 5)) (1.25.8)\n", |
|
|
39 |
"Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests->python-twitter<4.0,>=3.0->chatterbot==0.8.4->-r requirements.txt (line 5)) (3.0.4)\n", |
|
|
40 |
"Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests->python-twitter<4.0,>=3.0->chatterbot==0.8.4->-r requirements.txt (line 5)) (2019.11.28)\n", |
|
|
41 |
"Installing collected packages: PyYAML, chatterbot-corpus, chatterbot\n", |
|
|
42 |
" Attempting uninstall: PyYAML\n", |
|
|
43 |
" Found existing installation: pyyaml 5.3\n" |
|
|
44 |
] |
|
|
45 |
}, |
|
|
46 |
{ |
|
|
47 |
"name": "stderr", |
|
|
48 |
"output_type": "stream", |
|
|
49 |
"text": [ |
|
|
50 |
"ERROR: Cannot uninstall 'pyyaml'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.\n" |
|
|
51 |
] |
|
|
52 |
} |
|
|
53 |
], |
|
|
54 |
"source": [ |
|
|
55 |
"!pip install -r requirements.txt " |
|
|
56 |
] |
|
|
57 |
}, |
|
|
58 |
{ |
|
|
59 |
"cell_type": "code", |
|
|
60 |
"execution_count": 17, |
|
|
61 |
"metadata": {}, |
|
|
62 |
"outputs": [ |
|
|
63 |
{ |
|
|
64 |
"name": "stdout", |
|
|
65 |
"output_type": "stream", |
|
|
66 |
"text": [ |
|
|
67 |
"pip 20.0.2 from C:\\Users\\Vanisri Kirubakaran\\anaconda3-new\\lib\\site-packages\\pip (python 3.7)\n", |
|
|
68 |
"\n" |
|
|
69 |
] |
|
|
70 |
} |
|
|
71 |
], |
|
|
72 |
"source": [ |
|
|
73 |
"!pip --version" |
|
|
74 |
] |
|
|
75 |
}, |
|
|
76 |
{ |
|
|
77 |
"cell_type": "code", |
|
|
78 |
"execution_count": 23, |
|
|
79 |
"metadata": {}, |
|
|
80 |
"outputs": [ |
|
|
81 |
{ |
|
|
82 |
"name": "stdout", |
|
|
83 |
"output_type": "stream", |
|
|
84 |
"text": [ |
|
|
85 |
"Collecting PyYAML==5.3.1\n", |
|
|
86 |
" Using cached PyYAML-5.3.1-cp37-cp37m-win_amd64.whl (216 kB)\n", |
|
|
87 |
"Installing collected packages: PyYAML\n" |
|
|
88 |
] |
|
|
89 |
}, |
|
|
90 |
{ |
|
|
91 |
"name": "stderr", |
|
|
92 |
"output_type": "stream", |
|
|
93 |
"text": [ |
|
|
94 |
"ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'C:\\\\Users\\\\Vanisri Kirubakaran\\\\anaconda3-new\\\\Lib\\\\site-packages\\\\_yaml.cp37-win_amd64.pyd'\n", |
|
|
95 |
"Consider using the `--user` option or check the permissions.\n", |
|
|
96 |
"\n" |
|
|
97 |
] |
|
|
98 |
} |
|
|
99 |
], |
|
|
100 |
"source": [ |
|
|
101 |
"!pip install --ignore-installed PyYAML==5.3.1" |
|
|
102 |
] |
|
|
103 |
}, |
|
|
104 |
{ |
|
|
105 |
"cell_type": "code", |
|
|
106 |
"execution_count": 1, |
|
|
107 |
"metadata": {}, |
|
|
108 |
"outputs": [ |
|
|
109 |
{ |
|
|
110 |
"name": "stdout", |
|
|
111 |
"output_type": "stream", |
|
|
112 |
"text": [ |
|
|
113 |
"Collecting pip==9.0.3\n", |
|
|
114 |
" Downloading pip-9.0.3-py2.py3-none-any.whl (1.4 MB)\n", |
|
|
115 |
"Installing collected packages: pip\n", |
|
|
116 |
" Attempting uninstall: pip\n", |
|
|
117 |
" Found existing installation: pip 20.0.2\n", |
|
|
118 |
" Uninstalling pip-20.0.2:\n", |
|
|
119 |
" Successfully uninstalled pip-20.0.2\n" |
|
|
120 |
] |
|
|
121 |
}, |
|
|
122 |
{ |
|
|
123 |
"name": "stderr", |
|
|
124 |
"output_type": "stream", |
|
|
125 |
"text": [ |
|
|
126 |
"ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'C:\\\\Users\\\\Vanisri Kirubakaran\\\\AppData\\\\Local\\\\Temp\\\\pip-uninstall-j9fdwomc\\\\pip.exe'\n", |
|
|
127 |
"Consider using the `--user` option or check the permissions.\n", |
|
|
128 |
"\n" |
|
|
129 |
] |
|
|
130 |
} |
|
|
131 |
], |
|
|
132 |
"source": [ |
|
|
133 |
"!pip install --upgrade --force-reinstall pip==9.0.3" |
|
|
134 |
] |
|
|
135 |
}, |
|
|
136 |
{ |
|
|
137 |
"cell_type": "code", |
|
|
138 |
"execution_count": 2, |
|
|
139 |
"metadata": {}, |
|
|
140 |
"outputs": [ |
|
|
141 |
{ |
|
|
142 |
"name": "stdout", |
|
|
143 |
"output_type": "stream", |
|
|
144 |
"text": [ |
|
|
145 |
"Requirement already satisfied: Flask==0.12.3 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from -r requirements.txt (line 4))\n", |
|
|
146 |
"Collecting chatterbot==0.8.4 (from -r requirements.txt (line 5))\n", |
|
|
147 |
" Downloading https://files.pythonhosted.org/packages/b6/8d/472f3e9e9f969fbbe455910148739d5fdad86e212573274ab0611d3272f2/ChatterBot-0.8.4-py2.py3-none-any.whl (72kB)\n", |
|
|
148 |
"Requirement already satisfied: SQLAlchemy==1.2 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from -r requirements.txt (line 6))\n", |
|
|
149 |
"Requirement already satisfied: itsdangerous>=0.21 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from Flask==0.12.3->-r requirements.txt (line 4))\n", |
|
|
150 |
"Requirement already satisfied: Jinja2>=2.4 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from Flask==0.12.3->-r requirements.txt (line 4))\n", |
|
|
151 |
"Requirement already satisfied: click>=2.0 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from Flask==0.12.3->-r requirements.txt (line 4))\n", |
|
|
152 |
"Requirement already satisfied: Werkzeug>=0.7 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from Flask==0.12.3->-r requirements.txt (line 4))\n", |
|
|
153 |
"Collecting chatterbot-corpus<1.2,>=1.1 (from chatterbot==0.8.4->-r requirements.txt (line 5))\n", |
|
|
154 |
" Downloading https://files.pythonhosted.org/packages/75/76/98639175fe64eaa3cb6903004d737a62cb6eab1f3f34020ca11fb3250214/chatterbot_corpus-1.1.4-py2.py3-none-any.whl (117kB)\n", |
|
|
155 |
"Requirement already satisfied: pymongo<4.0,>=3.3 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from chatterbot==0.8.4->-r requirements.txt (line 5))\n", |
|
|
156 |
"Requirement already satisfied: mathparse<0.2,>=0.1 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from chatterbot==0.8.4->-r requirements.txt (line 5))\n", |
|
|
157 |
"Requirement already satisfied: python-twitter<4.0,>=3.0 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from chatterbot==0.8.4->-r requirements.txt (line 5))\n", |
|
|
158 |
"Requirement already satisfied: python-dateutil<2.7,>=2.6 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from chatterbot==0.8.4->-r requirements.txt (line 5))\n", |
|
|
159 |
"Requirement already satisfied: nltk<4.0,>=3.2 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from chatterbot==0.8.4->-r requirements.txt (line 5))\n", |
|
|
160 |
"Requirement already satisfied: MarkupSafe>=0.23 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from Jinja2>=2.4->Flask==0.12.3->-r requirements.txt (line 4))\n", |
|
|
161 |
"Collecting PyYAML<4.0,>=3.12 (from chatterbot-corpus<1.2,>=1.1->chatterbot==0.8.4->-r requirements.txt (line 5))\n", |
|
|
162 |
" Downloading https://files.pythonhosted.org/packages/bf/96/d02ef8e1f3073e07ffdc240444e5041f403f29c0775f9f1653f18221082f/PyYAML-3.13-cp37-cp37m-win_amd64.whl (206kB)\n", |
|
|
163 |
"Requirement already satisfied: future in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from python-twitter<4.0,>=3.0->chatterbot==0.8.4->-r requirements.txt (line 5))\n", |
|
|
164 |
"Requirement already satisfied: requests-oauthlib in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from python-twitter<4.0,>=3.0->chatterbot==0.8.4->-r requirements.txt (line 5))\n", |
|
|
165 |
"Requirement already satisfied: requests in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from python-twitter<4.0,>=3.0->chatterbot==0.8.4->-r requirements.txt (line 5))\n", |
|
|
166 |
"Requirement already satisfied: six>=1.5 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from python-dateutil<2.7,>=2.6->chatterbot==0.8.4->-r requirements.txt (line 5))\n", |
|
|
167 |
"Requirement already satisfied: oauthlib>=3.0.0 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests-oauthlib->python-twitter<4.0,>=3.0->chatterbot==0.8.4->-r requirements.txt (line 5))\n", |
|
|
168 |
"Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests->python-twitter<4.0,>=3.0->chatterbot==0.8.4->-r requirements.txt (line 5))\n", |
|
|
169 |
"Requirement already satisfied: idna<2.9,>=2.5 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests->python-twitter<4.0,>=3.0->chatterbot==0.8.4->-r requirements.txt (line 5))\n", |
|
|
170 |
"Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests->python-twitter<4.0,>=3.0->chatterbot==0.8.4->-r requirements.txt (line 5))\n", |
|
|
171 |
"Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests->python-twitter<4.0,>=3.0->chatterbot==0.8.4->-r requirements.txt (line 5))\n", |
|
|
172 |
"Installing collected packages: PyYAML, chatterbot-corpus, chatterbot\n", |
|
|
173 |
" Found existing installation: PyYAML 5.3\n", |
|
|
174 |
" Uninstalling PyYAML-5.3:\n", |
|
|
175 |
" Successfully uninstalled PyYAML-5.3\n", |
|
|
176 |
" Rolling back uninstall of PyYAML\n" |
|
|
177 |
] |
|
|
178 |
}, |
|
|
179 |
{ |
|
|
180 |
"name": "stderr", |
|
|
181 |
"output_type": "stream", |
|
|
182 |
"text": [ |
|
|
183 |
" Cache entry deserialization failed, entry ignored\n", |
|
|
184 |
" Cache entry deserialization failed, entry ignored\n", |
|
|
185 |
" Cache entry deserialization failed, entry ignored\n", |
|
|
186 |
" Cache entry deserialization failed, entry ignored\n", |
|
|
187 |
" Cache entry deserialization failed, entry ignored\n", |
|
|
188 |
" Cache entry deserialization failed, entry ignored\n", |
|
|
189 |
" DEPRECATION: Uninstalling a distutils installed project (PyYAML) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.\n", |
|
|
190 |
"Exception:\n", |
|
|
191 |
"Traceback (most recent call last):\n", |
|
|
192 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\basecommand.py\", line 215, in main\n", |
|
|
193 |
" status = self.run(options, args)\n", |
|
|
194 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\commands\\install.py\", line 342, in run\n", |
|
|
195 |
" prefix=options.prefix_path,\n", |
|
|
196 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\req\\req_set.py\", line 784, in install\n", |
|
|
197 |
" **kwargs\n", |
|
|
198 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\req\\req_install.py\", line 851, in install\n", |
|
|
199 |
" self.move_wheel_files(self.source_dir, root=root, prefix=prefix)\n", |
|
|
200 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\req\\req_install.py\", line 1064, in move_wheel_files\n", |
|
|
201 |
" isolated=self.isolated,\n", |
|
|
202 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\wheel.py\", line 345, in move_wheel_files\n", |
|
|
203 |
" clobber(source, lib_dir, True)\n", |
|
|
204 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\wheel.py\", line 323, in clobber\n", |
|
|
205 |
" shutil.copyfile(srcfile, destfile)\n", |
|
|
206 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\shutil.py\", line 121, in copyfile\n", |
|
|
207 |
" with open(dst, 'wb') as fdst:\n", |
|
|
208 |
"PermissionError: [Errno 13] Permission denied: 'c:\\\\users\\\\vanisri kirubakaran\\\\anaconda3-new\\\\Lib\\\\site-packages\\\\_yaml.cp37-win_amd64.pyd'\n" |
|
|
209 |
] |
|
|
210 |
} |
|
|
211 |
], |
|
|
212 |
"source": [ |
|
|
213 |
"!pip install -r requirements.txt --disable-pip-version-check" |
|
|
214 |
] |
|
|
215 |
}, |
|
|
216 |
{ |
|
|
217 |
"cell_type": "code", |
|
|
218 |
"execution_count": 3, |
|
|
219 |
"metadata": {}, |
|
|
220 |
"outputs": [ |
|
|
221 |
{ |
|
|
222 |
"name": "stdout", |
|
|
223 |
"output_type": "stream", |
|
|
224 |
"text": [ |
|
|
225 |
"Collecting pip\n", |
|
|
226 |
" Downloading https://files.pythonhosted.org/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-py2.py3-none-any.whl (1.5MB)\n", |
|
|
227 |
"Installing collected packages: pip\n", |
|
|
228 |
" Found existing installation: pip 9.0.3\n", |
|
|
229 |
" Uninstalling pip-9.0.3:\n", |
|
|
230 |
" Successfully uninstalled pip-9.0.3\n" |
|
|
231 |
] |
|
|
232 |
}, |
|
|
233 |
{ |
|
|
234 |
"name": "stderr", |
|
|
235 |
"output_type": "stream", |
|
|
236 |
"text": [ |
|
|
237 |
"Cache entry deserialization failed, entry ignored\n", |
|
|
238 |
"Exception:\n", |
|
|
239 |
"Traceback (most recent call last):\n", |
|
|
240 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\shutil.py\", line 398, in _rmtree_unsafe\n", |
|
|
241 |
" os.unlink(fullname)\n", |
|
|
242 |
"PermissionError: [WinError 5] Access is denied: 'C:\\\\Users\\\\Vanisri Kirubakaran\\\\AppData\\\\Local\\\\Temp\\\\pip-8gao_bdp-uninstall\\\\users\\\\vanisri kirubakaran\\\\anaconda3-new\\\\scripts\\\\pip.exe'\n", |
|
|
243 |
"\n", |
|
|
244 |
"During handling of the above exception, another exception occurred:\n", |
|
|
245 |
"\n", |
|
|
246 |
"Traceback (most recent call last):\n", |
|
|
247 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\basecommand.py\", line 215, in main\n", |
|
|
248 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\commands\\install.py\", line 342, in run\n", |
|
|
249 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\req\\req_set.py\", line 795, in install\n", |
|
|
250 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\req\\req_install.py\", line 767, in commit_uninstall\n", |
|
|
251 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\req\\req_uninstall.py\", line 142, in commit\n", |
|
|
252 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\_vendor\\retrying.py\", line 49, in wrapped_f\n", |
|
|
253 |
" return Retrying(*dargs, **dkw).call(f, *args, **kw)\n", |
|
|
254 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\_vendor\\retrying.py\", line 212, in call\n", |
|
|
255 |
" raise attempt.get()\n", |
|
|
256 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\_vendor\\retrying.py\", line 247, in get\n", |
|
|
257 |
" six.reraise(self.value[0], self.value[1], self.value[2])\n", |
|
|
258 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\_vendor\\six.py\", line 686, in reraise\n", |
|
|
259 |
" def assertRegex(self, *args, **kwargs):\n", |
|
|
260 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\_vendor\\retrying.py\", line 200, in call\n", |
|
|
261 |
" attempt = Attempt(fn(*args, **kwargs), attempt_number, False)\n", |
|
|
262 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\utils\\__init__.py\", line 102, in rmtree\n", |
|
|
263 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\shutil.py\", line 516, in rmtree\n", |
|
|
264 |
" return _rmtree_unsafe(path, onerror)\n", |
|
|
265 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\shutil.py\", line 395, in _rmtree_unsafe\n", |
|
|
266 |
" _rmtree_unsafe(fullname, onerror)\n", |
|
|
267 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\shutil.py\", line 395, in _rmtree_unsafe\n", |
|
|
268 |
" _rmtree_unsafe(fullname, onerror)\n", |
|
|
269 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\shutil.py\", line 395, in _rmtree_unsafe\n", |
|
|
270 |
" _rmtree_unsafe(fullname, onerror)\n", |
|
|
271 |
" [Previous line repeated 1 more time]\n", |
|
|
272 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\shutil.py\", line 400, in _rmtree_unsafe\n", |
|
|
273 |
" onerror(os.unlink, fullname, sys.exc_info())\n", |
|
|
274 |
" File \"c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages\\pip\\utils\\__init__.py\", line 114, in rmtree_errorhandler\n", |
|
|
275 |
"PermissionError: [WinError 5] Access is denied: 'C:\\\\Users\\\\Vanisri Kirubakaran\\\\AppData\\\\Local\\\\Temp\\\\pip-8gao_bdp-uninstall\\\\users\\\\vanisri kirubakaran\\\\anaconda3-new\\\\scripts\\\\pip.exe'\n" |
|
|
276 |
] |
|
|
277 |
} |
|
|
278 |
], |
|
|
279 |
"source": [ |
|
|
280 |
"!pip install --upgrade pip" |
|
|
281 |
] |
|
|
282 |
}, |
|
|
283 |
{ |
|
|
284 |
"cell_type": "code", |
|
|
285 |
"execution_count": 10, |
|
|
286 |
"metadata": {}, |
|
|
287 |
"outputs": [ |
|
|
288 |
{ |
|
|
289 |
"name": "stdout", |
|
|
290 |
"output_type": "stream", |
|
|
291 |
"text": [ |
|
|
292 |
"Found existing installation: PyYAML 5.3\n" |
|
|
293 |
] |
|
|
294 |
}, |
|
|
295 |
{ |
|
|
296 |
"name": "stderr", |
|
|
297 |
"output_type": "stream", |
|
|
298 |
"text": [ |
|
|
299 |
"ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.\n" |
|
|
300 |
] |
|
|
301 |
} |
|
|
302 |
], |
|
|
303 |
"source": [ |
|
|
304 |
"!pip uninstall PyYAML==5.3" |
|
|
305 |
] |
|
|
306 |
}, |
|
|
307 |
{ |
|
|
308 |
"cell_type": "code", |
|
|
309 |
"execution_count": 5, |
|
|
310 |
"metadata": {}, |
|
|
311 |
"outputs": [ |
|
|
312 |
{ |
|
|
313 |
"ename": "ModuleNotFoundError", |
|
|
314 |
"evalue": "No module named 'chatterbot'", |
|
|
315 |
"output_type": "error", |
|
|
316 |
"traceback": [ |
|
|
317 |
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", |
|
|
318 |
"\u001b[1;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", |
|
|
319 |
"\u001b[1;32m<ipython-input-5-5b4764c2a302>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[0mchatterbot\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mChatBot\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mchatterbot\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtrainers\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mListTrainer\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mos\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
320 |
"\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'chatterbot'" |
|
|
321 |
] |
|
|
322 |
} |
|
|
323 |
], |
|
|
324 |
"source": [ |
|
|
325 |
"from chatterbot import ChatBot\n", |
|
|
326 |
"from chatterbot.trainers import ListTrainer\n", |
|
|
327 |
"import os\n", |
|
|
328 |
"\n", |
|
|
329 |
"\n", |
|
|
330 |
"english_bot = ChatBot('Bot')\n", |
|
|
331 |
"english_bot.set_trainer(ListTrainer)\n", |
|
|
332 |
"for file in os.listdir('data'):\n", |
|
|
333 |
" print('Training using '+file)\n", |
|
|
334 |
" convData = open('data/' + file).readlines()\n", |
|
|
335 |
" english_bot.train(convData)\n", |
|
|
336 |
" print(\"Training completed for \"+file)" |
|
|
337 |
] |
|
|
338 |
}, |
|
|
339 |
{ |
|
|
340 |
"cell_type": "code", |
|
|
341 |
"execution_count": null, |
|
|
342 |
"metadata": {}, |
|
|
343 |
"outputs": [], |
|
|
344 |
"source": [ |
|
|
345 |
"so,tried various things for the error,but no use..seems like pip version and PyYAML versions do not match.But pyyaml version is difficult to change.\n", |
|
|
346 |
"so..took each line out from requirements.txt and run as separate commands.\n", |
|
|
347 |
"also updated SQLAlchemy to 1.2 from 1.1.11 " |
|
|
348 |
] |
|
|
349 |
}, |
|
|
350 |
{ |
|
|
351 |
"cell_type": "code", |
|
|
352 |
"execution_count": 8, |
|
|
353 |
"metadata": {}, |
|
|
354 |
"outputs": [ |
|
|
355 |
{ |
|
|
356 |
"name": "stdout", |
|
|
357 |
"output_type": "stream", |
|
|
358 |
"text": [ |
|
|
359 |
"Requirement already satisfied: Flask==0.12.3 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (0.12.3)\n", |
|
|
360 |
"Requirement already satisfied: itsdangerous>=0.21 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from Flask==0.12.3) (1.1.0)\n", |
|
|
361 |
"Requirement already satisfied: Werkzeug>=0.7 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from Flask==0.12.3) (1.0.0)\n", |
|
|
362 |
"Requirement already satisfied: click>=2.0 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from Flask==0.12.3) (7.0)\n", |
|
|
363 |
"Requirement already satisfied: Jinja2>=2.4 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from Flask==0.12.3) (2.11.1)\n", |
|
|
364 |
"Requirement already satisfied: MarkupSafe>=0.23 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from Jinja2>=2.4->Flask==0.12.3) (1.1.1)\n" |
|
|
365 |
] |
|
|
366 |
} |
|
|
367 |
], |
|
|
368 |
"source": [ |
|
|
369 |
"!pip install Flask==0.12.3" |
|
|
370 |
] |
|
|
371 |
}, |
|
|
372 |
{ |
|
|
373 |
"cell_type": "code", |
|
|
374 |
"execution_count": 9, |
|
|
375 |
"metadata": {}, |
|
|
376 |
"outputs": [ |
|
|
377 |
{ |
|
|
378 |
"name": "stdout", |
|
|
379 |
"output_type": "stream", |
|
|
380 |
"text": [ |
|
|
381 |
"Collecting chatterbot==0.8.4\n", |
|
|
382 |
" Using cached ChatterBot-0.8.4-py2.py3-none-any.whl (72 kB)\n", |
|
|
383 |
"Collecting chatterbot-corpus<1.2,>=1.1\n", |
|
|
384 |
" Using cached chatterbot_corpus-1.1.4-py2.py3-none-any.whl (117 kB)\n", |
|
|
385 |
"Requirement already satisfied: mathparse<0.2,>=0.1 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from chatterbot==0.8.4) (0.1.2)\n", |
|
|
386 |
"Requirement already satisfied: pymongo<4.0,>=3.3 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from chatterbot==0.8.4) (3.10.1)\n", |
|
|
387 |
"Requirement already satisfied: python-dateutil<2.7,>=2.6 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from chatterbot==0.8.4) (2.6.1)\n", |
|
|
388 |
"Requirement already satisfied: python-twitter<4.0,>=3.0 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from chatterbot==0.8.4) (3.5)\n", |
|
|
389 |
"Requirement already satisfied: nltk<4.0,>=3.2 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from chatterbot==0.8.4) (3.4.5)\n", |
|
|
390 |
"Requirement already satisfied: sqlalchemy<1.3,>=1.2 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from chatterbot==0.8.4) (1.2.0)\n", |
|
|
391 |
"Collecting PyYAML<4.0,>=3.12\n", |
|
|
392 |
" Using cached PyYAML-3.13-cp37-cp37m-win_amd64.whl (206 kB)\n", |
|
|
393 |
"Requirement already satisfied: six>=1.5 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from python-dateutil<2.7,>=2.6->chatterbot==0.8.4) (1.14.0)\n", |
|
|
394 |
"Requirement already satisfied: requests-oauthlib in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from python-twitter<4.0,>=3.0->chatterbot==0.8.4) (1.3.0)\n", |
|
|
395 |
"Requirement already satisfied: future in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from python-twitter<4.0,>=3.0->chatterbot==0.8.4) (0.18.2)\n", |
|
|
396 |
"Requirement already satisfied: requests in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from python-twitter<4.0,>=3.0->chatterbot==0.8.4) (2.22.0)\n", |
|
|
397 |
"Requirement already satisfied: oauthlib>=3.0.0 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests-oauthlib->python-twitter<4.0,>=3.0->chatterbot==0.8.4) (3.1.0)\n", |
|
|
398 |
"Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests->python-twitter<4.0,>=3.0->chatterbot==0.8.4) (1.25.8)\n", |
|
|
399 |
"Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests->python-twitter<4.0,>=3.0->chatterbot==0.8.4) (3.0.4)\n", |
|
|
400 |
"Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests->python-twitter<4.0,>=3.0->chatterbot==0.8.4) (2019.11.28)\n", |
|
|
401 |
"Requirement already satisfied: idna<2.9,>=2.5 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests->python-twitter<4.0,>=3.0->chatterbot==0.8.4) (2.8)\n", |
|
|
402 |
"Installing collected packages: PyYAML, chatterbot-corpus, chatterbot\n", |
|
|
403 |
"Successfully installed PyYAML-3.13 chatterbot-0.8.4 chatterbot-corpus-1.1.4\n" |
|
|
404 |
] |
|
|
405 |
} |
|
|
406 |
], |
|
|
407 |
"source": [ |
|
|
408 |
"!pip install chatterbot==0.8.4" |
|
|
409 |
] |
|
|
410 |
}, |
|
|
411 |
{ |
|
|
412 |
"cell_type": "code", |
|
|
413 |
"execution_count": 10, |
|
|
414 |
"metadata": {}, |
|
|
415 |
"outputs": [ |
|
|
416 |
{ |
|
|
417 |
"name": "stdout", |
|
|
418 |
"output_type": "stream", |
|
|
419 |
"text": [ |
|
|
420 |
"Requirement already satisfied: SQLAlchemy==1.2 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (1.2.0)\n" |
|
|
421 |
] |
|
|
422 |
} |
|
|
423 |
], |
|
|
424 |
"source": [ |
|
|
425 |
"!pip install SQLAlchemy==1.2" |
|
|
426 |
] |
|
|
427 |
}, |
|
|
428 |
{ |
|
|
429 |
"cell_type": "code", |
|
|
430 |
"execution_count": 11, |
|
|
431 |
"metadata": {}, |
|
|
432 |
"outputs": [ |
|
|
433 |
{ |
|
|
434 |
"name": "stdout", |
|
|
435 |
"output_type": "stream", |
|
|
436 |
"text": [ |
|
|
437 |
"Old database removed. Training new database\n", |
|
|
438 |
"Training using botprofile.yml\n", |
|
|
439 |
"List Trainer: [####################] 100%\n", |
|
|
440 |
"Training completed for botprofile.yml\n", |
|
|
441 |
"Training using cough.cold.yml\n", |
|
|
442 |
"List Trainer: [####################] 100%\n", |
|
|
443 |
"Training completed for cough.cold.yml\n", |
|
|
444 |
"Training using doctor.yml\n", |
|
|
445 |
"List Trainer: [####################] 100%\n", |
|
|
446 |
"Training completed for doctor.yml\n", |
|
|
447 |
"Training using fever.yml\n", |
|
|
448 |
"List Trainer: [####################] 100%\n", |
|
|
449 |
"Training completed for fever.yml\n", |
|
|
450 |
"Training using fracture.yml\n", |
|
|
451 |
"List Trainer: [####################] 100%\n", |
|
|
452 |
"Training completed for fracture.yml\n", |
|
|
453 |
"Training using generalhealth.yml\n", |
|
|
454 |
"List Trainer: [####################] 100%\n", |
|
|
455 |
"Training completed for generalhealth.yml\n", |
|
|
456 |
"Training using greetings.yml\n", |
|
|
457 |
"List Trainer: [####################] 100%\n", |
|
|
458 |
"Training completed for greetings.yml\n", |
|
|
459 |
"Training using headache.yml\n", |
|
|
460 |
"List Trainer: [####################] 100%\n", |
|
|
461 |
"Training completed for headache.yml\n", |
|
|
462 |
"Training using new.yml\n", |
|
|
463 |
"List Trainer: [####################] 100%\n", |
|
|
464 |
"Training completed for new.yml\n", |
|
|
465 |
"Training using personalinfo.yml\n", |
|
|
466 |
"List Trainer: [####################] 100%\n", |
|
|
467 |
"Training completed for personalinfo.yml\n" |
|
|
468 |
] |
|
|
469 |
} |
|
|
470 |
], |
|
|
471 |
"source": [ |
|
|
472 |
"from chatterbot import ChatBot\n", |
|
|
473 |
"from chatterbot.trainers import ListTrainer\n", |
|
|
474 |
"import os\n", |
|
|
475 |
"\n", |
|
|
476 |
"try:\n", |
|
|
477 |
"\tos.remove(\"db.sqlite3\")\n", |
|
|
478 |
"\tprint(\"Old database removed. Training new database\")\n", |
|
|
479 |
"except:\n", |
|
|
480 |
"\tprint('No database found. Creating new database.')\n", |
|
|
481 |
"\n", |
|
|
482 |
"english_bot = ChatBot('Bot')\n", |
|
|
483 |
"english_bot.set_trainer(ListTrainer)\n", |
|
|
484 |
"for file in os.listdir('data'):\n", |
|
|
485 |
" print('Training using '+file)\n", |
|
|
486 |
" convData = open('data/' + file).readlines()\n", |
|
|
487 |
" english_bot.train(convData)\n", |
|
|
488 |
" print(\"Training completed for \"+file)" |
|
|
489 |
] |
|
|
490 |
}, |
|
|
491 |
{ |
|
|
492 |
"cell_type": "code", |
|
|
493 |
"execution_count": null, |
|
|
494 |
"metadata": {}, |
|
|
495 |
"outputs": [], |
|
|
496 |
"source": [ |
|
|
497 |
"now,training is done but when you run the run file..you shall get error as no module named 'gtts' or no module named 'speech_recognition'.\n", |
|
|
498 |
"so,install each of them separately again." |
|
|
499 |
] |
|
|
500 |
}, |
|
|
501 |
{ |
|
|
502 |
"cell_type": "code", |
|
|
503 |
"execution_count": 16, |
|
|
504 |
"metadata": {}, |
|
|
505 |
"outputs": [ |
|
|
506 |
{ |
|
|
507 |
"name": "stdout", |
|
|
508 |
"output_type": "stream", |
|
|
509 |
"text": [ |
|
|
510 |
"Collecting gtts\n", |
|
|
511 |
" Using cached gTTS-2.1.1-py3-none-any.whl (25 kB)\n", |
|
|
512 |
"Requirement already satisfied: click in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from gtts) (7.0)\n", |
|
|
513 |
"Collecting gtts-token>=1.1.3\n", |
|
|
514 |
" Using cached gTTS-token-1.1.3.tar.gz (3.4 kB)\n", |
|
|
515 |
"Requirement already satisfied: beautifulsoup4 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from gtts) (4.8.2)\n", |
|
|
516 |
"Requirement already satisfied: requests in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from gtts) (2.22.0)\n", |
|
|
517 |
"Requirement already satisfied: six in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from gtts) (1.14.0)\n", |
|
|
518 |
"Requirement already satisfied: soupsieve>=1.2 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from beautifulsoup4->gtts) (1.9.5)\n", |
|
|
519 |
"Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests->gtts) (1.25.8)\n", |
|
|
520 |
"Requirement already satisfied: idna<2.9,>=2.5 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests->gtts) (2.8)\n", |
|
|
521 |
"Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests->gtts) (3.0.4)\n", |
|
|
522 |
"Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from requests->gtts) (2019.11.28)\n", |
|
|
523 |
"Building wheels for collected packages: gtts-token\n", |
|
|
524 |
" Building wheel for gtts-token (setup.py): started\n", |
|
|
525 |
" Building wheel for gtts-token (setup.py): finished with status 'done'\n", |
|
|
526 |
" Created wheel for gtts-token: filename=gTTS_token-1.1.3-py3-none-any.whl size=4100 sha256=b87d99ea50d25f8cb795fddd613682b55cff07690a6811f9d7cdd07184882ca4\n", |
|
|
527 |
" Stored in directory: c:\\users\\vanisri kirubakaran\\appdata\\local\\pip\\cache\\wheels\\c1\\78\\25\\81270af5521d88ea8db7da5d4f64872673976eb9692bcb0c13\n", |
|
|
528 |
"Successfully built gtts-token\n", |
|
|
529 |
"Installing collected packages: gtts-token, gtts\n", |
|
|
530 |
"Successfully installed gtts-2.1.1 gtts-token-1.1.3\n" |
|
|
531 |
] |
|
|
532 |
} |
|
|
533 |
], |
|
|
534 |
"source": [ |
|
|
535 |
"!pip install gtts" |
|
|
536 |
] |
|
|
537 |
}, |
|
|
538 |
{ |
|
|
539 |
"cell_type": "code", |
|
|
540 |
"execution_count": 21, |
|
|
541 |
"metadata": {}, |
|
|
542 |
"outputs": [ |
|
|
543 |
{ |
|
|
544 |
"name": "stdout", |
|
|
545 |
"output_type": "stream", |
|
|
546 |
"text": [ |
|
|
547 |
"Collecting SpeechRecognition\n", |
|
|
548 |
" Using cached SpeechRecognition-3.8.1-py2.py3-none-any.whl (32.8 MB)\n", |
|
|
549 |
"Installing collected packages: SpeechRecognition\n", |
|
|
550 |
"Successfully installed SpeechRecognition-3.8.1\n" |
|
|
551 |
] |
|
|
552 |
} |
|
|
553 |
], |
|
|
554 |
"source": [ |
|
|
555 |
"!pip install SpeechRecognition" |
|
|
556 |
] |
|
|
557 |
}, |
|
|
558 |
{ |
|
|
559 |
"cell_type": "code", |
|
|
560 |
"execution_count": null, |
|
|
561 |
"metadata": {}, |
|
|
562 |
"outputs": [], |
|
|
563 |
"source": [ |
|
|
564 |
"there will be an error with pyaudio as well mentioning no wheel file.go here https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio\n", |
|
|
565 |
" go down to pyaudio..and download cp37-cp37m-win_amd64.whl and then move it to the project's folder(NLP-project 1),then run below command." |
|
|
566 |
] |
|
|
567 |
}, |
|
|
568 |
{ |
|
|
569 |
"cell_type": "code", |
|
|
570 |
"execution_count": 25, |
|
|
571 |
"metadata": {}, |
|
|
572 |
"outputs": [ |
|
|
573 |
{ |
|
|
574 |
"name": "stdout", |
|
|
575 |
"output_type": "stream", |
|
|
576 |
"text": [ |
|
|
577 |
"Processing c:\\users\\vanisri kirubakaran\\downloads\\chatbot\\nlp-chatbot-master (1)\\pyaudio-0.2.11-cp37-cp37m-win_amd64.whl\n", |
|
|
578 |
"Installing collected packages: PyAudio\n", |
|
|
579 |
"Successfully installed PyAudio-0.2.11\n" |
|
|
580 |
] |
|
|
581 |
} |
|
|
582 |
], |
|
|
583 |
"source": [ |
|
|
584 |
"!pip install PyAudio-0.2.11-cp37-cp37m-win_amd64.whl" |
|
|
585 |
] |
|
|
586 |
}, |
|
|
587 |
{ |
|
|
588 |
"cell_type": "code", |
|
|
589 |
"execution_count": 26, |
|
|
590 |
"metadata": {}, |
|
|
591 |
"outputs": [ |
|
|
592 |
{ |
|
|
593 |
"name": "stdout", |
|
|
594 |
"output_type": "stream", |
|
|
595 |
"text": [ |
|
|
596 |
"Okay Bro\n", |
|
|
597 |
"You said: i have a headache\n", |
|
|
598 |
"\n", |
|
|
599 |
"- what kind of headache do you have : 1. Migrane headache - intense throbbing pain on just one side of the head. 2. Cluster headaches - severe and recurrent headaches 3. Tension Headache - Ocassional;\n", |
|
|
600 |
"Okay Bro\n", |
|
|
601 |
"You said: migraine\n", |
|
|
602 |
"\n", |
|
|
603 |
"- good to know. how may i assist you then?\n", |
|
|
604 |
"Okay Bro\n", |
|
|
605 |
"Your last instruction was unclear to me\n", |
|
|
606 |
"Okay Bro\n", |
|
|
607 |
"Your last instruction was unclear to me\n", |
|
|
608 |
"Okay Bro\n", |
|
|
609 |
"Your last instruction was unclear to me\n", |
|
|
610 |
"Okay Bro\n", |
|
|
611 |
"You said: i have cold\n", |
|
|
612 |
"\n", |
|
|
613 |
"- You should take a sudafed tablet after your meal.\n", |
|
|
614 |
"Okay Bro\n", |
|
|
615 |
"Your last instruction was unclear to me\n", |
|
|
616 |
"Okay Bro\n" |
|
|
617 |
] |
|
|
618 |
}, |
|
|
619 |
{ |
|
|
620 |
"ename": "KeyboardInterrupt", |
|
|
621 |
"evalue": "", |
|
|
622 |
"output_type": "error", |
|
|
623 |
"traceback": [ |
|
|
624 |
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", |
|
|
625 |
"\u001b[1;31mUnknownValueError\u001b[0m Traceback (most recent call last)", |
|
|
626 |
"\u001b[1;32m<ipython-input-26-636afcd1c583>\u001b[0m in \u001b[0;36mmyCommand\u001b[1;34m()\u001b[0m\n\u001b[0;32m 45\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 46\u001b[1;33m \u001b[0mcommand\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrecognize_google\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0maudio\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlower\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 47\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'You said: '\u001b[0m\u001b[1;33m+\u001b[0m \u001b[0mcommand\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;34m'\\n'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
627 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\speech_recognition\\__init__.py\u001b[0m in \u001b[0;36mrecognize_google\u001b[1;34m(self, audio_data, key, language, show_all)\u001b[0m\n\u001b[0;32m 857\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mshow_all\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mactual_result\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 858\u001b[1;33m \u001b[1;32mif\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0misinstance\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mactual_result\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdict\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mor\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mactual_result\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"alternative\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;32mraise\u001b[0m \u001b[0mUnknownValueError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 859\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
628 |
"\u001b[1;31mUnknownValueError\u001b[0m: ", |
|
|
629 |
"\nDuring handling of the above exception, another exception occurred:\n", |
|
|
630 |
"\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", |
|
|
631 |
"\u001b[1;32m<ipython-input-26-636afcd1c583>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 67\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 68\u001b[0m \u001b[1;32mwhile\u001b[0m \u001b[1;32mTrue\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 69\u001b[1;33m \u001b[0mvalue\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mget_bot_response\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmyCommand\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 70\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mvalue\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
632 |
"\u001b[1;32m<ipython-input-26-636afcd1c583>\u001b[0m in \u001b[0;36mmyCommand\u001b[1;34m()\u001b[0m\n\u001b[0;32m 49\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0msr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mUnknownValueError\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 50\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'Your last instruction was unclear to me'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 51\u001b[1;33m \u001b[0mcommand\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mmyCommand\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m;\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 52\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 53\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mcommand\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
633 |
"\u001b[1;32m<ipython-input-26-636afcd1c583>\u001b[0m in \u001b[0;36mmyCommand\u001b[1;34m()\u001b[0m\n\u001b[0;32m 44\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 45\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 46\u001b[1;33m \u001b[0mcommand\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrecognize_google\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0maudio\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlower\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 47\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'You said: '\u001b[0m\u001b[1;33m+\u001b[0m \u001b[0mcommand\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;34m'\\n'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 48\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
634 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\speech_recognition\\__init__.py\u001b[0m in \u001b[0;36mrecognize_google\u001b[1;34m(self, audio_data, key, language, show_all)\u001b[0m\n\u001b[0;32m 843\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mURLError\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 844\u001b[0m \u001b[1;32mraise\u001b[0m \u001b[0mRequestError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"recognition connection failed: {}\"\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0me\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mreason\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 845\u001b[1;33m \u001b[0mresponse_text\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mresponse\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdecode\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"utf-8\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 846\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 847\u001b[0m \u001b[1;31m# ignore any blank blocks\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
635 |
"\u001b[1;32m~\\anaconda3-new\\lib\\http\\client.py\u001b[0m in \u001b[0;36mread\u001b[1;34m(self, amt)\u001b[0m\n\u001b[0;32m 462\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 463\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mchunked\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 464\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_readall_chunked\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 465\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 466\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlength\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
636 |
"\u001b[1;32m~\\anaconda3-new\\lib\\http\\client.py\u001b[0m in \u001b[0;36m_readall_chunked\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 569\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 570\u001b[0m \u001b[1;32mwhile\u001b[0m \u001b[1;32mTrue\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 571\u001b[1;33m \u001b[0mchunk_left\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_get_chunk_left\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 572\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mchunk_left\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 573\u001b[0m \u001b[1;32mbreak\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
637 |
"\u001b[1;32m~\\anaconda3-new\\lib\\http\\client.py\u001b[0m in \u001b[0;36m_get_chunk_left\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 552\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_safe_read\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;31m# toss the CRLF at the end of the chunk\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 553\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 554\u001b[1;33m \u001b[0mchunk_left\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_read_next_chunk_size\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 555\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mValueError\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 556\u001b[0m \u001b[1;32mraise\u001b[0m \u001b[0mIncompleteRead\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34mb''\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
638 |
"\u001b[1;32m~\\anaconda3-new\\lib\\http\\client.py\u001b[0m in \u001b[0;36m_read_next_chunk_size\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 512\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m_read_next_chunk_size\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 513\u001b[0m \u001b[1;31m# Read the next chunk size from the file\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 514\u001b[1;33m \u001b[0mline\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mreadline\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0m_MAXLINE\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 515\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mline\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m>\u001b[0m \u001b[0m_MAXLINE\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 516\u001b[0m \u001b[1;32mraise\u001b[0m \u001b[0mLineTooLong\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"chunk size\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
639 |
"\u001b[1;32m~\\anaconda3-new\\lib\\socket.py\u001b[0m in \u001b[0;36mreadinto\u001b[1;34m(self, b)\u001b[0m\n\u001b[0;32m 587\u001b[0m \u001b[1;32mwhile\u001b[0m \u001b[1;32mTrue\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 588\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 589\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_sock\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrecv_into\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mb\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 590\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 591\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_timeout_occurred\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;32mTrue\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
640 |
"\u001b[1;31mKeyboardInterrupt\u001b[0m: " |
|
|
641 |
] |
|
|
642 |
} |
|
|
643 |
], |
|
|
644 |
"source": [ |
|
|
645 |
"from flask import Flask, render_template, request\n", |
|
|
646 |
"from chatterbot import ChatBot\n", |
|
|
647 |
"from chatterbot.trainers import ChatterBotCorpusTrainer\n", |
|
|
648 |
"import os\n", |
|
|
649 |
"from gtts import gTTS\n", |
|
|
650 |
"import speech_recognition as sr\n", |
|
|
651 |
"import os\n", |
|
|
652 |
"import re\n", |
|
|
653 |
"import webbrowser\n", |
|
|
654 |
"import smtplib\n", |
|
|
655 |
"import requests\n", |
|
|
656 |
"\n", |
|
|
657 |
"\n", |
|
|
658 |
"from chatterbot import ChatBot\n", |
|
|
659 |
"from chatterbot.trainers import ListTrainer\n", |
|
|
660 |
"\n", |
|
|
661 |
"filenumber=int(os.listdir('saved_conversations')[-1])\n", |
|
|
662 |
"filenumber=filenumber+1\n", |
|
|
663 |
"file= open('saved_conversations/'+str(filenumber),\"w+\")\n", |
|
|
664 |
"file.write('bot : Hi There! I am a medical chatbot. You can begin conversation by typing in a message and pressing enter.\\n')\n", |
|
|
665 |
"file.close()\n", |
|
|
666 |
"\n", |
|
|
667 |
"\n", |
|
|
668 |
"english_bot = ChatBot('Bot',\n", |
|
|
669 |
" storage_adapter='chatterbot.storage.SQLStorageAdapter',\n", |
|
|
670 |
" logic_adapters=[\n", |
|
|
671 |
" {\n", |
|
|
672 |
" 'import_path': 'chatterbot.logic.BestMatch'\n", |
|
|
673 |
" },\n", |
|
|
674 |
" \n", |
|
|
675 |
"],\n", |
|
|
676 |
"trainer='chatterbot.trainers.ListTrainer')\n", |
|
|
677 |
"english_bot.set_trainer(ListTrainer)\n", |
|
|
678 |
"\n", |
|
|
679 |
"\n", |
|
|
680 |
"def myCommand():\n", |
|
|
681 |
" r = sr.Recognizer()\n", |
|
|
682 |
"\n", |
|
|
683 |
" with sr.Microphone() as source:\n", |
|
|
684 |
" print('Okay Bro')\n", |
|
|
685 |
" r.pause_treshold = 1\n", |
|
|
686 |
" r.adjust_for_ambient_noise(source, duration = 1)\n", |
|
|
687 |
" audio = r.listen(source)\t\n", |
|
|
688 |
"\n", |
|
|
689 |
" try:\n", |
|
|
690 |
" command = r.recognize_google(audio).lower()\n", |
|
|
691 |
" print('You said: '+ command + '\\n')\n", |
|
|
692 |
"\n", |
|
|
693 |
" except sr.UnknownValueError:\n", |
|
|
694 |
" print('Your last instruction was unclear to me')\n", |
|
|
695 |
" command = myCommand();\n", |
|
|
696 |
"\n", |
|
|
697 |
" return command \n", |
|
|
698 |
"\n", |
|
|
699 |
"\n", |
|
|
700 |
"def get_bot_response(command):\n", |
|
|
701 |
" #userText = request.args.get('msg')\n", |
|
|
702 |
" response = str(english_bot.get_response(command))\n", |
|
|
703 |
"\n", |
|
|
704 |
" appendfile=os.listdir('saved_conversations')[-1]\n", |
|
|
705 |
" appendfile= open('saved_conversations/'+str(filenumber),\"a\")\n", |
|
|
706 |
" appendfile.write('user : '+command+'\\n')\n", |
|
|
707 |
" appendfile.write('bot : '+response+'\\n')\n", |
|
|
708 |
" appendfile.close()\n", |
|
|
709 |
" return response\n", |
|
|
710 |
"\n", |
|
|
711 |
"\n", |
|
|
712 |
"while True:\n", |
|
|
713 |
" value=get_bot_response(myCommand())\n", |
|
|
714 |
" print(value)" |
|
|
715 |
] |
|
|
716 |
}, |
|
|
717 |
{ |
|
|
718 |
"cell_type": "code", |
|
|
719 |
"execution_count": null, |
|
|
720 |
"metadata": {}, |
|
|
721 |
"outputs": [], |
|
|
722 |
"source": [ |
|
|
723 |
"P.S i stopped the running last time..\n", |
|
|
724 |
"now trying speech function.move to after 4 commands." |
|
|
725 |
] |
|
|
726 |
}, |
|
|
727 |
{ |
|
|
728 |
"cell_type": "code", |
|
|
729 |
"execution_count": 27, |
|
|
730 |
"metadata": {}, |
|
|
731 |
"outputs": [ |
|
|
732 |
{ |
|
|
733 |
"name": "stdout", |
|
|
734 |
"output_type": "stream", |
|
|
735 |
"text": [ |
|
|
736 |
"Collecting pyttsx3\n", |
|
|
737 |
" Downloading pyttsx3-2.90-py3-none-any.whl (39 kB)\n", |
|
|
738 |
"Collecting pypiwin32; platform_system == \"Windows\"\n", |
|
|
739 |
" Using cached pypiwin32-223-py3-none-any.whl (1.7 kB)\n", |
|
|
740 |
"Requirement already satisfied: pywin32; platform_system == \"Windows\" in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from pyttsx3) (227)\n", |
|
|
741 |
"Requirement already satisfied: comtypes; platform_system == \"Windows\" in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from pyttsx3) (1.1.7)\n", |
|
|
742 |
"Installing collected packages: pypiwin32, pyttsx3\n", |
|
|
743 |
"Successfully installed pypiwin32-223 pyttsx3-2.90\n" |
|
|
744 |
] |
|
|
745 |
} |
|
|
746 |
], |
|
|
747 |
"source": [ |
|
|
748 |
"!pip install pyttsx3" |
|
|
749 |
] |
|
|
750 |
}, |
|
|
751 |
{ |
|
|
752 |
"cell_type": "code", |
|
|
753 |
"execution_count": 29, |
|
|
754 |
"metadata": {}, |
|
|
755 |
"outputs": [ |
|
|
756 |
{ |
|
|
757 |
"name": "stdout", |
|
|
758 |
"output_type": "stream", |
|
|
759 |
"text": [ |
|
|
760 |
"Requirement already satisfied: pypiwin32 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (223)\n", |
|
|
761 |
"Requirement already satisfied: pywin32>=223 in c:\\users\\vanisri kirubakaran\\anaconda3-new\\lib\\site-packages (from pypiwin32) (227)\n" |
|
|
762 |
] |
|
|
763 |
} |
|
|
764 |
], |
|
|
765 |
"source": [ |
|
|
766 |
"!pip install pypiwin32" |
|
|
767 |
] |
|
|
768 |
}, |
|
|
769 |
{ |
|
|
770 |
"cell_type": "code", |
|
|
771 |
"execution_count": 30, |
|
|
772 |
"metadata": {}, |
|
|
773 |
"outputs": [ |
|
|
774 |
{ |
|
|
775 |
"ename": "TypeError", |
|
|
776 |
"evalue": "item 1 in _argtypes_ passes a union by value, which is unsupported.", |
|
|
777 |
"output_type": "error", |
|
|
778 |
"traceback": [ |
|
|
779 |
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", |
|
|
780 |
"\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", |
|
|
781 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\pyttsx3\\__init__.py\u001b[0m in \u001b[0;36minit\u001b[1;34m(driverName, debug)\u001b[0m\n\u001b[0;32m 19\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 20\u001b[1;33m \u001b[0meng\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0m_activeEngines\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mdriverName\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 21\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
782 |
"\u001b[1;32m~\\anaconda3-new\\lib\\weakref.py\u001b[0m in \u001b[0;36m__getitem__\u001b[1;34m(self, key)\u001b[0m\n\u001b[0;32m 136\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_commit_removals\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 137\u001b[1;33m \u001b[0mo\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 138\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mo\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
783 |
"\u001b[1;31mKeyError\u001b[0m: None", |
|
|
784 |
"\nDuring handling of the above exception, another exception occurred:\n", |
|
|
785 |
"\u001b[1;31mImportError\u001b[0m Traceback (most recent call last)", |
|
|
786 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\pyttsx3\\drivers\\sapi5.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[0mcomtypes\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mgen\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mSpeechLib\u001b[0m \u001b[1;31m# comtypes\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 4\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mImportError\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
787 |
"\u001b[1;31mImportError\u001b[0m: cannot import name 'SpeechLib' from 'comtypes.gen' (C:\\Users\\Vanisri Kirubakaran\\anaconda3-new\\lib\\site-packages\\comtypes\\gen\\__init__.py)", |
|
|
788 |
"\nDuring handling of the above exception, another exception occurred:\n", |
|
|
789 |
"\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", |
|
|
790 |
"\u001b[1;32m~\\anaconda3-new\\lib\\ctypes\\__init__.py\u001b[0m in \u001b[0;36mWINFUNCTYPE\u001b[1;34m(restype, *argtypes, **kw)\u001b[0m\n\u001b[0;32m 120\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 121\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0m_win_functype_cache\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrestype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0margtypes\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mflags\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 122\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
791 |
"\u001b[1;31mKeyError\u001b[0m: (<class 'ctypes.HRESULT'>, (<class 'comtypes.automation.tagVARIANT'>, <class 'ctypes.wintypes.LP_c_long'>), 0)", |
|
|
792 |
"\nDuring handling of the above exception, another exception occurred:\n", |
|
|
793 |
"\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", |
|
|
794 |
"\u001b[1;32m<ipython-input-30-dd44a913bd59>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mpyttsx3\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mengine\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpyttsx3\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0minit\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 3\u001b[0m \u001b[0mengine\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msay\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"I will speak this text\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[0mengine\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrunAndWait\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
795 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\pyttsx3\\__init__.py\u001b[0m in \u001b[0;36minit\u001b[1;34m(driverName, debug)\u001b[0m\n\u001b[0;32m 20\u001b[0m \u001b[0meng\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0m_activeEngines\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mdriverName\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 21\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 22\u001b[1;33m \u001b[0meng\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mEngine\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdriverName\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdebug\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 23\u001b[0m \u001b[0m_activeEngines\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mdriverName\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0meng\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 24\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0meng\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
796 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\pyttsx3\\engine.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, driverName, debug)\u001b[0m\n\u001b[0;32m 28\u001b[0m \u001b[1;33m@\u001b[0m\u001b[0mtype\u001b[0m \u001b[0mdebug\u001b[0m\u001b[1;33m:\u001b[0m \u001b[0mbool\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 29\u001b[0m \"\"\"\n\u001b[1;32m---> 30\u001b[1;33m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mproxy\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdriver\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mDriverProxy\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mweakref\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mproxy\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdriverName\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdebug\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 31\u001b[0m \u001b[1;31m# initialize other vars\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 32\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_connects\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m{\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
797 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\pyttsx3\\driver.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, engine, driverName, debug)\u001b[0m\n\u001b[0;32m 48\u001b[0m \u001b[1;31m# import driver module\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 49\u001b[0m \u001b[0mname\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m'pyttsx3.drivers.%s'\u001b[0m \u001b[1;33m%\u001b[0m \u001b[0mdriverName\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 50\u001b[1;33m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_module\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mimportlib\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mimport_module\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mname\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 51\u001b[0m \u001b[1;31m# build driver instance\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 52\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_driver\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_module\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mbuildDriver\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mweakref\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mproxy\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
798 |
"\u001b[1;32m~\\anaconda3-new\\lib\\importlib\\__init__.py\u001b[0m in \u001b[0;36mimport_module\u001b[1;34m(name, package)\u001b[0m\n\u001b[0;32m 125\u001b[0m \u001b[1;32mbreak\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 126\u001b[0m \u001b[0mlevel\u001b[0m \u001b[1;33m+=\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 127\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0m_bootstrap\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_gcd_import\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mname\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mlevel\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mpackage\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mlevel\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 128\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 129\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
799 |
"\u001b[1;32m~\\anaconda3-new\\lib\\importlib\\_bootstrap.py\u001b[0m in \u001b[0;36m_gcd_import\u001b[1;34m(name, package, level)\u001b[0m\n", |
|
|
800 |
"\u001b[1;32m~\\anaconda3-new\\lib\\importlib\\_bootstrap.py\u001b[0m in \u001b[0;36m_find_and_load\u001b[1;34m(name, import_)\u001b[0m\n", |
|
|
801 |
"\u001b[1;32m~\\anaconda3-new\\lib\\importlib\\_bootstrap.py\u001b[0m in \u001b[0;36m_find_and_load_unlocked\u001b[1;34m(name, import_)\u001b[0m\n", |
|
|
802 |
"\u001b[1;32m~\\anaconda3-new\\lib\\importlib\\_bootstrap.py\u001b[0m in \u001b[0;36m_load_unlocked\u001b[1;34m(spec)\u001b[0m\n", |
|
|
803 |
"\u001b[1;32m~\\anaconda3-new\\lib\\importlib\\_bootstrap_external.py\u001b[0m in \u001b[0;36mexec_module\u001b[1;34m(self, module)\u001b[0m\n", |
|
|
804 |
"\u001b[1;32m~\\anaconda3-new\\lib\\importlib\\_bootstrap.py\u001b[0m in \u001b[0;36m_call_with_frames_removed\u001b[1;34m(f, *args, **kwds)\u001b[0m\n", |
|
|
805 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\pyttsx3\\drivers\\sapi5.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mImportError\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;31m# Generate the SpeechLib lib and any associated files\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[0mengine\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mcomtypes\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mclient\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mCreateObject\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"SAPI.SpVoice\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 7\u001b[0m \u001b[0mstream\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mcomtypes\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mclient\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mCreateObject\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"SAPI.SpFileStream\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mcomtypes\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mgen\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mSpeechLib\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
806 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\comtypes\\client\\__init__.py\u001b[0m in \u001b[0;36mCreateObject\u001b[1;34m(progid, clsctx, machine, interface, dynamic, pServerInfo)\u001b[0m\n\u001b[0;32m 248\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mdynamic\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 249\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mcomtypes\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mclient\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdynamic\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mDispatch\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mobj\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 250\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0m_manage\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mobj\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mclsid\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0minterface\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0minterface\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 251\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 252\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mCoGetObject\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdisplayname\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0minterface\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mNone\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdynamic\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mFalse\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
807 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\comtypes\\client\\__init__.py\u001b[0m in \u001b[0;36m_manage\u001b[1;34m(obj, clsid, interface)\u001b[0m\n\u001b[0;32m 186\u001b[0m \u001b[0mobj\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__dict__\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'__clsid'\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mstr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mclsid\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 187\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0minterface\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 188\u001b[1;33m \u001b[0mobj\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mGetBestInterface\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mobj\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 189\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mobj\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 190\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
808 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\comtypes\\client\\__init__.py\u001b[0m in \u001b[0;36mGetBestInterface\u001b[1;34m(punk)\u001b[0m\n\u001b[0;32m 108\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 109\u001b[0m \u001b[1;31m# import the wrapper, generating it on demand\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 110\u001b[1;33m \u001b[0mmod\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mGetModule\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mtlib\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 111\u001b[0m \u001b[1;31m# Python interface class\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 112\u001b[0m \u001b[0minterface\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmod\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mitf_name\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
809 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\comtypes\\client\\_generate.py\u001b[0m in \u001b[0;36mGetModule\u001b[1;34m(tlib)\u001b[0m\n\u001b[0;32m 108\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 109\u001b[0m \u001b[1;31m# create and import the module\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 110\u001b[1;33m \u001b[0mmod\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0m_CreateWrapper\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mtlib\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mpathname\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 111\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 112\u001b[0m \u001b[0mmodulename\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtlib\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mGetDocumentation\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
810 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\comtypes\\client\\_generate.py\u001b[0m in \u001b[0;36m_CreateWrapper\u001b[1;34m(tlib, pathname)\u001b[0m\n\u001b[0;32m 182\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 183\u001b[0m \u001b[0mofi\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mclose\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 184\u001b[1;33m \u001b[0mmod\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0m_my_import\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfullname\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 185\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mmod\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 186\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
811 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\comtypes\\client\\_generate.py\u001b[0m in \u001b[0;36m_my_import\u001b[1;34m(fullname)\u001b[0m\n\u001b[0;32m 22\u001b[0m \u001b[1;32mand\u001b[0m \u001b[0mcomtypes\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mclient\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mgen_dir\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mcomtypes\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mgen\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__path__\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 23\u001b[0m \u001b[0mcomtypes\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mgen\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__path__\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcomtypes\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mclient\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mgen_dir\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 24\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0m__import__\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfullname\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mglobals\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mlocals\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;34m'DUMMY'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 25\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 26\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m_name_module\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mtlib\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
812 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\comtypes\\gen\\_C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 1739\u001b[0m \u001b[1;33m(\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;34m'in'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mVARIANT\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'Position'\u001b[0m \u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1740\u001b[0m \u001b[1;33m(\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;34m'in'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'optional'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mSpeechStreamSeekPositionType\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'Origin'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m0\u001b[0m \u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1741\u001b[1;33m ( ['out', 'retval'], POINTER(VARIANT), 'NewPosition' )),\n\u001b[0m\u001b[0;32m 1742\u001b[0m ]\n\u001b[0;32m 1743\u001b[0m \u001b[1;31m################################################################\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
813 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\comtypes\\__init__.py\u001b[0m in \u001b[0;36m__setattr__\u001b[1;34m(self, name, value)\u001b[0m\n\u001b[0;32m 327\u001b[0m \u001b[1;31m# overrides this by \"Interface._methods_ = [...]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 328\u001b[0m \u001b[1;31m## assert self.__dict__.get(\"_methods_\", None) is None\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 329\u001b[1;33m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_make_methods\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mvalue\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 330\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_make_specials\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 331\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0mname\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m\"_disp_methods_\"\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
814 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\comtypes\\__init__.py\u001b[0m in \u001b[0;36m_make_methods\u001b[1;34m(self, methods)\u001b[0m\n\u001b[0;32m 696\u001b[0m \u001b[0mrestype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mname\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0margtypes\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mparamflags\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0midlflags\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdoc\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mitem\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 697\u001b[0m \u001b[1;31m# the function prototype\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 698\u001b[1;33m \u001b[0mprototype\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mWINFUNCTYPE\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrestype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m*\u001b[0m\u001b[0margtypes\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 699\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 700\u001b[0m \u001b[1;31m# a low level unbound method calling the com method.\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
815 |
"\u001b[1;32m~\\anaconda3-new\\lib\\ctypes\\__init__.py\u001b[0m in \u001b[0;36mWINFUNCTYPE\u001b[1;34m(restype, *argtypes, **kw)\u001b[0m\n\u001b[0;32m 121\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0m_win_functype_cache\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrestype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0margtypes\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mflags\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 122\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 123\u001b[1;33m \u001b[1;32mclass\u001b[0m \u001b[0mWinFunctionType\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0m_CFuncPtr\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 124\u001b[0m \u001b[0m_argtypes_\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0margtypes\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 125\u001b[0m \u001b[0m_restype_\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mrestype\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
816 |
"\u001b[1;31mTypeError\u001b[0m: item 1 in _argtypes_ passes a union by value, which is unsupported." |
|
|
817 |
] |
|
|
818 |
} |
|
|
819 |
], |
|
|
820 |
"source": [ |
|
|
821 |
"import pyttsx3\n", |
|
|
822 |
"engine = pyttsx3.init()\n", |
|
|
823 |
"engine.say(\"I will speak this text\")\n", |
|
|
824 |
"engine.runAndWait()" |
|
|
825 |
] |
|
|
826 |
}, |
|
|
827 |
{ |
|
|
828 |
"cell_type": "code", |
|
|
829 |
"execution_count": 34, |
|
|
830 |
"metadata": {}, |
|
|
831 |
"outputs": [ |
|
|
832 |
{ |
|
|
833 |
"data": { |
|
|
834 |
"text/plain": [ |
|
|
835 |
"1" |
|
|
836 |
] |
|
|
837 |
}, |
|
|
838 |
"execution_count": 34, |
|
|
839 |
"metadata": {}, |
|
|
840 |
"output_type": "execute_result" |
|
|
841 |
} |
|
|
842 |
], |
|
|
843 |
"source": [ |
|
|
844 |
"import os\n", |
|
|
845 |
"os.system(\"echo 'hello world'\")\n", |
|
|
846 |
"os.system(\"say 'hello world'\") " |
|
|
847 |
] |
|
|
848 |
}, |
|
|
849 |
{ |
|
|
850 |
"cell_type": "code", |
|
|
851 |
"execution_count": 35, |
|
|
852 |
"metadata": {}, |
|
|
853 |
"outputs": [ |
|
|
854 |
{ |
|
|
855 |
"data": { |
|
|
856 |
"text/plain": [ |
|
|
857 |
"1" |
|
|
858 |
] |
|
|
859 |
}, |
|
|
860 |
"execution_count": 35, |
|
|
861 |
"metadata": {}, |
|
|
862 |
"output_type": "execute_result" |
|
|
863 |
} |
|
|
864 |
], |
|
|
865 |
"source": [ |
|
|
866 |
"from win32com.client import Dispatch\n", |
|
|
867 |
"\n", |
|
|
868 |
"speak = Dispatch(\"SAPI.SpVoice\")\n", |
|
|
869 |
"\n", |
|
|
870 |
"speak.Speak(\"Ciao\")" |
|
|
871 |
] |
|
|
872 |
}, |
|
|
873 |
{ |
|
|
874 |
"cell_type": "code", |
|
|
875 |
"execution_count": 39, |
|
|
876 |
"metadata": {}, |
|
|
877 |
"outputs": [ |
|
|
878 |
{ |
|
|
879 |
"name": "stdout", |
|
|
880 |
"output_type": "stream", |
|
|
881 |
"text": [ |
|
|
882 |
"Okay Bro\n", |
|
|
883 |
"You said: latest ringtone\n", |
|
|
884 |
"\n", |
|
|
885 |
"- Thank you kindly. How are you feeling today?\n", |
|
|
886 |
"Okay Bro\n", |
|
|
887 |
"Your last instruction was unclear to me\n", |
|
|
888 |
"Okay Bro\n", |
|
|
889 |
"Your last instruction was unclear to me\n", |
|
|
890 |
"Okay Bro\n", |
|
|
891 |
"You said: i have settled in the meaning in hindi\n", |
|
|
892 |
"\n", |
|
|
893 |
"- - What are your interests\n", |
|
|
894 |
"Okay Bro\n", |
|
|
895 |
"Your last instruction was unclear to me\n", |
|
|
896 |
"Okay Bro\n", |
|
|
897 |
"Your last instruction was unclear to me\n", |
|
|
898 |
"Okay Bro\n", |
|
|
899 |
"Your last instruction was unclear to me\n", |
|
|
900 |
"Okay Bro\n", |
|
|
901 |
"You said: cold\n", |
|
|
902 |
"\n", |
|
|
903 |
"- You should take a sudafed tablet after your meal.\n", |
|
|
904 |
"Okay Bro\n" |
|
|
905 |
] |
|
|
906 |
}, |
|
|
907 |
{ |
|
|
908 |
"ename": "KeyboardInterrupt", |
|
|
909 |
"evalue": "", |
|
|
910 |
"output_type": "error", |
|
|
911 |
"traceback": [ |
|
|
912 |
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", |
|
|
913 |
"\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", |
|
|
914 |
"\u001b[1;32m<ipython-input-39-4d7ef7dbb8f0>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 71\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 72\u001b[0m \u001b[1;32mwhile\u001b[0m \u001b[1;32mTrue\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 73\u001b[1;33m \u001b[0mvalue\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mget_bot_response\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmyCommand\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 74\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mvalue\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
915 |
"\u001b[1;32m<ipython-input-39-4d7ef7dbb8f0>\u001b[0m in \u001b[0;36mmyCommand\u001b[1;34m()\u001b[0m\n\u001b[0;32m 42\u001b[0m \u001b[0mr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mpause_treshold\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 43\u001b[0m \u001b[0mr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0madjust_for_ambient_noise\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msource\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mduration\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 44\u001b[1;33m \u001b[0maudio\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlisten\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msource\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 45\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 46\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
916 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\speech_recognition\\__init__.py\u001b[0m in \u001b[0;36mlisten\u001b[1;34m(self, source, timeout, phrase_time_limit, snowboy_configuration)\u001b[0m\n\u001b[0;32m 650\u001b[0m \u001b[1;32mbreak\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 651\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 652\u001b[1;33m \u001b[0mbuffer\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0msource\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstream\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msource\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mCHUNK\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 653\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mbuffer\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;32mbreak\u001b[0m \u001b[1;31m# reached end of the stream\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 654\u001b[0m \u001b[0mframes\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mbuffer\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
917 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\speech_recognition\\__init__.py\u001b[0m in \u001b[0;36mread\u001b[1;34m(self, size)\u001b[0m\n\u001b[0;32m 159\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 160\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mread\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0msize\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 161\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mpyaudio_stream\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msize\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mexception_on_overflow\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mFalse\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 162\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 163\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mclose\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
918 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\pyaudio.py\u001b[0m in \u001b[0;36mread\u001b[1;34m(self, num_frames, exception_on_overflow)\u001b[0m\n\u001b[0;32m 606\u001b[0m paCanNotReadFromAnOutputOnlyStream)\n\u001b[0;32m 607\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 608\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mpa\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread_stream\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_stream\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnum_frames\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mexception_on_overflow\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 609\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 610\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mget_read_available\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
919 |
"\u001b[1;31mKeyboardInterrupt\u001b[0m: " |
|
|
920 |
] |
|
|
921 |
} |
|
|
922 |
], |
|
|
923 |
"source": [ |
|
|
924 |
"from flask import Flask, render_template, request\n", |
|
|
925 |
"from chatterbot import ChatBot\n", |
|
|
926 |
"from chatterbot.trainers import ChatterBotCorpusTrainer\n", |
|
|
927 |
"import os\n", |
|
|
928 |
"from gtts import gTTS\n", |
|
|
929 |
"import speech_recognition as sr\n", |
|
|
930 |
"import os\n", |
|
|
931 |
"import re\n", |
|
|
932 |
"import webbrowser\n", |
|
|
933 |
"import smtplib\n", |
|
|
934 |
"import requests\n", |
|
|
935 |
"from win32com.client import Dispatch\n", |
|
|
936 |
"speak = Dispatch(\"SAPI.SpVoice\")\n", |
|
|
937 |
"from chatterbot import ChatBot\n", |
|
|
938 |
"from chatterbot.trainers import ListTrainer\n", |
|
|
939 |
"\n", |
|
|
940 |
"filenumber=int(os.listdir('saved_conversations')[-1])\n", |
|
|
941 |
"filenumber=filenumber+1\n", |
|
|
942 |
"file= open('saved_conversations/'+str(filenumber),\"w+\")\n", |
|
|
943 |
"file.write('bot : Hi There! I am a medical chatbot. You can begin conversation by typing in a message or saying it.\\n')\n", |
|
|
944 |
"file.close()\n", |
|
|
945 |
"\n", |
|
|
946 |
"print(\"Hi\")\n", |
|
|
947 |
"speak.Speak(\"Hey There! I am a medical chatbot. You can begin conversation.\")\n", |
|
|
948 |
"\n", |
|
|
949 |
"\n", |
|
|
950 |
"english_bot = ChatBot('Bot',\n", |
|
|
951 |
" storage_adapter='chatterbot.storage.SQLStorageAdapter',\n", |
|
|
952 |
" logic_adapters=[\n", |
|
|
953 |
" {\n", |
|
|
954 |
" 'import_path': 'chatterbot.logic.BestMatch'\n", |
|
|
955 |
" },\n", |
|
|
956 |
" \n", |
|
|
957 |
"],\n", |
|
|
958 |
"trainer='chatterbot.trainers.ListTrainer')\n", |
|
|
959 |
"english_bot.set_trainer(ListTrainer)\n", |
|
|
960 |
"\n", |
|
|
961 |
"\n", |
|
|
962 |
"def myCommand():\n", |
|
|
963 |
" r = sr.Recognizer()\n", |
|
|
964 |
"\n", |
|
|
965 |
" with sr.Microphone() as source:\n", |
|
|
966 |
" print('I am listenong')\n", |
|
|
967 |
" speak.Speak(\"I am listening\")\n", |
|
|
968 |
" r.pause_treshold = 1\n", |
|
|
969 |
" r.adjust_for_ambient_noise(source, duration = 1)\n", |
|
|
970 |
" audio = r.listen(source)\t\n", |
|
|
971 |
"\n", |
|
|
972 |
" try:\n", |
|
|
973 |
" command = r.recognize_google(audio).lower()\n", |
|
|
974 |
" print('You said: '+ command + '\\n')\n", |
|
|
975 |
" speak.Speak(\"You said: \"+ command)\n", |
|
|
976 |
"\n", |
|
|
977 |
" except sr.UnknownValueError:\n", |
|
|
978 |
" print('Your last instruction was unclear to me')\n", |
|
|
979 |
" speak.Speak(\"Your last instruction was unclear to me\")\n", |
|
|
980 |
" command = myCommand();\n", |
|
|
981 |
"\n", |
|
|
982 |
" return command \n", |
|
|
983 |
"\n", |
|
|
984 |
"\n", |
|
|
985 |
"def get_bot_response(command):\n", |
|
|
986 |
" #userText = request.args.get('msg')\n", |
|
|
987 |
" response = str(english_bot.get_response(command))\n", |
|
|
988 |
" speak.Speak(response)\n", |
|
|
989 |
"\n", |
|
|
990 |
" appendfile=os.listdir('saved_conversations')[-1]\n", |
|
|
991 |
" appendfile= open('saved_conversations/'+str(filenumber),\"a\")\n", |
|
|
992 |
" appendfile.write('user : '+command+'\\n')\n", |
|
|
993 |
" appendfile.write('bot : '+response+'\\n')\n", |
|
|
994 |
" appendfile.close()\n", |
|
|
995 |
" return response\n", |
|
|
996 |
"\n", |
|
|
997 |
"\n", |
|
|
998 |
"while True:\n", |
|
|
999 |
" value=get_bot_response(myCommand())\n", |
|
|
1000 |
" print(value)" |
|
|
1001 |
] |
|
|
1002 |
}, |
|
|
1003 |
{ |
|
|
1004 |
"cell_type": "code", |
|
|
1005 |
"execution_count": null, |
|
|
1006 |
"metadata": {}, |
|
|
1007 |
"outputs": [], |
|
|
1008 |
"source": [ |
|
|
1009 |
"Yay!" |
|
|
1010 |
] |
|
|
1011 |
}, |
|
|
1012 |
{ |
|
|
1013 |
"cell_type": "code", |
|
|
1014 |
"execution_count": null, |
|
|
1015 |
"metadata": {}, |
|
|
1016 |
"outputs": [], |
|
|
1017 |
"source": [ |
|
|
1018 |
"trying to display as html file." |
|
|
1019 |
] |
|
|
1020 |
}, |
|
|
1021 |
{ |
|
|
1022 |
"cell_type": "code", |
|
|
1023 |
"execution_count": 45, |
|
|
1024 |
"metadata": {}, |
|
|
1025 |
"outputs": [ |
|
|
1026 |
{ |
|
|
1027 |
"name": "stdout", |
|
|
1028 |
"output_type": "stream", |
|
|
1029 |
"text": [ |
|
|
1030 |
"Hi\n", |
|
|
1031 |
"I am listening\n", |
|
|
1032 |
"You said: i feel dizzy\n", |
|
|
1033 |
"\n", |
|
|
1034 |
"- This might be because you are tired, you should take some rest.\n", |
|
|
1035 |
"I am listening\n", |
|
|
1036 |
"You said: thank you\n", |
|
|
1037 |
"\n", |
|
|
1038 |
"- happy to help!\n", |
|
|
1039 |
"I am listening\n" |
|
|
1040 |
] |
|
|
1041 |
}, |
|
|
1042 |
{ |
|
|
1043 |
"ename": "KeyboardInterrupt", |
|
|
1044 |
"evalue": "", |
|
|
1045 |
"output_type": "error", |
|
|
1046 |
"traceback": [ |
|
|
1047 |
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", |
|
|
1048 |
"\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", |
|
|
1049 |
"\u001b[1;32m<ipython-input-45-a11162ca3415>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 82\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 83\u001b[0m \u001b[1;32mwhile\u001b[0m \u001b[1;32mTrue\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 84\u001b[1;33m \u001b[0mvalue\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mget_bot_response\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmyCommand\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 85\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mvalue\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 86\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
1050 |
"\u001b[1;32m<ipython-input-45-a11162ca3415>\u001b[0m in \u001b[0;36mmyCommand\u001b[1;34m()\u001b[0m\n\u001b[0;32m 53\u001b[0m \u001b[0mr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mpause_treshold\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 54\u001b[0m \u001b[0mr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0madjust_for_ambient_noise\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msource\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mduration\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 55\u001b[1;33m \u001b[0maudio\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlisten\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msource\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 56\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 57\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
1051 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\speech_recognition\\__init__.py\u001b[0m in \u001b[0;36mlisten\u001b[1;34m(self, source, timeout, phrase_time_limit, snowboy_configuration)\u001b[0m\n\u001b[0;32m 650\u001b[0m \u001b[1;32mbreak\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 651\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 652\u001b[1;33m \u001b[0mbuffer\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0msource\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstream\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msource\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mCHUNK\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 653\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mbuffer\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;32mbreak\u001b[0m \u001b[1;31m# reached end of the stream\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 654\u001b[0m \u001b[0mframes\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mbuffer\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
1052 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\speech_recognition\\__init__.py\u001b[0m in \u001b[0;36mread\u001b[1;34m(self, size)\u001b[0m\n\u001b[0;32m 159\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 160\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mread\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0msize\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 161\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mpyaudio_stream\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msize\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mexception_on_overflow\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mFalse\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 162\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 163\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mclose\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
1053 |
"\u001b[1;32m~\\anaconda3-new\\lib\\site-packages\\pyaudio.py\u001b[0m in \u001b[0;36mread\u001b[1;34m(self, num_frames, exception_on_overflow)\u001b[0m\n\u001b[0;32m 606\u001b[0m paCanNotReadFromAnOutputOnlyStream)\n\u001b[0;32m 607\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 608\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mpa\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread_stream\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_stream\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnum_frames\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mexception_on_overflow\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 609\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 610\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mget_read_available\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", |
|
|
1054 |
"\u001b[1;31mKeyboardInterrupt\u001b[0m: " |
|
|
1055 |
] |
|
|
1056 |
} |
|
|
1057 |
], |
|
|
1058 |
"source": [ |
|
|
1059 |
"from flask import Flask, render_template, request\n", |
|
|
1060 |
"from chatterbot import ChatBot\n", |
|
|
1061 |
"from chatterbot.trainers import ChatterBotCorpusTrainer\n", |
|
|
1062 |
"import os\n", |
|
|
1063 |
"from gtts import gTTS\n", |
|
|
1064 |
"import speech_recognition as sr\n", |
|
|
1065 |
"import os\n", |
|
|
1066 |
"import re\n", |
|
|
1067 |
"import webbrowser\n", |
|
|
1068 |
"import smtplib\n", |
|
|
1069 |
"import requests\n", |
|
|
1070 |
"from win32com.client import Dispatch\n", |
|
|
1071 |
"speak = Dispatch(\"SAPI.SpVoice\")\n", |
|
|
1072 |
"from chatterbot import ChatBot\n", |
|
|
1073 |
"from chatterbot.trainers import ListTrainer\n", |
|
|
1074 |
"\n", |
|
|
1075 |
"filenumber=int(os.listdir('saved_conversations')[-1])\n", |
|
|
1076 |
"filenumber=filenumber+1\n", |
|
|
1077 |
"file= open('saved_conversations/'+str(filenumber),\"w+\")\n", |
|
|
1078 |
"file.write('bot : Hi There! I am a medical chatbot. You can begin conversation by typing in a message and pressing enter or by saying it.\\n')\n", |
|
|
1079 |
"file.close()\n", |
|
|
1080 |
"\n", |
|
|
1081 |
"print(\"Hi\")\n", |
|
|
1082 |
"speak.Speak(\"Hey There! I am a medical chatbot. You can begin conversation.\")\n", |
|
|
1083 |
"\n", |
|
|
1084 |
"app = Flask(__name__)\n", |
|
|
1085 |
"\n", |
|
|
1086 |
"\n", |
|
|
1087 |
"\n", |
|
|
1088 |
"english_bot = ChatBot('Bot',\n", |
|
|
1089 |
" storage_adapter='chatterbot.storage.SQLStorageAdapter',\n", |
|
|
1090 |
" logic_adapters=[\n", |
|
|
1091 |
" {\n", |
|
|
1092 |
" 'import_path': 'chatterbot.logic.BestMatch'\n", |
|
|
1093 |
" },\n", |
|
|
1094 |
" \n", |
|
|
1095 |
"],\n", |
|
|
1096 |
"trainer='chatterbot.trainers.ListTrainer')\n", |
|
|
1097 |
"english_bot.set_trainer(ListTrainer)\n", |
|
|
1098 |
"\n", |
|
|
1099 |
"\n", |
|
|
1100 |
"\n", |
|
|
1101 |
"@app.route(\"/\")\n", |
|
|
1102 |
"def home():\n", |
|
|
1103 |
" return render_template(\"index.html\")\n", |
|
|
1104 |
"\n", |
|
|
1105 |
"def myCommand():\n", |
|
|
1106 |
" r = sr.Recognizer()\n", |
|
|
1107 |
"\n", |
|
|
1108 |
" with sr.Microphone() as source:\n", |
|
|
1109 |
" print('I am listening')\n", |
|
|
1110 |
" speak.Speak(\"I am listening\")\n", |
|
|
1111 |
" r.pause_treshold = 1\n", |
|
|
1112 |
" r.adjust_for_ambient_noise(source, duration = 1)\n", |
|
|
1113 |
" audio = r.listen(source)\t\n", |
|
|
1114 |
"\n", |
|
|
1115 |
" try:\n", |
|
|
1116 |
" command = r.recognize_google(audio).lower()\n", |
|
|
1117 |
" print('You said: '+ command + '\\n')\n", |
|
|
1118 |
" speak.Speak(\"You said: \"+ command)\n", |
|
|
1119 |
"\n", |
|
|
1120 |
" except sr.UnknownValueError:\n", |
|
|
1121 |
" print('Your last instruction was unclear to me')\n", |
|
|
1122 |
" speak.Speak(\"Your last instruction was unclear to me\")\n", |
|
|
1123 |
" command = myCommand();\n", |
|
|
1124 |
"\n", |
|
|
1125 |
" return command \n", |
|
|
1126 |
"\n", |
|
|
1127 |
"@app.route(\"/get\")\n", |
|
|
1128 |
"def get_bot_response(command):\n", |
|
|
1129 |
" #userText = request.args.get('msg')\n", |
|
|
1130 |
" response = str(english_bot.get_response(command))\n", |
|
|
1131 |
" speak.Speak(response)\n", |
|
|
1132 |
"\n", |
|
|
1133 |
" appendfile=os.listdir('saved_conversations')[-1]\n", |
|
|
1134 |
" appendfile= open('saved_conversations/'+str(filenumber),\"a\")\n", |
|
|
1135 |
" appendfile.write('user : '+command+'\\n')\n", |
|
|
1136 |
" appendfile.write('bot : '+response+'\\n')\n", |
|
|
1137 |
" appendfile.close()\n", |
|
|
1138 |
" return response\n", |
|
|
1139 |
"\n", |
|
|
1140 |
"\n", |
|
|
1141 |
"while True:\n", |
|
|
1142 |
" value=get_bot_response(myCommand())\n", |
|
|
1143 |
" print(value)\n", |
|
|
1144 |
"\n", |
|
|
1145 |
"\n", |
|
|
1146 |
"# if __name__ == \"__main__\":\n", |
|
|
1147 |
"# app.run()\n" |
|
|
1148 |
] |
|
|
1149 |
}, |
|
|
1150 |
{ |
|
|
1151 |
"cell_type": "code", |
|
|
1152 |
"execution_count": null, |
|
|
1153 |
"metadata": {}, |
|
|
1154 |
"outputs": [], |
|
|
1155 |
"source": [] |
|
|
1156 |
} |
|
|
1157 |
], |
|
|
1158 |
"metadata": { |
|
|
1159 |
"kernelspec": { |
|
|
1160 |
"display_name": "Python 3", |
|
|
1161 |
"language": "python", |
|
|
1162 |
"name": "python3" |
|
|
1163 |
}, |
|
|
1164 |
"language_info": { |
|
|
1165 |
"codemirror_mode": { |
|
|
1166 |
"name": "ipython", |
|
|
1167 |
"version": 3 |
|
|
1168 |
}, |
|
|
1169 |
"file_extension": ".py", |
|
|
1170 |
"mimetype": "text/x-python", |
|
|
1171 |
"name": "python", |
|
|
1172 |
"nbconvert_exporter": "python", |
|
|
1173 |
"pygments_lexer": "ipython3", |
|
|
1174 |
"version": "3.7.6" |
|
|
1175 |
} |
|
|
1176 |
}, |
|
|
1177 |
"nbformat": 4, |
|
|
1178 |
"nbformat_minor": 4 |
|
|
1179 |
} |