It appears I overlooked this functionality when adding Django integration to ChatterBot. There is currently no way to do this within a django app.
@gunthercox Could chatterbot be trained externally and then combined with the django app?
Yeah @gunthercox is this possible ?
@liberaltech @shuboy2014 Not really. If the "external" training updated the statement and response entries in the django app's database, then yes. Otherwise it is not possible.
The solution that I am currently considering, is adding an API endpoint for training the chat bot, or at least for passing data to it's training function.
@gunthercox I created an adapter with weighted user inputs that then generate a response.
I modified the time_adapter.py, this would be a very tedious task for a large database of questions.
from .logic_adapter import LogicAdapter
from chatterbot.conversation import Statement
from textblob.classifiers import NaiveBayesClassifier
from datetime import datetime
class CustomerSupportAdapter(LogicAdapter):
"""
The TimeLogicAdapter returns the current time.
"""
def __init__(self, **kwargs):
super(CustomerSupportAdapter, self).__init__(**kwargs)
training_data = [
("Are international students elibgible", 1),
("Im an international student, can I apply", 1),
("whats available to international students", 1),
("international students", 1),
("do international students qualify", 1),
("international students accepted", 1),
("do i qualify as an international student", 1),
("as an international student do i qualify", 1),
("what are the requirements for international students", 1)
]
self.classifier = NaiveBayesClassifier(training_data)
def process(self, statement):
# now = datetime.now()
confidence = self.classifier.classify(statement.text.lower())
response = Statement("The Mount Baker, Washington program is open to international students")
return confidence, response
If you used the DjangoStorageAdapter as the storage for the training it shouldn't the training-from-corpus examples "just work"?
One problem with the DjangoStorageAdapter that I'm seeing is that Response.response.text is actually the statement that is being responded to and Response.statement.text is the real response. At least if you look at the data in the admin interface after submitting at least 2 chats to the API using the example django app.html: Issue #308
@gunthercox ETA for the fix?
Thanks.
fix in 2 weeks on my fork @totalgood, with PR to @gunthercox repo
@hobson hi , i want to train the chatterbot with storage DjangoStorageAdapter, and use database as django database . but It seems inconsistent database formats
Me too @chenjun0210 . I'm working on it. But you could probably fork and fix faster than me, if you have an urgent need.
I'm currently working to add a Django management command and training_data parameter that will allow chat bots to be trained. This functionality should be available in the next version released.
Updated documentation will be available, but essentially all you will need to do is call the following command in your Django project.
python manage.py train
The changes can be seen here: https://github.com/gunthercox/ChatterBot/pull/401
excellent
--Hobson
(503) 974-6274
gh https://github.com/hobson/ twtr https://twitter.com/hobsonlane li
https://www.linkedin.com/in/hobsonlane g+
http://plus.google.com/+HobsonLane/ so
http://stackoverflow.com/users/623735/hobs
On Thu, Nov 10, 2016 at 4:56 PM, Gunther Cox [email protected]
wrote:
I'm currently working to add a Django management command and training_data
parameter that will allow chat bots to be trained. This functionality
should be available in the next version released.Updated documentation will be available, but essentially all you will need
to do is call the following command in your Django project.python manage.py train
The changes can be seen here: #401
https://github.com/gunthercox/ChatterBot/pull/401—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/gunthercox/ChatterBot/issues/295#issuecomment-259852935,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAR396j3vX3LxMRKpTcynw4Ke0l-luH9ks5q871YgaJpZM4J9Cm3
.