AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Chatscript Madlibs help
 
 

I am new to chatscript and am trying to teach a bot madlibs. My code seems straightforward to me, but isn’t working right. Here’s what I have as a test:

topic: ~MADLIB keep ()

u: (madlib)

 
$issue madNoun

        Give me a noun


u
: ($issue=madNoun _*) give me another noun

        $madNoun 
_0

 $issue 
madNoun2


u
: ($issue=madNoun2 _*) give me an adjective

        $madNoun2 
_0

        $issue 
madAdj


u
: ($issue=madAdj _*) give me another adjective

        $madAdj 
_0

        $issue 
madAdj2


u
: ($issue=madAdj2 _*)

        
$madAdj2 _0

        $issue 
null

n My poem n Roses are $madAdj n $madNoun are blue n  $madNoun2 is $madAdj2 n 
And so are younn Do you want to make another madlib?

 
a: (~yes)

  
$issue madNoun

                Give me a noun

 a
: (~no)

  
$issue=null

  oh
ok then


t
:

        Do 
you want to play a madlib?

          
a: (~yes)

                
$issue madNoun

                Give me a noun

          a
: (~no)

  
$issue null

                Oh
ok then 

 

And here is the conversation I keep getting:

scalen: > madlib
Iris
:  
My poem 
Roses are unknown
-word 
unknown
-word are blue 
unknown
-word is unknown-word 
And so are you

Do 
you want to make another madlib?
scalen: > yes
Iris
:  
My poem 
Roses are yes 
~yes are blue 
~yes is yes 
And so are you

Do 
you want to make another madlib

Can anyone spot what is wrong? It seems the bot is taking the one input and pushing itself through each step when I think it should be stopping for each input

 

 
  [ # 1 ]

I know very little about Chatscript and so may be barking up the wrong tree totally but in this part of your code, you seem to be mixing up nouns and adjectives:

u: ($issue=madNoun2 _*) give me an adjective

        $madNoun2 
_0

        $issue 
madAdj 

And in this part, you have no user prompt:

u: ($issue=madAdj2 _*) 

As I say though, my knowledge of Chatscript wouldn’t fill the back of a stamp.

 

 
  [ # 2 ]

Thanks for the quick reply. From my understanding, the first part is on issue “madNoun2” and looking for a noun “_*” which will then be saved as $madNoun2. Upo recieving that noun, the bot then asks for an adjective and changes the issue to “madAdj” so on the next input it knows it’s looking for an adjective.

Then the output for the madAdj2 should be the completed madlib (the really long line)

Does that make sense? I might be going about this the wrong way

 

 
  [ # 3 ]

Hmn, this is what I’m getting…


HARRY:  Do you want to play a madlib?
todd: > yes please
HARRY:  Give me a noun
todd: > table
HARRY:  Give me another noun
todd: > chair
HARRY:  Give me an adjective
todd: > fluffy
HARRY:  Give me another adjective
todd: > bilious
HARRY:  N My poem n Roses are fluffy n table are blue n chair is bilious n And so are you! nn Do you want to make another madlib?
todd: >

which seems near to what you want and not what you posted…  The n is obvious supposed to be a \n, right?  Let me guess you are on windows?  I’m on mac


Do you want to make another madlib?
todd: > yes
HARRY:  N My poem n Roses are yes n yes are blue n yes is yes n And so are you! nn Do you want to make another madlib?
todd: >

 

 
  [ # 4 ]

There is some confusion in this code.  First, how do you get to this topic? Is this called from a control script in gambit or responder mode? Clearly it’s not keyword based, so you have to directly call it or tell your bot to use that as the starting topic. Your “log” suggests that you speak first, which would imply you didn’t show us what happened before.


The t: gambit asks for a noun if you want to play, but does not try to trap it.
The u: responder for the word madlib says “give me a noun” but we dont see that in the trace.

If you give it words that are not real words, then you will see unknown-word because your memorization is on _0 which is the canonical form and not ‘_0 which is the original form. Unknown words have that as their canonical form.

 

 
  [ # 5 ]

when you ask do you want to play another… you should at that time CLEAR all your variables…
$madnoun = null
$madadj = null
etc.
Otherwise you contaminate game 2 with game1’s answers

 

 
  [ # 6 ]

topic: ~madlib keep repeat () 


... wink


keep keeps the rejoinders, repeat allows responses to be repeated, you need both.  At least it worked for me when I added it.

HARRY:  Do you want to play a madlib?
todd: > sure
HARRY:  Give me a noun
todd: > Trombone
HARRY:  Give me another noun
todd: > Insect
HARRY:  Give me an adjective
todd: > Slidey
HARRY:  Give me another adjective
todd: > Creepy
HARRY: 
My poem
Roses are slimey
trombone are blue
insect is creepy
And so are you!

Do you want to make another madlib?
todd: > who are you calling creepy?!?
HARRY:  I don’t know what to say.
todd: > why not?
HARRY:  I don’t know what to say.
todd: > bah, stupid chatbot
HARRY:  I don’t know what to say.
todd: > ok, I want to play madlib again.
HARRY:  I don’t know what to say.
todd: > hmn
HARRY:  I don’t know what to say.
todd: > madlib
HARRY:  Give me a noun
todd: > Chatbot
HARRY:  Give me another noun
todd: > dead
HARRY:  Give me an adjective
todd: > oops
HARRY:  Give me another adjective
todd: > mistake
HARRY: 
My poem
Roses are yes
chatbot are blue
dead is mistake
And so are you!

Do you want to make another madlib?
todd: > not really, thanks.
HARRY:  Oh, ok then

 

 
  [ # 7 ]

Thank you everyone for the responses! I think it is probably a combination of all these, I’ll give them a shot when I get back to the office tomorrow!

Bruce, Do I need a way into the topic? I thought that if there was no keyword it would just get matched whenever something in it gets a hit (“madlib” in this case)

 

 
  [ # 8 ]

A topic is accessed EITHER by its keywords, or because some code somewhere else accesses that topic.

In the case of the Harry Control script, it “starts” in the ~introductions topic.  If you make NO CHANGES to anything, your topic will not be accessed.

 

 
  [ # 9 ]

Harry STARTS in ~introductions, but may not stay there.
It always, however, checks ~keywordless if it can’t find answers in its normal path. So if you don’t want to hack the control structure, just put
u: () respond(~madlib)

in ~keywordless somewhere. But that’s only good for responders. Unless the system is already in your madlib topic, your gambit will be useless.

 

 
  [ # 10 ]

Thank you all! I have it fixed and working (for now raspberry )

 

 
  login or register to react