25
Powerpoint Templates Page 1 Powerpoint Templates Using Databases in AIML by Steve Worswick 1

Powerpoint Templates Page 1 Powerpoint Templates Using Databases in AIML by Steve Worswick 1

Embed Size (px)

Citation preview

Powerpoint TemplatesPage 1

Powerpoint Templates

Using Databases in AIMLby Steve Worswick

1

Powerpoint TemplatesPage 2

The problem

Where does a dog live? Which animal has 2 legs?What lives on a farm and says, ‘moo’?How many legs has the animal that eats flies?Which animals say nothing?Does a cow have more legs than a chicken?…

Animal Legs Lives Eats Says

dog 4 in a kennel meat woof

chicken 2 on a farm corn cluck

giraffe 4 in Africa leaves nothing

spider 8 in a web flies nothing

cow 4 on a farm grass moo

2

Powerpoint TemplatesPage 3

Setting up the database

<category><pattern>XCHECKANIMAL DOG</pattern><template><think>

<set name="animal">dog</set> <set name="legs">4</set><set name="lives">in a kennel</set><set name="eats">meat</set><set name="says">woof</set>

</think></template></category>

Animal Legs Lives Eats Says

dog 4 in a kennel meat woof

chicken 2 on a farm corn cluck

giraffe 4 in Africa leaves nothing

spider 8 in a web flies nothing

cow 4 on a farm grass moo

3

Powerpoint TemplatesPage 4

<category><pattern>XCHECKANIMAL DOG</pattern><template><think>

<set name="animal">dog</set> <set name="legs">4</set><set name="lives">in a kennel</set><set name="eats">meat</set><set name="says">woof</set>

</think></template></category>

<category><pattern>WHERE DOES A * LIVE</pattern><template>

<srai>XCHECKANIMAL <star index="1"/></srai>A <get name="animal"/> lives <get name="lives"/>. </template></category>

Where does a dog live?

4

Powerpoint TemplatesPage 5

<category><pattern>XCHECKANIMAL *</pattern><template><think>

<set name="animal">UNKNOWN</set>

<set name="legs">UNKNOWN</set>

<set name="lives">UNKNOWN</set><set name="eats">UNKOWN</set><set name="says">UNKNOWN</set>

</think></template></category>

<category><pattern>WHERE DOES A * LIVE</pattern><template>

<srai>XCHECKANIMAL <star index="1"/></srai><condition name="animal">

<li value="UNKNOWN">I haven’t heard of a <star index="1"/>.</li><li> A <get name="animal"/> lives <get name="lives"/>.</li>

</condition></template></category>

Where does a dog live?

5

Powerpoint TemplatesPage 6

Which animal has 2 legs?

<category><pattern>WHICH ANIMAL HAS 2 LEGS</pattern><template><think><set name="list">Results:<br/></set>

<srai>XCHECKANIMAL DOG</srai><srai>XCHECKMATCH 2 LEGS</srai><srai>XCHECKANIMAL CHICKEN</srai><srai>XCHECKMATCH 2 LEGS</srai><srai>XCHECKANIMAL GIRAFFE</srai><srai>XCHECKMATCH 2 LEGS</srai><srai>XCHECKANIMAL SPIDER</srai><srai>XCHECKMATCH 2 LEGS</srai><srai>XCHECKANIMAL COW</srai><srai>XCHECKMATCH 2 LEGS</srai>

</think><get name="list"/>.</template></category>

Animal Legs

dog 4

chicken 2

giraffe 4

spider 8

cow 4

6

Powerpoint TemplatesPage 7

<srai>XCHECKANIMAL DOG</srai><srai>XCHECKMATCH 2 LEGS</srai><srai>XCHECKANIMAL CHICKEN</srai><srai>XCHECKMATCH 2 LEGS</srai><srai>XCHECKANIMAL GIRAFFE</srai><srai>XCHECKMATCH 2 LEGS</srai><srai>XCHECKANIMAL SPIDER</srai><srai>XCHECKMATCH 2 LEGS</srai><srai>XCHECKANIMAL COW</srai><srai>XCHECKMATCH 2 LEGS</srai>

