Last active
August 29, 2015 14:22
-
-
Save manojrammurthy/9b6dfc641f2d51cf648b to your computer and use it in GitHub Desktop.
AIML Description is done here
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AIML stands for Artificial Intelligence Modelling Language. AIML is XML based markup language meant to create artificial intelligent application to create human interface while keeping the implementation simple to program, easy to understand and highly maintainable. | |
| AIML was developed by the Alicebot free software community and Dr. Richard S. Wallace during 1995-2000. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setting the condition | |
| like setting the state of the bot to be happy or sad etc | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <aiml version="1.0.1" encoding="UTF-8"?> | |
| <category> | |
| <pattern> HOW ARE YOU FEELING TODAY </pattern> | |
| <template> | |
| <think><set name="state"> happy</set></think> | |
| <condition name="state" value="happy"> | |
| I am happy! | |
| </condition> | |
| <condition name="state" value="sad"> | |
| I am sad! | |
| </condition> | |
| </template> | |
| </category> | |
| </aiml> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| as the name suggests random tag is used to get random responses for the same input | |
| usually random tags are associated with li tags | |
| li tags will be having different patterns | |
| <random> | |
| <li>pattern1</li> | |
| <li>pattern2</li> | |
| <li>pattern3</li> | |
| . | |
| . | |
| .<li>patternN</li> | |
| </random> | |
| example: | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <aiml version="1.0.1" encoding="UTF-8"?> | |
| <category> | |
| <pattern>HI</pattern> | |
| <template> | |
| <random> | |
| <li> Hello! </li> | |
| <li> Hi! Nice to meet you! </li> | |
| </random> | |
| </template> | |
| </aiml> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| It helps to reduce defining multiple categories. | |
| example= bye | |
| bot = goodbye | |
| example = bye manoj | |
| bot goodbye | |
| here bot is supposed to say goodbye when it encounters bye at the starting of the message . | |
| 1) general category | |
| <category> | |
| <pattern>BYE</pattern> | |
| <template>Good Bye!</template> | |
| </category> | |
| 2)generating generic category using srai | |
| <category> | |
| <pattern>BYE *</pattern> | |
| <template> | |
| <srai>BYE</srai> | |
| </template> | |
| </category> | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <aiml version="1.0.1" encoding="UTF-8"?> | |
| <category> | |
| <pattern> WHO IS ALBERT EINSTEIN </pattern> | |
| <template>Albert Einstein was a german physicist.</template> | |
| </category> | |
| <category> | |
| <pattern> WHO IS ISSAC NEWTON </pattern> | |
| <template>Issac Newton was a english physicist and mathematician.</template> | |
| </category> | |
| <category> | |
| <pattern>DO YOU KNOW WHO * IS</pattern> | |
| <template> | |
| <srai>WHO IS <star/></srai> | |
| </template> | |
| </category> | |
| <category> | |
| <pattern>BYE</pattern> | |
| <template>Good Bye!</template> | |
| </category> | |
| <category> | |
| <pattern>BYE *</pattern> | |
| <template> | |
| <srai>BYE</srai> | |
| </template> | |
| </category> | |
| </aiml> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| no matter where the word is in a pattern bot should output a specific template | |
| example: | |
| Human: I love going to school daily. | |
| Robot: School is an important institution in a child's life. | |
| Human: I like my school. | |
| Robot: School is an important institution in a child's life. | |
| step1: create category | |
| <category> | |
| <pattern>SCHOOL</pattern> | |
| <template>School is an important institution in a child's life.</template> | |
| </category> | |
| step2: create generic category | |
| <category> | |
| <pattern>_ SCHOOL</pattern> | |
| <template> | |
| <srai>SCHOOL</srai> | |
| </template> | |
| </category> | |
| <category> | |
| <pattern>_ SCHOOL</pattern> | |
| <template> | |
| <srai>SCHOOL</srai> | |
| </template> | |
| </category> | |
| <category> | |
| <pattern>SCHOOL *</pattern> | |
| <template> | |
| <srai>SCHOOL</srai> | |
| </template> | |
| </category> | |
| <category> | |
| <pattern>_ SCHOOL *</pattern> | |
| <template> | |
| <srai>SCHOOL</srai> | |
| </template> | |
| </category> | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <aiml version="1.0.1" encoding="UTF-8"?> | |
| <category> | |
| <pattern> WHO IS ALBERT EINSTEIN </pattern> | |
| <template>Albert Einstein was a german physicist.</template> | |
| </category> | |
| <category> | |
| <pattern> WHO IS ISSAC NEWTON </pattern> | |
| <template>Issac Newton was a english physicist and mathematician.</template> | |
| </category> | |
| <category> | |
| <pattern>DO YOU KNOW WHO * IS</pattern> | |
| <template> | |
| <srai>WHO IS <star/></srai> | |
| </template> | |
| </category> | |
| <category> | |
| <pattern>BYE</pattern> | |
| <template>Good Bye!</template> | |
| </category> | |
| <category> | |
| <pattern>BYE *</pattern> | |
| <template> | |
| <srai>BYE</srai> | |
| </template> | |
| </category> | |
| <category> | |
| <pattern>FACTORY</pattern> | |
| <template>Development Center!</template> | |
| </category> | |
| <category> | |
| <pattern>INDUSTRY</pattern> | |
| <template> | |
| <srai>FACTORY</srai> | |
| </template> | |
| </category> | |
| <category> | |
| <pattern>SCHOOL</pattern> | |
| <template>School is an important institution in a child's life.</template> | |
| </category> | |
| <category> | |
| <pattern>_ SCHOOL</pattern> | |
| <template> | |
| <srai>SCHOOL</srai> | |
| </template> | |
| </category> | |
| <category> | |
| <pattern>_ SCHOOL</pattern> | |
| <template> | |
| <srai>SCHOOL</srai> | |
| </template> | |
| </category> | |
| <category> | |
| <pattern>SCHOOL *</pattern> | |
| <template> | |
| <srai>SCHOOL</srai> | |
| </template> | |
| </category> | |
| <category> | |
| <pattern>_ SCHOOL *</pattern> | |
| <template> | |
| <srai>SCHOOL</srai> | |
| </template> | |
| </category> | |
| </aiml> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| a bot should reply in same manner for similiar words. | |
| example: Industry | |
| bot: development center | |
| example: factory | |
| bot: development center | |
| step1: create category | |
| <category> | |
| <pattern>FACTORY</pattern> | |
| <template>Development Center!</template> | |
| </category> | |
| step2: create generic category | |
| <category> | |
| <pattern>INDUSTRY</pattern> | |
| <template> | |
| <srai>FACTORY</srai> | |
| </template> | |
| </category> | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <aiml version="1.0.1" encoding="UTF-8"?> | |
| <category> | |
| <pattern> WHO IS ALBERT EINSTEIN </pattern> | |
| <template>Albert Einstein was a german physicist.</template> | |
| </category> | |
| <category> | |
| <pattern> WHO IS ISSAC NEWTON </pattern> | |
| <template>Issac Newton was a english physicist and mathematician.</template> | |
| </category> | |
| <category> | |
| <pattern>DO YOU KNOW WHO * IS</pattern> | |
| <template> | |
| <srai>WHO IS <star/></srai> | |
| </template> | |
| </category> | |
| <category> | |
| <pattern>BYE</pattern> | |
| <template>Good Bye!</template> | |
| </category> | |
| <category> | |
| <pattern>BYE *</pattern> | |
| <template> | |
| <srai>BYE</srai> | |
| </template> | |
| </category> | |
| <category> | |
| <pattern>FACTORY</pattern> | |
| <template>Development Center!</template> | |
| </category> | |
| <category> | |
| <pattern>INDUSTRY</pattern> | |
| <template> | |
| <srai>FACTORY</srai> | |
| </template> | |
| </category> | |
| </aiml> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <category> | |
| <pattern> A * is a *. </pattern> | |
| <template> | |
| When a <star index="1"/> is not a <star index="2"/>? | |
| </template> | |
| </category> | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <aiml version="1.0.1" encoding="UTF-8"?> | |
| <category> | |
| <pattern>I LIKE *</pattern> | |
| <template> | |
| I too like <star/>. ((<star index="1"/> is often used as <star />)) | |
| </template> | |
| </category> | |
| <category> | |
| <pattern>A * IS A *</pattern> | |
| <template> | |
| How <star index="1"/> can not be a <star index="2"/>? | |
| </template> | |
| </category> | |
| </aiml> | |
| example = i like mango | |
| bot = i too like mango | |
| example = mango is a fruit | |
| bot = how mango can not be a fruit | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| that tag is used to respond based on the context | |
| <?xml version="1.0" encoding="UTF-8"> | |
| <aiml version="1.0.1" encoding="UTF-8"> | |
| <category> | |
| <pattern>what about the movies</pattern> | |
| <template>do you like comedy movies</template> | |
| </category> | |
| <category> | |
| <pattern>yes</pattern> | |
| <that>do you like comedy movies</that> | |
| <template>Nice, i like comedy movies too </template> | |
| </category> | |
| <category> | |
| <pattern>no</pattern> | |
| <that> do you like comedy movies</that> | |
| <template> ok, but i like comedy movies</template> | |
| </category> | |
| </aiml> | |
| so based on the above aiml responses would be | |
| Human: What about movies? | |
| Robot: Do you like comedy movies? | |
| Human: No | |
| Robot: Ok! But I like comedy movies. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <think> <set name="variable-name"> variable-value </set></think> | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <aiml version="1.0.1" encoding="UTF-8"?> | |
| <category> | |
| <pattern>My name is *</pattern> | |
| <template> | |
| Hello!<think><set name="username"> <star/></set></think> | |
| </template> | |
| </category> | |
| <category> | |
| <pattern>Byeee</pattern> | |
| <template> | |
| Hi <get name="username"/> Thanks for the conversation! | |
| </template> | |
| </category> | |
| </aiml> | |
| example output : | |
| Human: My name is Mahesh | |
| Robot: Hello! | |
| Human: Byeee | |
| Robot: Hi Mahesh Thanks for the conversation! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| in aiml topic tag is used to store context for future conversation | |
| example : | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <aiml version="1.0.1" encoding="UTF-8"?> | |
| <category> | |
| <pattern>LET DISCUSS MOVIES</pattern> | |
| <template>Yes <set name="topic">movies</set></template> | |
| </category> | |
| <topic name="movies"> | |
| <category> | |
| <pattern> * </pattern> | |
| <template>Watching good movie refreshes our minds.</template> | |
| </category> | |
| <category> | |
| <pattern> I LIKE WATCHING COMEDY! </pattern> | |
| <template>I like comedy movies too.</template> | |
| </category> | |
| </topic> | |
| </aiml> | |
| Human: let discuss movies | |
| Robot: Yes movies | |
| Human: Comedy movies are nice to watch | |
| Robot: Watching good movie refreshes our minds. | |
| Human: I like watching comedy | |
| Robot: I too like watching comedy. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good job, Manoj!