ChatterBot 1.2.2__tar.gz → 1.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. {chatterbot-1.2.2 → chatterbot-1.2.4}/ChatterBot.egg-info/PKG-INFO +16 -20
  2. {chatterbot-1.2.2 → chatterbot-1.2.4}/ChatterBot.egg-info/SOURCES.txt +2 -0
  3. {chatterbot-1.2.2 → chatterbot-1.2.4}/ChatterBot.egg-info/requires.txt +11 -1
  4. {chatterbot-1.2.2 → chatterbot-1.2.4}/PKG-INFO +16 -20
  5. {chatterbot-1.2.2 → chatterbot-1.2.4}/README.md +1 -2
  6. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/__init__.py +1 -1
  7. chatterbot-1.2.4/chatterbot/__main__.py +27 -0
  8. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/chatterbot.py +52 -6
  9. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/comparisons.py +3 -13
  10. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/sqlalchemy_app/models.py +2 -2
  11. chatterbot-1.2.4/chatterbot/logic/specific_response.py +76 -0
  12. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/logic/time_adapter.py +3 -7
  13. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/logic/unit_conversion.py +4 -3
  14. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/storage/__init__.py +2 -0
  15. chatterbot-1.2.4/chatterbot/storage/redis.py +390 -0
  16. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/storage/sql_storage.py +1 -1
  17. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/tagging.py +3 -7
  18. chatterbot-1.2.4/chatterbot/trainers.py +569 -0
  19. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/utils.py +16 -25
  20. chatterbot-1.2.4/chatterbot/vectorstores.py +74 -0
  21. {chatterbot-1.2.2 → chatterbot-1.2.4}/pyproject.toml +16 -7
  22. chatterbot-1.2.4/setup.cfg +9 -0
  23. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_chatbot.py +43 -0
  24. chatterbot-1.2.2/chatterbot/__main__.py +0 -12
  25. chatterbot-1.2.2/chatterbot/logic/specific_response.py +0 -37
  26. chatterbot-1.2.2/chatterbot/trainers.py +0 -381
  27. chatterbot-1.2.2/setup.cfg +0 -18
  28. {chatterbot-1.2.2 → chatterbot-1.2.4}/ChatterBot.egg-info/dependency_links.txt +0 -0
  29. {chatterbot-1.2.2 → chatterbot-1.2.4}/ChatterBot.egg-info/top_level.txt +0 -0
  30. {chatterbot-1.2.2 → chatterbot-1.2.4}/LICENSE +0 -0
  31. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/adapters.py +0 -0
  32. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/components.py +0 -0
  33. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/constants.py +0 -0
  34. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/conversation.py +0 -0
  35. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/corpus.py +0 -0
  36. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/exceptions.py +0 -0
  37. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/__init__.py +0 -0
  38. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/__init__.py +0 -0
  39. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/abstract_models.py +0 -0
  40. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/admin.py +0 -0
  41. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/apps.py +0 -0
  42. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0001_initial.py +0 -0
  43. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0002_statement_extra_data.py +0 -0
  44. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0003_change_occurrence_default.py +0 -0
  45. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0004_rename_in_response_to.py +0 -0
  46. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0005_statement_created_at.py +0 -0
  47. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0006_create_conversation.py +0 -0
  48. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0007_response_created_at.py +0 -0
  49. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0008_update_conversations.py +0 -0
  50. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0009_tags.py +0 -0
  51. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0010_statement_text.py +0 -0
  52. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0011_blank_extra_data.py +0 -0
  53. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0012_statement_created_at.py +0 -0
  54. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0013_change_conversations.py +0 -0
  55. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0014_remove_statement_extra_data.py +0 -0
  56. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0015_statement_persona.py +0 -0
  57. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0016_statement_stemmed_text.py +0 -0
  58. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0017_tags_unique.py +0 -0
  59. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0018_text_max_length.py +0 -0
  60. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/0019_alter_statement_id_alter_tag_id_and_more.py +0 -0
  61. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/migrations/__init__.py +0 -0
  62. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/model_admin.py +0 -0
  63. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/models.py +0 -0
  64. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/django_chatterbot/settings.py +0 -0
  65. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/ext/sqlalchemy_app/__init__.py +0 -0
  66. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/filters.py +0 -0
  67. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/languages.py +0 -0
  68. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/logic/__init__.py +0 -0
  69. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/logic/best_match.py +0 -0
  70. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/logic/logic_adapter.py +0 -0
  71. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/logic/mathematical_evaluation.py +0 -0
  72. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/parsing.py +0 -0
  73. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/preprocessors.py +0 -0
  74. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/response_selection.py +0 -0
  75. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/search.py +0 -0
  76. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/storage/django_storage.py +0 -0
  77. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/storage/mongodb.py +0 -0
  78. {chatterbot-1.2.2 → chatterbot-1.2.4}/chatterbot/storage/storage_adapter.py +0 -0
  79. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_adapter_validation.py +0 -0
  80. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_benchmarks.py +0 -0
  81. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_cli.py +0 -0
  82. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_comparisons.py +0 -0
  83. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_conversations.py +0 -0
  84. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_corpus.py +0 -0
  85. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_examples.py +0 -0
  86. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_filters.py +0 -0
  87. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_initialization.py +0 -0
  88. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_languages.py +0 -0
  89. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_parsing.py +0 -0
  90. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_preprocessors.py +0 -0
  91. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_response_selection.py +0 -0
  92. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_search.py +0 -0
  93. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_tagging.py +0 -0
  94. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_turing.py +0 -0
  95. {chatterbot-1.2.2 → chatterbot-1.2.4}/tests/test_utils.py +0 -0
