and editing

APE - alphabetic predictive encoder


APE builds strings of output text based on the statistics of the input text. The higher the specified order (an input parameter), the more closely the output resembles the input.

As the most simple example, consider APE operating at order 2, generating output text based on a paragraph of input text. If the starting seed (the seed length is the same as the order, in this case 2) were Th, APE would copy the seed to the output, and then examine the input text to see what letters immediately follow Th throughout. It might find that the letters a e i and o as well as space occur right after Th, each of them several times. APE would select either a e i o or space and copy it to the output. The probability of chosing a particular letter is based on how frequently it occurs after the seed sequence in the input text.

Assume for the sake of illustration that APE chooses the letter e. APE copies the letter e to the output which now contains the letters The. APE then drops the first letter T from the seed and adds e to the end; the seed is now he.

APE then starts over, examining the input text to see which letters follow the sequence he. It continues on generating letters based on the seed, selecting a letter from the input that follows the seed sequence, transferring that letter to the output, and then updating the seed.

For lower orders (e.g., 2 or 3) APE will generate short runs of letters that are recognizeable and these may appear in interesting combinations to create new words. For higher orders, longer sequences from the input text appear in the output, possibly complete words. For the highest order (e.g., 8 or 9) complete words and phrases or even sentences from the input may appear in the output since higher orders give less flexibility for variation. Of course the output is highly dependent on the input.


APE requires the following inputs:

TimmiT eclectic solutions and editing