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

A preprocessing screener

I’m looking for a way for a set of responders in preprocessing to test the presence of some words, but then allow the input to continue to main as if the sentence had not been used up. I’d need a sort of SameInput() equivalent.


  [ # 1 ]


First, terminology.  There are 3 stages of processing. Preprocessing (the stage) happens before any user input is processed so it has no knowledge of it.  Main processing (the stage) gets each sentence in succession.  PostProcessing (the stage) happens after all user input has been seen, so has no knoweldge of it (other than what data may have been recorded).

If you want to look at a sentence to set some flags, then keep going to actually generate answers, that is trivial.
At the start of main processing, do:
u: () ^respond(~preprocesstopic)
and just don’t generate any output for the user.  I do this all the time, setting flags, gathering information about the user, etc.

Matching a pattern and running a rule does not use up input. It does not stop any other rule even in the same topic from firing. Generating output does.


  [ # 2 ]

Hi Ed,

Here is what I do in my control file to look for specific words in input to see if my students are asking about family problems or past medical problems.

u: ($code=main [~role_family family]) $family = true
u: ($code=main [ever past history prior before previous]) $pasthistory = true
u: () refine ()
  a: ([~role_family family]) $family = true $pasthistory = null  
  a: ([ever past history prior before previous]) $pasthistory = true $family = null

The first part looks for family words and if they are present sets the variable $family to true. Same with past tense words.

The refine section ensures that only one variable is true at a time. This is needed in case someone asks “Has anyone in your family ever had cancer”. Without the refine section both $family and $pasthistory would = true. I decided that family should be tested first so if $family is true then the second rule in refine does not fire.

In our topics, we make decisions on these flags. At the beginning of my currentpain topic for example, we have this.

u: ($pasthistory) respond(~pastpain) 
u: ($family) respond(~familypain)

So if either of those flags have been set during sentence processing in control, then we direct the response to the correct topic.

Not sure if this is what you were looking for, but that’s how we look at sentence input and set some variables in control, then act on them in topics.




  [ # 3 ]

Hi Doug.
I followed Bruce’s method; organized these flag setter’s through topics.

Your detailed example looks good enough to include it in the tutorial.


  login or register to react