:\
It's very useful for games.
Here is how my random phrase program works. I haven't implemented an FB version. (yet?) It's of middle-of-the-road complexity. Any more complex and it would require a specialized phrase building program. Less complex leaves out features!
First, I create a list of phrases or words. Each phrase has two numbers assigned to it: one is the option set number, and the other is the phrase number within the option set. For example, here are 6 option sets.
text="
[0],,
0: businessman,,
1: IT specialist,,
2: marketeer,,
3: cost specialist,,
[1],,
0: Money,,
1: Cash,,
2: Gold,,
[2],,
0: Leon,,
1: Smarty,,
2: Pen,,
[3],,
0: Gu,,
1: Fab,,
2: Spark,,
[4],,
0:stein,,
1:ovich,,
2:no,,
3:-Li,,
[5],,
0:Jack,,
1:Andy,,
2:Michael,,
3:Chris,,
4:Matt,,
5:John,,
6:Alice,,
7:Nicole,,
8:Danielle,,
9:Emily,,
10:Laura,,
11:Lin,,
"
Then, I specify the sentence structure. A number in square brackets indicates that the phrase program chooses one of the option sets above. A secondary number in parentheses indicates which phrase/word to randomly pick from the option set.
"(all)" means any word in the option set can be picked.
"(num1, num1, num3)" selects an option set phrase from the list of option set IDs.
A "," precedes another number in square brackets.
This can be nested:
(num1:x, num2:y, num3:z) signifies that the program should pick any of these paths at random to be followed.
text matches="
[5](all),
[0](
0:(
[1](all)
),
1:(
[2](all)
),
2:(
[3](all)
),
),
[4](all)
"
A few more strings:
"Text type" is normally "random 1:n match". A "random" text type signifies that the program just randomly picks one phrase from the list.
The "text replacements" string functions like.. a text replacement-- see example 2 below.
I send these four/five strings to the program, which creates an initial data structure in memory. I also assign a sentence ID to this sentence at the same time. Then call the program with the sentence ID when needed.
Here are three full examples of my system...
<text name="employee name generation" text type="random 1:n match"
text="
[0],,
0: businessman,,
1: IT specialist,,
2: marketeer,,
3: cost specialist,,
[1],,
0: Money,,
1: Cash,,
2: Gold,,
[2],,
0: Leon,,
1: Smarty,,
2: Pen,,
[3],,
0: Gu,,
1: Fab,,
2: Spark,,
[4],,
0:stein,,
1:ovich,,
2:no,,
3:-Li,,
[5],,
0:Jack,,
1:Andy,,
2:Michael,,
3:Chris,,
4:Matt,,
5:John,,
6:Alice,,
7:Nicole,,
8:Danielle,,
9:Emily,,
10:Laura,,
11:Lin,,
"
text replacements=""
text matches="
[5](all),
[0](
0:(
[1](all)
),
1:(
[2](all)
),
2:(
[3](all)
),
),
[4](all)
">
<text name="ftext past occupation" text type="random 1:n match"
text="
[0],,
0: fishing,,
1: recreational sports,,
2: media,,
[1],,
0: crab fisherman,,
1: longshoreman,,
2: boat operator,,
[2],,
0: professional angler,,
1: skydiving instructor,,
2: survival trainer,,
3: bear-wrestler,,
[3],,
0: news anchor,,
1: weatherman,,
2: nature show host,,
3: special investigator,,
[4],,
0: off the shores of,,
1: on the plains of,,
2: on the steppes of,,
[5],,
0: North Carolina,,
1: Louisiana,,
2: Alaska,,
3: American Samoa,,
4: the Serengeti,,
5: the Australian Outback,,
6: the US Great Plains,,
7: Eastern Europe,,
"
text replacements="
lotsofwater=[5](0,1,2,3)
lotsofland=[5](4,5,6,7)
"
text matches="
[0](0:(
[1](all),
[4](0:[lotsofwater]),
),
1:(
[2](all),
[4](1:[lotsofland], 2:[lotsofland]),
),
2:
(
[3](all),
[4](1:[lotsofland], 2:[lotsofland]),
),
)
">
<text name="ftext easy phrase" text type="random"
text="a piece of cake,,
easier than stealing candy from a baby,,
just gravy,,
easy as pie,,
a cake walk,,
a walk in the park">
<text name="ftext large thing" text type="random"
text="enormous,,
gigantic,,
sumo-wrestler-like,,
galactic,,
giant-like,,
McDonald's-like,,
Big-Mac-like,,
mouth-dropping">