proper import

pull/1/head
Bobloy 7 years ago
parent 33307aa76f
commit 1cde856661

@ -125,7 +125,7 @@ class SynsetDistance(Comparator):
""" """
from nltk.corpus import wordnet from nltk.corpus import wordnet
from nltk import word_tokenize from nltk import word_tokenize
from chatterbot import utils from chatter.chatterbot import utils
import itertools import itertools
tokens1 = word_tokenize(statement.text.lower()) tokens1 = word_tokenize(statement.text.lower())

@ -1,6 +1,6 @@
from chatterbot.constants import TAG_NAME_MAX_LENGTH, STATEMENT_TEXT_MAX_LENGTH from chatter.chatterbot.constants import TAG_NAME_MAX_LENGTH, STATEMENT_TEXT_MAX_LENGTH
from chatterbot.conversation import StatementMixin from chatter.chatterbot.conversation import StatementMixin
from chatterbot.ext.sqlalchemy_app.types import UnicodeString from chatter.chatterbot.ext.sqlalchemy_app.types import UnicodeString
from sqlalchemy import Table, Column, Integer, DateTime, ForeignKey, PickleType from sqlalchemy import Table, Column, Integer, DateTime, ForeignKey, PickleType
from sqlalchemy.ext.declarative import declared_attr, declarative_base from sqlalchemy.ext.declarative import declared_attr, declarative_base
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
@ -72,8 +72,8 @@ class Statement(Base, StatementMixin):
return [tag.name for tag in self.tags] return [tag.name for tag in self.tags]
def get_statement(self): def get_statement(self):
from chatterbot.conversation import Statement as StatementObject from chatter.chatterbot.conversation import Statement as StatementObject
from chatterbot.conversation import Response as ResponseObject from chatter.chatterbot.conversation import Response as ResponseObject
statement = StatementObject( statement = StatementObject(
self.text, self.text,

@ -2,8 +2,8 @@ from __future__ import unicode_literals
from time import sleep from time import sleep
from chatterbot.conversation import Statement from chatter.chatterbot.conversation import Statement
from chatterbot.input import InputAdapter from chatter.chatterbot.input import InputAdapter
class Gitter(InputAdapter): class Gitter(InputAdapter):

@ -2,8 +2,8 @@ from __future__ import unicode_literals
from time import sleep from time import sleep
from chatterbot.conversation import Statement from chatter.chatterbot.conversation import Statement
from chatterbot.input import InputAdapter from chatter.chatterbot.input import InputAdapter
class HipChat(InputAdapter): class HipChat(InputAdapter):

@ -1,6 +1,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from chatterbot.adapters import Adapter from chatter.chatterbot.adapters import Adapter
class InputAdapter(Adapter): class InputAdapter(Adapter):

@ -2,8 +2,8 @@ from __future__ import unicode_literals
import datetime import datetime
from chatterbot.conversation import Statement from chatter.chatterbot.conversation import Statement
from chatterbot.input import InputAdapter from chatter.chatterbot.input import InputAdapter
class Mailgun(InputAdapter): class Mailgun(InputAdapter):

@ -2,8 +2,8 @@ from __future__ import unicode_literals
from time import sleep from time import sleep
from chatterbot.conversation import Statement from chatter.chatterbot.conversation import Statement
from chatterbot.input import InputAdapter from chatter.chatterbot.input import InputAdapter
class Microsoft(InputAdapter): class Microsoft(InputAdapter):

@ -1,8 +1,8 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from chatterbot.conversation import Statement from chatter.chatterbot.conversation import Statement
from chatterbot.input import InputAdapter from chatter.chatterbot.input import InputAdapter
from chatterbot.utils import input_function from chatter.chatterbot.utils import input_function
class TerminalAdapter(InputAdapter): class TerminalAdapter(InputAdapter):

@ -1,7 +1,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from chatterbot.conversation import Statement from chatter.chatterbot.conversation import Statement
from chatterbot.input import InputAdapter from chatter.chatterbot.input import InputAdapter
class VariableInputTypeAdapter(InputAdapter): class VariableInputTypeAdapter(InputAdapter):

@ -1,7 +1,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from chatterbot.adapters import Adapter from chatter.chatterbot.adapters import Adapter
from chatterbot.utils import import_module from chatter.chatterbot.utils import import_module
class LogicAdapter(Adapter): class LogicAdapter(Adapter):
@ -18,8 +18,8 @@ class LogicAdapter(Adapter):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super(LogicAdapter, self).__init__(**kwargs) super(LogicAdapter, self).__init__(**kwargs)
from chatterbot.comparisons import levenshtein_distance from chatter.chatterbot.comparisons import levenshtein_distance
from chatterbot.response_selection import get_first_response from chatter.chatterbot.response_selection import get_first_response
# Import string module parameters # Import string module parameters
if 'statement_comparison_function' in kwargs: if 'statement_comparison_function' in kwargs:

@ -1,6 +1,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from chatterbot.conversation import Statement from chatter.chatterbot.conversation import Statement
from .best_match import BestMatch from .best_match import BestMatch

@ -1,7 +1,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from chatterbot.conversation import Statement from chatter.chatterbot.conversation import Statement
from chatterbot.logic import LogicAdapter from chatter.chatterbot.logic import LogicAdapter
class MathematicalEvaluation(LogicAdapter): class MathematicalEvaluation(LogicAdapter):

@ -2,7 +2,7 @@ from __future__ import unicode_literals
from collections import Counter from collections import Counter
from chatterbot import utils from chatter.chatterbot import utils
from .logic_adapter import LogicAdapter from .logic_adapter import LogicAdapter

@ -16,7 +16,7 @@ class SpecificResponseAdapter(LogicAdapter):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super(SpecificResponseAdapter, self).__init__(**kwargs) super(SpecificResponseAdapter, self).__init__(**kwargs)
from chatterbot.conversation import Statement from chatter.chatterbot.conversation import Statement
self.input_text = kwargs.get('input_text') self.input_text = kwargs.get('input_text')

@ -81,7 +81,7 @@ class TimeLogicAdapter(LogicAdapter):
return features return features
def process(self, statement): def process(self, statement):
from chatterbot.conversation import Statement from chatter.chatterbot.conversation import Statement
now = datetime.now() now = datetime.now()

@ -1,4 +1,4 @@
from chatterbot.adapters import Adapter from chatter.chatterbot.adapters import Adapter
class OutputAdapter(Adapter): class OutputAdapter(Adapter):

@ -1,4 +1,4 @@
from chatterbot.storage import StorageAdapter from chatter.chatterbot.storage import StorageAdapter
class Query(object): class Query(object):
@ -116,7 +116,7 @@ class MongoDatabaseAdapter(StorageAdapter):
""" """
Return the class for the statement model. Return the class for the statement model.
""" """
from chatterbot.conversation import Statement from chatter.chatterbot.conversation import Statement
# Create a storage-aware statement # Create a storage-aware statement
statement = Statement statement = Statement
@ -128,7 +128,7 @@ class MongoDatabaseAdapter(StorageAdapter):
""" """
Return the class for the response model. Return the class for the response model.
""" """
from chatterbot.conversation import Response from chatter.chatterbot.conversation import Response
# Create a storage-aware response # Create a storage-aware response
response = Response response = Response

@ -1,8 +1,8 @@
from chatterbot.storage import StorageAdapter from chatter.chatterbot.storage import StorageAdapter
def get_response_table(response): def get_response_table(response):
from chatterbot.ext.sqlalchemy_app.models import Response from chatter.chatterbot.ext.sqlalchemy_app.models import Response
return Response(text=response.text, occurrence=response.occurrence) return Response(text=response.text, occurrence=response.occurrence)
@ -86,28 +86,28 @@ class SQLStorageAdapter(StorageAdapter):
""" """
Return the statement model. Return the statement model.
""" """
from chatterbot.ext.sqlalchemy_app.models import Statement from chatter.chatterbot.ext.sqlalchemy_app.models import Statement
return Statement return Statement
def get_response_model(self): def get_response_model(self):
""" """
Return the response model. Return the response model.
""" """
from chatterbot.ext.sqlalchemy_app.models import Response from chatter.chatterbot.ext.sqlalchemy_app.models import Response
return Response return Response
def get_conversation_model(self): def get_conversation_model(self):
""" """
Return the conversation model. Return the conversation model.
""" """
from chatterbot.ext.sqlalchemy_app.models import Conversation from chatter.chatterbot.ext.sqlalchemy_app.models import Conversation
return Conversation return Conversation
def get_tag_model(self): def get_tag_model(self):
""" """
Return the conversation model. Return the conversation model.
""" """
from chatterbot.ext.sqlalchemy_app.models import Tag from chatter.chatterbot.ext.sqlalchemy_app.models import Tag
return Tag return Tag
def count(self): def count(self):
@ -379,14 +379,14 @@ class SQLStorageAdapter(StorageAdapter):
""" """
Drop the database attached to a given adapter. Drop the database attached to a given adapter.
""" """
from chatterbot.ext.sqlalchemy_app.models import Base from chatter.chatterbot.ext.sqlalchemy_app.models import Base
Base.metadata.drop_all(self.engine) Base.metadata.drop_all(self.engine)
def create(self): def create(self):
""" """
Populate the database with the tables. Populate the database with the tables.
""" """
from chatterbot.ext.sqlalchemy_app.models import Base from chatter.chatterbot.ext.sqlalchemy_app.models import Base
Base.metadata.create_all(self.engine) Base.metadata.create_all(self.engine)
def _session_finish(self, session, statement_text=None): def _session_finish(self, session, statement_text=None):

@ -130,7 +130,7 @@ def remove_stopwords(tokens, language):
Stop words are words like "is, the, a, ..." Stop words are words like "is, the, a, ..."
Be sure to download the required NLTK corpus before calling this function: Be sure to download the required NLTK corpus before calling this function:
- from chatterbot.utils import nltk_download_corpus - from chatter.chatterbot.utils import nltk_download_corpus
- nltk_download_corpus('corpora/stopwords') - nltk_download_corpus('corpora/stopwords')
""" """
from nltk.corpus import stopwords from nltk.corpus import stopwords

Loading…
Cancel
Save