pep8
This commit is contained in:
parent
5434da22bc
commit
04fd25d4bd
@ -1,6 +1,5 @@
|
||||
import sys
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import importlib
|
||||
|
||||
|
@ -5,7 +5,6 @@ View the corpus on GitHub at https://github.com/gunthercox/chatterbot-corpus
|
||||
|
||||
from chatterbot_corpus import Corpus
|
||||
|
||||
|
||||
__all__ = (
|
||||
'Corpus',
|
||||
)
|
||||
|
@ -29,7 +29,6 @@ class ModelBase(object):
|
||||
|
||||
Base = declarative_base(cls=ModelBase)
|
||||
|
||||
|
||||
tag_association_table = Table(
|
||||
'tag_association',
|
||||
Base.metadata,
|
||||
|
@ -23,10 +23,10 @@ class Microsoft(InputAdapter):
|
||||
|
||||
# NOTE: Direct Line client credentials are different from your bot's
|
||||
# credentials
|
||||
self.direct_line_token_or_secret = kwargs.\
|
||||
self.direct_line_token_or_secret = kwargs. \
|
||||
get('direct_line_token_or_secret')
|
||||
|
||||
authorization_header = 'BotConnector {}'.\
|
||||
authorization_header = 'BotConnector {}'. \
|
||||
format(self.direct_line_token_or_secret)
|
||||
|
||||
self.headers = {
|
||||
@ -64,7 +64,7 @@ class Microsoft(InputAdapter):
|
||||
def get_most_recent_message(self):
|
||||
import requests
|
||||
|
||||
endpoint = '{host}/api/conversations/{id}/messages'\
|
||||
endpoint = '{host}/api/conversations/{id}/messages' \
|
||||
.format(host=self.directline_host,
|
||||
id=self.conversation_id)
|
||||
|
||||
|
@ -5,11 +5,10 @@ from chatter.chatterbot.input import InputAdapter
|
||||
|
||||
|
||||
class VariableInputTypeAdapter(InputAdapter):
|
||||
|
||||
JSON = 'json'
|
||||
TEXT = 'text'
|
||||
OBJECT = 'object'
|
||||
VALID_FORMATS = (JSON, TEXT, OBJECT, )
|
||||
VALID_FORMATS = (JSON, TEXT, OBJECT,)
|
||||
|
||||
def detect_type(self, statement):
|
||||
|
||||
|
@ -51,7 +51,7 @@ class MultiLogicAdapter(LogicAdapter):
|
||||
if adapter.can_process(statement):
|
||||
|
||||
output = adapter.process(statement)
|
||||
results.append((output.confidence, output, ))
|
||||
results.append((output.confidence, output,))
|
||||
|
||||
self.logger.info(
|
||||
'{} selected "{}" as a response with a confidence of {}'.format(
|
||||
|
@ -42,8 +42,8 @@ class TimeLogicAdapter(LogicAdapter):
|
||||
])
|
||||
|
||||
labeled_data = (
|
||||
[(name, 0) for name in self.negative] +
|
||||
[(name, 1) for name in self.positive]
|
||||
[(name, 0) for name in self.negative] +
|
||||
[(name, 1) for name in self.positive]
|
||||
)
|
||||
|
||||
train_set = [
|
||||
|
@ -24,12 +24,12 @@ class StorageAdapter(object):
|
||||
# The string must be lowercase
|
||||
model_name = model_name.lower()
|
||||
|
||||
kwarg_model_key = '%s_model' % (model_name, )
|
||||
kwarg_model_key = '%s_model' % (model_name,)
|
||||
|
||||
if kwarg_model_key in self.kwargs:
|
||||
return self.kwargs.get(kwarg_model_key)
|
||||
|
||||
get_model_method = getattr(self, 'get_%s_model' % (model_name, ))
|
||||
get_model_method = getattr(self, 'get_%s_model' % (model_name,))
|
||||
|
||||
return get_model_method()
|
||||
|
||||
@ -157,7 +157,8 @@ class StorageAdapter(object):
|
||||
|
||||
class EmptyDatabaseException(Exception):
|
||||
|
||||
def __init__(self, value='The database currently contains no entries. At least one entry is expected. You may need to train your chat bot to populate your database.'):
|
||||
def __init__(self,
|
||||
value='The database currently contains no entries. At least one entry is expected. You may need to train your chat bot to populate your database.'):
|
||||
self.value = value
|
||||
|
||||
def __str__(self):
|
||||
|
@ -61,8 +61,8 @@ class Trainer(object):
|
||||
|
||||
def __init__(self, value=None):
|
||||
default = (
|
||||
'A training class must be specified before calling train(). ' +
|
||||
'See http://chatterbot.readthedocs.io/en/stable/training.html'
|
||||
'A training class must be specified before calling train(). ' +
|
||||
'See http://chatterbot.readthedocs.io/en/stable/training.html'
|
||||
)
|
||||
self.value = value or default
|
||||
|
||||
@ -393,7 +393,6 @@ class UbuntuCorpusTrainer(Trainer):
|
||||
|
||||
file_kwargs = {}
|
||||
|
||||
|
||||
# Specify the encoding in Python versions 3 and up
|
||||
file_kwargs['encoding'] = 'utf-8'
|
||||
# WARNING: This might fail to read a unicode corpus file in Python 2.x
|
||||
|
@ -76,7 +76,7 @@ def input_function():
|
||||
The function 'raw_input' becomes 'input' in Python 3.
|
||||
"""
|
||||
|
||||
user_input = input() # NOQA
|
||||
user_input = input() # NOQA
|
||||
|
||||
return user_input
|
||||
|
||||
|
@ -1,10 +1,30 @@
|
||||
{
|
||||
"author" : ["Bobloy"],
|
||||
"bot_version" : [3,0,0],
|
||||
"description" : "Create an offline chatbot that talks like your average member using Machine Learning",
|
||||
"hidden" : false,
|
||||
"install_msg" : "Thank you for installing Chatter!",
|
||||
"requirements" : ["sqlalchemy<1.3,>=1.2", "python-twitter<4.0,>=3.0", "python-dateutil<2.7,>=2.6", "pymongo<4.0,>=3.3", "nltk<4.0,>=3.2", "mathparse<0.2,>=0.1", "chatterbot-corpus<1.2,>=1.1"],
|
||||
"short" : "Local Chatbot run on machine learning",
|
||||
"tags" : ["chat", "chatbot", "cleverbot", "clever","bobloy"]
|
||||
"author": [
|
||||
"Bobloy"
|
||||
],
|
||||
"bot_version": [
|
||||
3,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"description": "Create an offline chatbot that talks like your average member using Machine Learning",
|
||||
"hidden": false,
|
||||
"install_msg": "Thank you for installing Chatter!",
|
||||
"requirements": [
|
||||
"sqlalchemy<1.3,>=1.2",
|
||||
"python-twitter<4.0,>=3.0",
|
||||
"python-dateutil<2.7,>=2.6",
|
||||
"pymongo<4.0,>=3.3",
|
||||
"nltk<4.0,>=3.2",
|
||||
"mathparse<0.2,>=0.1",
|
||||
"chatterbot-corpus<1.2,>=1.1"
|
||||
],
|
||||
"short": "Local Chatbot run on machine learning",
|
||||
"tags": [
|
||||
"chat",
|
||||
"chatbot",
|
||||
"cleverbot",
|
||||
"clever",
|
||||
"bobloy"
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user