How to Make a Floem

This page explains how Floetry makes a floem from a baseflow, and how you can make your own baseflow.

For the moment, you will have to have a composer account to be able to create and edit a baseflow. If you are a fan, you can still see baseflows, and make limited changes by "customizing" the baseflow.

So what's a baseflow?

To make a floem, we "expand" the baseflow. Start with the rule name of the first rule in the baseflow. Write it down in a workspace (like a blackboard) that we'll call floem-in-progress.

  1. Find any rule name in the floem-in-progress. (The first time will be trivial, since that's the only thing that will be there.)
  2. Find all the clauses defined by that rule name.
  3. Choose, at random, one of them.
  4. "Expand" the rule name by replacing it with the clause you chose. This will make a different and sometimes longer floem-in-progress (which is why we call it "expansion").
  5. Repeat the entire process until there are no more rule names to expand.

When you finish you will have made a new floem. It's that simple.

Because of step 3, every time you do this process you can get something different. Depending on how many times you make a choice, and how many choices you have to choose from, you can get an enormous variety of possible sentences.

Let's look more closely at the format of a baseflow. We'll build up a small demonstration baseflow, and then use it in a walk-through of the process above to generate a floem.

How to Make a Baseflow

In Floetry, you can make a baseflow by finding a baseflow to start with (look in "baseflows") and making a copy of it. Then you can edit it until you get what you like. You could, if you wnat, erase everything and make a brand new baseflow from scratch. Of course in that case, it doesn't matter what baseflow you start with.

Let's look at the structure of a baseflow.

In a baseflow, blank lines are ignored. Also any text on a line after and including the characters "//" is ignored. Such text is called a "comment." (Putting // at the front of a line is an easy way to "turn off" a clause or rule that you don't want Floetry to use just now.)

A rule name is also called a non-terminal symbol, because you don't "terminate" the process of making a floem as long as there are non-terminals in it. Similarly, text that does not start with @ is called a terminal.

The way to really understand all this is to play with it. Make a copy of "My First Baseflow" and edit it. Put comment marks in front of everything you don't understand yet, and see what you get. Then add new rules by taking out the comment marks. Or try your own!

An Example Baseflow

Here are the first two rules of First Baseflow:

	@demo @sentence .

	@sentence  @phrase likes @phrase

You can make your own copy of this baseflow in order to edit it as you go through this lesson.

The first rule is the one floetry will use to generate a complete floem. In this case the rule's name is "@demo". The rule can be read like this: "a @demo is a @sentence followed by a period."

The second rule defines one clause for the rule @sentence. It says that a @sentence is made up of a @phrase, followed by the word "likes" followed by another @phrase.

So the nonterminals in the above two rules are @sentence and @phrase. And the terminals are 'likes' and '.'.

(Floetry knows how to capitalize the first word of a sentence, which is pretty handy.)

Here are some more rules to expand our baseflow. There are two clauses for the rule @phrase:

		my @pet
		your @pet

Note that you don't have to put a clause on the line that defines the rule name. Putting the rule name on a separate line can make your baseflow easier to read.

The above rule says a @phrase is either "my @pet" or "your @pet". When floetry needs a @phrase, it will pick one of these at random.

The following rule provides several choices for "@pet":


A walk-through

Let's walk though the steps of making a floem using the baseflow we just defined.

Our first rule is @demo, so that will be where we start.

	floem-in-progress:	@demo

@demo has a single clause, so we will replace it by its one definition:

	floem-in-progress:	@sentence .

@sentence also has a single clause (so far):

	floem-in-progress:	@phrase likes @phrase .

Now we have two rules to expand. Let's start with the second one just for fun. We have to look at all the clauses defined by the rule @phrase:

		my @pet
		your @pet

Let's pick the first clause. Then our floem-in-progress is:

	floem-in-progress:	@phrase likes my @pet .

Again we can choose any one of the rules in the floem-in-progress to expand. This time choose the first @phrase and the second rule:

	floem-in-progress:	your @pet likes my @pet .

Again repeat the process, this time by replacing the first @pet with the clause "cat":

	floem-in-progress:	your cat likes my @pet .

This time we have fewer non-terminals than we did last time, so we are getting closer to being finished! Naybe you are beginning to see how nice it is to have a computer do this for you.

In facte, we have only one more step to go. We have to replace the final non-terminal, @pet, by one of its clauses. Let's choose "uncle":

	floem-in-progress:	your cat likes my uncle .

Now that there are no more non-terminals, we are essentially finished. Floetry will automatically capitalize the sentence and put the period closer to the last word. So the final result in this case will be:

	Your cat likes my uncle.

How many different floems are there?

Using different random choices, the baseflow will generate many other fleoms, for example:

	My cat liks your parakeet.
	My dog liks my cat.
	Your uncle likes your uncle.

Because this baseflow is so simple, we can easily compute the total number of floems our baseflow can generate.

There are four kinds of @pet. There are two choices for @phrase, "my @pet" and "your @pet", and each has 4 possible expansions, so there are 4 + 4 = 8 choices for @phrase in total. There is only one choice for @sentence, but it contains @phrase twice, so there are 8 x 8 = 64 different @sentences. Finally, there is only one kind of @demo, so there are a total of 64 @demo floems defined with this simple rule.

You can easily see how these numbers grow quickly. If @demo could end with "!" as well as "." (which we'll do in a moment), there would be 128 possible floems. If we added 4 new pet words to the 4 we already have, we could again double the number of floems, now up to 512.

More tricks

Tnis was a very simple example. Let's take it a little further and learn some new tricks.

You can define more clauses by reusing the same rule name.

		@sentence !

The rule above adds a new clause to demo, and it says that a demo sentence can end with "!" (or with "." as our first rule specified).

The rule below adds two new clauses to the rule @sentence that we already presented.

  		@phrase is actually @phrase
  	  	@phrase @transitive-verb +s @phrase

The symbol +s in the second clause above tells floetry to combine the previous word with "s" You can use it for +ed and +ing too. Floetry has some intelligence for how to do that, for instance, whether to add "es". Would you call that "AI"? It doesn't know all the rules, and could be a whole lot smarter. :-)

When you have a lot of single word clauses, as a shortcut, you can put them all on one line. So instead of writing


you can start the rule with the symbol "*"

		* love ignore cuddle wrankle hug kiss clobber

If you want to include multi-word clauses, those must be on their own line.

  		* frog pig monkey sister-in-law
  	  	weird uncle
  	  	furry panda

Note once again that if we have two sets of clauses with the same rule name, the clauses just get combined. So the two @pet rules above are equivalent to:

		* cat dog parakeet uncle frog pig monkey sister-in-law
		weird uncle
		fuzzy panda

(We did the same thing with @sentence above.)

Let's expand @phrase to include not only "my @pet" and "your @pet" but also "@name":

		* Bart Lisa Fred Wilma Kermit Lucy
		Charlie Brown
		Miss Piggy

If you capitalize a word in a clause, it will always be capitalized. Otherwise, it will be capitalized only when it appears at the beginning of a sentence.

It can be convenient for rule names to be parts of speech, but that definitely isn't required. The following rule uses two parts of speech, verbs and prepositions, because in English, prepositions are often very closely related to the verb they follow.

  		@phrase is @feeling @phrase
 	   	mad at
  	  	pissed off about
  	  	crazy over
  	  	head over heals in love with

Had we defined @verb and @preposition separately (@phrase is @verb @preposition @phrase), we could get lots of other combinations, some of which make sense and some of which are a bit awkward, like "mad over", "pissed off with", and "head over heals in love at".

As an exercise, you might try to see how many sentences are possible with our newly expanded baseflow. The number will be quite large. But in one simple step, it can become infinite. Read the section for wizards to see how.

More Rebaseflows

You can look at the First Baseflow or any of the other baseflows to see how they do things. You can also use X-Ray to see the 'skeleton' of the floems you create. X-Ray shows you how which rules are used to generate a particular floem. It's a helpful way to see what's happening when things don't go as you expect.

Now it's your turn. Feel free to make your own creation! The best way to learn is to play, so have fun!