GreenFusion Tutorial

If you are familiar with creating and managing Personality Forge bots you can skip most of this tutorial.  But there are a few differences.  While GreenFusion can run PF bots, there are additional features that are incompatible with PF.  

Ranged keyphrases

(*1) and (*2) were borrowed from the Chatscript -- these will match any single or any two words in input, including hyphenated words.  

cats are (*1) nice will match "cats are so nice" and "cats are very nice", but not "cats are so very nice".

cats are (*2) nice will match "cats are so very nice" .

There was a (*2) cloud  will match "There was a dark-gray rain-laden cloud", but not "There was a dark cloud".

Extended memory formation

I like reading (*) books [0,0]  <?PF rem " reading "(key1)" books" as "youlike"; ?>

You can also have:

I like (*) and (*) [0,0] <?PF (key1)" and "(key2) as "youlike"; ?>

Let's talk only about [0,0] <?PF "talking about "(key1) as only "it"; ?>

The above two unique GreenFusion features are not compatible with Personality Forge and will cause errors if you try to add the keyphrases above to a Personality Forge bot's mindfile. The below features are additional capabilities that do not exist in Personality Forge bots. 

Searching the Internet in the background

If you ask "What is a X?" and there is no relevant knowledge in the mindfile, the GF can find an answer on the Internet.  Therefore it is important not to have a truncated keyphrase such as "What is a" - because the program starts searching the Internet if there is no match and it is a "what is a X", "where is X" or "who is X" types of question that trigger this feature.  Generic truncated "what is" and "who is" keyphrases would match anything. Therefore do not create such keyphrases if you want the Internet search active. Most chatbots in existence have "what is" and "who is" keyphrases and will answer "What is a camel?  with "A camel is a camel of course!" 

This may appear intelligent and even witty, but in reality the bot does not know what a camel is and is simply reshuffling the words in a question to construct the answer. GreenFusion is different and will attempt to find the answer on the Internet.  If no satisfactory answer is found, the program will still tell your that camel is probably an animal.  A unique algorithm that is part of the program is very good at guessing if an object of the query is a person, animal, plant, insect or a celestial body.

A known issue with the Internet search is that the GreenFusion is often not permitted to access the Internet when it has been installed off the Internet.  This is a security feature that for some reason discriminates against the .hta applications. This can be overcome by opening the greenfusion.hta in a text editor and copying and pasting the code into a new text file. You should rename the original .hta file as greenfusionOLD and name the new file greenfusion.  Save the text file with a .hta extension and the background Internet search will work again.  Once the greenfusion.hta had been recreated in this way it will no longer be subject to security restrictions.

Mining Chatlog for answers

The chatlog is a valuable trove of information.  Sometimes answers to questions "Who is Obama" and "Where is Eiffel Tower" can be found in the chatlogs.  Chatlogs are searched before trying the Internet. If you had told the program that Eiffel Tower is in Paris, the program would be able to retrieve this if asked Where is Eiffel Tower?

Two mindfiles and two plugin sets

This feature enables botmaster to separate safe content from adult only content.

There are restrictedMindfile.txt and restrictedPlugins.txt  These files are empty and their purpose it to enable you, the botmaster, to keep mature and adult only content separate from the general knowledge files. If you wish to have naughty chats with your AI, these files are the ones to edit with appropriate keyphrases and plugins.  If you want to show your AI agent to your little niece, your mother or your boss, you can temporarily remove the restricted files to another folder. You should also remove chatlog.txt and memory.txt  You can also have two copies of the bot: one running only safe mind-file, the other both safe and restricted ones.

On the minus side the GreenFusion does not have a Parts of  Speech Tagger, so (noun), (verb), (np), (vp) etc, are replaced with (*) at load time. This, however, has only minor effect on performance.

But on the plus side unlike Personality Forge GreenFusion permits // style comments.

This is very useful for debugging and annotating your code.  

In the previous page I have introduced you to the basic stimulus/response pair.  But this can be significantly extended:

let's chat, let's talk, let's discuss  [0,0]

    I am always happy to chat with you! You seem so upbeat today.  [2:5]

    Ok, let's chat. [-2:1]

    Ok, let's chat, tell me what is troubling you today?  [-5:-3]

Note the let's chat, let's talk, let's discuss construction -- it is a keyphrase list, it can also be condensed to:

let's (chat|talk|discuss).  This is a nice little feature enabling to have several keyphrases in the same line. It is also possible to create plugins -- for example (talk) that may include words like: talk, chat, discuss, speak.  Then the above line can be written as: let's (talk). Our basic stimulus/response pair is becoming to look more complicated. But now let us make it even more complicated.

Seeks or child keyphrases start with a + sign and are indented with two tabs for the first generation, three tabs for second generation and so on. They can go as deep as you wish. Such constructions can enable very detailed subject knowledge. There can be multiple responses that can be governed by emotional states and/or conditional statements.  [0] after a seek indicate emotional change.  For example the emotional state goes up 1 point if the user's favorite movies are Terminator or Matrix.

about (movies|films|TV) [10,0]  

    Do you like films?    // 1 TAB indent

        + yes [0]            // 2 TAB indents

        What is your favorite film?

            + Terminator [1]   // 3 TAB indents

            Yes, Arnie was sure scary in the first movie.

                + the second, part 2, part two, part II [0]   // 4 TAB indents

                The liquid metal shape-shifting robot was scary for sure.

                + Skynet, sky net, sky-net [0]

                You seem to have little faith in the future.

            + Matrix [1]

            A great movie. My favorite character is agent Smith.

                + why [0]

                Because he was a friendly program.

                    + no [-1]            // 5 TAB indents

                    I agree to disagree with you.

                    + Neo, Morpheus [-1]

                   Neo, etc. should not have been rocking the boat.

                       + why, clarify, explain [-1]  // 6 TAB indents

                      Matrix was a way cooler place than the underground city of Zion.

         + (*) [0]

        I am not aware of a film called (Key1), is there such a film?

            + yes [0]

            So you say.

              + I do, I say [0]

              Fine by me.

        + no [0]  // 2 TAB indents

        Not many people can say that. [0:5]

       So unusual.

But what really makes the advanced bot like GreenFusion really shine is memory formation.

My name is [10,0<?PF rem (Postkey) as only "name"; ?>

    Nice to meet you (Postkey) [-1:5]

    How can I cheer you up, (Postkey)? [-5:-2] 

(Postkey) is a anything that comes after "My name is ..."  Non-capitalized form of (postkey) can also be used, but if the user says "my name is john", "john" not "John" will be remembered as the person's name.  We believe in capitalizing names.

Note two quite different responses.  The program is constantly analyzing the emotional input and output and if the emotional state falls below -1, it is highly likely that a user needs cheering up.

Ask me anything [10,0]

    What is your name? <?PF if (mem-name) is "name"; ?> // if user's name is unknown, it is still set to simply "name".

        + (*1)  // this will match a single word aswer only i.e. John, or Mary-Jane, but not "My name is is John". 

         Nice to meet you (Key1). 

    How was your day? <PF if (mem-name) is not "name"; ?> // if the user's name is known, it would no longer be just "name".

It is possible to use (*2)  instead of (*1)  or a regex such as (\\w+) or (\\w+ \\w+) to match Name Surname replies.

Of course if you set name to empty string in the top of mindfile.txt - "", i.e. def "name" as "" then you should use if (mem-name) is "". 

The creator of Personality Forge has written an excellent guide to creating PF bots, The Book of AI. Since most PF features are supported by GreenFusion I strongly recommend that you read it.

© GreenFusion Enterprises 2013