Upgrade to our Diamond service and we will build you your own app for Android or iOS
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: 2411, today: 2, week: 2, month: 12

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: 2351, today: 2, week: 3, month: 12

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: 2423, today: 0, week: 0, month: 11

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: 2382, today: 0, week: 0, month: 8

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: 2653, today: 2, week: 3, month: 14

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: 2453, today: 2, week: 2, month: 13

by bobred posted Dec 29 2017, 17:02

self script do have random selection.


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

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: 2558, today: 1, week: 1, month: 12

by bobred posted Sep 10 2018, 8:59

how would i implement this?


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2163, today: 3, week: 3, month: 12

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: 2181, today: 2, week: 2, month: 11

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: 2133, today: 1, week: 1, month: 10

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: 2103, today: 1, week: 1, month: 11

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: 2113, today: 1, week: 3, month: 14

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: 2201, today: 0, week: 0, month: 7

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: 2141, today: 0, week: 0, month: 7

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: 2163, today: 0, week: 2, month: 8

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: 2350, today: 1, week: 1, month: 11

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: 2114, today: 0, week: 1, month: 9

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: 2099, today: 0, week: 0, month: 10

by bobred posted Sep 19 2018, 14:37

okay I will try it.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2207, today: 1, week: 2, month: 9

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: 2116, today: 1, week: 1, month: 10

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: 2152, today: 2, week: 2, month: 11

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: 2113, today: 1, week: 2, month: 12

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: 2107, today: 1, week: 1, month: 11

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: 2086, today: 1, week: 1, month: 9

Id: 20274332
Tags: how to
Posted: Dec 24 2017, 18:00
Replies: 25
Views: 4084, today: 3, week: 7, month: 32
0 0 0.0/5