-
Notifications
You must be signed in to change notification settings - Fork 135
Tutorial Properties
Properties provide a way to preload the bot with a set of name-value pairs, that you can then refer to during AIML execution. These 'bot' properties are stored in a configuration file as defined below
brain:
files:
properties: $BOT_ROOT/config/properties.txt
The bot loads these properties are starting up. Each property is a name-value pair separated by a colon ':' as below. The bot treats the first colon as a separator and any other colons as part of the value element, so your value can contain URLS for example.
name:Y-Bot
firstname:Y
middlename:AIML
lastname:BoT
fullname:Y-Bot
nationality:Scottish
ethnicity:Electronic
gender:male
species:robot
personality:helpful and fun
You can have any number of name-value pairs. However they should be unique, duplicates will result in the last value in the list overriding the preceding values.
To reference a property, you use the bot
element as follows
<?xml version="1.0" encoding="UTF-8"?>
<aiml version="2.0">
<category>
<pattern>WHAT IS YOUR NAME</pattern>
<template>My name is <bot name="name" /></template>
<category>
<category>
<pattern>ARE YOU A MAN OR A WOMAN</pattern>
<template>I am considered <bot name="gender" /> by many</template>
<category>
</aiml>
Running this through the bot, you can then the properties in action as follows
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?
>>> What is your name
My name is Y-Bot
>>> Are you a man or a woman
I am considered male by many
Email: keiffster@gmail.com | Twitter: @keiffster | Facebook: keith.sterling | LinkedIn: keithsterling | My Blog
- Home
- Background
- Guiding Principles
- Reporting an Issue
- Installation
- You And Your Bot
- Bots
- Clients
- Configuration
- AIML
- Sentence Splitting
- Natural Langauge Processing
- Normalization
- Spelling
- Sentiment Analysis
- Translation
- Security
- Hot Reload
- Logging
- Out of Band
- Multi Language
- RDF Support
- Rich Media
- Asynchronous Events
- Triggers
- External Services
- Dynamic Sets, Maps & Vars
- Extensions
- Pre & Post Processors
- Custom Nodes
- The Brain Tree
- Utilities
- Building It Yourself
- Creating Your Own Bot
- Contributing
- Performance Testing
- FAQ
- History
- Website