That element

  • Pierre

    Pierre - 2007-03-27


    In your program, the pattern-side <that> returns the whole previous input, while it should return only the previous sentence, don't you think? It works like it on different interpreters I tried.

    Here is a suggestion (split the last output to return only the last sentence):

    in User.getLastBotOutput  :

    - return ((Result)Results[0]).RawOutput;

    + AIMLbot.Normalize.SplitIntoSentences splitter = new AIMLbot.Normalize.SplitIntoSentences(bot);
    + string[] output = splitter.Transform(((Result)Results[0]).RawOutput);
    + if (output.Length > 0) return output[output.Length - 1];
    + else return "*";

    Best Regards,


    • Nicholas Tollervey


      Must have missed that one... I'll take a look and fix it to how the AIML standard specifies - however I seem to remember it being quite vague on what exactly constitutes "that" - is it the complete last utterance (as my bot behaves) or just the final sentence within the last utterance? Thanks for pointing it out and if in doubt I'll follow the "norm".

      Best wishes,


    • Nicholas Tollervey

      Hi Pierre,

      I'm currently preparing a new release of AIMLBot with bug fixes and so on.

      I've been looking into the issue you mention above. Section 8.4 of the AIML standard explains that:

      "An input match path has three components, whose order is mandatory, and which correspond to the three components of a load-time match path:

      1. pattern: the normalized input

      2. that: the previous bot output, normalized according to the same rules as in input normalization.

      NB: If there was no previous bot output, or the previous bot output was unavailable, the value of the input path that is *.

      3. topic: the current value of the topic predicate.

      NB: If the topic predicate has no value, then the value of the input path topic is *."

      This certainly seems ambiguous with regard to your excellent point. Now, my initial feeling is that "the previous bot output" means the complete output rather than last sentence because the AIML standard document is also very specific about referencing sentences within "previous bot output" when defining the <that> tag. Therefore I'm assuming that if the AIML standard meant the last sentence then they would have been just as specific.

      There is a further justification for including the complete previous bot output. Imagine the following category:

      <that>* b *</that>

      If the previous bot output had been:

      a b c. x y z.

      Consisting of two sentences ({a b c} and {x y z}) then returning the complete previous bot output will match the category above. If I used the method you suggest this wouldn't be the case - despite the category explicitly matching if "b" were to appear in the previous output. The fact that the order of the output sentences depends on the order of the "stimuli" from the user means that (obviously) sentence order limits the scope of what the previous bot output would be should it only be the last sentence.

      I'd be inclined to let the bot-master decide how and what to match by providing them with as big a context as possible in terms of "previous bot output".

      However, I realise that I might be wrong in this (as others have followed your example) so please argue your case and pick at my argument - I welcome with enthusiasm constructive criticism, especially if it changes my mind! :-P

      Best wishes,


    • Pierre

      Pierre - 2007-04-03

      Hi Nicholas,

      The interest (at least for me) to keep only the previous bot sentence is that my AIML code contains a lot of recursive responses, through the <srai> tag. Some categories contain an answer, then point at another category, that will add another sentence to the final output. For example, the bot answers a question, then ask something to the user. Those 2 sentences are not in the same category, because the second one can be used in many cases.

      Another example: the bot ask something and want a specific answer from the user. If he doesn't give it, the bot will say "No, try again." then repeat the question (=point at the question category).

      In these cases, if the tag <that> returns the whole previous output, I can't catch the question the bot asked, since it will return the sentence before also.

      Well, I don't know which of the 2 cases (your example or mine) is the most important to handle. I can just say that Pandorabots returns the last sentence also.

      What do you think about it?

      Best regards,


    • roberto gilli

      roberto gilli - 2009-05-25

      Hi Nicolas,

      I agree with Pierre as far as the "that interpretation". Actually in AIMLbot, the "that" tag doesn't work.

      I can manage to use a "temporary topic" but the AIML code will be "clumsy"... :-)

      best regards


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks