Did you know Bot Libre also provides 3D avatars and a free web speech API?
FAQ

What are the supported response and chat log formats for importing and exporting?

by admin posted Jun 4 2014, 10:44

From the "Training & Chat Logs page" in your bot's Admin Console you can import chat logs and response lists to train your bot.

Four formats are supported:
  • Response List
  • CSV List
  • Chat Log
  • AIML

The Training & Chat Logs page also supports exporting conversations, or responses to any of these formats. The easiest way to learn a format is to export a conversation log or responses in the format to use as an example.

Response List

A response list is a list of question/response pairs. Each phrase is separated by a new line, and each question/response list is separated by an empty line. You can also tag responses with meta data such as keywords to influence when the response is used. Response lists are the recommended way to train a bot. The bot will automatically find the best matching response for any question, the questions do not need to be exact matches, only sufficiently similar, or include a keyword.

Response lists support the following tags:

  • keywords: a set of space separated keywords, any question with any of the keywords may trigger the response to be used
  • required: a set of space separated words that are all required to be in the question to use the response
  • topic: the topic to categories the response, this both sets the conversation topic, and is more likely to be used if the topic is active
  • label: a name to label this response so it can be reused for other questions
  • previous: the response will more likely be used if the bot's previous response matches (can use patterns, can have multiple previous tags)
  • require previous: the response will only be used if the bot's previous response matches (can use patterns, can have multiple require previous tags)
  • no repeat: the bot will not use this response twice in the same conversation
  • on repeat: the bot will use this phrase the second time this response is triggered in the same conversation (can have multiple on repeat tags)
  • condition: a conditional statement of Self code, this response will only be used if the condition evaluates to true
  • think: a block of Self code to be executed when the response is used
  • command: a JSON command to be sent with the response to the chat client (such as a mobile command to open an app)
  • emotions: a set of space separated emotions this response will trigger
  • actions: a set of space separated actions this response will trigger
  • poses: a set of space separated poses this response will trigger

You can also define "default:" responses, or "greeting:" phrases, or execute Self scripts through "script:".

Example Response List:
greeting: Hello, how can I help?

default: Sorry, I did not understand that, perhaps rephrase your question, or email [email protected]

Hello
Hello there

Hi
Hi, who are you?

How are you?
Fine.
Good.
Swell.
I am sad today.

How old are you?
I am only 1 year old.
keywords: old
required: old
topic: age

CSV List

A Comma Separated Values (CSV) list is a list of question/response pairs separated by a comma. Each question/response is separated by a new line. CSV is a convenient format to export from Excel or other spreadsheets. Each response can have multiple questions separated by a "?", and a third, fourth, and fifth column can be used for keywords, required words, and the topic.

For example:
"Hello","Hello there"
"Hi","Hi, how are you? How are you?"
"How are you?","Fine."
"How old are you?","I am only 1 year old.","old","old","age"

Chat Log

The chat logs format is a log of a conversation between two or more people. Each phrase starts with the name of the speaker followed by a ':' (i.e. Jim:). Each phrase is separated by a new line. If the log contains multiple conversations, then each conversation must be separated by a empty new line.

Chat logs are an easy way to train a bot from exiting conversation logs that you might have from live chat, chat rooms, or find online. However, chat logs are not always the best way to train a bot as it will learn all of the responses. You have more control over how the bot will use a response using a response list file, or AIML.

Example Chat Log:
Jim: Hello
Cindy: Hello Jim
Jim: How are you Cindy?
Cindy: I am fine thanks for asking.

Jim: Hi
Cindy: Hey
Jim: What is your name?
Cindy: My name is Cindy.

The name is important, as the bot can learn to replace the name in a phrase with the speaker or targets of the phrase. For example "Hello Jim" can automatically become the template response Template("Hello {:target}"). Templates require that comprehension is enabled in the bot.

It is important to separate new conversations by an empty line. The bot will learn from the conversation in context. Starting a new conversation starts a new context, so the bot will not get confused with the phrases in the previous conversation. i.e. if there was no new line above, the bot with think that "Hi" was a response to "I am fine thanks for asking." in the context of "How are you Cindy?".

The chat log format also supports some advanced syntax. You can add a default response to your bot using the "default:" prefix. A default response is what the bot will say when it does not know a good response.

You can associate a phrase with an emotional state using "", any of the following emotions can be used love, like, dislike, hate, rage, anger, calm, serene, ecstatic, happy, sad, crying, panic, afraid, confident, courageous, surprise, bored, laughter, serious.

You can execute a Self script from a chat log. This allows you to load knowledge into your bot. Scripts are executed using the "script:" prefix.

For example:
default: I do not understand.
default: Sorry, please rephrase your question.

anonymous: lol

anonymous: love

anonymous: Stop that!

script: #self.name = "Cindy";

AIML

The Artificial Intelligence Markup Language is a standard XML format for chat bot responses. It includes XML elements for patterns (questions) and templates (responses).

The are many free AIML files available on the web in many different languages.
See Scripting your bot with AIML for more information.


by pleabargain posted Nov 21 2016, 6:03

This page has not been updated in two years. 

Are there working source files we can see of the above examples? Esp. the csv example, it is not  clear. does the csv need column headers? How are the words separated in the cell itself? 

inputresponsekeywordsrequired wordstopic
     

Each response can have multiple questions separated by a "?", and a third, fourth, and fifth column can be used for keywords, required words, and the topic.

Does that mean I can have * number of responses in column 2?


Updated: Nov 21 2016, 6:14
Thumbs up: 3, thumbs down: 1, stars: 4.25
Views: 4297, today: 0, week: 4, month: 45

by admin posted Nov 21 2016, 9:15
Actually if you look at the post it says, "Updated: Nov 11, 13:14", so was updated just this month.

We have a script library of many different examples here,

https://www.botlibre.com/browse?browse-type=Script

I would recommend using our "response list" format.

There is a good example here,

https://www.botlibre.com/script?id=657587

See also,
https://www.botlibre.com/forum-post?id=483549

For the response CSV format, you basically have,
question, answer

Normally it is best to put each question in its own row, but it is possible to put multiple questions in a single cell separating by ?

Thumbs up: 1, thumbs down: 0, stars: 5.0
Views: 4127, today: 0, week: 5, month: 61

by pleabargain posted Nov 21 2016, 10:50

Many thanks for the quick reply and the links.

I will investigate accordingly.

with regards,

Dennis


Updated: Jan 22 2017, 11:27
Thumbs up: 0, thumbs down: 1, stars: 2.0
Views: 3958, today: 1, week: 8, month: 38

by marlonZA posted Jan 22 2017, 9:55

Hey there

There are some docs on this (i know, it's hard to find, and confusingly organised), helpful to my previous endeavours.

http://www.botlibre.com/forum-post?id=483549 (read it all, but scroll down almost to the bottom for chat logs)

or if you want to give the Self scripting a go:http://www.botlibre.com/forum-post?id=699077

Hope this helps

Marlon


Updated: Jan 22 2017, 11:27
Thumbs up: 5, thumbs down: 3, stars: 4.25
Views: 4394, today: 0, week: 2, month: 50

Id: 30598
Tags: chat logs, training, aiml, chat log, importing, logs, keywords, responses, topics, response list, csv, formats
Posted: Jun 4 2014, 10:44
Updated: Jul 21 2017, 8:44
Replies: 4
Views: 7993, today: 1, week: 14, month: 143
5 0 4.6/5