This is a proprietary tag that allows you to define expressions for your bot that will be triggered if you use a Lemurtar avatar.
The following examples will add a 'smile' to your lemurtar
<avatar action="smile" />
If any of the attributes below are missing the tag might not behave as expected.
# | Name | Type | Description | Options |
---|---|---|---|---|
1 | action | string | the action you wish your avatar to perform | sad, happy, angry, scared, love |
<aiml version="2.0">
<category>
<pattern>TEST HAPPY</pattern>
<template>I am happy<avatar action="happy" /></template>
</category>
</aiml>
{
"success": true,
"data": {
"conversation": {
"input": "test happy",
"output": "I am happy",
"id": "08b53284-355f-4d89-9f8b-38878eddfc8d",
"topic": ""
},
"bot": {
"id": "dilly",
"name": "Dilly",
"image": "https://demo.lemurengine.com/widgets/dilly.png"
},
"client": {
"id": "8db4c2d7-c96d-43c1-bef7-0b30e8e86e96",
"image": "https://demo.lemurengine.com/images/default/blank.png",
"name": ""
},
"features": {
"action": "happy"
},
"metadata": {
"version": "1.5.0",
"date": "2021-12-01T07:55:10.606212Z",
"duration": "337ms"
}
},
"message": "Conversation turn successful"
}
This tag allows you to access bot properties (which are stored in the database).
The following examples will fetch a 'favmusic' value from the bot_properties table
<bot name="favmusic" />
If any of the attributes below are missing the tag might not behave as expected.
# | Name | Type | Description |
---|---|---|---|
1 | name | string | the name of the property you wish to retrieve |
<aiml version="2.0">
<category>
<pattern>WHAT IS YOUR FAVORITE MUSIC</pattern>
<template>My favorite music is <bot name="favmusic" /></template>
</category>
</aiml>
{
"conversation":{
"user":"What is your favourite music?",
"bot":"My favorite name is house music"
}
}
The condition tag is used to switch between responses based upon a certain condition being true.
The following example states check the value of the variable 'state' and match the value in the proceeding <li> tags to work out if a response should be displayed and if there is no match use the final <li> tag which has no conditional value.
<condition name="state">
<li value="bored">Yes I am very bored.</li>
<li value="busy">No I am quite busy.</li>
<li>I am not really sure.</li>
</condition>
If any of the attributes below are missing the tag might not behave as expected.
# | Name | Type | Description |
---|---|---|---|
1 | name | string | Looks in the global 'name' variables for a matching variable with the same name. |
2 | var | string | Looks in the local 'var' variables for a matching variable with the same name. |
<aiml version="2.0">
<category>
<pattern>ARE YOU BORED</pattern>
<template>
<think><set name="state">busy</set></think>
<condition name="state">
<li value="bored">Yes I am very bored.</li>
<li value="busy">No I am quite busy.</li>
<li>I am not really sure.</li>
</condition>
</template>
</category>
</aiml>
{
"conversation":{
"user":"Are you bored?",
"bot":"No I am quite busy."
}
}
This tag will display the current date in a format and timezone of your choosing.
The following examples will return the current date in the %Xformat
<date format="%X" />
If any of the attributes below are missing the tag might not behave as expected.
# | Name | Type | Default | Description |
---|---|---|---|---|
1 | locale | string | en_US | Help on locale codes stackoverflow |
2 | format | string | %B %d %Y | For a full list of allowed formats: php.net/function.strftime |
3 | timezone | string | en_US | Help on available |
<aiml version="2.0">
<category>
<pattern>WHAT IS THE DATE</pattern>
<template>The date is <date format="%X" /></template>
</category>
</aiml>
{
"conversation":{
"user":"What the date?",
"bot":"The date is 01/12/21"
}
}
When inputs are normalized a dataset is built up in the normalizations table, this tag will attempt to substitute the value the user want to denormalize back to its normalized value.
The following examples will attempt to denormalize the value 'google dot com'.
<denormalize>google dot com</denormalize>
<aiml version="2.0">
<category>
<pattern>DENORMALIZE *</pattern>
<template><denormalize><star/></denormalize></template>
</category>
</aiml>
{
"conversation":{
"user":"Denormalize google dot com",
"bot":"google dot com"
}
}
The eval tag is used inside a learn tag and its allows you to substitute the item to evaluate in the category that is being taught.
The following example sets the subject of the question.
WHAT COLOR IS THE <eval><star /></eval>
The following example sets the subject of the answer.
The <eval><star /></eval> is blue
<aiml version="2.0">
<category>
<pattern>THE * IS GRASS</pattern>
<template>
I will remember that the <star /> is green.
<learn>
<category>
<pattern>WHAT COLOR IS THE <eval><star /></eval></pattern>
<template>The <eval><star /></eval> is green</template>
</category>
</learn>
</template>
</category>
</aiml>
{
"conversation":[
{
"user":"The grass is green.",
"bot":"I will remember that the grass is green."
},
{
"user":"What color is the grass?",
"bot":"The grass is green."
}
]}
The evaluate tag is an alias for the the eval tag. Please see the eval tag for details.
The explode tag is break a word into its letters (with a space in between each letter)
The following example will explode the word 'word'.
<explode>word</explode>
<aiml version="2.0">
<category>
<pattern>EXPLODE THIS WORD</pattern>
<template><explode>word</explode></template>
</category>
</aiml>
{
"conversation":
{
"user":"Explode this word",
"bot":"w o r d"
}
}
The feature tag allows you to set and return information in the features field of the response
This is not part of the conversation but is a way of adding extra features to your response
Features are a key pair value and your key can be anything you wish. It is up to your own front end application on how you interpret it.
A good example of this implementation is the avatar chat demo. 'bot_mood' features are used to control the expression of the avatar in the front end. Why not test this out by telling the bot you love it.
<feature name="client_mood"><star/></feature>
<aiml version="2.0">
<category>
<pattern>I AM FEELING SO *</pattern>
<template>Why do you feel <star />?<feature name="client_mood"><star/></feature></template>
</category>
</aiml>
{
"data": {
"conversation": {
"input": "I feel so happy",
"output": "Why do you feel so happy?",
"id": "b5ee10dc-4a15-4c60-951b-9962d3d387a2",
"topic": ""
},
"features": {
"client_mood": "happy"
}
},
The first tag returns the first word found in its wildcards contents
<first><star/></first>
<aiml version="2.0">
<category>
<pattern>TELL ME THE FIRST ITEM IN THIS LIST *</pattern>
<template><first><star/></first></template>
</category>
</aiml>
{
"conversation":
{
"user":"Tell me the first item in this list a b c",
"bot":"a"
}
}
The formal tag is used to capitalise each word in a sentence.
<formal>this is the title of my paper</formal>
<aiml version="2.0">
<category>
<pattern>FORMALIZE THE TITLE OF MY BOOK</pattern>
<template><formal><star/></formal></template>
</category>
</aiml>
{
"conversation":
{
"user":"formalize the title of my book",
"bot":"The Title Of My Book"
}
}
The gender tag is used to look up third person gender transformations from the word_transformations table.
They took <gender><star/></gender> dinner
<aiml version="2.0">
<category>
<pattern>DID THEY TAKE HER DINNER</pattern>
<template>No, they took <gender><star/></gender> dinner!</template>
</category>
</aiml>
{
"conversation":
{
"user":"Did they take her dinner?",
"bot":"No, they took his dinner!"
}
}
This tag is used to return the value of a predicate.
The following examples will return the value of a global variable named "dinner"
<get name="dinner" />
If any of the attributes below are missing the tag might not behave as expected.
# | Name | Type | Description |
---|---|---|---|
1 | name | string | Looks in the global 'name' variables for a matching variable with the same name and returns it value. |
2 | var | string | Looks in the local 'var' variables for a matching variable with the same name and returns it value. |
<aiml version="2.0">
<category>
<pattern>WHAT IS ARE YOU EATING FOR DINNER</pattern>
<template>
<think><set name="dinner">noodles</set></think>
I am having <get name="dinner" /> for dinner.
</template>
</category>
</aiml>
{
"conversation":{
"user":"What are you having for dinner?",
"bot":"I am having noodles for dinner"
}
}
The gossip tag is used store tidbits of gossip from the client.
<learn><gossip><star/></gossip></learn>
<aiml version="2.0">
<category>
<pattern>DID YOU HEAR THAT *</pattern>
<template>Interesting gossip!<learn><gossip><star/></gossip></learn></template>
</category>
</aiml>
{
"conversation":[
{
"user":"Did they hear that Harry met Sally?",
"bot":"Interesting gossip!"
},
{
"user":"Tell me some gossip",
"bot":"Harry met Sally"
}
]}
The id tag returns the current conversation id.
The conversation id is <id/>
<aiml version="2.0">
<category>
<pattern>WHAT IS THE CONVERSATION ID</pattern>
<template>The conversation id is <id/></template>
</category>
</aiml>
{
"conversation":
{
"user":"What is the conversation id?",
"bot":"The conversation id is bot-john-4726952"
}
}
The input tag returns the users last sentence.
Get the last sentence
You said: <input />
Get the second to last input
Before this you said: <input index="2"/>
Consider the user input: "Hello! How are you?
Hello! = <input index="1,2"/>
How are you? = <input index="1,1"/>
These attributes are optional
# | Name | Type | Description | Example |
---|---|---|---|---|
1 | index | integer | The index of the input you wish to get | index="2" |
<aiml version="2.0">
<category>
<pattern>WHAT DID I SAY</pattern>
<template>You said: '<input />'</template>
</category>
</aiml>
{
"conversation":
{
"user":"What did I say?",
"bot":"You said: 'What did I say?'"
}
}
The javascript tag returns javascript code inside a safe [script][/script] block. You will have to convert the [script][\script] tag to a <script></script> in your own front end.
<javascript>alert('hi')</javascript>
<aiml version="2.0">
<category>
<pattern>ALERT *</pattern>
<template><javascript>alert('<star />')</javascript></template>
</category>
</aiml>
{
"conversation":
{
"user":"Alert hello",
"bot":"[script]alert('hello')[/script]"
}
}
The learn tag is used to teach the bot new things during the conversation.
<learn>
<category>
<pattern>WHAT DO I LIKE</pattern>
<template>You like music.</template>
</category>
</learn>
<aiml version="2.0">
<category>
<pattern>I LIKE MUSIC</pattern>
<template>
I will remember that you like music.
<learn>
<category>
<pattern>WHAT DO I LIKE</pattern>
<template>You like music.</template>
</category>
</learn>
</template>
</category>
</aiml>
{
"conversation":[
{
"user":"I like music.",
"bot":"I will remember that you like music."
},
{
"user":"What do I like?",
"bot":"You like music."
}
]}
The li tag is used with a <condition> or <random> tag as a way of selecting an response from a list of responses.
If you want to use this tag inside a <condition> then please see the condition tag for details.
If you want to use this tag inside a <random> then please see the random tag for details.
The loop tag is used to iterate over a set of list item elements that are contained in a condition block.
The loop tags sits before the closing <li/> to indicate that the if the condition of the li is not met then a loop should occur and if the condition is met the loop should break
<li value='2'><think><set var='count_down'>1</set></think>2 <loop/></li>
<aiml version="2.0">
<category>
<pattern>COUNT DOWN FROM <set>testnumber</set></pattern>
<template>
<think><set var='count_down'><star/></set></think>
<condition var='count_down'>
<li value='5'><think><set var='count_down'>4</set></think>5 <loop/></li>
<li value='4'><think><set var='count_down'>3</set></think>4 <loop/></li>
<li value='3'><think><set var='count_down'>2</set></think>3 <loop/></li>
<li value='2'><think><set var='count_down'>1</set></think>2 <loop/></li>
<li value='1'><think><set var='count_down'>0</set></think>1 </li>
<li></li>
</condition>
</template>
</category>
</aiml>
{
"conversation":
{
"user":"Count down from 3",
"bot":"3 2 1"
}
}
The lowercase tag is used to convert the output to lowercase.
<lowercase>THIS WILL BE LOWERCASE</lowercase>
<aiml version="2.0">
<category>
<pattern>LOWERCASE *</pattern>
<template><lowercase><star/></lowercase></template>
</category>
</aiml>
{
"conversation":
{
"user":"lowercase THIS INPUT",
"bot":"this input"
}
}
The map tag is used to link a value to its map value. Map values are stored in the table map_values and are grouped by maps in the maps table.
The following example will look up the mapped value of 'France' which belongs to the map called 'capital'.
<map name="capital">France</map> is the capital of France
<aiml version="2.0">
<category>
<pattern>WHAT IS THE CAPITAL OF *</pattern>
<template>
<map name="capital"><star /></map> is the capital of <star />
</template>
</category>
</aiml>
{
"conversation":
{
"user":"What is the capital of France?",
"bot":"Paris is the capital of France."
}
}
Maintained for backward compatibility - Do use this format if you can avoid it.
Expanded format
<set><name>dinner</name>noodles</set>
Equivalent preferred format
<set name="dinner">noodles</set>
Outputs the normalized value
The following examples will attempt to normalize the value 'google.com'.
<normalize>google dot com</normalize>
<aiml version="2.0">
<category>
<pattern>NORMALIZE *</pattern>
<template><normalize><star/></normalize></template>
</category>
</aiml>
{
"conversation":{
"user":"Normalize google.com",
"bot":"google dot com"
}
}
The person tag is used to transform a pronoun between the first and second person. These transformations are stored in the word_transformations table.
You are <person><star/></person>
<aiml version="2.0">
<category>
<pattern>I AM *</pattern>
<template>You are <person><star/></person></template>
</category>
</aiml>
{
"conversation":
{
"user":"I am talking to you",
"bot":"You are talking to me"
}
}
The person2 tag is used to transform a pronoun between the first and third person. These transformations are stored in the word_transformations table.
They are <person2><star/></person2>
<aiml version="2.0">
<category>
<pattern>GIVE IT *</pattern>
<template>I GAVE IT <person><star/></person></template>
</category>
</aiml>
{
"conversation":
{
"user":"Give it to me",
"bot":"I gave it to them"
}
}
The program tag is an alias for the the version tag. Please see the version tag for details.
The random tag is used with <li> tags to provide a list of potential bot responses, one of which will be returned randomly.
The following example will randomly pick 'yes' or 'no'.
<random><li>yes</li><li>no</li></random>
<aiml version="2.0">
<category>
<pattern>WHAT ARE YOU EATING FOR DINNER</pattern>
<template>
<random>
<li>Spaghetti.</li>
<li>Noodles.</li>
<li>Curry.</li>
<li>Chips.</li>
</random>
</template>
</category>
</aiml>
{
"conversation":
{
"user":"What are you eating for dinner?",
"bot":"Curry."
}
}
Can be used with or without attributes to set a bot ratings or to get bot ratings metrics.
Only numerical responses are counted towards the rating and the min/max are set to 0 and 5.
These attributes are optional and are used when you want to retrieve certain metrics.
# | Name attribute value | Description | Example |
---|---|---|---|
1 | average | The average rating of the bot | <rate name="average" /> |
2 | count | The number of ratings given | <rate name="count"/> |
3 | min | The minimum rating given | <rate name="min"/> |
4 | max | The maximum rating given | <rate name="max"/> |
Rate the bot
You have rated me <rate><star /></rate> out of 5
Get the bot rating
I am rated <rate name="average"/> out of 5
<aiml version="2.0">
<category>
<pattern>I RATE YOU * STARS</pattern>
<template>
You have rated me <rate><star /></rate> out of 5
</template>
</category>
</aiml>
<category>
<pattern>TELL ME YOUR RATING STATS</pattern>
<template>
I am have been rated <rate name="average" /> out of 5 by <rate name="count" /> people.
My highest rating is <rate name="max" /> and my lowest is <rate name="min" />.
</template>
</category>
</aiml>
{
"conversation": [
{
"user":"I rate you 5 stars",
"bot":"You have rated me 5 out of 5."
},
{
"user":"Tell me your rating stats",
"bot":"I am have been rated 4.3 out of 5 by 67 people. My highest rating is 5 and my lowest is 0."
}
]}
The request tag returns the client's last full request.
Get the client’s last input request, consisting of one or more input sentences.
You said: <request/>
which is equivalent to: <request index="1"/>
Get the client’s 2nd to last input request, consisting of one or more input sentences.
Before that you said: <request index="2"/>
The response tag returns the bot's last response.
Get the last response
I said: <response />
which is equivalent to: <response index="1"/>
Get the second to last response
Before I you said: <response index="2"/>
These attributes are optional
# | Name | Type | Description | Example |
---|---|---|---|---|
1 | index | integer | The index of the input you wish to get | index="2" |
<aiml version="2.0">
<category>
<pattern>WHAT DID YOU SAY</pattern>
<template>I said: '<request index="1"/>'</template>
</category>
</aiml>
{
"conversation":[
{
"user":"Hello",
"bot":"Hi"
},
{
"user":"What did you say?",
"bot":"I said: 'Hi'"
}
]}
The rest tag returns all the words after the first word in its contents and applies to wildcards in patterns only.
<rest><star/></rest>
<aiml version="2.0">
<category>
<pattern>TELL ME THE REST OF ITEM IN THIS LIST *</pattern>
<template><rest><star/></rest></template>
</category>
</aiml>
{
"conversation":
{
"user":"Tell me the rest of item in this list a b c",
"bot":"b c"
}
}
The sentence tag is used to capitalise the first word in a sentence.
<sentence>this is a sentence</sentence>
<aiml version="2.0">
<category>
<pattern>CONVERT *</pattern>
<template><sentence><star/></sentence></template>
</category>
</aiml>
{
"conversation":
{
"user":"convert my nicely formatted sentence.",
"bot":"My nicely formatted sentence."
}
}
This tag is used to set the value of a predicate.
The following examples will set the value of a global variable named "dinner" to 'noodles.
<set name="dinner">noodles<set/>
If any of the attributes below are missing the tag might not behave as expected.
# | Name | Type | Description |
---|---|---|---|
1 | name | string | Looks in the global 'name' variables for a matching variable with the same name and returns it value. |
2 | var | string | Looks in the local 'var' variables for a matching variable with the same name and returns it value. |
<aiml version="2.0">
<category>
<pattern>I AM EATING * FOR MY DINNER</pattern>
<template>
<think><set name="dinner"><star/></set></think>
You are having <get name="dinner" /> for dinner.
</template>
</category>
</aiml>
{
"conversation":{
"user":"I am having noodles for dinner",
"bot":"You are having noodles for dinner"
}
}
The size tag returns the number of categories the bot has access to.
My brain is <size/> categories big
<aiml version="2.0">
<category>
<pattern>HOW CLEVER ARE YOU</pattern>
<template>My brain is <size/> categories big.</template>
</category>
</aiml>
{
"conversation":
{
"user":"How clever are you?",
"bot":"My brain is 100 categories big"
}
}
The sr tag is an alias for for <srai><star /></srai>. Please see the srai tag for details.
The srai tag will research the database for a matching category.
This tag will research the database for a category which matches 'HI'.
<srai>HI</srai>
<aiml version="2.0">
<category>
<pattern>YO *</pattern>
<template><srai>HI</srai></template>
</category>
</aiml>
{
"conversation":
{
"user":"Yo",
"bot":"Hello!"
}
}
This tag is not supported. You can easily link any category to any bot from within the admin area.
The star tag is used to output portions of the user's input that were captured by wildcards.
Your favorite <star /> is <star index="2" />
<aiml version="2.0">
<category>
<pattern>MY FAVORITE * IS *</pattern>
<template>Your favorite <star /> is <star index="2" />
</category>
</aiml>
{
"conversation":
{
"user":"My favorite dinner is noodles",
"bot":"Your favorite dinner is noodles"
}
}
The that tag is used provide context to a category before it can be matched. The category can only be used if the value of <that> matches the denormalized bot response.
<aiml version="2.0">
<category>
<pattern>YES</pattern>
<that>DO YOU WANT TO EAT DINNER</that>
<template>I do too.</template>
</category>
</aiml>
{
"conversation":[
{
"user":"I am hungry",
"bot":"Do you want to eat dinner?"
},
{
"user":"Yes",
"bot":"I do too."
}
]}
The thatstar tag is used to echo portions of the bot's response that were captured by wildcards.
<aiml version="2.0">
<category>
<pattern>I LIKE IT TOO</pattern>
<that>I LIKE *</that>
<template>What is your favorite flavour of <thatstar /></template>
</category>
</aiml>
{
"conversation":[
{
"user":"I like cheese",
"bot":"I like pizza"
}, {
"user":"I like it too!",
"bot":"What is your favorite flavour of pizza?"
}
]}
The think tag allows to silently perform tag functions without outputting anything.
This example sets a global variable called 'dinner' to 'noodles' - nothing is output in the response
<think> <set name="dinner">noodles </set> </think>
<aiml version="2.0">
<category>
<pattern>MY DINNER IS *</pattern>
<template>
<think><set name="dinner"><star /></set></think>
I will remember your dinner
</template>
</category>
</aiml>
{
"conversation":
{
"user":"My dinner is noodles",
"bot":"I will remember your dinner"
}}
If a category is wrapped in a topic the category can only be matched if topic is matched.
<aiml version="2.0">
<category>
<pattern>LETS CHANGE THE TOPIC TO *</pattern>
<template>
Sure, we can talk about <set name="topic"><star /></set>
</template>
</category>
<topic name="noodles">
<category>
<pattern>I LIKE THEM SPICY</pattern>
<template>I like mine in soup</template>
</category>
</topic>
</aiml>
{
"conversation":[
{
"user":"Lets change the topic to noodles",
"bot":"Sure, we can talk about noodles"
},
{
"user":"I like them spicy",
"bot":"I like them in soup"
}
]}
The topicstar has two uses;
These attributes are optional
# | Name | Type | Description | Example |
---|---|---|---|---|
1 | index | integer | The index of the topic star you wish to get | index="2" |
<aiml version="2.0">
<category>
<pattern>I WOULD LIKE SOME NOODLES</pattern>
<template>
Ok.<think><set name=”topic”>eat noodles</set></think>
</template>
</category>
<topic name="eat *">
<category>
<pattern>WHAT DO I WANT</pattern>
<template><topicstar/></template>
</category>
</topic>
</aiml>
{
"conversation":[
{
"user":"I would like some noodles",
"bot":"Ok."
}, {
"user":"What do I want?",
"bot":"noodles"
}
]}
The uppercase tag is used to convert the output to uppercase.
<uppercase>this will be uppercase</uppercase>
<aiml version="2.0">
<category>
<pattern>UPPERCASE *</pattern>
<template><uppercase><star/></uppercase></template>
</category>
</aiml>
{
"conversation":
{
"user":"uppercase this input",
"bot":"THIS INPUT"
}
}
Maintained for backward compatibility - Do use this format if you can avoid it.
Expanded format
<li><value>noodles</value>yum yum</li>
Equivalent preferred format
<li value="noodles">yum yum</li>
Maintained for backward compatibility - Do use this format if you can avoid it.
Expanded format
<set><var>dinner</var>noodles</set>
Equivalent preferred format
<set var="dinner">noodles</set>
The version tag returns the current app version.
The app version is <version/>
<aiml version="2.0">
<category>
<pattern>WHAT IS THE VERSION OF THIS APP</pattern>
<template>The version is <version/></template>
</category>
</aiml>
{
"conversation":
{
"user":"What is the version of this app?",
"bot":"The version is v1.2.0"
}
}
If you need help with customisation or a bespoke feature - then get in touch with us over that theramenrobotdiscocode.com and let's see how we can help.
Get In Touch