Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the format of the ChatterBot corpus #818

Merged
merged 1 commit into from
Jul 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 64 additions & 1 deletion docs/corpus.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,68 @@ check out the `chatterbot_corpus/data`_ directory in the separate chatterbot-cor
be released and upgraded independently from the :code:`chatterbot` package.


Data Format
-----------

The data file contained in ChatterBot Corpus is formatted using `YAML`_ syntax.
This format is used because it is easily readable by both humans and machines.

.. list-table:: Corpus Properties
:widths: 15 10 30
:header-rows: 1

* - Property
- Required
- Description
* - categories
- Required
- A list of categories that describe the conversations.
* - conversations
- Optional
- A list of conversations. Each conversation is denoted as a list.

Here is an example of the corpus data:

.. code-block:: yaml
:name: corpus-example.yml

categories:
- english
- greetings
conversations:
- - Hello
- Hi
- - Hello
- Hi, how are you?
- I am doing well.
- - Good day to you sir!
- Why thank you.
- - Hi, How is it going?
- It's going good, your self?
- Mighty fine, thank you.

The values in this example have the following relationships.

.. list-table:: Evaluated statement relationships
:widths: 15 40
:header-rows: 1

* - Statement
- Response
* - Hello
- Hi
* - Hello
- Hi, how are you?
* - Hi, how are you?
- I am doing well.
* - Good day to you sir!
- Why thank you.
* - Hi, How is it going?
- It's going good, your self?
* - It's going good, your self?
- Mighty fine, thank you.


Exporting your chat bot's database as a training corpus
-------------------------------------------------------

Expand All @@ -34,11 +96,12 @@ train other chat bots.
.. code-block:: python

chatbot = ChatBot('Export Example Bot')
chatbot.trainer.export_for_training('./export.json')
chatbot.trainer.export_for_training('./export.yml')

Here is an example:

.. literalinclude:: ../examples/export_example.py
:language: python

.. _chatterbot_corpus/data: https://github.com/gunthercox/chatterbot-corpus/tree/master/chatterbot_corpus/data
.. _YAML: http://www.yaml.org/