<category><pattern>XCHECKMATCH 2 LEGS</pattern><template><condition name="legs"><li value="2"><set name="list"><get name="list"/><br/><get name="animal"/></set></li></condition></template></category>

Which animal has 2 legs?

Animal Legs

dog 4

chicken 2

giraffe 4

spider 8

cow 4

7

Powerpoint TemplatesPage 8

<learn> and </learn> tags

<category><pattern>WHEN I SAY * YOU SAY *</pattern><template> If you say "<star/>" to me again, I will remember what you told me.

<learn><category><pattern><eval><uppercase><star/></uppercase></eval></pattern><template><eval><star index="2"/></eval></template></category></learn>

</template></category>

Human: Jump.Bot: I can’t jump, I have no legs. Human: When I say jump, you say how high.Bot: If you say "jump" to me again, I will remember what you told me.Human: Jump.Bot: How high.

8

Powerpoint TemplatesPage 9

Botcompare.aiml

<category><pattern>ARE * AND * THE SAME THING</pattern><template><srai>

BOTCOMPARE <star/> XSPLIT <star index="2"/></srai><condition name="match">

<li value="YES">Yes they are.</li><li value="NO">No, they are different.</li>

</template></category>

Human: Are Homer Simpson and Marge Simpson the same thing?Bot: No, they are different. Human: Are Bart Simpson and Bart Simpson the same thing? Bot: Yes they are.

www.square-bear.co.uk/aiml9

Powerpoint TemplatesPage 10

<category><pattern>BOTCOMPARISON</pattern><template><learn>

<category> <pattern> <eval><uppercase>BOTCHECK <get name="comparevalue1"/> </uppercase></eval> </pattern> <template>

<think> <set name="match">YES</set>

</think> </template></category>

</learn> <srai>botcheck <get name="comparevalue2"/></srai><srai>botremovecomparison</srai></template></category>

10

Botcompare.aiml

Powerpoint TemplatesPage 11

<category><pattern>XSCANANIMALDATABASE</pattern><template><think><set name="list">Results:<br/></set>

<srai>XCHECKANIMAL DOG</srai><srai>XCHECKMATCH</srai><srai>XCHECKANIMAL CHICKEN</srai><srai>XCHECKMATCH</srai><srai>XCHECKANIMAL GIRAFFE</srai><srai>XCHECKMATCH</srai><srai>XCHECKANIMAL SPIDER</srai><srai>XCHECKMATCH</srai><srai>XCHECKANIMAL COW</srai><srai>XCHECKMATCH</srai>

</think><get name="list"/>.</template></category>

Which animal has 2 legs?

Animal Legs

dog 4

chicken 2

giraffe 4

spider 8

cow 4

11

Powerpoint TemplatesPage 12

Which animal has 2 legs?

Animal Legs

dog 4

chicken 2

giraffe 4

spider 8

cow 4

<category><pattern>WHICH ANIMAL HAS * LEGS</pattern><template><think><set name="searchfor"><star/></set>

<learn><category> <pattern>XCHECKMATCH</pattern> <template><srai>BOTCOMPARE <get name="legs"/> XSPLIT <get name="searchfor"/></srai><condition name="match"><li value="YES"><set name="list"><get name="list"/><br/><get name="animal"/></set></li></condition> </template></category> </learn>

</think><srai>XSCANANIMALDATABASE</srai></template></category>

12

Powerpoint TemplatesPage 13

What lives on afarm and says ‘moo’?

<category><pattern>WHAT LIVES * AND SAYS *</pattern><template><think><set name="searchfor"><star/> <star index="2"/></set>

<learn><category> <pattern>XCHECKMATCH</pattern> <template><srai>BOTCOMPARE <get name="lives"/> <get name="says"/> XSPLIT <get name="searchfor"/></srai><condition name="match"><li value="YES"><set name="list"><get name="list"/><br/><get name="animal"/></set></li></condition> </template></category> </learn>

</think><srai>XSCANANIMALDATABASE</srai></template></category>

