Skip to main content

An open-source chat bot program written in Python.

Project description

.. figure:: http://i.imgur.com/b3SCmGT.png
:alt: Chatterbot: Machine learning in Python

Chatterbot: Machine learning in Python
ChatterBot
==========

ChatterBot is a machine-learning based conversational dialog engine
build in Python which makes it possible to generate responses based on
collections of known conversations. The language independent design of
ChatterBot allows it to be trained to speak any language.

|Package Version| |PyPi| |Requirements Status| |Build Status| |Coverage
Status|

An example of typical input would be something like this:

| **user:** Good morning! How are you doing?
| **bot:** I am doing very well, thank you for asking.
| **user:** Your welcome.
| **bot:** Do you like hats?

Installation
------------

This package can be installed from
`Pypi <https://pypi.python.org/pypi/ChatterBot>`__ by running:

::

pip install chatterbot

Create a new chat bot
~~~~~~~~~~~~~~~~~~~~~

**Note:** *The ``ChatBot`` object takes an optional parameter for the
bot's name. The default name is 'bot'.*

::

from chatterbot import ChatBot
chatbot = ChatBot("Ron Obvious")

Training
~~~~~~~~

After creating a new chatterbot instance it is also possible to train
the bot. Training is a good way to ensure that the bot starts off with
knowledge about specific responses. The current training method takes a
list of statements that represent a conversation.

**Note:** Training is not required but it is recommended.

::

conversation = [
"Hello",
"Hi there!",
"How are you doing?",
"I'm doing great.",
"That is good to hear",
"Thank you.",
"Your welcome."
]

chatbot.train(conversation)

Get a response
~~~~~~~~~~~~~~

::

response = chatbot.get_response("Good morning!")
print(response)

Change the default log file
~~~~~~~~~~~~~~~~~~~~~~~~~~~

**Note:** The default log file is ``database.db``.

::

chatbot.database.path = "path/to/file.db"

Other bot types
---------------

ChatterBot comes with a selection of useful chat bots built in.

Terminal ChatterBot
^^^^^^^^^^^^^^^^^^^

This is a simple chatterbot that runs in the console. It responds to any
user input that is entered.

::

from chatterbot import Terminal
terminal = Terminal()
terminal.begin()

Social ChatterBot
~~~~~~~~~~~~~~~~~

This bot type integrates with various social networking sites to
communicate.

::

from chatterbot import SocialBot

TWITTER = {
"CONSUMER_KEY": "<consumer_key>",
"CONSUMER_SECRET": "<consumer_secret>"
}

chatbot = SocialBot(twitter=TWITTER)

You will need to generate your own keys for using any API. To use this
feature with twitter's api you will need to register your application at
`Twitter's developer website <https://dev.twitter.com/apps>`__ to get
the token and secret keys.

Talk with CleverBot
~~~~~~~~~~~~~~~~~~~

Want to see what two bots have to say to each other? This allows your
ChatterBot to talk to `CleverBot <http://www.cleverbot.com/>`__.

::

from chatterbot import TalkWithCleverbot
talk = TalkWithCleverbot()
talk.begin()

Use Cases
---------

**Using ChatterBot in your app? Let us know!** - `Salvius (humanoid
robot) <https://github.com/gunthercox/salvius>`__

History
-------

See release notes for changes
https://github.com/gunthercox/ChatterBot/releases

.. |Package Version| image:: https://badge.fury.io/py/ChatterBot.png
:target: http://badge.fury.io/py/ChatterBot
.. |PyPi| image:: https://pypip.in/download/ChatterBot/badge.svg
:target: https://pypi.python.org/pypi/ChatterBot
.. |Requirements Status| image:: https://requires.io/github/gunthercox/ChatterBot/requirements.svg?branch=master
:target: https://requires.io/github/gunthercox/ChatterBot/requirements/?branch=master
.. |Build Status| image:: https://travis-ci.org/gunthercox/ChatterBot.svg?branch=master
:target: https://travis-ci.org/gunthercox/ChatterBot
.. |Coverage Status| image:: https://img.shields.io/coveralls/gunthercox/ChatterBot.svg
:target: https://coveralls.io/r/gunthercox/ChatterBot

Project details


Release history Release notifications | RSS feed

This version

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ChatterBot-0.1.0.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

ChatterBot-0.1.0-py2.py3-none-any.whl (15.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ChatterBot-0.1.0.tar.gz.

File metadata

  • Download URL: ChatterBot-0.1.0.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ChatterBot-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c4a5d9a963de84b04ae5524735736944d017780a071706ab11f6bdf278d045ce
MD5 d11b9c6f2087a71a4466a8833c18280a
BLAKE2b-256 81bb37b685e2bd1048f93181edb1b92adaf1cc5cccfc618570650af2719ea88e

See more details on using hashes here.

File details

Details for the file ChatterBot-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for ChatterBot-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 793d30f10860dd362fa9c202b6fce7d643a97c72e62d018ee34f22b03ae79884
MD5 095cd2999ecc6e058b4996a218271162
BLAKE2b-256 823129331dcc41ca0cda20c4f479bf4c90bf3b3fd4eda53c7bf7e5bce75a59ab

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page