AI Zone Admin Forum Add your forum

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

How to handle extra input after ~emohello and ~emogoodbye

I’m trying to use ~emohello and ~emogoodbye in responder patters to match a wide range of greetings the user might say, regardless of whether there is extra input after the greeting.

I don’t want to do anything with the extra input; I just want the rule to match the likes of “hello” as well as “hello Ted”, and likewise with “goodbye” and “goodbye Ted”. Before learning that ~emohello and ~emogoodbye are interjections that end up in their own sentence, my rule was as follows:

#! hello               <-- Matches
#! hello Ted           <-- Doesn't match
#! hello mate          <-- Doesn't match
#! hello old friend    <-- Doesn't match
u: (~emohello)
Hello to you too

I now understand why the above doesn’t work, but don’t know how to fix it.

I’ve tried using %more, ^next(), and ^refine() as documented here, but these seem like they’re meant for use on rejoinders as opposed to top-level rules.

I also tried to disable interjection splitting by removing #DO_INTERJECTION_SPLITTING from, but this didn’t appear to have any effect. I also don’t know what the other implications of this are.

TL;DR I want to use ~emohello and ~emogoodbye as if they were concepts, not interjections.


  [ # 1 ]

Had similar issues with some of the # flags not doing what I thought they would do when removed, although did find that #DO_INTERJECTION_SPLITTING was certainly working at one point as i removed it for the same reason you did.  However we’ve also had the need to treat multiple sentences as one input (eg when capturing a story) so we use the following (probably not ideal) to build all the input strings into one which could also be a work around for you. This goes at the start of control_script after any %input<%userfirstline type initialisation rule. Set $combinesentences to true or false in your initialisation

u: (_*) # sentence splitting, gets passed each user sentence automatically by Chatscript
if ($combinesentences == false{
# default behaviour
   # save and discard all input sentences except last.
$$sentenceCounter += 1
= ^savesentence($$sentenceCounter)
   if (%
# If there are no more then the last sentence will be passed to the processing below
else {
$$thissentence = ^original(_0# interesting, just takes first word if omit _* from rule
$$sentencestring = ^join(AUTOSPACE $$sentencestring $$thissentence# not sure of . placement
if (%more
else {
^analyze($$sentencestring# so passes whole input as one

: () # Main per-sentence processing
   # then your standard processing goes here 

If does tend to lose any full stops though.




  login or register to react