Module eliza::script

source ·
Expand description

The script defines a set of rules which enable ELIZA to engage in discourse with a user.

The beauty of ELIZA’s design methodology means that the role of the programmer and playwright are separated. An important property of ELIZA is that a script is data - it is not part of the program itself. Hence, ELIZA is not restricted to a particular set of recognition patterns or responses, indeed not even to any specific language.

Script Structure

The script is written in json and is composed of the following.

{
    "greetings" : ["", ...],
    "farewells" : ["", ...],
    "fallbacks" : ["", ...],
    "transforms" : [
        {"word": "", "equivalents": ["", ...]},
        ...
    ],
    "synonyms" : [
        {"word": "", "equivalents": ["", ...]},
        ...
    ],
    "reflections" : [
        {"word": "", "inverse": ["", ...], "twoway": bool},
        ...
    ],
    "keywords" : [
        {
            "key": "", "rank": number,
            "rules": [
                {
                    "memorise": bool, "decomposition_rule": rust_regex,
                    "reassembly_rules": ["", ...]
                },
                ...
            ]
        },
        ...
    ]
}

See struct documentation for more information on each element.

Structs

  • A keyword and it’s associated decompositon and reassembly rules.
  • A set of string pairs, used to post process any contextual information in an ELIZA response.
  • A rule to decompose a user’s input then assemble a response based on that input.
  • A collection of ELIZA directives.
  • A rule to aid the playwright in constructing simple decomposition rules.
  • A rule to transform a user’s input prior to processing.