pep8
This commit is contained in:
parent
5434da22bc
commit
04fd25d4bd
@ -1,6 +1,5 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import importlib
|
import importlib
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ View the corpus on GitHub at https://github.com/gunthercox/chatterbot-corpus
|
|||||||
|
|
||||||
from chatterbot_corpus import Corpus
|
from chatterbot_corpus import Corpus
|
||||||
|
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'Corpus',
|
'Corpus',
|
||||||
)
|
)
|
||||||
|
@ -29,7 +29,6 @@ class ModelBase(object):
|
|||||||
|
|
||||||
Base = declarative_base(cls=ModelBase)
|
Base = declarative_base(cls=ModelBase)
|
||||||
|
|
||||||
|
|
||||||
tag_association_table = Table(
|
tag_association_table = Table(
|
||||||
'tag_association',
|
'tag_association',
|
||||||
Base.metadata,
|
Base.metadata,
|
||||||
|
@ -23,10 +23,10 @@ class Microsoft(InputAdapter):
|
|||||||
|
|
||||||
# NOTE: Direct Line client credentials are different from your bot's
|
# NOTE: Direct Line client credentials are different from your bot's
|
||||||
# credentials
|
# credentials
|
||||||
self.direct_line_token_or_secret = kwargs.\
|
self.direct_line_token_or_secret = kwargs. \
|
||||||
get('direct_line_token_or_secret')
|
get('direct_line_token_or_secret')
|
||||||
|
|
||||||
authorization_header = 'BotConnector {}'.\
|
authorization_header = 'BotConnector {}'. \
|
||||||
format(self.direct_line_token_or_secret)
|
format(self.direct_line_token_or_secret)
|
||||||
|
|
||||||
self.headers = {
|
self.headers = {
|
||||||
@ -64,7 +64,7 @@ class Microsoft(InputAdapter):
|
|||||||
def get_most_recent_message(self):
|
def get_most_recent_message(self):
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
endpoint = '{host}/api/conversations/{id}/messages'\
|
endpoint = '{host}/api/conversations/{id}/messages' \
|
||||||
.format(host=self.directline_host,
|
.format(host=self.directline_host,
|
||||||
id=self.conversation_id)
|
id=self.conversation_id)
|
||||||
|
|
||||||
|
@ -5,11 +5,10 @@ from chatter.chatterbot.input import InputAdapter
|
|||||||
|
|
||||||
|
|
||||||
class VariableInputTypeAdapter(InputAdapter):
|
class VariableInputTypeAdapter(InputAdapter):
|
||||||
|
|
||||||
JSON = 'json'
|
JSON = 'json'
|
||||||
TEXT = 'text'
|
TEXT = 'text'
|
||||||
OBJECT = 'object'
|
OBJECT = 'object'
|
||||||
VALID_FORMATS = (JSON, TEXT, OBJECT, )
|
VALID_FORMATS = (JSON, TEXT, OBJECT,)
|
||||||
|
|
||||||
def detect_type(self, statement):
|
def detect_type(self, statement):
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class MultiLogicAdapter(LogicAdapter):
|
|||||||
if adapter.can_process(statement):
|
if adapter.can_process(statement):
|
||||||
|
|
||||||
output = adapter.process(statement)
|
output = adapter.process(statement)
|
||||||
results.append((output.confidence, output, ))
|
results.append((output.confidence, output,))
|
||||||
|
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
'{} selected "{}" as a response with a confidence of {}'.format(
|
'{} selected "{}" as a response with a confidence of {}'.format(
|
||||||
|
@ -24,12 +24,12 @@ class StorageAdapter(object):
|
|||||||
# The string must be lowercase
|
# The string must be lowercase
|
||||||
model_name = model_name.lower()
|
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:
|
if kwarg_model_key in self.kwargs:
|
||||||
return self.kwargs.get(kwarg_model_key)
|
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()
|
return get_model_method()
|
||||||
|
|
||||||
@ -157,7 +157,8 @@ class StorageAdapter(object):
|
|||||||
|
|
||||||
class EmptyDatabaseException(Exception):
|
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
|
self.value = value
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -393,7 +393,6 @@ class UbuntuCorpusTrainer(Trainer):
|
|||||||
|
|
||||||
file_kwargs = {}
|
file_kwargs = {}
|
||||||
|
|
||||||
|
|
||||||
# Specify the encoding in Python versions 3 and up
|
# Specify the encoding in Python versions 3 and up
|
||||||
file_kwargs['encoding'] = 'utf-8'
|
file_kwargs['encoding'] = 'utf-8'
|
||||||
# WARNING: This might fail to read a unicode corpus file in Python 2.x
|
# WARNING: This might fail to read a unicode corpus file in Python 2.x
|
||||||
|
@ -1,10 +1,30 @@
|
|||||||
{
|
{
|
||||||
"author" : ["Bobloy"],
|
"author": [
|
||||||
"bot_version" : [3,0,0],
|
"Bobloy"
|
||||||
"description" : "Create an offline chatbot that talks like your average member using Machine Learning",
|
],
|
||||||
"hidden" : false,
|
"bot_version": [
|
||||||
"install_msg" : "Thank you for installing Chatter!",
|
3,
|
||||||
"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"],
|
0,
|
||||||
"short" : "Local Chatbot run on machine learning",
|
0
|
||||||
"tags" : ["chat", "chatbot", "cleverbot", "clever","bobloy"]
|
],
|
||||||
|
"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