The Book of AI

How To Build Chatbots with The Personality Forge
Chapters
Chapter 4: Plug-ins for Responses

Plug-ins provide dynamic content for Responses. Each one is filled in with either the specific or random contents of the Plug-in. As an example, the Response "I like (animal)s" will become as "I like eagles" or "I like horses".

Key Plug-ins

The most common and useful Plug-ins for Responses are the Keys generated by the Keyphrase that was matched. For details on where Keys come from, see the Keyphrase section on Keys.

Keyphrase: do (you|we) * want to (vp)
Response: Now do you really want to go to the moon?

(prekey): the part of the sentence BEFORE the matched Keyphrase. In the above example, it would be "now".

Key Contents
(key1) you
(key2) really
(key3) go

(postkey): the part of the sentence AFTER the matched Keyphrase. In the above example, it would be "to the moon".

NOTE: Wildcard Plug-ins do NOT work with Special Keyphrases, as they don't generate Keys.

Custom Plug-ins

Custom Plug-ins are created by users like you. Their creators can either share them with everyone or keep them private. Custom Plug-ins all start with p:. Note that Custom Plugin-ins can be used as Wildcards in Keyphrases as well. This list is added to all the time and available by clicking Plug-ins in the Chatbot Workshop. Here are a few examples of the thousands that are available:

(p:food-drink) inserts a food or drink, such as "honey cake", "strong drink", or "popcorn".

(p:bodypart-outside) inserts the name of an external body part like "nose", "arm", "neck", or "elbow".

(p:consume) inserts a verb that means "to consume", such as "eat", "gobble down", and "swallow up".

PLUS THOUSANDS MORE!

AI Engine Plug-ins

AI Engine Plug-ins don't begin with a p:. These plug-ins are built into the system. The Custom Plug-ins here are curated Custom Plug-ins, being a complete English-language list of each kind of the corresponding word.

(name) inserts the name of the person a chatbot is chatting with.

(object) inserts an object, such as "allen wrench", "serpent", or "rubber ball".

(substance) the name of a substance, such as "ice", "scrap iron", or "mustard".

(animal) inserts an animal, such as "finch", "bulldog", or "walrus".

(adj) inserts an adjective

(verb) inserts a verb
(adverb) insert an adjective

(friend) inserts the name of someone a chatbot considers a friend.
(enemy) inserts the name of someone a chatbot dislikes.

(definition) inserts a complete sentence giving the definition of (key1). This would only really work when the Keyphrase is something like "what does (*) mean". When using this plug-in, the Response must simply be "(definition)" with no other words.

Time & Date Plug-ins

(time) inserts the time, in the format "6:25 PM".

(dayofweek) inserts the present day of the week, such as "Monday" or "Friday".

(year) inserts the present year.

(month) inserts the present month, such as "June" or "August".

(date) inserts the present month's date, such as the "4th" or "25th".

(tomorrow) inserts tomorrow's day and date, such as the "Wednesday, May 4th" or "Saturday, June 25th".

Local Plug-ins

A Local Plug-in is a list of options within a Response.

Response: I went to the (zoo|park|movies) last night.

Either the word "zoo", "park", or "movies" will be randomly selected.

Local Plug-ins can contain phrases or other plug-ins as well:

Response: My sister is training to become a (kung-fu master|(p:person)|jerk|(object) hunter)

One of the above options will be chosen, and if it contains further plug-ins, those will be inserted as normal.

Universal Plug-ins

Universal Plug-ins use WordNet to let you insert just about any category of noun or verb without having to make a list yourself. The syntax is like this: (typeof-word) where word is the type of noun or verb you want. Some examples: (typeof-beverage), (typeof-shoe), or (typeof-attack).

Universal Plug-ins are a little bit tricky. It can take a little searching to find the right word to use and can have some strange and unpredictable results. For example:

(typeof-food_product) You may have thought that (typeof-food) would be the best word, but when you navigate WordNet, you will see that "food product" is the name of the category with all the food in it. The results here include "oatmeal", "fettucine", or "blueberry muffin".

(typeof-smell-n) You have to add -n at the end if you want the noun version of "smell" or WordNet will assume it's a verb since the verb is the more common use of the word. Results for the noun "smell" include "fragrance" and "stench".

To find the best word to use, go to the Topic Navigator. The nouns are arranged in a tree, with most general at the top and most specific at the bottom. Either navigate around or search to try to find a category whose subcategories (and their subcategories) are the types of words you want to use. Try out your Universal Plug-in by adding it to a Response and then testing it in Debug.

If you need to specify the word type, add -n or -v at the end of the Universal Plug-in, such as (typeof-drink-v), which will return a plug-in of the verb drink instead of the noun drink. Note that WordNet does not contain proper nouns, so it won't work for media, people, books, movies, etc.

Rhyming Plug-ins

These are fun Plug-ins that let you insert a word that rhymes with any of the Wildcard Keys. If multiple words are in the Key, the last word is used for the rhyme.

(rhyme1) a word that rhymes with the (key1)

(rhyme2) a word that rhymes with the (key2)

and so on

Spelling Plug-ins

These Plug-ins let you spell the contents of a Key. This is useful when text-to-speech is being used via the Chatbot API.

(spell1) the spelling for (key1)

(spell2) the spelling for (key2)

and so on

Plug-in Inflectors

Plug-ins can also be inflected! That means you can change the form of the nouns or verbs before displaying them, so that they fit your Response. Let's say you have (key1) which is "hug". If your Response works better with "hugging", then you simply use an inflector. That looks like this: (key1)ed. Inflectors give you access to a greater variety of Responses.

(key1)s changes "man" to "men" (noun) or "eaten" to "eats" (verb)

(key1)ed changes "running" to "ran"

(key1)ing changes "thundered" to "thundering"

(key1)_ changes "kicking" to "kick" or "books" to "book" (the base form)

(key1)er changes "kindest" to "kinder"

(key1)est changes "funny" to "funniest"

More About Plug-ins

A or An?

If you have a Response that has "a (noun)" and the random noun turns out to start with a vowel such as in "avalanche", then the phrase will be automatically converted into "an avalanche". To take advantage of this, please use "a" before plug-ins, rather than "an".

Two of Each Plug-in

Any Custom Plug-in, Universal Plug-in, and AI Engine Plug-in except the (name), (definition), and Time & Date Plug-ins can be used twice in a Response. To create a second Plug-in of the same type, add a 2 to the end of it. For example, use (p:adj-pos) and (p:adj-pos2). The following Response, "I had to choose between a (animal) and a (animal2). I chose the (animal)" might be transformed into "I had to choose between a bear and a penguin. I chose the bear."