Showing posts with label synonyms. Show all posts
Showing posts with label synonyms. Show all posts

Sunday, June 28, 2009

Tags

No of different tags used in this blog: 450 (approx) (like, wow)

Have just added list of Tags/Labels used in this blog to the Adventures home page. Can be found on the right after the j-pop player. There are an awful lot of them. Therefore thought should explain something about my approach to tagging.

Now, whilst at the Uni of Strathclyde, taught indexing for several years. This was for usual reason i.e. no-one else wanted to teaching indexing and I agreed to do it when arrived as new lecturer and knew no better.

Thus am aware of benefits of controlled vocabularies, can tell a Broader from a Narrower term, and describe the glory that is the Scope Note. Since started in this business when indexes were mostly on paper also know the difference between KWIC and KWOC and might even still attempt a description of PRECIS.

However, fond readers will note that in this blog have happily thrown all that nonsense out of the window. Instead am practising the art of Tagging as Stream of Consciousness. Basically, when come to the end of the entry, fill in the tags happily with whatever first comes into head. This is usually related to the content of the entry, though this is not guaranteed. Sometimes yield happily to word association e.g. in post before last tagged Mirror (because was using mirror water effect) and then tagged Smoke, since, you know, there is that phrase smoke and mirrors. Think this may be rather ineffective subconcious act of subversion against the dark tides of orderly metadata.

Therefore you may find the list of tags:

a) A delightful source of serendipitous amusement; or

b) A disgrace.

Enjoy! (As the waitress says when serving you with a plate of slightly overcooked pasta and a glass of slightly underchilled white wine)

Thursday, March 26, 2009

<srai>: The basics I: Linking Synonyms

The simplest form of category in AIML is one with an atomic pattern, namely, a pattern with no wild cards.

For example

<category>
<pattern>NAME</pattern>
<template>My name is ALICE.</template>
</category>

produces the dialog:

Human: Name?
Robot: My name is ALICE.

But there are many different ways of asking for a name. "What is your name?", "Who are you?", "Tell me your name", "Do you have a name?", "Your name is?" are all synonyms for "Name?".

In AIML we link all of these synonyms together using the <srai> tag.

The category:

<category>
<pattern>WHAT IS YOUR NAME</pattern>
<template><srai>NAME</srai></template>
</category>

used in conjunction with the category above, produces the dialog:

Human: What is your name?
Robot: My name is ALICE.

Similarly, we can add categories such as:

<category>
<pattern>DO YOU HAVE A NAME</pattern>
<template><srai>NAME</srai></template>
</category>

and

<category>
<pattern>YOUR NAME IS</pattern>
<template><srai>NAME</srai></template>
</category>

and so on for all the variations of "Name?"

Creating a new chat bot involves writing an enormous amount of original AIML content. Because of its minimalism, AIML lets the botmaster approach content creation one small step at a time. Typically when creating a bot, we identify in the chat logs a new variation of an input we have already seen before. For example, we might see "I want to know your name", and realize there is already a response for this. The convenience of <srai> is that we don't have to go searching through files and files of code to find the response. We know the response is already in there somewhere, so we can just link to it with <srai>:

<category>
<pattern>I WANT TO KNOW YOUR NAME</pattern>
<template><srai>WHAT IS YOUR NAME</srai></template>
</category>

Notice that we linked to WHAT IS YOUR NAME. This doesn't matter, because there is already another category linking WHAT IS YOUR NAME to NAME.

As a general rule of thumb, a good design principle of AIML is to follow the rule that each <srai> should "shorten" then input. In this case that means that reducing WHAT IS YOUR NAME (4 words) to NAME (1 word) is ok, and reducing I WANT TO KNOW YOUR NAME (6 words) to WHAT IS YOUR NAME (4 words) is ok, but we should avoid categories like:

<category>
<pattern>TELL ME YOUR NAME</pattern>
<template><srai>I WANT TO KNOW YOUR NAME</srai></template>
</category>

By avoiding such designs, the AIML program is guaranteed to terminate, and we will never see the "Too much recursion in AIML" error. Why this is, will be explained in more detail later. For now, keep in mind the design rule that in AIML, it is better to store actual responses along with the simplest and shortest possible patterns. That is why putting the response "My name is ALICE" inside the category with pattern NAME, is better than putting it with WHAT IS YOUR NAME.