Skip to content

Config_Brain

Keith Sterling edited this page Aug 1, 2017 · 5 revisions

Brain Configuration

The first part of the brain configuration specifies some system settings that affect how the program operates

brain:
    supress_warnings: true
    allow_system_aiml: true
    allow_learn_aiml: true
    allow_learnf_aiml: true

    pattern_nodes: $BOT_ROOT/config/pattern_nodes.conf
    template_nodes: $BOT_ROOT/config/template_nodes.conf

    dump_to_file: /tmp/braintree.txt

The following describes each setting

supress_warnings: true

If specified as true displays AIML parse errors in the log file as the files are loaded. If false nothing is displayed

allow_system_aiml: true

Set to true if you want to allow the use of the system grammar tag. Warning, this can provide access to the underlying operating system.

allow_learn_aiml: true

If true the learn tags are evaluated and for the period of a users conversation new knowledge can be acquired

allow_learnf_aiml: true

If true the learnf tags are evaluated and new knowledge is written to aiml files. These files will then be loaded during the next execution those making the new knowedge permanent.

pattern_nodes: $BOT_ROOT/config/pattern_nodes.conf

Specifies the file that is used to load the pattern nodes. If missing the program uses its own internal version of the file. This is only useful if you are developing your own tags. See Developing Your Own Tags for more details

template_nodes: $BOT_ROOT/config/template_nodes.conf

Specifies the file that is used to load the template nodes. If missing the program uses its own internal version of the file. This is only useful if you are developing your own tags. See Developing Your Own Tags for more details.

dump_to_file: /tmp/braintree.txt

If this setting is specified then once the AIML grammars have been loaded and parsed and the internal parse tree is created, it will write out a text version of the tree to a file. Useful to debug how the tree has been constructed. This can take several seconds to create, so only use in none production environments. If missing then no file is created.

Binary File Format

The latest version of the program provides a way to speed up the loading of the brain by first allowing you to save a binary version of the brain to a file, and then load the file instead of parsing the AIML grammars each time on startup. This improves load perfomnace by 4-5 times. The settings for this are

save_binary: false
load_binary: false
binary_filename: /tmp/y-bot.brain
load_aiml_on_binary_fail: false

The following describes each setting

save_binary: false

If set to true, writes a binary version of the parse tree ( the brain ) to the file specified in the binary_filename setting.

load_binary: false

If set to true, loads a binary version of the parse tree ( the brain ) from the file specified in the binary_filename setting.

binary_filename: /tmp/y-bot.brain

Name of the file to save/load binary version of the parse tree in

load_aiml_on_binary_fail: false

Additional setting ( defaults to false if missing ), that allows the system to continue if the load of the binary file fails. Instead, the program will revert back to loading all of the AIML grammars from the .aiml files

A typical use of the settings is to first set save to true and load to false

save_binary: true
load_binary: false
binary_filename: /tmp/y-bot.brain

This will create a binary brain. Once you have confirmed this is valid and working as expected, flip save to false and load to true

save_binary: false
load_binary: true
binary_filename: /tmp/y-bot.brain

All subsequent loads will now use the binary brain, rather than the aiml text files. Don't forget to flip the settings back round if you change any of the grammars.

Brain Files

The files section of the brain cofiguration specifies the location of all the various aiml and config files used by the brain. The configuration is either the specification of a directory, file extension to load and whether to search sub directions, or the specification of a single file.

   files:
        aiml:
            files: $BOT_ROOT/aiml
            extension: .aiml
            directories: true
        sets:
            files: $BOT_ROOT/sets
            extension: .txt
            directories: false
        maps:
            files: $BOT_ROOT/maps
            extension: .txt
            directories: false
        denormal: $BOT_ROOT/config/denormal.txt
        normal: $BOT_ROOT/config/normal.txt
        gender: $BOT_ROOT/config/gender.txt
        person: $BOT_ROOT/config/person.txt
        person2: $BOT_ROOT/config/person2.txt
        predicates: $BOT_ROOT/config/predicates.txt
        pronouns: $BOT_ROOT/config/pronouns.txt
        properties: $BOT_ROOT/config/properties.txt
        triples: $BOT_ROOT/config/triples.txt
        preprocessors: $BOT_ROOT/config/preprocessors.conf
        postprocessors: $BOT_ROOT/config/postprocessors.conf

The following describes each setting

       aiml:
            files: $BOT_ROOT/aiml
            extension: .aiml
            directories: true

Specifies the location of AIML files to load into the brain

        sets:
            files: $BOT_ROOT/sets
            extension: .txt
            directories: false

Specifies the location of sets to load into the brain

        maps:
            files: $BOT_ROOT/maps
            extension: .txt
            directories: false

Specifies the location of maps to load into the brain

        denormal: $BOT_ROOT/config/denormal.txt

Specifies the location of file which contains all denormalisation substitutions that can be applied via the tag

        normal: $BOT_ROOT/config/normal.txt

Specifies the location of file which contains all normalisation substitutions that can be applied via the tag

        gender: $BOT_ROOT/config/gender.txt

Specifies the location of file which contains all gender substitutions that can be applied via the tag

        person: $BOT_ROOT/config/person.txt

Specifies the location of file which contains all person substitutions that can be applied via the tag

        person2: $BOT_ROOT/config/person2.txt

Specifies the location of file which contains all person2 substitutions that can be applied via the tag

        predicates: $BOT_ROOT/config/predicates.txt

Specifies the location of file which contains all predicates substitutions that can be applied via the tag

        pronouns: $BOT_ROOT/config/pronouns.txt

Specifies the location of file which contains all pronouns substitutions that cna can applied via the tag

        properties: $BOT_ROOT/config/properties.txt

Specifies the location of file which contains all properties substitutions that can be applied via the tag

        triples: $BOT_ROOT/config/triples.txt

Specifies the location of file which contains all triples settings that cna be applied via the tag. Note this is pandora/Alice specific and at this time, I literally have no idea how it works !

        preprocessors: $BOT_ROOT/config/preprocessors.conf

Specifies the location of the file that contains all the preprocessors that are applied to the submitted question. These typically remove punctuation, normalise grammar and sort out any formatting. For more information of available preprocessors and what each of them do see PreProcessors

        postprocessors: $BOT_ROOT/config/postprocessors.conf

Specifies the location of the file that contains all the postprocessors that are applied to the generated response. These typically denormalise grammar and sort out any formatting. For more information of available preprocessors and what each of them do see PostProcessors

Brain Services

The services section of the brain configuration is used to specify configuration information for services which are called from the tag

        REST:
            path: programy.utils.services.rest.GenericRESTService
        Pannous:
            path: programy.utils.services.pannous.PannousService
        Pandora:
            path: programy.utils.services.pandora.PandoraService
        Wikipedia:
            path: programy.utils.services.wikipediaservice.WikipediaService

The following describes each setting

REST:
    path: programy.utils.services.rest.GenericRESTService

Specifies the path to the python module which contains the generic REST service

Pannous:
    path: programy.utils.services.pannous.PannousService

Specifies the path to the python module which contains the service to access Pannous chatbot API

Pandora:
    path: programy.utils.services.pandora.PandoraService

Specifies the path to the python module which contains the service to access Pandora chatbot API

Wikipedia:
    path: programy.utils.services.wikipediaservice.WikipediaService

Specifies the path to the python module which contains the service to access Wikipedia

Clone this wiki locally