Skip to content

Tutorial Langauge Grammar Manipulation

Keith Sterling edited this page Nov 10, 2017 · 7 revisions

AIML comes with a number of grammar text manipulation tags. These tags are used to convert the input or output stream based on some basic grammar rules

  • normalize - Converts input stream into text elements that are more easily parsable by the Bot
  • denormalize - Essentially the reverse of normalize in that it converts text into more human readable elements
  • person - Transform pronouns between first and third person
  • person2 - Transforms pronouns between first and second person
  • gender - Converts the gender of the enclosed text

Each of these conversion tags uses a file of substitutions that it uses to match input text and to convert to using output text. The locations of these files are held in the brain configuration section under files.

Normalize

Normalize uses the file referenced in normal element of the files section of brain as defined below

brain:
    files:
        normal: $BOT_ROOT/config/normal.txt
<category>
    <pattern>HELLO *</pattern>
    <template>
        <normalize><star /></normalize>
    </template>
</category>
Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot version 0.0.1, initiated March 14, 2017
Hi, how can I help you today?
>>> XXX
YYY

Denormalize

Denormalize uses the file referenced in denormal element of the files section of brain as defined below

brain:
    files:
        denormal: $BOT_ROOT/config/denormal.txt
<category>
    <pattern>HELLO *</pattern>
    <template>
        <denormalize><star /></denormalize>
    </template>
</category>
Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot version 0.0.1, initiated March 14, 2017
Hi, how can I help you today?
>>> XXX
YYY

Person

Person uses the file referenced in person element of the files section of brain as defined below

brain:
    files:
        person: $BOT_ROOT/config/person.txt
<category>
    <pattern>HELLO *</pattern>
    <template>
        <person><star /></person>
    </template>
</category>
Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot version 0.0.1, initiated March 14, 2017
Hi, how can I help you today?
>>> XXX
YYY

Person2

Person2 uses the file referenced in person2 element of the files section of brain as defined below

brain:
    files:
        person2: $BOT_ROOT/config/person2.txt
<category>
    <pattern>HELLO *</pattern>
    <template>
        <person2><star /></person2>
    </template>
</category>
Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot version 0.0.1, initiated March 14, 2017
Hi, how can I help you today?
>>> XXX
YYY

Gender

Gender uses the file referenced in gender element of the files section of brain as defined below

brain:
    files:
        gender: $BOT_ROOT/config/gender.txt
<category>
    <pattern>HELLO *</pattern>
    <template>
        <gender><star /></gender>
    </template>
</category>
Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot version 0.0.1, initiated March 14, 2017
Hi, how can I help you today?
>>> XXX
YYY

Back to Tutorial | Back - Text Translation | Next - List Processing

Clone this wiki locally