📜 ⬆️ ⬇️

Learning AIML

AIML (Artificial Intelligence Markup Language) is a markup language for artificial intelligence. AIML is a subset (dialect) of XML, it is intended to create virtual interlocutors.
This is one of the very first languages ​​used to create bots, he also thinks the easiest.

So the AIML file contains a set of categories. A category is opened with a <category> tag and closed with a </category> tag. Like HTML, each opening tag must have a closing tag. Otherwise, the AIML structure will be broken and the bot will not be able to speak. The category (category) includes patterns (pattern) and templates (template). Both the word pattern and the word template are translated into Russian in the same way - as a sample or pattern. Therefore, in order not to be confused, we will call them so: patterns and templates.
The pattern is written in capital letters. To define an arbitrary word or group of words, use the sign *
Examples of patterns:
<pattern> HELLO </ pattern>
<pattern> HELLO * </ pattern>
<pattern> * HELLO * </ pattern>
<pattern>> HELLO </ pattern
</ code>
Pattern 1 is only suitable for an incoming replica containing a single word "Hello" - and for no other.
Pattern 2 is only suitable for an incoming replica that begins with the word "Hello" and contains some more words after the word "Hello", for example, "Hello Bot!".
Pattern 3 is only suitable for an incoming replica, starting with 1 or more words, followed by the word "Hello" and containing some more words after the word "Hello", for example, "Hey you hi handsome!".
Pattern 4 is only suitable for an incoming replica, starting with 1 or more words, followed by the word "Hello", for example, "Bot, hello!".

A template can include one replica, for example:

<template> Good day! </ template>
')
Or a few replicas. In this case, you must use the additional tag <random>. Example:

<template>
<random>
<li> Good afternoon! </ li>
<li> Hello </ li>
<li> Hello ... </ li>
</ random>
</ template>

In this case, one of the replicas between the <li> </ li> tags will be arbitrarily selected as the response replica.
Random can be combined with a regular replica. For example:
<template>
<random>
<li> Good afternoon! </ li>
<li> Hello </ li>
<li> Hello ... </ li>
</ random>
How are you?
</ template>

In this case, the bot will respond "Good afternoon! How are you? ”Or“ Hello, How are you? ”Or“ Hello ... How are you? ”
So, let's make a stupid bot that will respond to any proposal: "hello":
<category>
<pattern> * </ pattern>
<template> hello </ template>
</ category>
Using these simple tags, well, a couple more complicated ones (which I will discuss in the next lesson, if the same post gets good grades :)), you can create a bot like ALICE, which was the winner of the turing test.
Thank you all, a new lesson will be released soon, but if this one is interesting to you ... I’ll tell you more about the AIML history, Turing test
PS there is still no space in front of the template, there are no spaces in front of other tags either, just the Habr encoding does not allow me (as a newbie) to do everything right, just before the template two t merge and complete nonsense comes out. .komu need AIML in the correct form - write in inbox, with joy I will send txt

Source: https://habr.com/ru/post/69630/


All Articles