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..

No match in rejoinders
 
 

Hello !
I’m getting a weird behavior with the rejoinder pattern matching as you can see in the following debug trace. The try here is to catch the second sentence if the first failed before.

testuser: > yes, good
.Pushing Topic ~preprocesstopic
.Enter Topic:


.Topic: ~preprocesstopic linear Gambits:
..try t:0.0 @0:
..  **  Match: t:  ^if 00k( ! $topicdata ) 00V{ $topicdata = ^jsoncreate ( permanent object ) } 004 ^if 00F( ...
.Result: NOPROBLEM Topic: ~preprocesstopic
Popping Topic

.Pushing Topic ~multiplesentencescontrol
.Enter Topic:


.Topic: ~multiplesentencescontrol linear Statements:
..try u:0.0 @0:      pattern: ( _* )
..( _* )+
..  **  Match: u:  ( _* ) $$sentencecounter += 1 $_tmp = ^savesentence ( $$sentencecounter ) ^respond ( ~anal…
..  Wildcards: _0=~yes / ~yes (1-1)
...Respond trying ~analizesentence
....Pushing Topic ~analizesentence
....Enter Topic:


....Topic: ~analizesentence linear Statements:
....,try u:0.0 @0:      pattern: ( collecteddatajson )
....,( collecteddatajson-      Remaining pattern: )
....,try u:1.0 @0:      pattern: ( $backtointroduction $button )
....,( $backtointroduction-      Remaining pattern: $button )
....Result: NOPROBLEM Topic: ~analizesentence
...Popping Topic ~multiplesentencescontrol
.Result: ENDSENTENCE Topic: ~multiplesentencescontrol
.Popping Topic ~multiplesentencescontrol

.Pushing Topic ~multiplesentencescontrol
.Enter Topic:


.Topic: ~multiplesentencescontrol linear Statements:
..try u:0.0 @0:      pattern: ( _* )
..( _* )+
..  **  Match: u:  ( _* ) $$sentencecounter += 1 $_tmp = ^savesentence ( $$sentencecounter ) ^respond ( ~anal…
..  Wildcards: _0=good / good (1-1)
...Respond trying ~analizesentence
....Pushing Topic ~analizesentence
....Enter Topic:


....Topic: ~analizesentence linear Statements:
....,try u:0.0 @0:      pattern: ( collecteddatajson )
....,( collecteddatajson-      Remaining pattern: )
....,try u:1.0 @0:      pattern: ( $backtointroduction $button )
....,( $backtointroduction-      Remaining pattern: $button )
....Result: NOPROBLEM Topic: ~analizesentence
...Popping Topic ~multiplesentencescontrol
..try u:1.0 @0:      pattern: ( )
..( )+
..  **  Match: u:  ( ) $_count = 0 ^loop ( $$sentencecounter ) 018 { $_count += 1 ^restoresentence ( $_count ...
....Respond trying ~processonesentence
....,Pushing Topic ~processonesentence
....,Enter Topic:


....,Topic: ~processonesentence linear Statements:
....,.try u:0.0 @0: pattern: ( %input<%userfirstline )
....,.( %input(3)<%userfirstline(1)- Remaining pattern: )
....,.try u:1.0 @0: pattern: ( %input>=1 )
....,.( %input(3)>=1+ )+
....,. ** Match: u: ( %input>=1 ) $responsecount = %response ^if 00f( ! $data ) 00G{ $topiccurrent = $topict…
....,.try u:2.0 @0: pattern: ( )
....,.( )+
....,. ** Match: u: ( ) ^currenttopic ( ) ^if 00m( %response != 0 ) 00q{ ^end ( INPUT ) } 004 ^if 00w( %respon…
....,....Pushing Topic ~mycoin
  try rejoinder for: ~mycoin 0.1
....,....,try a:0.1 @0:      pattern: ( ~goodness )
....,....,( ~goodness-      Remaining pattern: )
....,....,try a:0.2 @0:      pattern: ( [ ~badness ~negativeemotions ] )
....,....,(
....,....,[ ~badness- ~negativeemotions- ]-
....,....,      Remaining pattern: )
....,....,try a:0.3 @0:      pattern: ( )
....,....,( )+
....,....,  **  Match: a:  ( ) Woot! \n ^cleandataandbacktointro ( )
....,....Popping Topic ~mycoin
....,Result: ENDINPUT Topic: ~processonesentence
....Popping Topic ~multiplesentencescontrol
.Result: ENDINPUT Topic: ~multiplesentencescontrol
.Popping Topic ~multiplesentencescontrol
.Pushing Topic ~postprocesstopic
.Enter Topic:


.Topic: ~postprocesstopic linear Gambits:
..try t:0.0 @0:      pattern: ( $backtointroduction !$button )
..( $backtointroduction(true)+ !$button()+ )+
..  **  Match: t:  ( $backtointroduction !$button ) ^log ( OUTPUT_ECHO “^Clean postprocess \n” ) ^cleandata (...
Clean postprocess
Clean postprocess
Gambit trying ~introductions
....Pushing Topic ~introductions
....Enter Topic:


....Topic: ~introductions linear Gambits:
....,try t:0.0 @0:      pattern: ( %input<%userfirstline %input>0 )
....,( %input(3)<%userfirstline(1)-      Remaining pattern: %input>0 )
....,try t:1.0 @0:      pattern: ( %input>=1 !%more )
....,( %input(3)>=1+ !%more-      Remaining pattern: )
....,try t:2.0 @0:      pattern: ( %input<%userfirstline )
....,( %input(3)<%userfirstline(1)-      Remaining pattern: )
....Result: NOPROBLEM Topic: ~introductions
....Popping Topic ~introductions
..try t:1.0 @0:      pattern: ( $backtointroduction $button )
..( $backtointroduction-      Remaining pattern: $button )
..try t:2.0 @0:      pattern: ( ! $cs_token=$std_cstoken )
..( !$cs_token(67336959)=$std_cstoken(67336959)-      Remaining pattern: )
..try t:3.0 @0:      pattern: ( $$tmptoken )
..( $$tmptoken-      Remaining pattern: )
.Result: NOPROBLEM Topic: ~postprocesstopic
Popping Topic
Respond: user:testuser bot:mybot ip: (~mycoin) 3   yes, good ==> Woot!  When:Mar05’18-15:17:33 Why:~mycoin.0.3.~multiplesentencescontrol.1.0   F:13402
bot:  Woot!

The engine is splitting correctly the INPUT and I’m getting the second part where I would like to match my rejoinder :

..  Wildcards: _0=good / good (1-1)

Then, the engine is trying the rejoinders…

try rejoinder for: ~mycoin 0.1
....,....,try a:0.1 @0:      pattern: ( ~goodness )
....,....,( ~goodness-      Remaining pattern: )
....,....,try a:0.2 @0:      pattern: ( [ ~badness ~negativeemotions ] )
....,....,(
....,....,[ ~badness- ~negativeemotions- ]-
....,....,      Remaining pattern: )
....,....,try a:0.3 @0:      pattern: ( )
....,....,( )+
....,....,  **  Match: a:  ( ) Woot! \n ^cleandataandbacktointro ( )

So, good not matched ~goodness. :testpattern works.

Do you know why my rejoinder is not working please ?
Thank you for your help ^_^

 

 
  [ # 1 ]

After some debugs, I can see that my control script is trying the second sentence, but is trying the first one in rejoinders.

Here is the sentence in input :

yes, I’m good

Here is the result of trace pattern :

.Topic: ~multiplesentencescontrol linear Statements:
..try u:0.0 @0:      pattern: ( _* )
..( _* )+
..  **  Match: u:  ( _* ) $$sentencecounter += 1 $_tmp = ^savesentence ( $$sentencecounter ) ^respond ( ~anal…
..  Wildcards: _0=I am good / I be good (1-3)
....Enter Topic:....,.  **  Match: u:  ( ) ^currenttopic ( ) ^if 00m( %response != 0 ) 00O{ ^setpreviousruletag ( ) ^end ( INPUT ...
....,....,try a:0.1 @0:      pattern: ( _0=~goodness )
....,....,( _0(I be good)=~goodness-      Remaining pattern: )
....,....,try a:0.2 @0:      pattern: ( [ ~badness ~negativeemotions ] )
....,....,(
....,....,[ ~badness- ~negativeemotions- ]-
....,....,      Remaining pattern: )
....,....,try a:0.3 @0:      pattern: ( ^setwildcardindex ( _7 ) _* )
....,....,( ^setwildcardindex+ _* )+
....,....,  **  Match: a:  ( ^setwildcardindex ( _7 ) _* ) Woot _7 ! \n ^cleandataandbacktointro ( )
....,....,  Wildcards: _0=I am good / I be good (1-3)  _1=65535 / 65535 (0-0)  _2=65535 / 65535 (0-0)  _3=null (0-0)  _4=null (0-0)  _5=null (0-0)  _6=null (0-0)  _7=~yes / ~yes (1-1)

So, I’m suspecting that I’m not sending correctly the second sentence in my Constrol Script.

 

 
  [ # 2 ]

It seems that the new manual could be useful on this topic : https://github.com/chatscriptnlp/ChatScriptNLP/blob/master/WIKI/Practicum-rejoinders.md#rejoinders-and-control-scripts

Now, I’m trying to figure out how to implement this useful explanation.
Thank you for this new document.

 

 
  [ # 3 ]

Okay ! I got this work now !

In your preprocessing topic, you have just to add this

u: ( %more ~yes ) ^next(INPUTnofail(TOPIC ^rejoinder())

u: ( %more ~no ) ^next(INPUTnofail(TOPIC ^rejoinder()) 

And, you engine got ~yes and there is another sentence in the stack, then, it puts the next one and try the rejoinder. If no output fires, it will process the rest of the sentence.

It seems to work. I need to do more regress tests. But if you think that it’s a wrong manner to do, feel to free to share smile
Thank you!

 

 
  login or register to react