Обновление Diamond и мы построим вам свой собственный приложение для Android или iOS
Документы : Руководство Пользователя : AIML

АИМЛ

Обзор

Aiml-это искусственный интеллект, Язык разметки. Это XML-стандарт для определения чате ответы бота. Бот Либре боты АИМЛ поддержку, но основанные на самостоятельной и иметь базу знаний, похожими на человеческий мозг.

О АИМЛ

АИМЛ определяет как бот должен отвечать на вопрос, используя <шаблон> и <шаблон> элементы. Шаблон представляет вопрос пользователя, и шаблон определяет ответ бота. Структура и элементы шаблона сгруппированы в элементе категории, которые могут быть сгруппированы по элементам тему.

Список шаблонов АИМЛ теги

Tags Description
<star index="N"/> Replaced with value of * in pattern (or Nth *).
<that index="M,N"/> Replaced with value of bot's previous response (or Mth previous response, and N sentence of the response).
<input index="N"/> Replaced with value of users's input (or Nth *).
<thatstar index="N"/> Replaced with value of * in "that" (or Nth *).
<topicstar index="N"/> Replaced with value of * in topic (or Nth *).
<get name="XXX"/> Replaced by the value of the conversation specific variable.
<bot name="XXX"/> Replaced by the value of the bot specific variable.
<sr/> Short form for <srai><star/><srai> (replaced with response to value of * from pattern).
<person2/> Converts the text (or <star/>) between 1st and 2nd person (I <-> he, etc.).
<person/> Converts the text (or <star/>) between 1st and 3rd person (I <-> you, etc.).
<gender/> Converts the text (or <star/>) between male and female (he <-> she).
<date/> Replaced with the current date and time, a "format" attribute is also supported.
<id/> Replaced by the client id.
<size/> Replaced with the size of bot's memory.
<version/> Replaced with the AI engine version.
<uppercase> Converts the text to uppercase.
<lowercase> Converts the text to lowercase.
<formal> Converts all words in the text to be capitalized.
<sentence> Converts the first word in the text to be capitalized.
<condition name="X" value="Y"> Defines an "if" condition based on comparing the value of a variable to a pattern.
<condition name="X"> Case statement.
<condition> Multi-valued if/else statement.
<random> Choose on of the nested <li> values at random.
<li name="X" value="Y"> Used in random and condition tags.
<li value="Y"> Used in random and condition tags.
<li> Used in random and condition tags.
<set name="XXX"> Set the value of a variable.
<gossip> Logs the text.
<srai> Recursively evaluates the text and replaces it with the response.
<think> Evaluates the nested statements but does not output any result.
<learn> Load external AIML file, this is not currently allowed.
<system> Executes a OS command, this is not currently allowed.
<javascript> Executes JavaScript code.
<topic> Category topic tags can now be set on a category to make it easier to add categories to topics.
<map> Maps tag to allow the lookup of the element value in a predefined mapping, returning the mapped value.
<loop> Condition loops tag to loop a conditional statement.
<var> Local variables attribute for variables scoped to a category.
<sraix> Remote requests tag to make a remote request of another bot instance, or service.
<normalize> and <denormalize> Normalization and denormalization tags to convert special character into words, and back again.
<request> Request tag to return the user's previous input request.
<response> Response tag to return the bot's previous response.
<learn>, <learnf>, and <eval> Learning tags to dynamically train a bot with new responses.
<explode> Explode tag to split a word into its characters.
<oob> Mobile (out of band) tag to support client and mobile device commands.
(<b>, <a>, <i>, <ul>, <ol>, <li>, <p>, <br>, <button>, <img>, <video>) Various HTML tags are also allowed.
<self> Evaluate Self code (Bot Libre extension).

Список АИМЛ операторов рисунком

Tags Description
* Matches one or more words.
_ Matches one or more words, takes priority over all other words and wildcards, except $.
^ Matches zero or more words.
# Matches zero or more words, takes priority over all other words and wildcards, except $.
$ Pattern priority marker to make a pattern word match highest priority.
() Optional set of words (Bot Libre extension).
[] Required set of words (Bot Libre extension).
<set> Set tag to evaluate a pattern based on words defined in a predefined set.
/ Regular expression pattern (Bot Libre extension).
{} Self code (Bot Libre extension).

Примеры

Вот простой пример Привет мир' АИМЛ:
Этот код сделает ваш бот в ответ 'Здравствуй' на вопрос 'Привет мир'.

1
2
<aiml>
    <category>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Вот простой пример подстановки:
Этот код сделает ваш бот в ответ 'Здравствуй' на любой вопрос, содержащий слово "привет".

1
2
<aiml>
    <category>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Вот это шутка, вот пример:
Этот код сделает ваш бот рассказать анекдот.

1
2
<aiml>
    <category>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Вот сложный пример шаблона:
Этот код сделает ваш бот отвечает на вопрос 'ты любишь яблоки или ты любишь апельсины" с "Я люблю яблоки и я люблю апельсины'.

1
2
<aiml>
    <category>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


^ и # маски

1
2
<category>
    <pattern>^ aiml ^</pattern>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


$ Приоритет

1
2
<category>
    <pattern># sex #</pattern>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


() и [] списки

1
2
<category>
    <pattern>do [you u] (really) [like love luv lv] me</pattern>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Регулярные выражения

1
2
<category>
    <pattern>my email is /.+\@.+\..+</pattern>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Наборы

1
2
<category>
    <pattern>I am <set>name</set></pattern>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Шаблон АИМЛ установить Тип объекта познания:

1
2
<category>
    <pattern>load animals</pattern>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Шаблон теги

1
2
<category>
    <pattern><bot name="name"/></pattern>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Атрибуты как элементы

1
2
<category>
    <pattern>My * is *</pattern>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Карты

1
2
<category>
    <pattern>what is the capital of <set>country</set></pattern>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Бот Либре расширяет карту обслуживания также позволяет устанавливать карту значение. Это позволит установить значение отношения объекта познания.

1
2
<category>
    <pattern>the opposite of * is *</pattern>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Условия и циклы

1
2
<category>
    <pattern>count down from <set>number</set></pattern>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Обучение

1
2
<category>
    <pattern>learn question * answer *</pattern>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Sraix

1
2
<category>
    <pattern>ask * about *</pattern>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Собственн

1
2
<category>
    <pattern>what is * + *</pattern>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


См. Также