Animal Lives Says

dog in a kennel woof

chicken on a farm cluck

giraffe in Africa nothing

spider in a web nothing

cow on a farm moo13

Powerpoint TemplatesPage 14

How many legs has the animal that eats flies?

<category><pattern>HOW MANY LEGS HAS THE ANIMAL THAT EATS *</pattern><template><think><set name="searchfor"><star/></set>

<learn><category> <pattern>XCHECKMATCH</pattern> <template><srai>BOTCOMPARE <get name="eats"/> XSPLIT <get name="searchfor"/></srai><condition name="match"><li value="YES"><set name="list"><get name="list"/><br/>A <get name="animal"/> eats <get name="eats"/> and has <get name="legs"/> legs.</set></li></condition> </template></category> </learn>

</think><srai>XSCANANIMALDATABASE</srai></template></category>

Animal Legs Eats

dog 4 meat

chicken 2 corn

giraffe 4 leaves

spider 8 flies

cow 4 grass14

Powerpoint TemplatesPage 15

Which animals say nothing?

<category><pattern>WHICH ANIMALS SAY *</pattern><template><think><set name="searchfor"><star/></set>

<learn><category> <pattern>XCHECKMATCH</pattern> <template><srai>BOTCOMPARE <get name="says"/> XSPLIT <get name="searchfor"/></srai><condition name="match"><li value="YES"><set name="list"><get name="list"/><br/><get name="animal"/></set></li></condition> </template></category> </learn>

</think><srai>XSCANANIMALDATABASE</srai></template></category>

Animal Says

dog woof

chicken cluck

giraffe nothing

spider nothing

cow moo

15

Powerpoint TemplatesPage 16

Does a cow havemore legs than a chicken?

<category><pattern>DOES A * HAVE MORE LEGS THAN A *</pattern><template> <think><srai>XCHECKANIMAL <star/></srai><set name="legs1"><get name="legs"/></set><srai>XCHECKANIMAL <star index="2"/></srai><set name="legs2"><get name="legs"/></set><set name="checklegs"><get name="legs1"/> <get name="legs2"/></set></think><condition name="checklegs">

<li value="2 2">They both have 2 legs.</li><li value="2 4">A <star index="2"/> has more legs.</li><li value="2 8">A <star index="2"/> has 4 times as many legs.</li><li value="4 2">A <star/> has more legs.</li><li value="4 4">They both have 4 legs.</li><li value="4 8">A <star index="2"/> has twice as many legs.</li><li value="8 2">A <star index="2"/> has 4 times as many legs.</li><li value="8 4">A <star/> has twice as many legs.</li><li value="8 8">They both have 8 legs.</li>

</condition></template></category>

16

Powerpoint TemplatesPage 17

<li value="UNKNOWN UNKNOWN">Sorry but I have never heard of either of those animals.</li>

<li value="2 UNKNOWN">Well, I have not heard of a <star index="2"/>. However, a <star/> only has 2 legs and so I guess a <star index="2"/> has more legs.</li><li value="4 UNKNOWN">Well, I have not heard of a <star index="2"/>. However, a <star/> has 4 legs and so I guess a <star/> has more legs.</li><li value="8 UNKNOWN">Well, I have not heard of a <star index="2"/>. However, a <star/> has 8 legs and so I guess a <star/> has more legs.</li>

<li value="UNKNOWN 2">Well, I have not heard of a <star/>. However, a <star index="2"/> only has 2 legs and so I guess a <star/> has more legs.</li><li value="UNKNOWN 4">Well, I have not heard of a <star/>. However, a <star index="2"/> has 4 legs and so I guess a <star index="2"/> has more legs.</li><li value="UNKNOWN 8">Well, I have not heard of a <star/>. However, a <star index="2"/> has 8 legs and so I guess a <star/> has more legs.</li>

<li>The one that runs fastest probably has more legs.</li>

Does a cow havemore legs than a chicken?

17

Powerpoint TemplatesPage 18

What if there isno unique index?

Animal Legs Lives Eats Says

dog 4 in a kennel meat woof

