Skip to content

Tutorial Bot Template

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

Template

We will start by creating a basic file structure to contain our tutorial files. A template already exists in Github call Template-y. This contains the following folder structure

Download this folder from Github and either use directly, or make a copy so that you always keep Tutorial files as they were when downloaded. We then rename the folder from template-y to tutorial-y.

tutorial-y \aiml Aiml files go here \maps Map files go here \rdf RDF knowledge files go here \sets Set files go here \src Source code for extensions, services etc go here \test Test files code in \src folder go here \temp Log, brain and error files are created here by Program-y

On Linux and Max

clear
export PYTHONPATH=./src:../program-y/src:../template-y/libs/MetOffer-1.3.2:.
python3 ../program-y/src/programy/clients/console.py --config ./config.yaml --cformat yaml --logging ./logging.yaml

On Windows

@echo off
CLS
mkdir .\temp
SET PYTHONPATH=..\programy\src;..\programy\libs\MetOffer-1.3.2;.
python ..\programy\src\programy\clients\console.py --config .\config.windows.yaml --cformat yaml --logging .\logging.windows.yaml

Configuration

Next we need to modify the configuration files so that so that we remove all y-bot grammar files. The reason for this, is that the tutorial uses the template bot set up found in Template-Y, but for the tutorial the instructions are intended to help reduce the amount of information and data which is loaded.

Where an instruction states to remove something from a section, it means only remove the reference stated and leave the other others, so for examples

Remove references to ..\program-y\bots\y-bot\aiml in files section of aiml

Change this section in the config from

            files: |
                    ../program-y/bots/y-bot/aiml
                    $BOT_ROOT/aiml

to

            files: |
                    $BOT_ROOT/aiml

This will mean you start with a completely empty bot with no grammar and then the tutorial will help you build it up

On Linux and Mac

Open config.yaml

  • Remove references to ../program-y/bots/y-bot/aiml in files section of aiml
  • Remove references to ../program-y/bots/y-bot/sets in files section of sets
  • Remove references to ../program-y/bots/y-bot/maps in files section of maps
  • Remove references to ../program-y/bots/y-bot/rdf in files section of rdf
  • Rename templatey.brain to tutorial.brain in binaries section

Your starting files section of the configuration should not look like this

    files:
        aiml:
            files: |
                    $BOT_ROOT/aiml
            extension: .aiml
            directories: true
            errors: $BOT_ROOT/temp/errors.txt
            duplicates: $BOT_ROOT/temp/duplicates.txt
            conversation: $BOT_ROOT/temp/conversation.txt
        sets:
            files: |
                    $BOT_ROOT/sets
            extension: .txt
            directories: false
        maps:
            files: |
                    $BOT_ROOT/maps
            extension: .txt
            directories: false
        denormal: ../program-y/bots/y-bot/config/denormal.txt
        normal: ../program-y/bots/y-bot/config/normal.txt
        gender: ../program-y/bots/y-bot/config/gender.txt
        person: ../program-y/bots/y-bot/config/person.txt
        person2: ../program-y/bots/y-bot/config/person2.txt
        properties: ../program-y/bots/y-bot/config/properties.txt
        rdf:
            files:  |
                    $BOT_ROOT/rdf
            extension: .txt
            directories: false

On Windows

Open config.yaml

  • Remove references to ..\program-y\bots\y-bot\aiml in files section of aiml
  • Remove references to ..\program-y\bots\y-bot\sets in files section of sets
  • Remove references to ..\program-y\bots\y-bot\maps in files section of maps
  • Remove references to ..\program-y\bots\y-bot\rdf in files section of rdf
  • Rename templatey.brain to tutorial.brain in binaries section

Running the Bot

On Linux and Mac

> console.sh

On Windows

$ console.cmd

You will then see the tutorial start

Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot version 0.0.1, initiated March 14, 2017
Hey, what’s up?
>>> 

There is nothing to ask it as we have not created any AIML yes, any questions will get the default response

Try it, ask it anything, you’ll get the same response

Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot version 0.0.1, initiated March 14, 2017
Hey, what’s up?
>>> Hello
Sorry, I don’t have an answer for that.

We are now ready to start creating out AIML grammars


Back to Tutorial | Next - Getting Started

Clone this wiki locally