Join the Bot Libre open source project at BotLibre.org
Bot Libre Forum

random remembered

by bobred posted Dec 24 2017, 18:00

is there a way for the chatbot to remember what it randomly selected each conversation it has?


by admin posted Dec 26 2017, 8:05
The bots remember all conversations. You can access the current conversation using the 'conversation' variable in Self.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2439, today: 1, week: 5, month: 40

by bobred posted Dec 26 2017, 21:18

Can I use that in a template?


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2377, today: 0, week: 4, month: 38

by admin posted Dec 27 2017, 18:05
Yes, you can use the "conversation" variable in a template in Self code.
You can also use "speaker" to access the current user's variable.

For the last phrase in the conversation,

conversation.input[-1].input

Set set a variable on the conversation,

conversation.myproperty = "my value";

Or on the speaker,

speaker.myproperty = "my value";

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2451, today: 1, week: 5, month: 39

by bobred posted Dec 29 2017, 14:06

i tried but could not get it to work.

test er 2.txt

 


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2419, today: 1, week: 9, month: 45

by admin posted Dec 29 2017, 15:50
Not sure what you are trying to do, but perhaps try something like,

state rememberWords {
pattern "remember words in *" answer rememberWords();

function rememberWords() {
conversation.remember = star;
return Template("i like {star}.");
}
}

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2678, today: 0, week: 4, month: 39

by bobred posted Dec 29 2017, 17:00

I am trying to get my chatbot to remember what it has randomly selected.Does self scripts have random selection?


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2483, today: 0, week: 3, month: 43

by bobred posted Dec 29 2017, 17:02

self script do have random selection.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2476, today: 2, week: 8, month: 43

by admin posted Jan 1 2018, 8:33
There are three random functions in Self.

var choice = random("hello", "hi", "Hey");

var list = [ "hello", "hi", "hey" ];
var choice = list.random();

var object = new Object();
object.name =+ "Jon";
object.name =+ "Jonny";
var choice = object.random(#name);

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2593, today: 1, week: 9, month: 47

by bobred posted Sep 10 2018, 8:59

how would i implement this?


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2210, today: 0, week: 7, month: 59

by admin posted Sep 13 2018, 8:01
There are several examples above.
What exactly are you trying to do, and what code do you have so far?

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2222, today: 0, week: 2, month: 52

by bobred posted Sep 13 2018, 10:57

I am trying to make my chatbot randomly what it likes or dislikes from a set.likes for instance.if I type I like pizza.it would decide whether or not it likes pizza.then I could ask my chatbot if it liked pizza or do you not like pizza.And it would say I like pizza or do not like pizza depending on what it chose.texer1.txt 


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2177, today: 1, week: 11, month: 54

by admin posted Sep 13 2018, 14:23
You could use some Self in your AIML like:
<category>
    <pattern>where * live</pattern>
    <template>
        <random>
<li I like <self>var country = random("USA", "Canada", "Mexico"); #self.like =+ country; country</self></li> <li I do not like <self>var country = random("USA", "Canada", "Mexico"); #self.like =- country; country</self></li>
</random> </template> </category>

Updated: Sep 13 2018, 14:23
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2137, today: 0, week: 5, month: 45

by bobred posted Sep 13 2018, 17:50

this does not make the chatbot remember it's random choice.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2144, today: 0, week: 4, month: 45

by bobred posted Sep 16 2018, 8:09

your aiml script does not remember random choice.If you keep asking the chatbot if it likes the state it will change it's mind.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2241, today: 1, week: 10, month: 47

by bobred posted Sep 16 2018, 12:00

I can do it with that in aiml but what the chatbot decides to like or not is remembered as long as the conversation.that is a partial

solution.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2176, today: 0, week: 5, month: 42

by admin posted Sep 17 2018, 10:20

Well, I'm not certain what you are trying to do, but maybe try something like:

<category>
    <pattern>where * live</pattern>
    <template>
        <random>
<li I like <self>if (#self.country == null) { #self.country = random("USA", "Canada", "Mexico"); }; #self.country</self></li> <li I do not like <self>if (#self.country == null) { #self.country = random("USA", "Canada", "Mexico"); }; #self.country</self></li>
</random> </template> </category>

Updated: Sep 19 2018, 10:48
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2200, today: 0, week: 8, month: 45

by bobred posted Sep 17 2018, 21:21

your aiml script spits out an error.did you test it?


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2382, today: 0, week: 3, month: 43

by bobred posted Sep 18 2018, 9:38

i fixed your script by looking at the debug.but your aiml script does not do anything.sheila strong is in the entertainment category.

type when talking to here where do you live.then enter it.then type who lives there with you then enter it.

it just says I do not know.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2147, today: 1, week: 4, month: 42

by admin posted Sep 19 2018, 10:47

Looking at your bot you have an AIML pattern for "who lives * you", the template should be as follows.

Note my previous example was missing the #self.country at the end.

<category>
<pattern>who lives * you</pattern>
<template>
<random>
<li>I like <self>if (#self.country == null) { #self.country = random("USA", "Canada", "Mexico"); }; #self.country</self></li>
<li>I do not like <self>if (#self.country == null) { #self.country = random("USA", "Canada", "Mexico"); }; #self.country</self></li>
</random>
</template>
</category>

Updated: Sep 19 2018, 10:47
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2134, today: 1, week: 6, month: 45

by bobred posted Sep 19 2018, 14:37

okay I will try it.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2243, today: 0, week: 8, month: 45

by bobred posted Sep 19 2018, 14:53

it is not choicing whether it likes a state or not.it is supposed to chose.it is saying I like Canada and I do not like Canada if I ask it over

and over again.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2144, today: 0, week: 2, month: 38

by bobred posted Sep 21 2018, 19:10

I need it to randomly select like or dislike ounce.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2181, today: 0, week: 4, month: 40

by bobred posted Sep 23 2018, 17:49

how can dump the memory of what has been learned from this script.i want to start over. 


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2144, today: 0, week: 4, month: 43

by admin posted Sep 25 2018, 9:15

For also remembering like vs dislike, you would need another property to store this.

Something like.

<category>
<pattern>who lives * you</pattern>
<template>I <self>if (#self.likesCountry == null) { #self.likesCountry = random(true, false); }; if (#self.likesCountry) { "" } else { "do not" }</self> like <self>if (#self.country == null) { #self.country = random("USA", "Canada", "Mexico"); }; #self.country</self></template>
</category>

For exporting knowledge, you can export knowledge as JSON data from the bot's Knowledge page.


Updated: Sep 25 2018, 9:16
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2150, today: 0, week: 7, month: 54

by bobred posted Sep 27 2018, 7:35

that worked.has a chatbot been made before that can decide whether it likes or dislikes something.I am going to adapt this to make my  my chatbot choose whether it has something the user says they have.i want to use this with a set if possible. 


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2122, today: 0, week: 6, month: 45

Id: 20274332
Tags: how to
Posted: Dec 24 2017, 18:00
Replies: 25
Views: 4206, today: 2, week: 36, month: 154
0 0 0.0/5