chicken 2 on a farm corn cluck

giraffe 4 in Africa leaves nothing

spider 8 in a web flies nothing

cow 4 on a farm grass moo

<category><pattern>XCHECKANIMAL DOG</pattern><template><think>

<set name="animal">dog</set> <set name="legs">4</set><set name="lives">in a kennel</set><set name="eats">meat</set><set name="says">woof</set>

</think></template></category>

18

Powerpoint TemplatesPage 19

First name Surname Department Employed since

Jane Peterson Sales 1992

Michael Brown Mail Room 2003

Jane Hargreaves Marketing 1996

Simon Brown Sales 2001

Paula Harrison Legal 1992

What if there isno unique index?

<category><pattern>XCHECKEMPLOYEE JANE</pattern><template><think>

<set name="firstname">Jane</set> <set name="surname">Peterson</set><set name="dept">Sales</set><set name="employed">1992</set>

</think></template></category>

19

Powerpoint TemplatesPage 20

What if there isno unique index?

Index First name Surname Department Employed since

1 Jane Peterson Sales 1992

2 Michael Brown Mail Room 2003

3 Jane Smith Marketing 1996

4 Simon Brown Sales 2001

5 Paula Harrison Legal 1992

<category><pattern>XCHECKEMPLOYEE 1</pattern><template><think>

<set name="firstname">Jane</set> <set name="surname">Peterson</set><set name="dept">Sales</set><set name="employed">1992</set>

</think></template></category>

20

Powerpoint TemplatesPage 21

<category><pattern>XSCANDATABASE</pattern><template><think>

<set name="list">Results:<br/></set><srai>XCHECKEMPLOYEE 1</srai><srai>XCHECKMATCH</srai><srai>XCHECKEMPLOYEE 2</srai><srai>XCHECKMATCH</srai><srai>XCHECKEMPLOYEE 3</srai><srai>XCHECKMATCH</srai><srai>XCHECKEMPLOYEE 4</srai><srai>XCHECKMATCH</srai><srai>XCHECKEMPLOYEE 5</srai><srai>XCHECKMATCH</srai>

</think><get name="list"/>.</template></category>

What if there isno unique index?

21

Powerpoint TemplatesPage 22

What use is it?(facts and figures)

Country Capital Currency Area Language Population

USA Washington DC Dollar 3,718,691 English 307,212,123

India New Delhi Rupee 1,269,338 Hindi 1,166,079,217

Animal chicken cow

Baby chick calf

Male rooster bull

Female hen cow

Legs 2 4

Sound cluck moo

Eats corn grass

Lives coop farm

Gives us eggs meat

Noun brood herd

Description galline bovine

Letter A B

Boy’s name Andrew Brian

Girl’s name Anne Brenda

City Athens Berlin

Country Algeria Belgium

Fruit Apple Banana

Vegetable Asparagus Bean

Animal Anteater Bear

Job Actor Banker

Sport Archery Baseball

Transport Airship Bicycle22

Powerpoint TemplatesPage 23

Word Syllables Plural Size Does

carrot 2 carrots C grows underground

Has Volume

a stalk 0

Use Speed Length Spell Colour

lets you see in the dark

NONE 6 C A R R O T orange

What is it Rhyme Synonym Where Made From

vegetable parrot root vegetable

in a grocers plant matter

What use is it?(word knowledge database)

A database with 2,000 records takesapproximately 10 seconds to search

23

Powerpoint TemplatesPage 24

What use is it?(word knowledge database)

<category><pattern>XCHECKWORD CARROT</pattern><template><think>

<set name="word">carrot</set><set name="syl">2</set><set name="plural">carrots</set><set name="size">C</set><set name="does">grows underground</set><set name="use">helps you see in the dark</set>…<set name="whatisit">vegetable</set><set name="wordhas">a stalk</set><set name="volume">0</set>

</think></template></category>

<category><pattern>XP2S CARROTS</pattern><template><think><set name="singular">carrot</set></think></template></category> 24

Powerpoint TemplatesPage 25

Any questions?

[email protected]/aiml

25