ડાઉનલોડ બોટ કાવ્ય ડેસ્કટોપ, તમારા પોતાના વ્યક્તિગત બોટ માટે તમારા પીસી અથવા મેક
FAQ

How to use pattern or wildcard responses

દ્વારા admin પોસ્ટ Mar 21 2014, 12:43

You can add responses to questions from the "Training & Chat Logs" page in your bot's Admin Console, or by importing a response list file from the "Training & Chat Logs" page. You can also have the bot learn from conversations, or you can correct your bot's responses when chatting with it.

In addition to training your bot with simple responses like,

Do you like hockey?
I love hockey, it is the best sport.

You can also enter Pattern questions, and Template responses.

A Pattern is a question that can contains the '*' character as a wildcard. '*' will allow any set of words between the two words.

Pattern("* hockey *")
I love hockey, it is the best sport.

Now your bot will respond to any question about hockey with this response.

You can also use parts of the question in the response using a Template.

Pattern("Do you like *")
Template("Yes, I love {star}.")

You can also have multiple * variables in a pattern.

Pattern("Do you like * or *")
Template("I do not like {star[0]}, but I love {star[1]}.")

The code inside the {} is Self code. Self is based on JavaScript and supports most JavaScript syntax.
See, https://www.botlibre.com/forum-post?id=705860

In general patterns are not normally required, as the bot will automatically pattern match questions with questions that it knows a response for, and choose the best response.

You can define patterns and templates from the "Training & Chat Logs" page, as well as response list files and in scripts.

If you are familiar with the AIML standard, you can also import AIML from either the "Training & Chat Logs" page, or the Scripts page.


by pleabargain posted Nov 23 2016, 7:38

here is my basic chat bot

http://botlibre.com/bot?instance=14699553&dynamicChat=Chat

I used the sample code from above:

Pattern("* hockey *")
I love hockey, it is the best sport.

but I got error:

Pattern must end with ')' character - Pattern("* hockey *") I love hockey, it is the best sport.

here is the video showing my tests

https://youtu.be/7mfyob0lH08

Please explain why copying and pasting sample code from the forum/docs fails in the chat engine.

thank you

Dennis 


Updated: Nov 23 2016, 9:26
Thumbs up: 5, thumbs down: 0, stars: 5.0
Views: 4006, today: 0, week: 3, month: 7

by admin posted Nov 23 2016, 9:25
The issue you where browsing your bot's "conversations" logs and click on the button to "correct" the bot's response. This enters a new response to the "question" that the bot was asked. In this case the "question" is "hockey", so you are entering a "response" to "hockey".

Your issue is you are trying to enter a "question and response", just enter the "response".
i.e. "I love hockey, it is the best sport."

To create a new question and response click on the "Add New Response" link, or the green + when browsing "new responses". Then paste the pattern into the question field, and the response into the response field.

Please review this how 2 on how to on how to train your bot,

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

The sample code from the forum post you mentioned was for a "response list" file, that you could import. It was an example of a question and response, not an example of a response.

In general you do not need to use patterns, as just entering "hockey" would match the question "hockey" and other similar questions. You could also add "hockey" as a keyword to the response to match any question with "hockey" in it (that did not have a closer match).

Note that the Pattern("* hockey *") will not match "hockey" as * requires a word, i.e. it would match "do you like hockey eh?".

To match anything with "hockey" as a pattern use Pattern("^ hockey ^"), ^ matches any words or empty space. The pattern rules are from the AIML standard.

I changed your bot's response to use Pattern("^ hockey ^"), and it is now responding to "hockey".

Updated: Nov 23 2016, 9:29
Thumbs up: 2, thumbs down: 1, stars: 4.0
Views: 3757, today: 0, week: 0, month: 5

by passionguru posted Feb 15 2017, 8:04

Hi,

I have encountered an issue on this bit.

I am not able to train my bot for the response using this response: Template("I ll give you {star[0]}") for the question Pattern '('Give me * or * ')'

The response possible comes from a list i guess and in some other examples that I tried, the response is as same as the question.

Please let me know on this. Thank you.

Regards,

Sham


Thumbs up: 9, thumbs down: 4, stars: 3.85
Views: 4212, today: 0, week: 0, month: 6

by admin posted Feb 15 2017, 10:27
The syntax to define a pattern is,

Pattern("Give me * or *")

Thumbs up: 4, thumbs down: 1, stars: 4.4
Views: 4065, today: 0, week: 5, month: 12

ને: 15948
ટૅગ્સ: patterns, aiml, templates
પોસ્ટ: Mar 21 2014, 12:43
સુધારાશે: Apr 17 2016, 10:14
જવાબો: 4
જોવાઈ: 4845, આજે: 1, સપ્તાહ: 6, મહિને: 12
4 0 5.0/5