@@ -1,27 +1,15 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: ChatterBot
3
- Version: 1.2.2
3
+ Version: 1.2.4
4
4
  Summary: ChatterBot is a machine learning, conversational dialog engine
5
5
  Author: Gunther Cox
6
- License: Copyright (c) 2016 - 2025, Gunther Cox
7
- All rights reserved.
8
-
9
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
10
-
11
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
12
-
13
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
14
-
15
- * Neither the name of ChatterBot nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
16
-
17
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
18
-
6
+ License-Expression: BSD-3-Clause
19
7
  Project-URL: Documentation, https://docs.chatterbot.us
20
8
  Project-URL: Repository, https://github.com/gunthercox/ChatterBot
9
+ Project-URL: Changelog, https://github.com/gunthercox/ChatterBot/releases
21
10
  Keywords: ChatterBot,chatbot,chat,bot,natural language processing,nlp,artificial intelligence,ai
22
11
  Classifier: Development Status :: 4 - Beta
23
12
  Classifier: Intended Audience :: Developers
24
- Classifier: License :: OSI Approved :: BSD License
25
13
  Classifier: Operating System :: OS Independent
26
14
  Classifier: Environment :: Console
27
15
  Classifier: Environment :: Web Environment
@@ -40,7 +28,7 @@ Classifier: Programming Language :: Python
40
28
  Classifier: Programming Language :: Python :: 3
41
29
  Classifier: Programming Language :: Python :: 3.9
42
30
  Classifier: Programming Language :: Python :: 3 :: Only
43
- Requires-Python: ~=3.9
31
+ Requires-Python: <3.13,>=3.9
44
32
  Description-Content-Type: text/markdown
45
33
  License-File: LICENSE
46
34
  Requires-Dist: mathparse<0.2,>=0.1
@@ -53,11 +41,20 @@ Requires-Dist: flake8; extra == "test"
53
41
  Requires-Dist: coverage; extra == "test"
54
42
  Requires-Dist: nose; extra == "test"
55
43
  Requires-Dist: sphinx<8.2,>=5.3; extra == "test"
44
+ Requires-Dist: sphinx-sitemap>=2.6.0; extra == "test"
45
+ Requires-Dist: huggingface_hub; extra == "test"
56
46
  Provides-Extra: dev
57
47
  Requires-Dist: pint>=0.8.1; extra == "dev"
58
- Requires-Dist: pymongo<4.12,>=4.11; extra == "dev"
59
48
  Requires-Dist: pyyaml<7.0,>=6.0; extra == "dev"
60
49
  Requires-Dist: chatterbot-corpus>=1.2.2; extra == "dev"
50
+ Provides-Extra: redis
51
+ Requires-Dist: redis[hiredis]; extra == "redis"
52
+ Requires-Dist: langchain-redis; extra == "redis"
53
+ Requires-Dist: langchain-huggingface; extra == "redis"
54
+ Requires-Dist: sentence-transformers; extra == "redis"
55
+ Provides-Extra: mongodb
56
+ Requires-Dist: pymongo<4.12,>=4.11; extra == "mongodb"
57
+ Dynamic: license-file
61
58
 
62
59
  ![ChatterBot: Machine learning in Python](https://i.imgur.com/b3SCmGT.png)
63
60
 
@@ -70,7 +67,6 @@ to be trained to speak any language.
70
67
 
71
68
  [![Package Version](https://img.shields.io/pypi/v/chatterbot.svg)](https://pypi.python.org/pypi/chatterbot/)
72
69
  [![Python 3.9](https://img.shields.io/badge/python-3.9-blue.svg)](https://www.python.org/downloads/release/python-360/)
73
- [![Django 2.0](https://img.shields.io/badge/Django-2.0-blue.svg)](https://docs.djangoproject.com/en/2.1/releases/2.0/)
74
70
  [![Coverage Status](https://img.shields.io/coveralls/gunthercox/ChatterBot.svg)](https://coveralls.io/r/gunthercox/ChatterBot)
75
71
  [![Code Climate](https://codeclimate.com/github/gunthercox/ChatterBot/badges/gpa.svg)](https://codeclimate.com/github/gunthercox/ChatterBot)
76
72
  [![Join the chat at https://gitter.im/chatterbot/Lobby](https://badges.gitter.im/chatterbot/Lobby.svg)](https://gitter.im/chatterbot/Lobby?utm_source=badge&utm_medium=badge&utm_content=badge)
@@ -161,7 +157,7 @@ See release notes for changes https://github.com/gunthercox/ChatterBot/releases
161
157
  a new branch `my-pull-request`.
162
158
  3. [Create a pull request](https://help.github.com/articles/creating-a-pull-request/).
163
159
  4. Please follow the [Python style guide for PEP-8](https://www.python.org/dev/peps/pep-0008/).
164
- 5. Use the projects [built-in automated testing](https://docs.chatterbot.us/testing.html).
160
+ 5. Use the projects [built-in automated testing](https://docs.chatterbot.us/testing/).
165
161
  to help make sure that your contribution is free from errors.
166
162
 
167
163
  # License
@@ -26,6 +26,7 @@ chatterbot/search.py
26
26
  chatterbot/tagging.py
27
27
  chatterbot/trainers.py
28
28
  chatterbot/utils.py
29
+ chatterbot/vectorstores.py
29
30
  chatterbot/ext/__init__.py
30
31
  chatterbot/ext/django_chatterbot/__init__.py
31
32
  chatterbot/ext/django_chatterbot/abstract_models.py
@@ -66,6 +67,7 @@ chatterbot/logic/unit_conversion.py
66
67
  chatterbot/storage/__init__.py
67
68
  chatterbot/storage/django_storage.py
68
69
  chatterbot/storage/mongodb.py
70
+ chatterbot/storage/redis.py
69
71
  chatterbot/storage/sql_storage.py
70
72
  chatterbot/storage/storage_adapter.py
71
73
  tests/test_adapter_validation.py
@@ -6,12 +6,22 @@ tqdm
6
6
 
7
7
  [dev]
8
8
  pint>=0.8.1
9
- pymongo<4.12,>=4.11
10
9
  pyyaml<7.0,>=6.0
11
10
  chatterbot-corpus>=1.2.2
12
11
 
12
+ [mongodb]
13
+ pymongo<4.12,>=4.11
14
+
15
+ [redis]
16
+ redis[hiredis]
17
+ langchain-redis
18
+ langchain-huggingface
19
+ sentence-transformers
20
+
13
21
  [test]
14
22
  flake8
15
23
  coverage
16
24
  nose
17
25
  sphinx<8.2,>=5.3
26
+ sphinx-sitemap>=2.6.0
27
+ huggingface_hub
@@ -1,27 +1,15 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: ChatterBot
3
- Version: 1.2.2
3
+ Version: 1.2.4
4
4
  Summary: ChatterBot is a machine learning, conversational dialog engine
5
5
  Author: Gunther Cox
6
- License: Copyright (c) 2016 - 2025, Gunther Cox
7
- All rights reserved.
8
-
9
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
10
-
11
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
12
-
13
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
14
-
15
- * Neither the name of ChatterBot nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
16
-
17
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
18
-
6
+ License-Expression: BSD-3-Clause
19
7
  Project-URL: Documentation, https://docs.chatterbot.us
20
8
  Project-URL: Repository, https://github.com/gunthercox/ChatterBot
9
+ Project-URL: Changelog, https://github.com/gunthercox/ChatterBot/releases
21
10
  Keywords: ChatterBot,chatbot,chat,bot,natural language processing,nlp,artificial intelligence,ai
22
11
  Classifier: Development Status :: 4 - Beta
23
12
  Classifier: Intended Audience :: Developers
24
- Classifier: License :: OSI Approved :: BSD License
25
13
  Classifier: Operating System :: OS Independent
26
14
  Classifier: Environment :: Console
27
15
  Classifier: Environment :: Web Environment
@@ -40,7 +28,7 @@ Classifier: Programming Language :: Python
40
28
  Classifier: Programming Language :: Python :: 3
41
29
  Classifier: Programming Language :: Python :: 3.9
42
30
  Classifier: Programming Language :: Python :: 3 :: Only
43
- Requires-Python: ~=3.9
31
+ Requires-Python: <3.13,>=3.9
44
32
  Description-Content-Type: text/markdown
45
33
  License-File: LICENSE
46
34
  Requires-Dist: mathparse<0.2,>=0.1
@@ -53,11 +41,20 @@ Requires-Dist: flake8; extra == "test"
53
41
  Requires-Dist: coverage; extra == "test"
54
42
  Requires-Dist: nose; extra == "test"
55
43
  Requires-Dist: sphinx<8.2,>=5.3; extra == "test"
44
+ Requires-Dist: sphinx-sitemap>=2.6.0; extra == "test"
45
+ Requires-Dist: huggingface_hub; extra == "test"
56
46
  Provides-Extra: dev
57
47
  Requires-Dist: pint>=0.8.1; extra == "dev"
58
- Requires-Dist: pymongo<4.12,>=4.11; extra == "dev"
59
48
  Requires-Dist: pyyaml<7.0,>=6.0; extra == "dev"
60
49
  Requires-Dist: chatterbot-corpus>=1.2.2; extra == "dev"
50
+ Provides-Extra: redis
51
+ Requires-Dist: redis[hiredis]; extra == "redis"
52
+ Requires-Dist: langchain-redis; extra == "redis"
53
+ Requires-Dist: langchain-huggingface; extra == "redis"
54
+ Requires-Dist: sentence-transformers; extra == "redis"
55
+ Provides-Extra: mongodb
56
+ Requires-Dist: pymongo<4.12,>=4.11; extra == "mongodb"
57
+ Dynamic: license-file
61
58
 
62
59
  ![ChatterBot: Machine learning in Python](https://i.imgur.com/b3SCmGT.png)
63
60
 
@@ -70,7 +67,6 @@ to be trained to speak any language.
70
67
 
71
68
  [![Package Version](https://img.shields.io/pypi/v/chatterbot.svg)](https://pypi.python.org/pypi/chatterbot/)
72
69
  [![Python 3.9](https://img.shields.io/badge/python-3.9-blue.svg)](https://www.python.org/downloads/release/python-360/)
73
- [![Django 2.0](https://img.shields.io/badge/Django-2.0-blue.svg)](https://docs.djangoproject.com/en/2.1/releases/2.0/)
74
70
  [![Coverage Status](https://img.shields.io/coveralls/gunthercox/ChatterBot.svg)](https://coveralls.io/r/gunthercox/ChatterBot)
75
71
  [![Code Climate](https://codeclimate.com/github/gunthercox/ChatterBot/badges/gpa.svg)](https://codeclimate.com/github/gunthercox/ChatterBot)
76
72
  [![Join the chat at https://gitter.im/chatterbot/Lobby](https://badges.gitter.im/chatterbot/Lobby.svg)](https://gitter.im/chatterbot/Lobby?utm_source=badge&utm_medium=badge&utm_content=badge)
@@ -161,7 +157,7 @@ See release notes for changes https://github.com/gunthercox/ChatterBot/releases
161
157
  a new branch `my-pull-request`.
162
158
  3. [Create a pull request](https://help.github.com/articles/creating-a-pull-request/).
163
159
  4. Please follow the [Python style guide for PEP-8](https://www.python.org/dev/peps/pep-0008/).
164
- 5. Use the projects [built-in automated testing](https://docs.chatterbot.us/testing.html).
160
+ 5. Use the projects [built-in automated testing](https://docs.chatterbot.us/testing/).
165
161
  to help make sure that your contribution is free from errors.
166
162
 
167
163
  # License
@@ -9,7 +9,6 @@ to be trained to speak any language.
9
9
 
10
10
  [![Package Version](https://img.shields.io/pypi/v/chatterbot.svg)](https://pypi.python.org/pypi/chatterbot/)
11
11
  [![Python 3.9](https://img.shields.io/badge/python-3.9-blue.svg)](https://www.python.org/downloads/release/python-360/)
12
- [![Django 2.0](https://img.shields.io/badge/Django-2.0-blue.svg)](https://docs.djangoproject.com/en/2.1/releases/2.0/)
13
12
  [![Coverage Status](https://img.shields.io/coveralls/gunthercox/ChatterBot.svg)](https://coveralls.io/r/gunthercox/ChatterBot)
14
13
  [![Code Climate](https://codeclimate.com/github/gunthercox/ChatterBot/badges/gpa.svg)](https://codeclimate.com/github/gunthercox/ChatterBot)
15
14
  [![Join the chat at https://gitter.im/chatterbot/Lobby](https://badges.gitter.im/chatterbot/Lobby.svg)](https://gitter.im/chatterbot/Lobby?utm_source=badge&utm_medium=badge&utm_content=badge)
@@ -100,7 +99,7 @@ See release notes for changes https://github.com/gunthercox/ChatterBot/releases
100
99
  a new branch `my-pull-request`.
101
100
  3. [Create a pull request](https://help.github.com/articles/creating-a-pull-request/).
102
101
  4. Please follow the [Python style guide for PEP-8](https://www.python.org/dev/peps/pep-0008/).
103
- 5. Use the projects [built-in automated testing](https://docs.chatterbot.us/testing.html).
102
+ 5. Use the projects [built-in automated testing](https://docs.chatterbot.us/testing/).
104
103
  to help make sure that your contribution is free from errors.
105
104
 
106
105
  # License
@@ -4,7 +4,7 @@ ChatterBot is a machine learning, conversational dialog engine.
4
4
  from .chatterbot import ChatBot
5
5
 
6
6
 
7
- __version__ = '1.2.2'
7
+ __version__ = '1.2.4'
8
8
 
9
9
  __all__ = (
10
10
  'ChatBot',
@@ -0,0 +1,27 @@
1
+ """
2
+ Example usage for ChatterBot command line arguments:
3
+
4
+ python -m chatterbot --help
5
+ """
6
+
7
+ import sys
8
+
9
+
10
+ def get_chatterbot_version():
11
+ """
12
+ Return the version of the current package.
13
+ """
14
+ from chatterbot import __version__
15
+
16
+ return __version__
17
+
18
+
19
+ if __name__ == '__main__':
20
+ if '--version' in sys.argv:
21
+ print(get_chatterbot_version())
22
+ elif '--help' in sys.argv:
23
+ print('usage: chatterbot [--version, --help]')
24
+ print(' --version: Print the version of ChatterBot')
25
+ print(' --help: Print this help message')
26
+ print()
27
+ print('Documentation at https://docs.chatterbot.us')
@@ -11,11 +11,41 @@ import spacy
11
11
  class ChatBot(object):
12
12
  """
13
13
  A conversational dialog chat bot.
14
+
15
+ :param name: A name is the only required parameter for the ChatBot class.
16
+ :type name: str
17
+
18
+ :keyword storage_adapter: The dot-notated import path to a storage adapter class.
19
+ Defaults to ``"chatterbot.storage.SQLStorageAdapter"``.
20
+ :type storage_adapter: str
21
+
22
+ :param logic_adapters: A list of dot-notated import paths to each logic adapter the bot uses.
23
+ Defaults to ``["chatterbot.logic.BestMatch"]``.
24
+ :type logic_adapters: list
25
+
26
+ :param tagger: The tagger to use for the chat bot.
27
+ Defaults to :class:`~chatterbot.tagging.PosLemmaTagger`
28
+ :type tagger: object
29
+
30
+ :param tagger_language: The language to use for the tagger.
31
+ Defaults to :class:`~chatterbot.languages.ENG`.
32
+ :type tagger_language: object
33
+
34
+ :param preprocessors: A list of preprocessor functions to use for the chat bot.
35
+ :type preprocessors: list
36
+
37
+ :param read_only: If True, the chat bot will not save any input it receives, defaults to False.
38
+ :type read_only: bool
39
+
40
+ :param logger: A ``Logger`` object.
41
+ :type logger: logging.Logger
14
42
  """
15
43
 
16
44
  def __init__(self, name, **kwargs):
17
45
  self.name = name
18
46
 
47
+ self.logger = kwargs.get('logger', logging.getLogger(__name__))
48
+
19
49
  storage_adapter = kwargs.get('storage_adapter', 'chatterbot.storage.SQLStorageAdapter')
20
50
 
21
51
  logic_adapters = kwargs.get('logic_adapters', [
@@ -30,11 +60,29 @@ class ChatBot(object):
30
60
 
31
61
  self.storage = utils.initialize_class(storage_adapter, **kwargs)
32
62
 
33
- Tagger = kwargs.get('tagger', PosLemmaTagger)
63
+ tagger_language = kwargs.get('tagger_language', languages.ENG)
34
64
 
35
- self.tagger = Tagger(language=kwargs.get(
36
- 'tagger_language', languages.ENG
37
- ))
65
+ try:
66
+ Tagger = kwargs.get('tagger', PosLemmaTagger)
67
+
68
+ self.tagger = Tagger(language=tagger_language)
69
+ except IOError as io_error:
70
+ # Return a more helpful error message if possible
71
+ if "Can't find model" in str(io_error):
72
+ model_name = utils.get_model_for_language(tagger_language)
73
+ if hasattr(tagger_language, 'ENGLISH_NAME'):
74
+ language_name = tagger_language.ENGLISH_NAME
75
+ else:
76
+ language_name = tagger_language
77
+ raise self.ChatBotException(
78
+ 'Setup error:\n'
79
+ f'The Spacy model for "{language_name}" language is missing.\n'
80
+ 'Please install the model using the command:\n\n'
81
+ f'python -m spacy download {model_name}\n\n'
82
+ 'See https://spacy.io/usage/models for more information about available models.'
83
+ ) from io_error
84
+ else:
85
+ raise io_error
38
86
 
39
87
  primary_search_algorithm = IndexedTextSearch(self, **kwargs)
40
88
  text_search_algorithm = TextSearch(self, **kwargs)
@@ -63,8 +111,6 @@ class ChatBot(object):
63
111
  # NOTE: 'xx' is the language code for a multi-language model
64
112
  self.nlp = spacy.blank(self.tagger.language.ISO_639_1)
65
113
 
66
- self.logger = kwargs.get('logger', logging.getLogger(__name__))
67
-
68
114
  # Allow the bot to save input it receives so that it can learn
69
115
  self.read_only = kwargs.get('read_only', False)
70
116
 
@@ -2,7 +2,7 @@
2
2
  This module contains various text-comparison algorithms
3
3
  designed to compare one statement to another.
4
4
  """
5
- from chatterbot import constants
5
+ from chatterbot.utils import get_model_for_language
6
6
  from difflib import SequenceMatcher
7
7
  import spacy
8
8
 
@@ -100,12 +100,7 @@ class SpacySimilarity(Comparator):
100
100
  def __init__(self, language):
101
101
  super().__init__(language)
102
102
 
103
- try:
104
- model = constants.DEFAULT_LANGUAGE_TO_SPACY_MODEL_MAP[self.language]
105
- except KeyError as e:
106
- raise KeyError(
107
- f'Spacy model is not available for language {self.language}'
108
- ) from e
103
+ model = get_model_for_language(language)
109
104
 
110
105
  # Disable the Named Entity Recognition (NER) component because it is not necessary
111
106
  self.nlp = spacy.load(model, exclude=['ner'])
@@ -157,12 +152,7 @@ class JaccardSimilarity(Comparator):
157
152
  def __init__(self, language):
158
153
  super().__init__(language)
159
154
 
160
- try:
161
- model = constants.DEFAULT_LANGUAGE_TO_SPACY_MODEL_MAP[self.language]
162
- except KeyError as e:
163
- raise KeyError(
164
- f'Spacy model is not available for language {self.language}'
165
- ) from e
155
+ model = get_model_for_language(language)
166
156
 
167
157
  # Disable the Named Entity Recognition (NER) component because it is not necessary
168
158
  self.nlp = spacy.load(model, exclude=['ner'])
@@ -1,7 +1,7 @@
1
1
  from sqlalchemy import Table, Column, Integer, String, DateTime, ForeignKey
2
- from sqlalchemy.orm import relationship
2
+ from sqlalchemy.orm import relationship, declarative_base
3
3
  from sqlalchemy.sql import func
4
- from sqlalchemy.ext.declarative import declared_attr, declarative_base
4
+ from sqlalchemy.ext.declarative import declared_attr
5
5
 
6
6
  from chatterbot.conversation import StatementMixin
7
7
  from chatterbot import constants
@@ -0,0 +1,76 @@
1
+ from chatterbot.logic import LogicAdapter
2
+ from chatterbot.conversation import Statement
3
+ from chatterbot import languages
4
+ from chatterbot.utils import get_model_for_language
5
+ import spacy
6
+
7
+
8
+ class SpecificResponseAdapter(LogicAdapter):
9
+ """
10
+ Return a specific response to a specific input.
11
+
12
+ :kwargs:
13
+ * *input_text* (``str``) --
14
+ The input text that triggers this logic adapter.
15
+ * *output_text* (``str`` or ``function``) --
16
+ The output text returned by this logic adapter.
17
+ If a function is provided, it should return a string.
18
+ """
19
+
20
+ def __init__(self, chatbot, **kwargs):
21
+ super().__init__(chatbot, **kwargs)
22
+
23
+ self.input_text = kwargs.get('input_text')
24
+
25
+ self.matcher = None
26
+
27
+ if MatcherClass := kwargs.get('matcher'):
28
+ language = kwargs.get('language', languages.ENG)
29
+
30
+ self.nlp = self._initialize_nlp(language)
31
+
32
+ self.matcher = MatcherClass(self.nlp.vocab)
33
+
34
+ self.matcher.add('SpecificResponse', [self.input_text])
35
+
36
+ self._output_text = kwargs.get('output_text')
37
+
38
+ def _initialize_nlp(self, language):
39
+ model = get_model_for_language(language)
40
+
41
+ return spacy.load(model)
42
+
43
+ def can_process(self, statement):
44
+ if self.matcher:
45
+ doc = self.nlp(statement.text)
46
+ matches = self.matcher(doc)
47
+
48
+ if matches:
49
+ return True
50
+ elif statement.text == self.input_text:
51
+ return True
52
+
53
+ return False
54
+
55
+ def process(self, statement, additional_response_selection_parameters=None):
56
+
57
+ if callable(self._output_text):
58
+ response_statement = Statement(text=self._output_text())
59
+ else:
60
+ response_statement = Statement(text=self._output_text)
61
+
62
+ if self.matcher:
63
+ doc = self.nlp(statement.text)
64
+ matches = self.matcher(doc)
65
+
66
+ if matches:
67
+ response_statement.confidence = 1
68
+ else:
69
+ response_statement.confidence = 0
70
+
71
+ elif statement.text == self.input_text:
72
+ response_statement.confidence = 1
73
+ else:
74
+ response_statement.confidence = 0
75
+
76
+ return response_statement
@@ -1,7 +1,8 @@
1
1
  from datetime import datetime
2
- from chatterbot import constants, languages
2
+ from chatterbot import languages
3
3
  from chatterbot.logic import LogicAdapter
4
4
  from chatterbot.conversation import Statement
5
+ from chatterbot.utils import get_model_for_language
5
6
  import spacy
6
7
 
7
8
 
@@ -36,12 +37,7 @@ class TimeLogicAdapter(LogicAdapter):
36
37
 
37
38
  language = kwargs.get('language', languages.ENG)
38
39
 
39
- try:
40
- model = constants.DEFAULT_LANGUAGE_TO_SPACY_MODEL_MAP[language]
41
- except KeyError as e:
42
- raise KeyError(
43
- f'Spacy model is not available for language {language}'
44
- ) from e
40
+ model = get_model_for_language(language)
45
41
 
46
42
  self.nlp = spacy.load(model)
47
43
 
@@ -158,7 +158,8 @@ class UnitConversion(LogicAdapter):
158
158
  response = func(p)
159
159
  if response.confidence == 1.0:
160
160
  break
161
- except Exception:
161
+ except Exception as e:
162
+ self.chatbot.logger.warning('Error during UnitConversion: {}'.format(str(e)))
162
163
  response.confidence = 0.0
163
- finally:
164
- return response
164
+
165
+ return response
@@ -2,6 +2,7 @@ from chatterbot.storage.storage_adapter import StorageAdapter
2
2
  from chatterbot.storage.django_storage import DjangoStorageAdapter
3
3
  from chatterbot.storage.mongodb import MongoDatabaseAdapter
4
4
  from chatterbot.storage.sql_storage import SQLStorageAdapter
5
+ from chatterbot.storage.redis import RedisVectorStorageAdapter
5
6
 
6
7
 
7
8
  __all__ = (
@@ -9,4 +10,5 @@ __all__ = (
9
10
  'DjangoStorageAdapter',
10
11
  'MongoDatabaseAdapter',
11
12
  'SQLStorageAdapter',
13
+ 'RedisVectorStorageAdapter',
12
14
  )