<topic> <that> precedence

  • 31 Replies
  • 16301 Views
*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6860
  • Mostly Harmless
<topic> <that> precedence
« on: July 20, 2014, 01:45:11 pm »
I'm working on my AIML interpreter and need to know this.

Squarebear or Dave can you help at all please ?

I need to understand in what order to process <topic> and <that>.

I'm thinking it's like this :

  • SOME INPUT<TOPIC> SOME TOPIC <THAT> SOMETHAT
  • SOME INPUT<TOPIC> SOME TOPIC
  • SOME INPUT<THAT> SOME THAT

So that's in order of precedence.

Cheers :)

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6860
  • Mostly Harmless
Re: <topic> <that> precedence
« Reply #1 on: July 20, 2014, 01:53:13 pm »
P.S. Clearly the first rule is correct as a <topic> cannot occur in a <that> at least I don't think it can ? Can things be nested ?

But what if a pattern has a match for <topic> and <that> ?

Do I return both ?

*

DaveMorton

  • Trusty Member
  • ********
  • Replicant
  • *
  • 636
  • Safe, Reliable Insanity, Since 1961
    • Geek Cave Creations
Re: <topic> <that> precedence
« Reply #2 on: July 20, 2014, 02:04:55 pm »
I was right there with you , right up until you asked, "Do I return both?"

Then it all fell apart on me. :o

With regard to your first post, the order you've listed is the correct one. Matches of topic/that trump matches of just topic, and matches of just topic trump matches of just that.

Now your second post has me all confusticated, I'm afraid. Can you please expand and elucidate a bit?
Comforting the Disturbed, Disturbing the Comfortable
Chat with Morti!
LinkedIn Profile
CAPTCHA4us

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6860
  • Mostly Harmless
Re: <topic> <that> precedence
« Reply #3 on: July 20, 2014, 02:17:50 pm »
Sorry Dave,

I forgot <that> is the bot's last response.

I also just realised the input would probably would never match both <topic> and <that> unless both the bot and the user are repeating themselves, I think...

Scrap that.  :-X

Thanks for the confirmation of the order though and welcome back to the site  :)


*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6860
  • Mostly Harmless
Re: <topic> <that> precedence
« Reply #4 on: July 20, 2014, 02:27:10 pm »
In fact even if they are repeating I don't think they could possibly match.

All this recursion I am playing with is driving me nuts  :D

*

squarebear

  • Trusty Member
  • *********
  • Terminator
  • *
  • 869
  • It's Hip to be Square
Re: <topic> <that> precedence
« Reply #5 on: July 20, 2014, 10:52:07 pm »
You can easily match both topic and that. One category could have set the topic and a category inside the topic could have a <that>. Fairly rare though.
Feeling Chatty?
www.mitsuku.com

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6860
  • Mostly Harmless
Re: <topic> <that> precedence
« Reply #6 on: July 20, 2014, 11:06:12 pm »
I thought there must exist the possibility that it could happen, couldn't figure out how though so thanks Steve.

Can you share an example please ?

In that scenario do you think it's best to return both responses or one or the other ?

What's accepted practice ?

Cheers :)

*

DaveMorton

  • Trusty Member
  • ********
  • Replicant
  • *
  • 636
  • Safe, Reliable Insanity, Since 1961
    • Geek Cave Creations
Re: <topic> <that> precedence
« Reply #7 on: July 20, 2014, 11:50:28 pm »
If there's a "tie" between two or more inputs that match topic, that and pattern identically, you have a choice (none of which involve returning more than one response). You can either:

a.) choose the "first" category encountered (ignoring all others), or...
b.) choose the "latest" category encountered (again, ignoring all others), or...
c.) randomly choose between ALL identically matched categories

Pandorabots (I believe) uses option "b", while Program O uses option "c". There are advantages to both, though option "b" makes it easier to troubleshoot when things go wrong. :)
Comforting the Disturbed, Disturbing the Comfortable
Chat with Morti!
LinkedIn Profile
CAPTCHA4us

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6860
  • Mostly Harmless
Re: <topic> <that> precedence
« Reply #8 on: July 21, 2014, 02:05:45 pm »
Presumably this would occur when an programmer has unwittingly supplied more than one pattern that matches. I imagine they would only want one response.

As it's impossible to read minds, I think I will default to the topic for now and maybe review it later.

*

squarebear

  • Trusty Member
  • *********
  • Terminator
  • *
  • 869
  • It's Hip to be Square
Re: <topic> <that> precedence
« Reply #9 on: July 21, 2014, 08:13:25 pm »
Here is an example:

Human: do you like cats
Bot: Sure. I like them very much. Do you like them?
Human: yes
Bot: Cool. My favourite is Garfield.
Human: yes
Bot: What do you mean "yes"?

Code
<category> 
    <pattern>DO YOU LIKE CATS</pattern>
        <template>
            <think><set name="topic">cats</set></think>
            Sure. I like them very much. Do you like them?
        </template>
</category>

<category>
<pattern>YES</pattern>
<that>DO YOU LIKE THEM</that>
    <template>
    Sorry. Who are "they"?
    </template>
