diff --git a/chatter/chatter.py b/chatter/chatter.py index 3678324..0a083a9 100644 --- a/chatter/chatter.py +++ b/chatter/chatter.py @@ -5,8 +5,8 @@ import discord from discord.ext import commands from redbot.core import Config -from .source import ChatBot -from .source.trainers import ListTrainer +from .chatterbot import ChatBot +from .chatterbot.trainers import ListTrainer class Chatter: @@ -23,7 +23,11 @@ class Chatter: "days": 1 } - self.chatbot = ChatBot("ChatterBot") + self.chatbot = ChatBot( + "ChatterBot", + storage_adapter='chatterbot.storage.SQLStorageAdapter', + database='./database.sqlite3' + ) self.chatbot.set_trainer(ListTrainer) self.config.register_global(**default_global) diff --git a/chatter/source/__init__.py b/chatter/chatterbot/__init__.py similarity index 91% rename from chatter/source/__init__.py rename to chatter/chatterbot/__init__.py index 2ea55f6..7a127ee 100644 --- a/chatter/source/__init__.py +++ b/chatter/chatterbot/__init__.py @@ -3,7 +3,7 @@ ChatterBot is a machine learning, conversational dialog engine. """ from .chatterbot import ChatBot -__version__ = '0.8.4' +__version__ = '0.8.5' __author__ = 'Gunther Cox' __email__ = 'gunthercx@gmail.com' __url__ = 'https://github.com/gunthercox/ChatterBot' diff --git a/chatter/source/__main__.py b/chatter/chatterbot/__main__.py similarity index 100% rename from chatter/source/__main__.py rename to chatter/chatterbot/__main__.py diff --git a/chatter/source/adapters.py b/chatter/chatterbot/adapters.py similarity index 96% rename from chatter/source/adapters.py rename to chatter/chatterbot/adapters.py index f99734d..83ce94c 100644 --- a/chatter/source/adapters.py +++ b/chatter/chatterbot/adapters.py @@ -16,7 +16,7 @@ class Adapter(object): """ Gives the adapter access to an instance of the ChatBot class. - :param chatbot: A chat bot instanse. + :param chatbot: A chat bot instance. :type chatbot: ChatBot """ self.chatbot = chatbot diff --git a/chatter/source/chatterbot.py b/chatter/chatterbot/chatterbot.py similarity index 91% rename from chatter/source/chatterbot.py rename to chatter/chatterbot/chatterbot.py index 66a92b9..2a5049d 100644 --- a/chatter/source/chatterbot.py +++ b/chatter/chatterbot/chatterbot.py @@ -20,15 +20,15 @@ class ChatBot(object): self.default_session = None - storage_adapter = kwargs.get('storage_adapter', 'chatter.source.storage.SQLStorageAdapter') + storage_adapter = kwargs.get('storage_adapter', 'chatterbot.storage.SQLStorageAdapter') logic_adapters = kwargs.get('logic_adapters', [ - 'chatter.source.logic.BestMatch' + 'chatterbot.logic.BestMatch' ]) - input_adapter = kwargs.get('input_adapter', 'chatter.source.input.VariableInputTypeAdapter') + input_adapter = kwargs.get('input_adapter', 'chatterbot.input.VariableInputTypeAdapter') - output_adapter = kwargs.get('output_adapter', 'chatter.source.output.OutputAdapter') + output_adapter = kwargs.get('output_adapter', 'chatterbot.output.OutputAdapter') # Check that each adapter is a valid subclass of it's respective parent utils.validate_adapter_class(storage_adapter, StorageAdapter) @@ -45,7 +45,7 @@ class ChatBot(object): # Add required system logic adapter self.logic.system_adapters.append( - utils.initialize_class('chatter.source.logic.NoKnowledgeAdapter', **kwargs) + utils.initialize_class('chatterbot.logic.NoKnowledgeAdapter', **kwargs) ) for adapter in logic_adapters: @@ -59,7 +59,7 @@ class ChatBot(object): preprocessors = kwargs.get( 'preprocessors', [ - 'chatter.source.preprocessors.clean_whitespace' + 'chatterbot.preprocessors.clean_whitespace' ] ) @@ -69,7 +69,7 @@ class ChatBot(object): self.preprocessors.append(utils.import_module(preprocessor)) # Use specified trainer or fall back to the default - trainer = kwargs.get('trainer', 'chatter.source.trainers.Trainer') + trainer = kwargs.get('trainer', 'chatterbot.trainers.Trainer') TrainerClass = utils.import_module(trainer) self.trainer = TrainerClass(self.storage, **kwargs) self.training_data = kwargs.get('training_data') diff --git a/chatter/source/comparisons.py b/chatter/chatterbot/comparisons.py similarity index 99% rename from chatter/source/comparisons.py rename to chatter/chatterbot/comparisons.py index 816e175..c500487 100644 --- a/chatter/source/comparisons.py +++ b/chatter/chatterbot/comparisons.py @@ -130,7 +130,7 @@ class SynsetDistance(Comparator): """ from nltk.corpus import wordnet from nltk import word_tokenize - from . import utils + from chatterbot import utils import itertools tokens1 = word_tokenize(statement.text.lower()) diff --git a/chatter/source/constants.py b/chatter/chatterbot/constants.py similarity index 100% rename from chatter/source/constants.py rename to chatter/chatterbot/constants.py diff --git a/chatter/source/conversation.py b/chatter/chatterbot/conversation.py similarity index 100% rename from chatter/source/conversation.py rename to chatter/chatterbot/conversation.py diff --git a/chatter/source/corpus.py b/chatter/chatterbot/corpus.py similarity index 100% rename from chatter/source/corpus.py rename to chatter/chatterbot/corpus.py diff --git a/chatter/source/ext/__init__.py b/chatter/chatterbot/ext/__init__.py similarity index 100% rename from chatter/source/ext/__init__.py rename to chatter/chatterbot/ext/__init__.py diff --git a/chatter/chatterbot/ext/django_chatterbot/__init__.py b/chatter/chatterbot/ext/django_chatterbot/__init__.py new file mode 100644 index 0000000..0bd8684 --- /dev/null +++ b/chatter/chatterbot/ext/django_chatterbot/__init__.py @@ -0,0 +1,3 @@ +default_app_config = ( + 'chatterbot.ext.django_chatterbot.apps.DjangoChatterBotConfig' +) diff --git a/chatter/source/ext/django_chatterbot/abstract_models.py b/chatter/chatterbot/ext/django_chatterbot/abstract_models.py similarity index 98% rename from chatter/source/ext/django_chatterbot/abstract_models.py rename to chatter/chatterbot/ext/django_chatterbot/abstract_models.py index 4531186..59c9cea 100644 --- a/chatter/source/ext/django_chatterbot/abstract_models.py +++ b/chatter/chatterbot/ext/django_chatterbot/abstract_models.py @@ -1,5 +1,5 @@ -from ...conversation import StatementMixin -from ... import constants +from chatterbot.conversation import StatementMixin +from chatterbot import constants from django.db import models from django.apps import apps from django.utils import timezone diff --git a/chatter/source/ext/django_chatterbot/admin.py b/chatter/chatterbot/ext/django_chatterbot/admin.py similarity index 93% rename from chatter/source/ext/django_chatterbot/admin.py rename to chatter/chatterbot/ext/django_chatterbot/admin.py index 193c264..a641883 100644 --- a/chatter/source/ext/django_chatterbot/admin.py +++ b/chatter/chatterbot/ext/django_chatterbot/admin.py @@ -1,5 +1,5 @@ from django.contrib import admin -from .models import ( +from chatterbot.ext.django_chatterbot.models import ( Statement, Response, Conversation, Tag ) diff --git a/chatter/source/ext/django_chatterbot/apps.py b/chatter/chatterbot/ext/django_chatterbot/apps.py similarity index 74% rename from chatter/source/ext/django_chatterbot/apps.py rename to chatter/chatterbot/ext/django_chatterbot/apps.py index b873e3e..13f8fe0 100644 --- a/chatter/source/ext/django_chatterbot/apps.py +++ b/chatter/chatterbot/ext/django_chatterbot/apps.py @@ -3,6 +3,6 @@ from django.apps import AppConfig class DjangoChatterBotConfig(AppConfig): - name = 'chatter.source.ext.django_chatterbot' + name = 'chatterbot.ext.django_chatterbot' label = 'django_chatterbot' verbose_name = 'Django ChatterBot' diff --git a/chatter/source/ext/django_chatterbot/factories.py b/chatter/chatterbot/ext/django_chatterbot/factories.py similarity index 89% rename from chatter/source/ext/django_chatterbot/factories.py rename to chatter/chatterbot/ext/django_chatterbot/factories.py index 7367b58..4ac52b8 100644 --- a/chatter/source/ext/django_chatterbot/factories.py +++ b/chatter/chatterbot/ext/django_chatterbot/factories.py @@ -2,8 +2,8 @@ These factories are used to generate fake data for testing. """ import factory -from . import models -from ... import constants +from chatterbot.ext.django_chatterbot import models +from chatterbot import constants from factory.django import DjangoModelFactory diff --git a/chatter/source/ext/django_chatterbot/management/__init__.py b/chatter/chatterbot/ext/django_chatterbot/management/__init__.py similarity index 100% rename from chatter/source/ext/django_chatterbot/management/__init__.py rename to chatter/chatterbot/ext/django_chatterbot/management/__init__.py diff --git a/chatter/source/ext/django_chatterbot/management/commands/__init__.py b/chatter/chatterbot/ext/django_chatterbot/management/commands/__init__.py similarity index 100% rename from chatter/source/ext/django_chatterbot/management/commands/__init__.py rename to chatter/chatterbot/ext/django_chatterbot/management/commands/__init__.py diff --git a/chatter/source/ext/django_chatterbot/management/commands/train.py b/chatter/chatterbot/ext/django_chatterbot/management/commands/train.py similarity index 88% rename from chatter/source/ext/django_chatterbot/management/commands/train.py rename to chatter/chatterbot/ext/django_chatterbot/management/commands/train.py index d4810b8..50af70d 100644 --- a/chatter/source/ext/django_chatterbot/management/commands/train.py +++ b/chatter/chatterbot/ext/django_chatterbot/management/commands/train.py @@ -11,8 +11,8 @@ class Command(BaseCommand): can_import_settings = True def handle(self, *args, **options): - from ..... import ChatBot - from ... import settings + from chatterbot import ChatBot + from chatterbot.ext.django_chatterbot import settings chatterbot = ChatBot(**settings.CHATTERBOT) diff --git a/chatter/source/ext/django_chatterbot/migrations/0001_initial.py b/chatter/chatterbot/ext/django_chatterbot/migrations/0001_initial.py similarity index 100% rename from chatter/source/ext/django_chatterbot/migrations/0001_initial.py rename to chatter/chatterbot/ext/django_chatterbot/migrations/0001_initial.py diff --git a/chatter/source/ext/django_chatterbot/migrations/0002_statement_extra_data.py b/chatter/chatterbot/ext/django_chatterbot/migrations/0002_statement_extra_data.py similarity index 100% rename from chatter/source/ext/django_chatterbot/migrations/0002_statement_extra_data.py rename to chatter/chatterbot/ext/django_chatterbot/migrations/0002_statement_extra_data.py diff --git a/chatter/source/ext/django_chatterbot/migrations/0003_change_occurrence_default.py b/chatter/chatterbot/ext/django_chatterbot/migrations/0003_change_occurrence_default.py similarity index 100% rename from chatter/source/ext/django_chatterbot/migrations/0003_change_occurrence_default.py rename to chatter/chatterbot/ext/django_chatterbot/migrations/0003_change_occurrence_default.py diff --git a/chatter/source/ext/django_chatterbot/migrations/0004_rename_in_response_to.py b/chatter/chatterbot/ext/django_chatterbot/migrations/0004_rename_in_response_to.py similarity index 100% rename from chatter/source/ext/django_chatterbot/migrations/0004_rename_in_response_to.py rename to chatter/chatterbot/ext/django_chatterbot/migrations/0004_rename_in_response_to.py diff --git a/chatter/source/ext/django_chatterbot/migrations/0005_statement_created_at.py b/chatter/chatterbot/ext/django_chatterbot/migrations/0005_statement_created_at.py similarity index 100% rename from chatter/source/ext/django_chatterbot/migrations/0005_statement_created_at.py rename to chatter/chatterbot/ext/django_chatterbot/migrations/0005_statement_created_at.py diff --git a/chatter/source/ext/django_chatterbot/migrations/0006_create_conversation.py b/chatter/chatterbot/ext/django_chatterbot/migrations/0006_create_conversation.py similarity index 100% rename from chatter/source/ext/django_chatterbot/migrations/0006_create_conversation.py rename to chatter/chatterbot/ext/django_chatterbot/migrations/0006_create_conversation.py diff --git a/chatter/source/ext/django_chatterbot/migrations/0007_response_created_at.py b/chatter/chatterbot/ext/django_chatterbot/migrations/0007_response_created_at.py similarity index 100% rename from chatter/source/ext/django_chatterbot/migrations/0007_response_created_at.py rename to chatter/chatterbot/ext/django_chatterbot/migrations/0007_response_created_at.py diff --git a/chatter/source/ext/django_chatterbot/migrations/0008_update_conversations.py b/chatter/chatterbot/ext/django_chatterbot/migrations/0008_update_conversations.py similarity index 100% rename from chatter/source/ext/django_chatterbot/migrations/0008_update_conversations.py rename to chatter/chatterbot/ext/django_chatterbot/migrations/0008_update_conversations.py diff --git a/chatter/source/ext/django_chatterbot/migrations/0009_tags.py b/chatter/chatterbot/ext/django_chatterbot/migrations/0009_tags.py similarity index 100% rename from chatter/source/ext/django_chatterbot/migrations/0009_tags.py rename to chatter/chatterbot/ext/django_chatterbot/migrations/0009_tags.py diff --git a/chatter/source/ext/django_chatterbot/migrations/0010_statement_text.py b/chatter/chatterbot/ext/django_chatterbot/migrations/0010_statement_text.py similarity index 100% rename from chatter/source/ext/django_chatterbot/migrations/0010_statement_text.py rename to chatter/chatterbot/ext/django_chatterbot/migrations/0010_statement_text.py diff --git a/chatter/source/ext/django_chatterbot/migrations/0011_blank_extra_data.py b/chatter/chatterbot/ext/django_chatterbot/migrations/0011_blank_extra_data.py similarity index 100% rename from chatter/source/ext/django_chatterbot/migrations/0011_blank_extra_data.py rename to chatter/chatterbot/ext/django_chatterbot/migrations/0011_blank_extra_data.py diff --git a/chatter/source/ext/django_chatterbot/migrations/__init__.py b/chatter/chatterbot/ext/django_chatterbot/migrations/__init__.py similarity index 100% rename from chatter/source/ext/django_chatterbot/migrations/__init__.py rename to chatter/chatterbot/ext/django_chatterbot/migrations/__init__.py diff --git a/chatter/source/ext/django_chatterbot/models.py b/chatter/chatterbot/ext/django_chatterbot/models.py similarity index 90% rename from chatter/source/ext/django_chatterbot/models.py rename to chatter/chatterbot/ext/django_chatterbot/models.py index ac51c06..d82a603 100644 --- a/chatter/source/ext/django_chatterbot/models.py +++ b/chatter/chatterbot/ext/django_chatterbot/models.py @@ -1,4 +1,4 @@ -from .abstract_models import ( +from chatterbot.ext.django_chatterbot.abstract_models import ( AbstractBaseConversation, AbstractBaseResponse, AbstractBaseStatement, AbstractBaseTag ) diff --git a/chatter/source/ext/django_chatterbot/settings.py b/chatter/chatterbot/ext/django_chatterbot/settings.py similarity index 59% rename from chatter/source/ext/django_chatterbot/settings.py rename to chatter/chatterbot/ext/django_chatterbot/settings.py index 802b77d..ed5ca46 100644 --- a/chatter/source/ext/django_chatterbot/settings.py +++ b/chatter/chatterbot/ext/django_chatterbot/settings.py @@ -2,16 +2,16 @@ Default ChatterBot settings for Django. """ from django.conf import settings -from ... import constants +from chatterbot import constants CHATTERBOT_SETTINGS = getattr(settings, 'CHATTERBOT', {}) CHATTERBOT_DEFAULTS = { 'name': 'ChatterBot', - 'storage_adapter': 'chatter.source.storage.DjangoStorageAdapter', - 'input_adapter': 'chatter.source.input.VariableInputTypeAdapter', - 'output_adapter': 'chatter.source.output.OutputAdapter', + 'storage_adapter': 'chatterbot.storage.DjangoStorageAdapter', + 'input_adapter': 'chatterbot.input.VariableInputTypeAdapter', + 'output_adapter': 'chatterbot.output.OutputAdapter', 'django_app_name': constants.DEFAULT_DJANGO_APP_NAME } diff --git a/chatter/source/ext/django_chatterbot/urls.py b/chatter/chatterbot/ext/django_chatterbot/urls.py similarity index 100% rename from chatter/source/ext/django_chatterbot/urls.py rename to chatter/chatterbot/ext/django_chatterbot/urls.py diff --git a/chatter/source/ext/django_chatterbot/views.py b/chatter/chatterbot/ext/django_chatterbot/views.py similarity index 95% rename from chatter/source/ext/django_chatterbot/views.py rename to chatter/chatterbot/ext/django_chatterbot/views.py index d73408e..ff4d12b 100644 --- a/chatter/source/ext/django_chatterbot/views.py +++ b/chatter/chatterbot/ext/django_chatterbot/views.py @@ -1,8 +1,8 @@ import json from django.views.generic import View from django.http import JsonResponse -from ... import ChatBot -from . import settings +from chatterbot import ChatBot +from chatterbot.ext.django_chatterbot import settings class ChatterBotViewMixin(object): @@ -28,7 +28,7 @@ class ChatterBotViewMixin(object): Return the conversation for the session if one exists. Create a new conversation if one does not exist. """ - from .models import Conversation, Response + from chatterbot.ext.django_chatterbot.models import Conversation, Response class Obj(object): def __init__(self): diff --git a/chatter/source/ext/sqlalchemy_app/__init__.py b/chatter/chatterbot/ext/sqlalchemy_app/__init__.py similarity index 100% rename from chatter/source/ext/sqlalchemy_app/__init__.py rename to chatter/chatterbot/ext/sqlalchemy_app/__init__.py diff --git a/chatter/source/ext/sqlalchemy_app/models.py b/chatter/chatterbot/ext/sqlalchemy_app/models.py similarity index 89% rename from chatter/source/ext/sqlalchemy_app/models.py rename to chatter/chatterbot/ext/sqlalchemy_app/models.py index 9f1b0d3..cba4a47 100644 --- a/chatter/source/ext/sqlalchemy_app/models.py +++ b/chatter/chatterbot/ext/sqlalchemy_app/models.py @@ -3,9 +3,9 @@ from sqlalchemy.orm import relationship from sqlalchemy.sql import func from sqlalchemy.ext.declarative import declared_attr, declarative_base -from ...constants import TAG_NAME_MAX_LENGTH, STATEMENT_TEXT_MAX_LENGTH -from .types import UnicodeString -from ...conversation import StatementMixin +from chatterbot.constants import TAG_NAME_MAX_LENGTH, STATEMENT_TEXT_MAX_LENGTH +from chatterbot.ext.sqlalchemy_app.types import UnicodeString +from chatterbot.conversation import StatementMixin class ModelBase(object): @@ -73,8 +73,8 @@ class Statement(Base, StatementMixin): return [tag.name for tag in self.tags] def get_statement(self): - from ...conversation import Statement as StatementObject - from ...conversation import Response as ResponseObject + from chatterbot.conversation import Statement as StatementObject + from chatterbot.conversation import Response as ResponseObject statement = StatementObject( self.text, diff --git a/chatter/source/ext/sqlalchemy_app/types.py b/chatter/chatterbot/ext/sqlalchemy_app/types.py similarity index 100% rename from chatter/source/ext/sqlalchemy_app/types.py rename to chatter/chatterbot/ext/sqlalchemy_app/types.py diff --git a/chatter/source/filters.py b/chatter/chatterbot/filters.py similarity index 100% rename from chatter/source/filters.py rename to chatter/chatterbot/filters.py diff --git a/chatter/source/input/__init__.py b/chatter/chatterbot/input/__init__.py similarity index 100% rename from chatter/source/input/__init__.py rename to chatter/chatterbot/input/__init__.py diff --git a/chatter/source/input/gitter.py b/chatter/chatterbot/input/gitter.py similarity index 98% rename from chatter/source/input/gitter.py rename to chatter/chatterbot/input/gitter.py index 6ed83db..db97772 100644 --- a/chatter/source/input/gitter.py +++ b/chatter/chatterbot/input/gitter.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals from time import sleep -from . import InputAdapter -from ..conversation import Statement +from chatterbot.input import InputAdapter +from chatterbot.conversation import Statement class Gitter(InputAdapter): diff --git a/chatter/source/input/hipchat.py b/chatter/chatterbot/input/hipchat.py similarity index 97% rename from chatter/source/input/hipchat.py rename to chatter/chatterbot/input/hipchat.py index b251157..57cf4d6 100644 --- a/chatter/source/input/hipchat.py +++ b/chatter/chatterbot/input/hipchat.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals from time import sleep -from . import InputAdapter -from ..conversation import Statement +from chatterbot.input import InputAdapter +from chatterbot.conversation import Statement class HipChat(InputAdapter): diff --git a/chatter/source/input/input_adapter.py b/chatter/chatterbot/input/input_adapter.py similarity index 96% rename from chatter/source/input/input_adapter.py rename to chatter/chatterbot/input/input_adapter.py index 3bc4b08..17b1dbe 100644 --- a/chatter/source/input/input_adapter.py +++ b/chatter/chatterbot/input/input_adapter.py @@ -1,5 +1,5 @@ from __future__ import unicode_literals -from ..adapters import Adapter +from chatterbot.adapters import Adapter class InputAdapter(Adapter): diff --git a/chatter/source/input/mailgun.py b/chatter/chatterbot/input/mailgun.py similarity index 94% rename from chatter/source/input/mailgun.py rename to chatter/chatterbot/input/mailgun.py index b1fe705..199a677 100644 --- a/chatter/source/input/mailgun.py +++ b/chatter/chatterbot/input/mailgun.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals import datetime -from . import InputAdapter -from ..conversation import Statement +from chatterbot.input import InputAdapter +from chatterbot.conversation import Statement class Mailgun(InputAdapter): diff --git a/chatter/source/input/microsoft.py b/chatter/chatterbot/input/microsoft.py similarity index 97% rename from chatter/source/input/microsoft.py rename to chatter/chatterbot/input/microsoft.py index 395a3de..5e57e78 100644 --- a/chatter/source/input/microsoft.py +++ b/chatter/chatterbot/input/microsoft.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals from time import sleep -from . import InputAdapter -from ..conversation import Statement +from chatterbot.input import InputAdapter +from chatterbot.conversation import Statement class Microsoft(InputAdapter): diff --git a/chatter/source/input/terminal.py b/chatter/chatterbot/input/terminal.py similarity index 73% rename from chatter/source/input/terminal.py rename to chatter/chatterbot/input/terminal.py index e2d7ba2..2fc15f2 100644 --- a/chatter/source/input/terminal.py +++ b/chatter/chatterbot/input/terminal.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals -from . import InputAdapter -from ..conversation import Statement -from ..utils import input_function +from chatterbot.input import InputAdapter +from chatterbot.conversation import Statement +from chatterbot.utils import input_function class TerminalAdapter(InputAdapter): diff --git a/chatter/source/input/variable_input_type_adapter.py b/chatter/chatterbot/input/variable_input_type_adapter.py similarity index 95% rename from chatter/source/input/variable_input_type_adapter.py rename to chatter/chatterbot/input/variable_input_type_adapter.py index 9158611..2b495d9 100644 --- a/chatter/source/input/variable_input_type_adapter.py +++ b/chatter/chatterbot/input/variable_input_type_adapter.py @@ -1,6 +1,6 @@ from __future__ import unicode_literals -from . import InputAdapter -from ..conversation import Statement +from chatterbot.input import InputAdapter +from chatterbot.conversation import Statement class VariableInputTypeAdapter(InputAdapter): diff --git a/chatter/source/logic/__init__.py b/chatter/chatterbot/logic/__init__.py similarity index 100% rename from chatter/source/logic/__init__.py rename to chatter/chatterbot/logic/__init__.py diff --git a/chatter/source/logic/best_match.py b/chatter/chatterbot/logic/best_match.py similarity index 100% rename from chatter/source/logic/best_match.py rename to chatter/chatterbot/logic/best_match.py diff --git a/chatter/source/logic/logic_adapter.py b/chatter/chatterbot/logic/logic_adapter.py similarity index 94% rename from chatter/source/logic/logic_adapter.py rename to chatter/chatterbot/logic/logic_adapter.py index df2c143..020c2a2 100644 --- a/chatter/source/logic/logic_adapter.py +++ b/chatter/chatterbot/logic/logic_adapter.py @@ -1,6 +1,6 @@ from __future__ import unicode_literals -from ..adapters import Adapter -from ..utils import import_module +from chatterbot.adapters import Adapter +from chatterbot.utils import import_module class LogicAdapter(Adapter): @@ -17,8 +17,8 @@ class LogicAdapter(Adapter): def __init__(self, **kwargs): super(LogicAdapter, self).__init__(**kwargs) - from ..comparisons import levenshtein_distance - from ..response_selection import get_first_response + from chatterbot.comparisons import levenshtein_distance + from chatterbot.response_selection import get_first_response # Import string module parameters if 'statement_comparison_function' in kwargs: diff --git a/chatter/source/logic/low_confidence.py b/chatter/chatterbot/logic/low_confidence.py similarity index 97% rename from chatter/source/logic/low_confidence.py rename to chatter/chatterbot/logic/low_confidence.py index fb5435c..bb8ebfd 100644 --- a/chatter/source/logic/low_confidence.py +++ b/chatter/chatterbot/logic/low_confidence.py @@ -1,5 +1,5 @@ from __future__ import unicode_literals -from ..conversation import Statement +from chatterbot.conversation import Statement from .best_match import BestMatch diff --git a/chatter/source/logic/mathematical_evaluation.py b/chatter/chatterbot/logic/mathematical_evaluation.py similarity index 95% rename from chatter/source/logic/mathematical_evaluation.py rename to chatter/chatterbot/logic/mathematical_evaluation.py index 2a65fdc..f1e3cbc 100644 --- a/chatter/source/logic/mathematical_evaluation.py +++ b/chatter/chatterbot/logic/mathematical_evaluation.py @@ -1,6 +1,6 @@ from __future__ import unicode_literals -from . import LogicAdapter -from ..conversation import Statement +from chatterbot.logic import LogicAdapter +from chatterbot.conversation import Statement class MathematicalEvaluation(LogicAdapter): diff --git a/chatter/source/logic/multi_adapter.py b/chatter/chatterbot/logic/multi_adapter.py similarity index 98% rename from chatter/source/logic/multi_adapter.py rename to chatter/chatterbot/logic/multi_adapter.py index 150f6c3..17e91f4 100644 --- a/chatter/source/logic/multi_adapter.py +++ b/chatter/chatterbot/logic/multi_adapter.py @@ -1,6 +1,6 @@ from __future__ import unicode_literals from collections import Counter -from .. import utils +from chatterbot import utils from .logic_adapter import LogicAdapter @@ -13,7 +13,7 @@ class MultiLogicAdapter(LogicAdapter): """ def __init__(self, **kwargs): - super().__init__(**kwargs) + super(MultiLogicAdapter, self).__init__(**kwargs) # Logic adapters added by the chat bot self.adapters = [] diff --git a/chatter/source/logic/no_knowledge_adapter.py b/chatter/chatterbot/logic/no_knowledge_adapter.py similarity index 100% rename from chatter/source/logic/no_knowledge_adapter.py rename to chatter/chatterbot/logic/no_knowledge_adapter.py diff --git a/chatter/source/logic/specific_response.py b/chatter/chatterbot/logic/specific_response.py similarity index 94% rename from chatter/source/logic/specific_response.py rename to chatter/chatterbot/logic/specific_response.py index 2ed6da1..611d54f 100644 --- a/chatter/source/logic/specific_response.py +++ b/chatter/chatterbot/logic/specific_response.py @@ -15,7 +15,7 @@ class SpecificResponseAdapter(LogicAdapter): def __init__(self, **kwargs): super(SpecificResponseAdapter, self).__init__(**kwargs) - from ..conversation import Statement + from chatterbot.conversation import Statement self.input_text = kwargs.get('input_text') diff --git a/chatter/source/logic/time_adapter.py b/chatter/chatterbot/logic/time_adapter.py similarity index 98% rename from chatter/source/logic/time_adapter.py rename to chatter/chatterbot/logic/time_adapter.py index 3de4001..6bf6c73 100644 --- a/chatter/source/logic/time_adapter.py +++ b/chatter/chatterbot/logic/time_adapter.py @@ -79,7 +79,7 @@ class TimeLogicAdapter(LogicAdapter): return features def process(self, statement): - from ..conversation import Statement + from chatterbot.conversation import Statement now = datetime.now() diff --git a/chatter/source/output/__init__.py b/chatter/chatterbot/output/__init__.py similarity index 100% rename from chatter/source/output/__init__.py rename to chatter/chatterbot/output/__init__.py diff --git a/chatter/source/output/gitter.py b/chatter/chatterbot/output/gitter.py similarity index 100% rename from chatter/source/output/gitter.py rename to chatter/chatterbot/output/gitter.py diff --git a/chatter/source/output/hipchat.py b/chatter/chatterbot/output/hipchat.py similarity index 100% rename from chatter/source/output/hipchat.py rename to chatter/chatterbot/output/hipchat.py diff --git a/chatter/source/output/mailgun.py b/chatter/chatterbot/output/mailgun.py similarity index 100% rename from chatter/source/output/mailgun.py rename to chatter/chatterbot/output/mailgun.py diff --git a/chatter/source/output/microsoft.py b/chatter/chatterbot/output/microsoft.py similarity index 100% rename from chatter/source/output/microsoft.py rename to chatter/chatterbot/output/microsoft.py diff --git a/chatter/source/output/output_adapter.py b/chatter/chatterbot/output/output_adapter.py similarity index 93% rename from chatter/source/output/output_adapter.py rename to chatter/chatterbot/output/output_adapter.py index 880cb18..631e343 100644 --- a/chatter/source/output/output_adapter.py +++ b/chatter/chatterbot/output/output_adapter.py @@ -1,4 +1,4 @@ -from ..adapters import Adapter +from chatterbot.adapters import Adapter class OutputAdapter(Adapter): diff --git a/chatter/source/output/terminal.py b/chatter/chatterbot/output/terminal.py similarity index 100% rename from chatter/source/output/terminal.py rename to chatter/chatterbot/output/terminal.py diff --git a/chatter/source/parsing.py b/chatter/chatterbot/parsing.py similarity index 100% rename from chatter/source/parsing.py rename to chatter/chatterbot/parsing.py diff --git a/chatter/source/preprocessors.py b/chatter/chatterbot/preprocessors.py similarity index 100% rename from chatter/source/preprocessors.py rename to chatter/chatterbot/preprocessors.py diff --git a/chatter/source/response_selection.py b/chatter/chatterbot/response_selection.py similarity index 100% rename from chatter/source/response_selection.py rename to chatter/chatterbot/response_selection.py diff --git a/chatter/source/storage/__init__.py b/chatter/chatterbot/storage/__init__.py similarity index 100% rename from chatter/source/storage/__init__.py rename to chatter/chatterbot/storage/__init__.py diff --git a/chatter/source/storage/django_storage.py b/chatter/chatterbot/storage/django_storage.py similarity index 98% rename from chatter/source/storage/django_storage.py rename to chatter/chatterbot/storage/django_storage.py index 5642b2c..dea6a82 100644 --- a/chatter/source/storage/django_storage.py +++ b/chatter/chatterbot/storage/django_storage.py @@ -1,5 +1,5 @@ -from . import StorageAdapter -from .. import constants +from chatterbot.storage import StorageAdapter +from chatterbot import constants class DjangoStorageAdapter(StorageAdapter): diff --git a/chatter/source/storage/mongodb.py b/chatter/chatterbot/storage/mongodb.py similarity index 98% rename from chatter/source/storage/mongodb.py rename to chatter/chatterbot/storage/mongodb.py index 92ce5a1..744d672 100644 --- a/chatter/source/storage/mongodb.py +++ b/chatter/chatterbot/storage/mongodb.py @@ -1,4 +1,4 @@ -from . import StorageAdapter +from chatterbot.storage import StorageAdapter class Query(object): @@ -116,7 +116,7 @@ class MongoDatabaseAdapter(StorageAdapter): """ Return the class for the statement model. """ - from ..conversation import Statement + from chatterbot.conversation import Statement # Create a storage-aware statement statement = Statement @@ -128,7 +128,7 @@ class MongoDatabaseAdapter(StorageAdapter): """ Return the class for the response model. """ - from ..conversation import Response + from chatterbot.conversation import Response # Create a storage-aware response response = Response diff --git a/chatter/source/storage/sql_storage.py b/chatter/chatterbot/storage/sql_storage.py similarity index 96% rename from chatter/source/storage/sql_storage.py rename to chatter/chatterbot/storage/sql_storage.py index 21c84e6..ed1153c 100644 --- a/chatter/source/storage/sql_storage.py +++ b/chatter/chatterbot/storage/sql_storage.py @@ -1,8 +1,8 @@ -from . import StorageAdapter +from chatterbot.storage import StorageAdapter def get_response_table(response): - from ..ext.sqlalchemy_app.models import Response + from chatterbot.ext.sqlalchemy_app.models import Response return Response(text=response.text, occurrence=response.occurrence) @@ -86,28 +86,28 @@ class SQLStorageAdapter(StorageAdapter): """ Return the statement model. """ - from ..ext.sqlalchemy_app.models import Statement + from chatterbot.ext.sqlalchemy_app.models import Statement return Statement def get_response_model(self): """ Return the response model. """ - from ..ext.sqlalchemy_app.models import Response + from chatterbot.ext.sqlalchemy_app.models import Response return Response def get_conversation_model(self): """ Return the conversation model. """ - from ..ext.sqlalchemy_app.models import Conversation + from chatterbot.ext.sqlalchemy_app.models import Conversation return Conversation def get_tag_model(self): """ Return the conversation model. """ - from ..ext.sqlalchemy_app.models import Tag + from chatterbot.ext.sqlalchemy_app.models import Tag return Tag def count(self): @@ -379,14 +379,14 @@ class SQLStorageAdapter(StorageAdapter): """ Drop the database attached to a given adapter. """ - from ..ext.sqlalchemy_app.models import Base + from chatterbot.ext.sqlalchemy_app.models import Base Base.metadata.drop_all(self.engine) def create(self): """ Populate the database with the tables. """ - from ..ext.sqlalchemy_app.models import Base + from chatterbot.ext.sqlalchemy_app.models import Base Base.metadata.create_all(self.engine) def _session_finish(self, session, statement_text=None): diff --git a/chatter/source/storage/storage_adapter.py b/chatter/chatterbot/storage/storage_adapter.py similarity index 100% rename from chatter/source/storage/storage_adapter.py rename to chatter/chatterbot/storage/storage_adapter.py diff --git a/chatter/source/trainers.py b/chatter/chatterbot/trainers.py similarity index 100% rename from chatter/source/trainers.py rename to chatter/chatterbot/trainers.py diff --git a/chatter/source/utils.py b/chatter/chatterbot/utils.py similarity index 100% rename from chatter/source/utils.py rename to chatter/chatterbot/utils.py diff --git a/chatter/source/ext/django_chatterbot/__init__.py b/chatter/source/ext/django_chatterbot/__init__.py deleted file mode 100644 index c683f59..0000000 --- a/chatter/source/ext/django_chatterbot/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -default_app_config = ( - 'chatter.source.ext.django_chatterbot.apps.DjangoChatterBotConfig' -)