├── .github └── ISSUE_TEMPLATE │ └── generic-issue.md ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── db.sqlite3 ├── entities ├── __init__.py ├── ent_base_model.py ├── ent_chat_keyword.py ├── ent_enabled_module.py └── ent_enabled_module_has_chat_keyword.py ├── global_constants.py ├── main.py ├── mgr ├── mgr_db.py └── mgr_voices.py ├── modules ├── __init__.py ├── get_random_fact │ ├── __init__.py │ ├── conf.py │ └── get_random_fact.py ├── get_random_question │ ├── __init__.py │ ├── conf.py │ └── get_random_question.py └── get_welcome_msg │ ├── __init__.py │ ├── conf.py │ └── get_welcome_msg.py ├── setup.py └── starterkit ├── abstr_answer.py └── fallback_module ├── conf.py └── get_smart_answer.py /.github/ISSUE_TEMPLATE/generic-issue.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Generic issue 3 | about: 'Recommended for all sorts of issues. ' 4 | 5 | --- 6 | 7 | - {Short description in 1-3 sentences} 8 | - {Describe the problem, new feature or what you want to change} 9 | - {Describe a possible solution to that problem, feature or desired code} 10 | - {Code or other facts to reproduce the issue} *(OPTIONAL, but strongly recommended)* 11 | - {Add a list of files which might need to be changed in order to implement the new feature/solve the bug. Please append the "py" filetype (Human.py) so we can avoid confusions. If a file hasn't been created yet, then you can use a recommended name by adding the [N] cue to it. (e.g.: Human.py[N])} *(OPTIONAL)* 12 | - {Maybe also add videos/pictures} *(OPTIONAL)* 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # sensitive content 2 | /secrets/secrets.py 3 | # db.sqlite3 PUSH DATABASE AS TRAINED 4 | 5 | # Byte-compiled / optimized / DLL files 6 | __pycache__/ 7 | *.py[cod] 8 | *$py.class 9 | /.idea/ 10 | 11 | # C extensions 12 | *.so 13 | 14 | # Distribution / packaging 15 | .Python 16 | build/ 17 | develop-eggs/ 18 | dist/ 19 | downloads/ 20 | eggs/ 21 | .eggs/ 22 | lib/ 23 | lib64/ 24 | parts/ 25 | sdist/ 26 | var/ 27 | wheels/ 28 | *.egg-info/ 29 | .installed.cfg 30 | *.egg 31 | MANIFEST 32 | 33 | # PyInstaller 34 | # Usually these files are written by a python script from a template 35 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 36 | *.manifest 37 | *.spec 38 | 39 | # Installer logs 40 | pip-log.txt 41 | pip-delete-this-directory.txt 42 | 43 | # Unit test / coverage reports 44 | htmlcov/ 45 | .tox/ 46 | .coverage 47 | .coverage.* 48 | .cache 49 | nosetests.xml 50 | coverage.xml 51 | *.cover 52 | .hypothesis/ 53 | .pytest_cache/ 54 | 55 | # Translations 56 | *.mo 57 | *.pot 58 | 59 | # Django stuff: 60 | *.log 61 | local_settings.py 62 | db.sqlite3-shm 63 | db.sqlite3-wal 64 | 65 | # Flask stuff: 66 | instance/ 67 | .webassets-cache 68 | 69 | # Scrapy stuff: 70 | .scrapy 71 | 72 | # Sphinx documentation 73 | docs/_build/ 74 | 75 | # PyBuilder 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # pyenv 82 | .python-version 83 | 84 | # celery beat schedule file 85 | celerybeat-schedule 86 | 87 | # SageMath parsed files 88 | *.sage.py 89 | 90 | # Environments 91 | .env 92 | .venv 93 | env/ 94 | venv/ 95 | ENV/ 96 | env.bak/ 97 | venv.bak/ 98 | 99 | # Spyder project settings 100 | .spyderproject 101 | .spyproject 102 | 103 | # Rope project settings 104 | .ropeproject 105 | 106 | # mkdocs documentation 107 | /site 108 | 109 | # mypy 110 | .mypy_cache/ 111 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Before you build you should have the CONFIDENTIAL.py in your current dir 2 | 3 | # Install dependencies 4 | FROM python:3 5 | MAINTAINER Kevin Riedl (WSDT) 6 | 7 | RUN python -m pip install --upgrade pip setuptools wheel && apt-get update && \ 8 | apt-get install -y build-essential swig git libpulse-dev libasound2-dev espeak && \ 9 | pip install --upgrade pocketsphinx && \ 10 | pip install chatterbot && \ 11 | pip install pyttsx3 && \ 12 | pip install peewee && \ 13 | git clone https://github.com/wsdt/Python_Voice_Chatbot.git && \ 14 | cd Python_Voice_Chatbot&&python setup.py 15 | 16 | 17 | # Collect newest version and then start bot 18 | CMD cd Python_Voice_Chatbot&&git pull&&python main.py 19 | 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Python_Voice_Chatbot [![Maintenance](https://img.shields.io/badge/Maintained%3F-no-red.svg)](https://bitbucket.org/lbesson/ansi-colors) [![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) [![GitHub license](https://img.shields.io/github/license/wsdt/Python_Voice_Chatbot.svg)](https://github.com/wsdt/Python_Voice_Chatbot/blob/master/LICENSE) [![Generic badge](https://img.shields.io/badge/Docker-Compatible-blue.svg)](https://www.docker.com/) [![Donate](https://img.shields.io/badge/Donate-Pay%20me%20a%20coffee-3cf)](https://github.com/wsdt/Global/wiki/Donation) [![saythanks](https://img.shields.io/badge/say-thanks-ff69b4.svg)](https://saythanks.io/to/kevin.riedl.privat%40gmail.com) 2 | 3 | Easy to use *modular* chatbot to talk to, get information from etc. (depends on enabled modules) and the best of all **keeping your data private/locally**. Therefore, the assistant can operate offline except by the use of some modules (e.g. weather module, etc.). Would love to see some reactions (issues, pull-requests, etc.). Please note, that this project is young and has not all featured functionalities. 4 | This application uses the Chatterbot framework. 5 | 6 | ## How to get started 7 | To get your home assistant running you just have to take 1-2 steps (depends on whether you started the assistant before). 8 | 1. Execute *setup.py* once, if you newly downloaded this assistant 9 | 1. Execute *main.py* 10 | 11 | Above steps will work assuming that you have all python libraries installed. Considering this I recommend using Docker, for that I have provided a [Dockerfile](https://github.com/wsdt/Python_Voice_Chatbot/blob/master/Dockerfile). 12 | 13 | ### Docker-Ready 14 | To start the bot without any complications I made a [Dockerfile](https://github.com/wsdt/Python_Voice_Chatbot/blob/master/Dockerfile) for you guys. You will find this project also on [Dockerhub (hub.docker.com/r/wsdt/python_voice_chatbot)](https://hub.docker.com/r/wsdt/python_voice_chatbot). Therefore you have two options to build the docker image: 15 | 1. Build docker image 16 | - Build the dockerfile yourself/locally. 17 | ``` docker build -t wsdt/python_voice_chatbot . ``` 18 | **OR** 19 | - You can also download the pre-compiled image from Dockerhub. Just pull the existing docker image (gets built every time a contributor pushes on Github). 20 | ``` docker pull wsdt/python_voice_chatbot ``` 21 | 1. Start a new container out of the newly created/built image: 22 | ``` docker run wsdt/python_voice_chatbot ``` 23 | 1. Verify that the container is running by: 24 | ``` docker ps -a ``` 25 | 26 | For more detailed information I recommend you to look through the [Docker-documentation](https://docs.docker.com/). 27 | 28 | ## Contribution [![Open Source Love svg2](https://badges.frapsoft.com/os/v2/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badges/) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) 29 | 30 | This project is licensed under GNU V3, so contributions/pull-requests are welcome. All contributors get listed here. 31 | 32 | **Contributors** 33 | - Kevin Riedl ([WSDT](https://github.com/wsdt)) 34 | 35 | ### How to contribute 36 | To create new modules or changing/extending the application core, please take a look into following files, which are well commented (Better documentation follows): 37 | 1. ./starterkit/abstr_answer.py --> How to create a new module 38 | 1. ./setup.py --> How to install this assistant 39 | 40 | Project not maintained due to other projects, which tried to do the same. 41 | 42 | ### How to add an issue 43 | 1. **Add a good title to your issue.** Please use a concise and precise title. 44 | * *BAD*: "ServiceMgr" 45 | * *GOOD*: "Redesign/Improve ServiceMgr" 46 | 2. **Add a good description to your issue.** Your description doesn't need to be concise, but should be clear/understandable and provide enough information for other contributors to solve the issue. For that I provided an issue template. 47 | 48 | ## Python_Chatbot 49 | You might have seen that I published also a quite similar repository called Python_Telegram_Chatbot [https://github.com/wsdt/Python_Telegram_Chatbot]. The Python_Chatbot repository is only a simple chatbot for your Telegram app, which can conversate with you and has some additional features like some information about your Instagram account, random quotes/pics/questions etc. 50 | 51 | In contrast to that **this** repository provides are more modular interface and does not communicate via Telegram, but via voice with you. 52 | -------------------------------------------------------------------------------- /db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsdt/Python_Voice_Chatbot/99ccd095eabcc15ffb1143eca37ace2ce74dc82b/db.sqlite3 -------------------------------------------------------------------------------- /entities/__init__.py: -------------------------------------------------------------------------------- 1 | from entities.ent_enabled_module import EnabledModule 2 | from entities.ent_chat_keyword import ChatKeyword 3 | from entities.ent_enabled_module_has_chat_keyword import EnabledModuleHasChatKeyword -------------------------------------------------------------------------------- /entities/ent_base_model.py: -------------------------------------------------------------------------------- 1 | from peewee import * 2 | from starterkit.fallback_module.conf import db 3 | 4 | # Create base model to keep code leaner 5 | class BaseModel(Model): 6 | class Meta: 7 | # Determine which db to use 8 | database = db 9 | -------------------------------------------------------------------------------- /entities/ent_chat_keyword.py: -------------------------------------------------------------------------------- 1 | from peewee import * 2 | from entities.ent_base_model import BaseModel 3 | 4 | class ChatKeyword(BaseModel): 5 | chat_keyword = CharField(unique=True) -------------------------------------------------------------------------------- /entities/ent_enabled_module.py: -------------------------------------------------------------------------------- 1 | from peewee import * 2 | from entities.ent_base_model import BaseModel 3 | 4 | # IMPORTANT: Peewee automatically creates an id (integer) field as primary key 5 | class EnabledModule(BaseModel): 6 | class_name = CharField(unique=True) 7 | custom_json_settings = TextField() -------------------------------------------------------------------------------- /entities/ent_enabled_module_has_chat_keyword.py: -------------------------------------------------------------------------------- 1 | from peewee import * 2 | from entities.ent_base_model import BaseModel 3 | from entities.ent_chat_keyword import ChatKeyword 4 | from entities.ent_enabled_module import EnabledModule 5 | 6 | """ Auflösungstabelle (N:M) for EnabledModule and ChatKeyword 7 | by using automatically created id field. """ 8 | class EnabledModuleHasChatKeyword(BaseModel): 9 | enabled_module_id = ForeignKeyField(EnabledModule) 10 | chat_keyword_id = ForeignKeyField(ChatKeyword) #, to_field="id" -------------------------------------------------------------------------------- /global_constants.py: -------------------------------------------------------------------------------- 1 | # DO NOT PUT ANY LOGIC IN THIS FILE 2 | 3 | # (MUST NOT BE CHANGED!) -> bound due to chatterBot 4 | DB_NAME = "db.sqlite3" -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | import os, sys 3 | from global_constants import DB_NAME 4 | 5 | # Catch before other imports to avoid confusing error msgs 6 | if not os.path.exists(DB_NAME): 7 | sys.exit("ERROR: No database detected. Please execute setup.py first!") 8 | 9 | from mgr.mgr_voices import live_speech 10 | from peewee import * 11 | 12 | 13 | 14 | def main(): 15 | # Start Voice Recognition 16 | live_speech() 17 | 18 | 19 | if __name__ == '__main__': 20 | main() 21 | -------------------------------------------------------------------------------- /mgr/mgr_db.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from peewee import * 3 | 4 | # TODO: Import all modules dynamically 5 | from modules.get_welcome_msg.get_welcome_msg import get_welcome_msg 6 | from modules.get_random_question.get_random_question import get_random_question 7 | from modules.get_random_fact.get_random_fact import get_random_fact 8 | from entities.ent_enabled_module import EnabledModule 9 | 10 | def db_loadEnabledModules(): 11 | enabled_modules = [] 12 | for module in EnabledModule.select(): 13 | enabled_modules.append( 14 | # str to class 15 | getattr(sys.modules[__name__], module.class_name)() # make instance out of class 16 | ) 17 | return enabled_modules 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /mgr/mgr_voices.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | from starterkit.fallback_module.get_smart_answer import get_smart_answer 3 | from mgr.mgr_db import db_loadEnabledModules 4 | 5 | # Speech to Text and reverse 6 | import speech_recognition as sr 7 | r = sr.Recognizer() 8 | import pyttsx3 9 | 10 | ENABLED_MODULES = db_loadEnabledModules() # do only once for better performance 11 | FALLBACK_MODULE = get_smart_answer() # shouldn't be changed, unless you know what you are doing 12 | 13 | # OUTPUT / Assistant Voice/Response +++++++++++++++ 14 | assistantVoice = pyttsx3.init() 15 | 16 | # TODO: Make this dynamic, by saving it to the database and letting the user decide when he wants 17 | def configureAssistantVoice(): 18 | # Set voice 19 | assistantVoice.setProperty('voice', "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\TTS_MS_EN-US_DAVID_11.0") 20 | 21 | # Set speech rate (slow down so it's clearer [might be too slow/fast for other voices]) 22 | assistantVoice.setProperty('rate',assistantVoice.getProperty('rate')-50) 23 | 24 | def getAssistantResponse(phrase): 25 | have_answered = False 26 | answer = "Unknown error" 27 | for module in ENABLED_MODULES: 28 | # text should be always a str, bc. we validated this in main.py 29 | if any(x in str(phrase) for x in module.getChatKeywords()): 30 | answer = str(module.getAnswer(phrase)) 31 | have_answered = True 32 | 33 | # Outside of for, so if nothing is returned we get a smart answer, but only if nothing answered until now 34 | if not have_answered: answer = str(FALLBACK_MODULE.getAnswer(phrase)) 35 | 36 | print("Assistant response: \""+answer+"\"") 37 | assistantVoice.say(answer) 38 | assistantVoice.runAndWait() 39 | 40 | 41 | # INPUT / Users Voice/Response +++++++++++++++ 42 | def live_speech(): 43 | print("Starting speech recognition.") 44 | 45 | # https://github.com/Uberi/speech_recognition/blob/master/reference/library-reference.rst 46 | with sr.Microphone() as source: 47 | while True: 48 | try: 49 | audio = r.listen(source,phrase_time_limit=10) # listen to source 50 | # use testing api key 51 | text = r.recognize_google(audio, language="en-US") 52 | print("Users message: '{}'".format(text)) 53 | getAssistantResponse(text) 54 | except sr.UnknownValueError: 55 | print("Sorry, I could not understand you.") 56 | except sr.RequestError: 57 | print("API call failed. Key valid? Internet connection?") 58 | 59 | # CONFIGURATION ++++++++++++++++++++++++++++++ 60 | try: 61 | configureAssistantVoice() 62 | except: 63 | print("VoiceMgr: Could not configure assistants speech. Using default settings.") -------------------------------------------------------------------------------- /modules/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | # Automatically imports all modu 4 | for module in os.listdir(os.path.dirname(__file__)): 5 | if module == '__init__.py' or os.path.isdir(__file__): 6 | continue 7 | __import__("modules."+module, locals(), globals()) 8 | del module # remove from scope 9 | -------------------------------------------------------------------------------- /modules/get_random_fact/__init__.py: -------------------------------------------------------------------------------- 1 | import modules.get_random_fact.conf 2 | import modules.get_random_fact.get_random_fact -------------------------------------------------------------------------------- /modules/get_random_fact/conf.py: -------------------------------------------------------------------------------- 1 | from entities.ent_enabled_module import EnabledModule 2 | from entities.ent_chat_keyword import ChatKeyword 3 | from modules.get_random_fact.get_random_fact import get_random_fact 4 | 5 | ENABLED_MODULE = EnabledModule ( 6 | class_name=get_random_fact().getStrClassName(), 7 | custom_json_settings={ 8 | "random_facts": [ 9 | "The way get started is to quit talking and begin doing. (Walt Disney)", 10 | "The pessimist sees difficulty in every opportunity. The optimist sees opportunity in every difficulty. (Winston Churchill)", 11 | "Don't let yesterday take up too much of today. (Will Rogers)", 12 | "You learn more from failure than from success. Don't let it stop you. Failure build character.", 13 | "It's not whether you get knocked down, it's whether you get up. (Vince Lombardi)", 14 | "If you are working on something that you really care about, you don't have to be pushed. The vision pulls you. (Steve Jobs)", 15 | "People who are crazy enough to think they can change the world, are the ones who do. (Rob Siltanen)", 16 | "Failure will never overtake me if my determination to succeed is strong enough. (Og Mandino)", 17 | "Entrepreneurs are great at dealing with uncertainty and also very good at minimizing risk. That's the classic entrepreneur. (Mohnish Pabrai)", 18 | "We may encounter many defeats but we must not be defeated. (Maya Angelou)", 19 | "Knowing is not enough; We must apply. Wishing is not enough; We must do. (Johann Wolfgang von Goethe)", 20 | "Imagine your life is perfect in every respect; What would it look like? (Brian Tracy)", 21 | "We generate fears while we sit. We overcome them by action. (Dr. Henry Link)", 22 | "Whether you think you can or think you can't, you're right. (Henry Ford)", 23 | "Security is mostly a superstition. Life is either a daring adventure or nothing. (Helen Keller)", 24 | "The man who has confidence in himself gains the confidence of others. (Hasidic Proverb)", 25 | "The only limit to our realization of tomorrow will be our doubts of today. (Franklin D. Roosevelt)", 26 | "Creativity is intelligence having fun. (Albert Einstein)", 27 | "What you lack in talent can be made up with desire, hustle and giving 110 % all the time. (Don Zimmer)", 28 | "Do what you can with all you have, wherever you are. (Theodore Roosevelt)", 29 | "Develop an attitude of gratitude. Say thank you to everyone you meet for everything they do for you. (Brian Tracy)", 30 | "You are never too old to set another goal or to dream a new dream. (C.S. Lewis)", 31 | "To see what is right and not do it is a lack of courage. (Confucious)", 32 | "Reading is to the mind, as exercise to the body. (Brian Tracy)", 33 | "Fake it until you make it! Act as if you had all the confidence you require until it becomes your reality. (Brian Tracy)", 34 | "The future belong to the competent. Get good, get better, be the best! (Brian Tracy)", 35 | "For every reason it's not possible, there are hundreds of people who have faced the same circumstances and succeeded. (Jack Canfield)", 36 | "Things work out best for those who make the best of how things work out. (John Wooden)", 37 | "A room without books is like a body without a soul. (Marcus Tullius Cicero)", 38 | "I think goals should never be easy, they should force you to work, even if they are uncomfortable at the time. (Michael Phelps)", 39 | "One of the lessons that I grew up with was to always stay true to yourself and never let what somebody else days distracts you from your goals. (Michelle Obama)", 40 | "Today's accomplishments were yesterday's impossibilities. (Robert H. Schuller)", 41 | "The only way to do great work is to love what you do. If you haven't found it yet, keep looking. Don't settle. (Steve Jobs)", 42 | "You Don’t Have To Be Great To Start, But You Have To Start To Be Great. (Zig Ziglar)", 43 | "A Clear Vision, Backed By Definite Plans, Gives You A Tremendous Feeling Of Confidence And Personal Power. (Brian Tracy)", 44 | "There Are No Limits To What You Can Accomplish, Except The Limits You Place On Your Own Thinking. (Brian Tracy)", 45 | "Integrity is the most valuable and respected quality of leadership. Always keep your word.", 46 | "Leadership is the ability to get extraordinary achievement from ordinary people.", 47 | "Leaders set high standards. Refuse to tolerate mediocrity or poor performance.", 48 | "Clarity is the key to effective leadership. What are your goals?", 49 | "The best leaders have a high Consideration Factor. They really care about their people.", 50 | "Leaders think and talk about the solutions. Followers think and talk about the problems.", 51 | "The key responsibility of leadership is to think about the future. No one else can do it for you.", 52 | "The effective leader recognizes that they are more dependent on their people than they are on them. Walk softly.", 53 | "Leaders never use the word failure. They look upon setbacks as learning experiences.", 54 | "Practice Golden Rule Management in everything you do. Manage others the way you would like to be managed.", 55 | "Superior leaders are willing to admit a mistake and cut their losses. Be willing to admit that you’ve changed your mind. Don’t persist when the original decision turns out to be a poor one.", 56 | "Leaders are anticipatory thinkers. They consider all consequences of their behaviors before they act.", 57 | "The true test of leadership is how well you function in a crisis.", 58 | "Leaders concentrate single-mindedly on one thing– the most important thing, and they stay at it until it’s complete.", 59 | "The three ‘C’s’ of leadership are Consideration, Caring, and Courtesy. Be polite to everyone.", 60 | "Respect is the key determinant of high-performance leadership. How much people respect you determines how well they perform.", 61 | "Leadership is more who you are than what you do.", 62 | "Entrepreneurial leadership requires the ability to move quickly when opportunity presents itself.", 63 | "Leaders are innovative, entrepreneurial, and future oriented. They focus on getting the job done.", 64 | "Leaders are never satisfied; they continually strive to be better.", 65 | "The best and most beautiful things in the world cannot be seen or even touched - they must be felt with the heart. (Helen Keller)", 66 | "The best preparation for tomorrow is doing your best today. (H. Jackson Brown, Jr.)", 67 | "I can't change the direction of the wind, but I can adjust my sails to always reach my destination. (Jimmy Dean)", 68 | "We must let go of the life we have planned, so as to accept the one that is waiting for us. (Joseph Campbell)", 69 | "You must do the things you think you cannot do. (Eleanor Roosevelt)", 70 | "Put your heart, mind, and soul into even your smallest acts. This is the secret of success. (Swami Sivananda)", 71 | "Start by doing what's necessary; then do what's possible; and suddenly you are doing the impossible. (Francis of Assisi)", 72 | "The limits of the possible can only be defined by going beyond them into the impossible. (Arthur C. Clarke)", 73 | "Happiness is not something you postpone for the future; it is something you design for the present. (Jim Rohn)", 74 | "Try to be a rainbow in someone's cloud. (Maya Angelou)", 75 | "It is during our darkest moments that we must focus to see the light. (Aristotle)", 76 | "Health is the greatest gift, contentment the greatest wealth, faithfulness the best relationship. (Buddha)", 77 | "Change your thoughts and you change the world. (Norman Vincent Peale)", 78 | "Nothing is impossible, the word itself says 'I'm possible'. (Audrey Hepburn)", 79 | "My mission in life is not merely to survive, but to thrive; and to do so with some passion, some compassion, some humor, and some style. (Maya Angelou)", 80 | "Today I choose life. Every morning when I wake up I can choose joy, happiness, negativity, pain... To feel the freedom that comes from being able to continue to make mistakes and choices - today I choose to feel life, not to deny my humanity but embrace it. (Kevyn Aucoin)", 81 | "Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven't found it yet keep looking. Don't settle. As with all matters of the heart, you'll know when you find it. (Steve Jobs)", 82 | "Believe you can and you're halfway there. (Theodore Roosevelt)", 83 | "Keep your face always toward the sunshine - and shadows will fall behind you. (Walt Whitman)", 84 | "Perfection is not attainable, but if we chase perfection we can catch excellence. (Vince Lombardi)", 85 | "If opportunity doesn't knock, build a door. (Milton Berle)", 86 | "What we think, we become. (Buddha)", 87 | "Clouds come floating into my life, no longer to carry rain or usher storm, but to add color to my sunset sky. (Rabindranath Tagore)", 88 | "What lies behind you and what lies in front of you, pales in comparison to what lies inside of you. (Ralph Waldo Emerson)", 89 | "Someone is sitting in the shade today because someone planted a tree a long time ago. (Warren Buffett)", 90 | "No act of kindness, no matter how small, is ever wasted. (Aesop)", 91 | "I believe that if one always looked at the skies, one would end up with wings. (Gustave Flaubert)", 92 | "We know what we are, but know not what we may be. (William Shakespeare)", 93 | "Let us sacrifice our today so that our children can have a better tomorrow. (A. P. J. Abdul Kalam)", 94 | "There are two ways of spreading light: to be the candle or the mirror that reflects it. (Edith Wharton)", 95 | "Let us remember: One book, one pen, one child, and one teacher can change the world. (Malala Yousafzai)", 96 | "All you need is the plan, the road map, and the courage to press on to your destination. (Earl Nightingale)", 97 | "Your personal life, your professional life, and your creative life are all intertwined. I went through a few very difficult years where I felt like a failure. But it was actually really important for me to go through that. Struggle, for me, is the most inspirational thing in the world at the end of the day - as long as you treat it that way. (Skylar Grey)", 98 | "Your present circumstances don't determine where you can go; they merely determine where you start. (Nido Qubein)", 99 | "I will love the light for it shows me that way, yet I will endure the darkness because it shows me the stars. (Og Mandino)", 100 | "It is in your moments of decision that your destiny is shaped. (Tony Robbins)", 101 | "Thousands of candles can be lighted from a single candle, and the life of the candle will not be shortened. Happiness never decreases by being shared. (Buddha)", 102 | "The only journey is the one within. (Rainer Maria Rilke)", 103 | "As we express our gratitude, we must never forget that the highest appreciation is not to utter words, but to live by them. (John F. Kennedy)", 104 | "The bird is powered by its own life and by its motivation. (A. P. J. Abdul Kalam)", 105 | "No matter what people tell you, words and ideas can change the world. (Robin Williams)", 106 | "Don't judge each day by the harvest you reap but by the seeds you plant. (Robert Louis Stevenson)", 107 | "I believe in pink. I believe that laughing is the best calorie burner. I believe in kissing, kissing a lot. I believe in being strong when everything seems to be going wrong. I believe that happy girls are the prettiest girls. I believe that tomorrow is another day and I believe in miracles. (Audrey Hepburn)", 108 | "Shoot for the moon and if you miss you will still be among the stars. (Les Brown)", 109 | "Let your life lightly dance on the edges of Time like dew on the tip of a leaf. (Rabindranath Tagore)", 110 | "I hated every minute of training, but I said, 'Don't quit. Suffer now and live the rest of your life as a champion.' (Muhammad Ali)", 111 | "We can't help everyone, but everyone can help someone. (Ronald Reagan)", 112 | "God always gives His best to those who leave the choice with him. (Jim Elliot)", 113 | "When you have a dream, you've got to grab it and never let go. (Carol Burnett)", 114 | "If you believe in yourself and have dedication and pride - and never quit, you'll be a winner. The price of victory is high but so are the rewards. (Paul Bryant)", 115 | "Let us make our future now, and let us make our dreams tomorrow's reality. (Malala Yousafzai)", 116 | "A hero is someone who has given his or her life to something bigger than oneself. (Joseph Campbell)", 117 | "When the sun is shining I can do anything; no mountain is too high, no trouble too difficult to overcome. (Wilma Rudolph)", 118 | "Throw your dreams into space like a kite, and you do not know what it will bring back, a new life, a new friend, a new love, a new country. (Anais Nin)", 119 | "If you always put limit on everything you do, physical or anything else. It will spread into your work and into your life. There are no limits. There are only plateaus, and you must not stay there, you must go beyond them. (Bruce Lee)", 120 | "To love means loving the unloveable. To forgive means pardoning the unpardonable. Faith means believing the unbelievable. Hope means hoping when everything seems hopeless. (Gilbert K. Chesterton)", 121 | "The measure of who we are is what we do with what we have. (Vince Lombardi)", 122 | "It is never too late to be what you might have been. (George Eliot)", 123 | "There is nothing impossible to him who will try. (Alexander the Great)", 124 | "Two roads diverged in a wood and I - took the one less traveled by, and that has made all the difference. (Robert Frost)", 125 | "From a small seed a mighty trunk may grow. (Aeschylus)", 126 | "Give light, and the darkess will disappear of itself. (Desiderius Erasmus)", 127 | "Love is a fruit in season at all times, and within reach of every hand. (Mother Teresa)", 128 | "Be brave enough to live life creatively. The creative place where no one else has ever been. (Alan Alda)", 129 | "If I have seen further than others, it is by standing upon the shoulders of giants. (Isaac Newton)", 130 | "Follow your bliss and the universe will open doors where there were only walls. (Joseph Campbell)", 131 | "Thinking: the talking of the soul with itself. (Plato)", 132 | "Happiness resides not in possessions, and not in gold, happiness dwells in the soul. (Democritus)", 133 | "How wonderful it is that nobody need wait a single moment before starting to improve the world. (Anne Frank)", 134 | "When we seek to discover the best in others, we somehow bring out the best in ourselves. (William Arthur Ward)", 135 | "With self-discipline most anything is possible. (Theodore Roosevelt)", 136 | "To the mind that is still, the whole universe surrenders. (Lao Tzu)", 137 | "Today is the only day. Yesterday is gone. (John Wooden)", 138 | "Your big opportunity may be right where you are now. (Napoleon Hill)", 139 | "The power of imagination makes us infinite. (John Muir)", 140 | "Out of difficulties grow miracles. (Jean de la Bruyere)", 141 | "What makes the desert beautiful is that somewhere it hides a well. (Antoine de Saint-Exupery)", 142 | "Tomorrow is the most important thing in life. Comes into us at midnight very clean. It's perfect when it arrives and it puts itself in our hands. It hopes we've learning something from yesterday. (John Wayne)", 143 | "If the world seems cold to you, kindle fires to warm it. (Lucy Larcom)", 144 | "How glorious a greeting the sun gives the mountains. (John Muir)", 145 | "When you get into a tight place and everything goes against you, till it seems as though you could not hang on a minute longer, never give up then, for that is just the place and time that the tide will turn. (Harriet Beecher Stowe)", 146 | "Happiness is a butterfly, which when pursued, is always beyond your grasp, but which, if you will sit down quietly, may alight upon you. (Nathaniel Hawthorne)", 147 | "Whoever is happy will make others happy too. (Anne Frank)", 148 | "In a gentle way, you can shake the world. (Mahatma Gandhi)", 149 | "Don't limit yourself. Many people limit themselves to what they think they can do. You can go as far as your mind lets you. What you believe, remember, you can achieve. (Mary Kay Ash)", 150 | "We can change our lives. We can do, have, and be exactly what we wish. (Tony Robbings)", 151 | "Even if I knew that tomorrow the 'would' would go to pieces, I would still plant my apple tree. (Martin Luther)", 152 | "Memories of our lives, of our works and our deeds will continue in others. (Rosa Parks)", 153 | "The things that we love tell us what we are. (Thomas Aquinas)", 154 | "Somewhere, something incredible is waiting to be known. (Sharon Begley)", 155 | "The glow of one warm thought is to me worth more than money. (Thomas Jefferson)", 156 | "If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music which he hears, however measured or far away. (Henry David Thoreau)", 157 | "Accept the things to which fate binds you, and love the people whom fate brings you together, but do so with all your heart. (Marcus Aurelius)", 158 | "If we did all the things we are capable of, we would literally astound ourselves. (Thomas A. Edison)", 159 | "Each day provides its own gifts. (Marcus Aurelius)", 160 | "Keep your feet on the ground, but let your heart soar as high as it will. Refuse to be average or to surrender to the chill of your spiritual environment. (Arthur Helps)", 161 | "Let us dream of tomorrow where we can truly love from the soul, and know love as the ultimate truth at the heart of all creation. (Michael Jackson)", 162 | "You change your life by changing your heart. (Max Lucado)", 163 | "A champion is someone who gets up when he can't. (Jack Dempsey)" 164 | ] 165 | } 166 | ) 167 | 168 | CHAT_KEYWORDS = [ 169 | ChatKeyword(chat_keyword="entertain"), 170 | ChatKeyword(chat_keyword="quote"), 171 | ChatKeyword(chat_keyword="fact") 172 | ] 173 | 174 | # Dependencies of the module 175 | DEPENDENCIES = [] -------------------------------------------------------------------------------- /modules/get_random_fact/get_random_fact.py: -------------------------------------------------------------------------------- 1 | import random 2 | from starterkit.abstr_answer import abstr_answer 3 | 4 | class get_random_fact(abstr_answer): 5 | def getAnswer(self, userInput): 6 | return self.db_loadCustom_json_settings()["random_facts"][random.randint(0, len(get_random_fact.facts) - 1)] -------------------------------------------------------------------------------- /modules/get_random_question/__init__.py: -------------------------------------------------------------------------------- 1 | import modules.get_random_question.conf 2 | import modules.get_random_question.get_random_question -------------------------------------------------------------------------------- /modules/get_random_question/conf.py: -------------------------------------------------------------------------------- 1 | from entities.ent_enabled_module import EnabledModule 2 | from entities.ent_chat_keyword import ChatKeyword 3 | from modules.get_random_question.get_random_question import get_random_question 4 | 5 | ENABLED_MODULE = EnabledModule( 6 | class_name=get_random_question().getStrClassName(), 7 | custom_json_settings={ 8 | "random_questions": [ 9 | "What's your favorite series?", 10 | "What do you like to listen to?", 11 | "How many sisters or brothers do you have?", 12 | "When you are old, what do you think children will ask you to tell stories about?", 13 | "If you could switch two movie characters, what switch would lead to the most inappropriate movies?", 14 | "What animal would be cutest if scaled down to the size of a cat?", 15 | "What inanimate object would be the most annoying if it played loud upbeat music while being used?", 16 | "When did something start out badly for you but in the end, it was great?", 17 | "What weird food combinations do you really enjoy?", 18 | "How would your country change if everyone, regardless of age, could vote?", 19 | "What are some red flags to watch out for in daily life?", 20 | "If your job gave you a surprise three day paid break to rest and recuperate, what would you do with " 21 | "those three days?", 22 | "Where do you get your news?","What movie can you watch over and over without ever getting tired of?", 23 | "What’s wrong but sounds right?", 24 | "What’s the most epic way you’ve seen someone quit or be fired?", 25 | "If you couldn’t be convicted of any one type of crime, what criminal charge would you like to be immune " 26 | "to?", 27 | "What social stigma does society need to get over?", 28 | "What’s the most creative use of emojis you’ve ever seen?", 29 | "What’s something that will always be in fashion, no matter how much time passes?", 30 | "What actors or actresses play the same character in almost every movie or show they do?", 31 | "In the past people were buried with the items they would need in the afterlife, what would you want " 32 | "buried with you so you could use it in the afterlife?", 33 | "What’s the best / worst practical joke that you’ve played on someone or that was played on you?", 34 | "Who do you go out of your way to be nice to?", 35 | "Where do you get most of the decorations for your home?", 36 | "What food have you never eaten but would really like to try?", 37 | "What food is delicious but a pain to eat?", 38 | "Who was your craziest / most interesting teacher?", 39 | "What 'old person' things do you do?", 40 | "What was the last photo you took?", 41 | "What is the most amazing slow motion video you’ve seen?", 42 | "Where are some unusual places you’ve been?", 43 | "Which celebrity do you think is the most down to earth?", 44 | "What would be the worst thing to hear as you are going under anesthesia before heart surgery?", 45 | "What’s the spiciest thing you’ve ever eaten?", 46 | "What’s the most expensive thing you’ve broken?", 47 | "What obstacles would be included in the World’s most amazing obstacle course?", 48 | "What makes you roll your eyes every time you hear it?", 49 | "What do you think you are much better at than you actually are?", 50 | "Should kidneys be able to be bought and sold?", 51 | "When was the last time you got to tell someone 'I told you so.'?", 52 | "What would a world populated by clones of you be like?", 53 | "What riddles do you know?", 54 | "What’s your cure for hiccups?", 55 | "What invention doesn’t get a lot of love, but has greatly improved the world?", 56 | "What’s something you really resent paying for?", 57 | "Do you think that aliens exist?", 58 | "What are you currently worried about?", 59 | "What’s the most interesting building you’ve ever seen or been in?", 60 | "What mythical creature do you wish actually existed?", 61 | "What are your most important rules when going on a date?", 62 | "How do you judge a person?", 63 | "If someone narrated your life, who would you want to be the narrator?", 64 | "What was the most unsettling film you’ve seen?", 65 | "What unethical experiment would have the biggest positive impact on society as a whole?", 66 | "When was the last time you were snooping, and found something you wish you hadn’t?", 67 | "Which celebrity or band has the worst fan base?", 68 | "What are you interested in that most people aren’t?", 69 | "If you were given a PhD degree, but had no more knowledge of the subject of the degree besides what you " 70 | "have now, what degree would you want to be given to you?", 71 | "What smartphone feature would you actually be excited for a company to implement?", 72 | "What’s something people don’t worry about but really should?", 73 | "What movie quotes do you use on a regular basis?", 74 | "Do you think that children born today will have better or worse lives than their parents?", 75 | "What’s the funniest joke you know by heart?", 76 | "When was the last time you felt you had a new lease on life?", 77 | "What’s the funniest actual name you’ve heard of someone having?", 78 | "Which charity or charitable cause is most deserving of money?", 79 | "What TV show character would it be the most fun to change places with for a week?", 80 | "What was cool when you were young but isn’t cool now?", 81 | "If you were moving to another country, but could only pack one carry-on sized bag, what would you pack?", 82 | "What’s the most ironic thing you’ve seen happen?", 83 | "If magic was real, what spell would you try to learn first?", 84 | "If you were a ghost and could possess people, what would you make them do?", 85 | "What goal do you think humanity is not focused enough on achieving?", 86 | "What problem are you currently grappling with?", 87 | "What character in a movie could have been great, but the actor they cast didn’t fit the role?", 88 | "What game have you spent the most hours playing?", 89 | "What’s the most comfortable bed or chair you’ve ever been in?", 90 | "What’s the craziest conversation you’ve overheard?", 91 | "What’s the hardest you’ve ever worked?", 92 | "What movie, picture, or video always makes you laugh no matter how often you watch it?", 93 | "What artist or band do you always recommend when someone asks for a music recommendation?", 94 | "If you could have an all-expenses paid trip to see any famous world monument, which monument would you " 95 | "choose?", 96 | "If animals could talk, which animal would be the most annoying?", 97 | "What’s the most addicted to a game you’ve ever been?", 98 | "What’s the coldest you’ve ever been?", 99 | "Which protagonist from a book or movie would make the worst roommate?", 100 | "Do you eat food that’s past its expiration date if it still smells and looks fine?", 101 | "What’s the most ridiculous thing you have bought?", 102 | "What’s the funniest comedy skit you’ve seen?", 103 | "What’s the most depressing meal you’ve eaten?", 104 | "What tips or tricks have you picked up from your job / jobs?", 105 | "What outdoor activity haven’t you tried, but would like to?", 106 | "What songs hit you with a wave of nostalgia every time you hear them?", 107 | "What’s the worst backhanded compliment you could give someone?", 108 | "What’s the most interesting documentary you’ve ever watched?", 109 | "What was the last song you sung along to?", 110 | "What’s the funniest thing you’ve done or had happen while your mind was wandering?", 111 | "What app can you not believe someone hasn’t made yet?", 112 | "When was the last time you face palmed?", 113 | "If you were given five million dollars to open a small museum, what kind of museum would you create?", 114 | "Which of your vices or bad habits would be the hardest to give up?", 115 | "What really needs to be modernized?", 116 | "When was the last time you slept more than nine hours?", 117 | "How comfortable are you speaking in front of large groups of people?", 118 | "What’s your worst example of procrastination?", 119 | "Who has zero filter between their brain and mouth?", 120 | "What was your most recent lie?", 121 | "When was the last time you immediately regretted something you said?", 122 | "What would be the best thing you could reasonably expect to find in a cave?", 123 | "What did you think was going to be amazing but turned out to be horrible?", 124 | "What bit of trivia do you know that is very interesting but also very useless?", 125 | "What’s the silliest thing you’ve seen someone get upset about?", 126 | "What animal or plant do you think should be renamed?", 127 | "What was the best thing that happened to you today?", 128 | "What languages do you wish you could speak?", 129 | "What’s the most pleasant sounding accent?", 130 | "What’s something that everyone, absolutely everyone, in the entire world can agree on?", 131 | "What country is the strangest?", 132 | "What’s the funniest word in the English language?", 133 | "What’s some insider knowledge that only people in your line of work have?", 134 | "Who do you wish you could get back into contact with?", 135 | "How do you make yourself sleep when you can’t seem to get to sleep?", 136 | "If people receive a purple heart for bravery, what would other color hearts represent?", 137 | "What are some of the best vacations you’ve had?", 138 | "If there was a book of commandments for the modern world, what would some of the rules be?", 139 | "What’s the craziest video you’ve ever seen?", 140 | "What’s your 'Back in my day, we…'?", 141 | "If you could know the truth behind every conspiracy, but you would instantly die if you hinted that you " 142 | "knew the truth, would you want to know?", 143 | "What animal would be the most terrifying if it could speak?", 144 | "What’s the worst hairstyle you’ve ever had?", 145 | "What habit do you have now that you wish you started much earlier?", 146 | "If you were given one thousand acres of land that you didn’t need to pay taxes on but couldn’t sell, " 147 | "what would you do with it?", 148 | "What about the opposite sex confuses you the most?", 149 | "When was the last time you yelled at someone?", 150 | "What’s the opposite of a koala?", 151 | "What kinds of things do you like to cook or are good at cooking?", 152 | "What life skills are rarely taught but extremely useful?", 153 | "What movie universe would be the worst to live out your life in?", 154 | "If you could hack into any one computer, which computer would you choose?", 155 | "Who do you feel like you know even though you’ve never met them?", 156 | "What’s the most ridiculous animal on the planet?", 157 | "What’s the worst thing you’ve eaten out of politeness?", 158 | "What’s the most historic thing that has happened in your lifetime?", 159 | "What happens in your country regularly that people in most countries would find strange or bizarre?", 160 | "What has been blown way out of proportion?", 161 | "When was a time you acted nonchalant but were going crazy inside?", 162 | "What’s about to get much better?", 163 | "What are some clever examples of misdirection you’ve seen?", 164 | "What’s your funniest story involving a car?", 165 | "What would be the click-bait titles of some popular movies?", 166 | "If you built a themed hotel, what would the theme be and what would the rooms look like?", 167 | "What scientific discovery would change the course of humanity overnight if it was discovered?", 168 | "Do you think that humans will ever be able to live together in harmony?", 169 | "What would your perfect bar look like?", 170 | "What’s the scariest nonhorror movie?", 171 | "What’s the most amazing true story you’ve heard?", 172 | "What’s the grossest food that you just can’t get enough of?", 173 | "What brand are you most loyal to?", 174 | "What’s the most awkward thing that happens to you on a regular basis?", 175 | "If you had to disappear and start a whole new life, what would you want your new life to look like?", 176 | "What movie or book do you know the most quotes from?", 177 | "What was one of the most interesting concerts you’ve been to?", 178 | "Where are you not welcome anymore?", 179 | "What do you think could be done to improve the media?", 180 | "What’s the most recent show you’ve binge watched?", 181 | "What’s the worst movie trope?", 182 | "What’s a common experience for many people that you’ve never experienced?", 183 | "What are some misconceptions about your hobby?", 184 | "What’s the smartest thing you’ve seen an animal do?", 185 | "What’s the most annoying noise?", 186 | "What’s your haunted house story?", 187 | "What did you Google last?", 188 | "What’s the dumbest thing someone has argued with you about?", 189 | "If money and practicality weren’t a problem, what would be the most interesting way to get around town?", 190 | "What’s the longest rabbit hole you’ve been down?", 191 | "What’s the saddest scene in a movie or TV series?", 192 | "What’s the most frustrating product you own?", 193 | "What inconsequential super power would you like to have?", 194 | "What qualities do all your friends have in common?", 195 | "What odd smell do you really enjoy?", 196 | "What’s the coolest animal you’ve seen in the wild?", 197 | "What’s the best lesson you’ve learned from a work of fiction?", 198 | "What food do you crave most often?", 199 | "Who in your life has the best / worst luck?", 200 | "What fashion trend makes you cringe or laugh every time you see it?", 201 | "What’s your best story of you or someone else trying to be sneaky and failing miserably?", 202 | "Which apocalyptic dystopia do you think is most likely?", 203 | "If you had a HUD that showed three stats about any person you looked at, what three stats would you want " 204 | "it to show?", 205 | "What’s the funniest thing you’ve seen a kid do?", 206 | "What’s your secret talent?", 207 | "What’s the best way you or someone you know has gotten out of a ticket / trouble with the law?", 208 | "Tear gas makes people cry and laughing gas makes people giggle, what other kinds of gases do you wish " 209 | "existed? " 210 | ]} 211 | ) 212 | 213 | CHAT_KEYWORDS = [ 214 | ChatKeyword(chat_keyword="question") 215 | ] 216 | 217 | # Dependencies of the module 218 | DEPENDENCIES = [] -------------------------------------------------------------------------------- /modules/get_random_question/get_random_question.py: -------------------------------------------------------------------------------- 1 | from starterkit.abstr_answer import abstr_answer 2 | import random 3 | 4 | 5 | class get_random_question(abstr_answer): 6 | def getAnswer(self, userInput): 7 | return self.db_loadCustom_json_settings()["random_questions"][random.randint(0, len(get_random_question.questions) - 1)] 8 | 9 | -------------------------------------------------------------------------------- /modules/get_welcome_msg/__init__.py: -------------------------------------------------------------------------------- 1 | import modules.get_welcome_msg.conf 2 | import modules.get_welcome_msg.get_welcome_msg -------------------------------------------------------------------------------- /modules/get_welcome_msg/conf.py: -------------------------------------------------------------------------------- 1 | from entities.ent_enabled_module import EnabledModule 2 | from entities.ent_chat_keyword import ChatKeyword 3 | from modules.get_welcome_msg.get_welcome_msg import get_welcome_msg 4 | 5 | ENABLED_MODULE = EnabledModule( 6 | class_name=get_welcome_msg().getStrClassName(), 7 | custom_json_settings={} 8 | ) 9 | 10 | """ TODO: Remove chat keywords and use chatterbot yaml (make own files 11 | for each module and then train the bot for this file. :) """ 12 | 13 | CHAT_KEYWORDS = [ 14 | ChatKeyword(chat_keyword="weather in") 15 | ] 16 | 17 | # Dependencies of the module 18 | DEPENDENCIES = [] -------------------------------------------------------------------------------- /modules/get_welcome_msg/get_welcome_msg.py: -------------------------------------------------------------------------------- 1 | from starterkit.abstr_answer import abstr_answer 2 | 3 | class get_welcome_msg(abstr_answer): 4 | def getAnswer(self, userInput): 5 | return "Welcome to PyChatbot :)" 6 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | import pip 3 | from global_constants import DB_NAME 4 | 5 | # We have to determine this BEFORE calling other imports to prevent creating an empty db before execution of config-script 6 | db_exists = os.path.exists(DB_NAME) 7 | 8 | from peewee import * 9 | import modules 10 | from starterkit.fallback_module.conf import chatbot, db 11 | from entities import * 12 | 13 | """ This file is only needed ONCE (when executing the assistant the first time). 14 | 15 | If you want to reset your assistant just delete the 'db.sqlite3' in the project's 16 | root directory and restart this script. """ 17 | 18 | 19 | """ ++++++++++++++++++++++ Assistant modules +++++++++++++++++++++++++++++++++++++++ 20 | No modules are required. If you don't want to use any additional features, then 21 | you can change the following array to an empty one: 22 | ENABLED_MODULES = [] 23 | 24 | If you disabled all modules then the assistant can only talk with you (= get_smart_answer). 25 | By this you can also easily add some modules to your project and place it here into the list. 26 | The more modules you have enabled the longer a potential answer of the bot might need. 27 | 28 | You can also create modules by your own. Just look into abstr_answer.py for a more detailed 29 | documentation. When you created one you place your module files into the 'modules' package 30 | to keep the project structure clean and then just import it here and place it in the 31 | 'ENABLED_MODULES'-array. 32 | 33 | CHANGE: ++ OPTIONAL ++ [-> by default, the assistant uses all modules] """ 34 | 35 | """ Your IDE might indicate that no reference has been found in __init__.py. 36 | As we are importing all modules dynamically, you can safely ignore this warning. """ 37 | ENABLED_MODULES = [ 38 | modules.get_welcome_msg, 39 | modules.get_random_question, 40 | modules.get_random_fact 41 | ] # DO NOT add get_smart_answer.py here, bc. it is not a module 42 | 43 | 44 | 45 | """ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 46 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 47 | ++++++ BELOW CODE SHOULDN'T BE CHANGED, UNLESS YOU KNOW WHAT YOU ARE DOING +++++++++++ 48 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 49 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ """ 50 | 51 | # Installer of dependencies (used e.g. by conf.py's) 52 | def install_dependency(package): 53 | pip.main(['install', package]) 54 | 55 | if not db_exists: # do not evaluate here again whether db exists (bc. of imports and automatic creation on connection etc.) 56 | print("Starting assistant setup.") 57 | chatbot.train("chatterbot.corpus.english") 58 | 59 | # +++++++++++++++++++++++ Database setup - Persistence ++++++++++++++++++++++++++ 60 | print("SETUP: Starting db and dependency setup.") 61 | 62 | # Connect to db, create db structure and insert data 63 | db.connect() 64 | db.create_tables([ 65 | EnabledModule, ChatKeyword, EnabledModuleHasChatKeyword 66 | ]) 67 | 68 | # INSERT all configured/enabled modules ++++++++++++++++++++++ 69 | for module in ENABLED_MODULES: 70 | # Save configured module from conf.py file 71 | if module.conf.ENABLED_MODULE.save() <= 0: 72 | print("CONFIDENTIAL:ERROR: Could not enable module -> "+str(module.conf.ENABLED_MODULE.class_name)) 73 | else: # only save module specific params if previous operation was successful. 74 | # Save all keywords of enabled module + save relationship afterwards 75 | for chat_keyword in module.conf.CHAT_KEYWORDS: 76 | # Save keyword 77 | if chat_keyword.save() <= 0: 78 | print("CONFIDENTIAL:ERROR: Could not save keyword -> "+str(chat_keyword.chat_keyword)) 79 | else: # only save relationship if keyword saving was successful 80 | # Create relationship to module 81 | if EnabledModuleHasChatKeyword( 82 | enabled_module_id=module.conf.ENABLED_MODULE, 83 | chat_keyword_id=chat_keyword 84 | ).save() <= 0: 85 | print("CONFIDENTIAL:ERROR: Could not establish relationship between -> "+str(module.conf.ENABLED_MODULE.class_name)+" and "+str(chat_keyword.chat_keyword)) 86 | 87 | # After db setup of single module, start dependency installing of module 88 | for dependency in module.conf.DEPENDENCIES: 89 | install_dependency(dependency) 90 | 91 | 92 | """ +++++++++ Train assistant (= default module (not removeable without coding) +++ 93 | -> Train bot/assistant with default language (english) """ 94 | print("Training assistant, this can take a while.") 95 | #TODO: make language configurable (also modules) and also train via twitter (also language chooseable) 96 | #chatbot.train("chatterbot.corpus.english") 97 | chatbot.train() 98 | 99 | print("SETUP: Ended db and dependency setup.") 100 | 101 | 102 | 103 | 104 | # TODO: Delete conf.py's after successful installation (or ask user to remove installation data = BETTER), bc. only needed once 105 | 106 | 107 | 108 | else: 109 | print("CONFIDENTIAL: Found database 'db.sqlite3'. Stopping script execution.\n"+ 110 | "Solution -> Delete the database file and re-execute this script OR just start the main.py.") 111 | -------------------------------------------------------------------------------- /starterkit/abstr_answer.py: -------------------------------------------------------------------------------- 1 | from abc import abstractmethod, ABC 2 | import json 3 | from entities import * 4 | 5 | """ PARENT CLASS = MODULE layout 6 | 7 | - How to create a new module? 8 | 1. Create a new folder in /modules. Please use the same name for that 9 | folder as for your module-file and the class inside that .py-file. 10 | e.g.: get_weather_info, get_traffic_info, get_cinema_info, ... 11 | 12 | 2. Create a __init__.py in your newly created folder, which imports 13 | both files you will create in your next steps (conf and your module-file). 14 | Just take a look into __init__.py-files of other modules. 15 | 16 | 3. Create your module logic by creating a .py-file, which exact the same 17 | name as your superior module folder. 18 | e.g. get_welcome_msg.py, get_traffic_info.py, get_cinemy_info.py 19 | 20 | 3.1. Write your logic by extending from this class. As class name, please 21 | use the same name as for your superior directory and the filename of your 22 | module. Here a small example. 23 | 24 | class get_weather_info(abstr_answer): 25 | @staticmethod 26 | def getAnswer(userInput): 27 | # Do sth with the userInput, do sth specific or just return 28 | # a static string. 29 | return "Thanks for testing me. You wrote -> "+str(userInput) 30 | 31 | So, if the userInput contains at least one of your keywords your 32 | method get's invoked. What you do with the userInput or what you 33 | are answering in general in your method is completely independent 34 | from other modules. 35 | 36 | 4. Create a new .py-file named 'conf.py'. This name is obligatory to 37 | integrate your module successfully into the assistant. This file is 38 | used to configure your module. You have determined in 3. and 3.1. what 39 | the assistant does/answers, when your method is invoked. But, you haven't 40 | set the keywords yet and other important metadata yet. For that we have 41 | the conf.py-file. 42 | 43 | ENABLED_MODULE = EnabledModule( # do not change 44 | class_name=get_weather_info().getStrClassName(), # just place here the same name as for your superior folder, the class name and the module-file 45 | custom_json_settings="{}" # Here you could place a json, which can be dynamically used by your module (without restrictions). 46 | ) 47 | 48 | CHAT_KEYWORDS = [ # do not change 49 | ChatKeyword(chat_keyword="weather"), #create a list of keywords. When one of your keywords is detected your get_answer() get's invoked. 50 | ChatKeyword(chat_keyword="storm") 51 | ] 52 | 53 | The 'chat_keywords' is an array, which contains keywords. By placing 54 | several keywords there you can decide when your getAnswer() method 55 | get's invoked. If your new module causes an error, then at least 56 | one of the keywords you have used is already in use by another enabled 57 | module. So, just remove the other module from the enabled_modules list 58 | in the setup.py OR change the keyword(s) in your module. 59 | -> Later, we might add the possibility to use the same keywords as other 60 | -> modules (for that just leave an issue on Github) 61 | """ 62 | 63 | # Extend from ABC (to be abstract) and from EnabledModule (to be a db entity) 64 | class abstr_answer(ABC): 65 | __chat_keywords = None # private emulation 66 | __custom_json_settings = None # private emulation 67 | 68 | @abstractmethod 69 | def getAnswer(self,userInput): 70 | raise NotImplementedError 71 | 72 | def db_loadCustom_json_settings(self): 73 | if self.__custom_json_settings is None: 74 | # Get first row [0], if no row found a exception might be thrown 75 | self.__custom_json_settings = json.loads((EnabledModule.select().where(EnabledModule.class_name == self.getStrClassName()))[0].custom_json_settings) 76 | 77 | return self.__custom_json_settings 78 | 79 | """ Load chat_keywords from database and return it as list. 80 | @param moduleStr: className -> e.g. use: get_welcome_msg().getClassName() """ 81 | def db_loadChatKeywordsOfModule(self): 82 | resultSet = (ChatKeyword.select() 83 | .where(EnabledModule.class_name == self.getStrClassName()) 84 | .join(EnabledModuleHasChatKeyword) 85 | .switch(EnabledModuleHasChatKeyword) 86 | .join(EnabledModule)) 87 | 88 | #TODO: Maybe return objs in future instead 89 | keywords = [] 90 | for keyword_row in resultSet: 91 | keywords.append(str(keyword_row)) 92 | 93 | return keywords 94 | 95 | def getChatKeywords(self): 96 | if self.__chat_keywords is None: 97 | self.__chat_keywords = self.db_loadChatKeywordsOfModule() 98 | return self.__chat_keywords 99 | 100 | def getStrClassName(self): 101 | return str(type(self).__name__) 102 | 103 | 104 | -------------------------------------------------------------------------------- /starterkit/fallback_module/conf.py: -------------------------------------------------------------------------------- 1 | from chatterbot import ChatBot 2 | from peewee import SqliteDatabase 3 | from global_constants import DB_NAME 4 | import logging 5 | 6 | 7 | """ As get_smart_answer is no regular module, the .conf-file here looks completely different. """ 8 | 9 | # Set database file 10 | db = SqliteDatabase(DB_NAME) 11 | 12 | # Set up chatbot 13 | """chatbot = ChatBot( 14 | 'HOME_ASSISTANT', 15 | trainer='chatterbot.trainers.ChatterBotCorpusTrainer' 16 | )""" 17 | 18 | # Comment out the following line to disable verbose logging 19 | logging.basicConfig(level=logging.INFO) 20 | 21 | chatbot = ChatBot( 22 | 'HOME_ASSISTANT', 23 | trainer='chatterbot.trainers.ChatterBotCorpusTrainer' 24 | ) 25 | 26 | 27 | -------------------------------------------------------------------------------- /starterkit/fallback_module/get_smart_answer.py: -------------------------------------------------------------------------------- 1 | from starterkit.abstr_answer import abstr_answer 2 | from starterkit.fallback_module.conf import chatbot 3 | 4 | class get_smart_answer(abstr_answer): 5 | def getAnswer(self,userInput): 6 | return chatbot.get_response(str(userInput)) --------------------------------------------------------------------------------