</category>


<topic name="CATS">
    <category>
        <pattern>YES</pattern>
        <that>DO YOU LIKE THEM</that>
        <template>
            Cool. My favourite is Garfield.
        </template>
    </category>

    <category>
    <pattern>YES</pattern>
    <template>
        What do you mean "yes"?
    </template>
    </category>

</topic>

However, this is a contrived example for demonstration, as you could do this with just <that> unless you had loads of "Do you like them?" type categories.

In the case of duplicates, I personally would go for Dave's option B. Sometimes, it's easier just to add a duplicate category than to search back through your AIML files to find the original. Option C would be a nightmare to debug, especially if you had a few hundred AIML files with matching categories. Bad practice I know but you will get people who do this.
Feeling Chatty?
www.mitsuku.com

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6860
  • Mostly Harmless
Re: <topic> <that> precedence
« Reply #10 on: July 21, 2014, 08:38:29 pm »
Steve by 'matching categories' you must mean categories with the same patterns ?

In my interpreter there will only ever be one category/pattern because at the time of making the Graphmaster I avoid duplication - I thought this was beneficial because why would anyone want say five answers to one pattern ? Aside from the scenario you mention that because it's easier to just add a new category.

If say they wanted random replies shouldn't that be done using the built in method of the <random> tag ?

To help things along when the Graphmaster is built I can output debug information on duplicates. But I would have to decide on which duplicate to use. So I would at some point chose to use the first one found or the last one found. Since internally AIML has no dating scheme I don't know how one would find the 'latest' category...

Sorry if I am not getting the point or have overlooked something. I really don't want to cater to bad practice to be fair, I'm designing it following the documentation...

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6860
  • Mostly Harmless
Re: <topic> <that> precedence
« Reply #11 on: July 21, 2014, 08:48:43 pm »
I guess you could date it from the time the file was last updated, but still that's catering to bad practice and I don't feel that should be the case. I think I will just produce an import report once the AIML has been looked over. Then one can remove duplicates from the AIML.

Thanks for the example :)

*

squarebear

  • Trusty Member
  • *********
  • Terminator
  • *
  • 869
  • It's Hip to be Square
Re: <topic> <that> precedence
« Reply #12 on: July 22, 2014, 10:52:56 am »
Of course, you are quite correct and shouldn't cater for bad practice and people should use random for multiple replies.
An import report would be cool. There used to be a free utility called Shadow Checker which would report on duplicate categories and also categories that would never be called because another one (probably with an underscore wildcard) was blocking them. Unfiortunately, this doesn't seem to be about any more since XP became defunct.
Feeling Chatty?
www.mitsuku.com

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6860
  • Mostly Harmless
Re: <topic> <that> precedence
« Reply #13 on: July 22, 2014, 03:35:18 pm »
Thanks Steve. I remember that shadow checker program, never got around to trying it though.

OK I will just do the import report then, thanks for your thought's Steve and Dave, much appreciated.

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6860
  • Mostly Harmless
Re: <topic> <that> precedence
« Reply #14 on: July 26, 2014, 09:34:59 pm »
Continuing with <topic> I found that topics can have a wildcard, but only one.

So is the same rule of precedence followed as per patterns ? I couldn't really make out what the documentation here meant :

http://www.alicebot.org/documentation/aiml-reference.html#topic

I was thinking it goes _, KEYWORD, * as per the way pattern does.

Also in the case of...

Code
<topicstar index="n"/>

Why would one have the index of 'n' when only one wildcard is allowed ?

Thanks for any guidance :)

 


Requirements for functional equivalence to conscious processing?
by DaltonG (General AI Discussion)
November 19, 2024, 11:56:05 am
Will LLMs ever learn what is ... is?
by HS (Future of AI)
November 10, 2024, 06:28:10 pm
Who's the AI?
by frankinstien (Future of AI)
November 04, 2024, 05:45:05 am
Project Acuitas
by WriterOfMinds (General Project Discussion)
October 27, 2024, 09:17:10 pm
Ai improving AI
by infurl (AI Programming)
October 19, 2024, 03:43:29 am
Atronach's Eye
by WriterOfMinds (Home Made Robots)
October 13, 2024, 09:52:42 pm
Running local AI models
by spydaz (AI Programming)
October 07, 2024, 09:00:53 am
Hi IM BAA---AAACK!!
by MagnusWootton (Home Made Robots)
September 16, 2024, 09:49:10 pm
LLaMA2 Meta's chatbot released
by spydaz (AI News )
August 24, 2024, 02:58:36 pm
ollama and llama3
by spydaz (AI News )
August 24, 2024, 02:55:13 pm
AI controlled F-16, for real!
by frankinstien (AI News )
June 15, 2024, 05:40:28 am
Open AI GPT-4o - audio, vision, text combined reasoning
by MikeB (AI News )
May 14, 2024, 05:46:48 am
OpenAI Speech-to-Speech Reasoning Demo
by MikeB (AI News )
March 31, 2024, 01:00:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am

Users Online

203 Guests, 0 Users

Most Online Today: 453. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles