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

% Previous does not work on java
 
 

Hi Gurus….
The following example works fine on perl (incluing on “Try RiveScript Online” of the rivescript web page) but it does’nt on java interpreter.

+ knock knock
- Who’s there?

+ *
% who is there
- <star> who

Do you have any idea of what am i doing wrong?

Thanks in advance.
rv

 

 
  [ # 1 ]

Hi

I think this also needs a substitution for “who’s” into “who is”

sub who's = who is 

So when the bot said “Who’s there?” and you send the next message, the bot’s last response to you is sent through the same substitution filters as the user’s message was, so “Who’s there?” needs to expand out into “who is there” to match the %Previous pattern.

 

 
  [ # 2 ]

Thanks Noah… but the problem is not that..
This is a only 5 lines rive (in spanish) and that does not work in java…

>>
! version = 2.0

+ toc toc
- Quien es?

+ *
% quien es
- <star> quien?
<<

-It’s not capital letter, i tryed all..
-Its not the question sign.
-There is not sustitutions.
-There are no strange characters in rive…

But i can’t make it work :(

 

 

 
  [ # 3 ]

I don’t work with the Java version much and handed primary development over to a friend.

But something to try next is to enable debug mode in RiveScript and check the logs to see what it’s doing with your %Previous while trying to match a reply to it.

Here is some example output from the JavaScript version:

+ *
I don't have a reply for that.
- Try asking that a different way.

+ *
% i dont have a reply for that
- I don'
t!

----------

Asked to reply to [web-user] hi
Checking topic random 
for any %Previous's
There'
s a %Previous in this topic!
Last replyi dont have a reply for that
Try to match lastReply (i dont have a reply for thatto i dont have a reply for that
Bot side matched
!
Try 
to match "hi" against * ((.*?))
ReplyI don't! 

The logs would typically say things like “Try to match lastReply ($lastReply) to $regularExpression” and will log whether the “bot side” matched (meaning the lastReply to the %) and then it will see if the user’s message also matched the trigger that went with that %Previous. So in the above example it said “Bot side matched!” and then made sure my user message “hi” matched the * wildcard on the trigger (it did) so the reply was chosen.

The 5 primary RiveScript implementations were all based on each other and all shared the vast majority of their logic (including what they log and how they phrase the logs, even!) because each new RiveScript module was referenced off a previous one. Literally “read the old code, translate to the new language”

The Java version has evolved but still came from the code I originally wrote so the debug log should be useful hopefully. The “debug” option is usually one given to the constructor; iirc when I first wrote RiveScript-Java it has a constructor of “public RiveScript(bool debug)” and some others.

 

 
  [ # 4 ]

Hi Rafael.
Just tested your script in java, and works for me.

 

 
  login or register to react