|Top Previous Next|
Examples > Exchange of words > Production
If you click on the name Exchange in the right block of the user interface, in the left block the tab will change automatically to the production page and the properties of the Exchange production are displayed. The text of the production is:
The syntax and meaning of the TETRA productions is explained in the chapter scripts in detail. The following explanation gives a first impression of them.
At first only the part of the code shall be discussed, which carries out the analysis of the text and the part, which stands for the remodelling of the text, shall be ignored. Please, click the button marked with the red arrow to collapse the semantic code. Then you get the following picture:
The whole rule is included into parenthesis: (...)+. This means, that the source text that the rule describes is a repeat (at least once) of what is described inside of the parenthesis.
Inside of the parenthesis there are three sections separated by a pipe character '|'. This symbol separates alternatives. The whole text therefore consists of the repeat of three alternatives. Abstaining from the expression included in the double braces, these are the alternatives:
"God" | "man" | SKIP
That means, at each position of the source text there is either the word "God" or the word "man" or the third alternative, denoted by SKIP, applies.
By the key word SKIP TETRA is instructed to skip all the text, which is not an alternative to SKIP; in the current case that is all the text, which not the word "God" or the word "man". Now it's quite logical that the Exchange production covers all text. The whole text consists in "God" or "man" or other words.
The parts of the rule included into the double braces of the first picture still have to be explained. They contain the instructions, which have to be executed, as soon as the preceding alternative was recognized.
The instruction "out <<" means, that the following expression shall be written into the output. If the word "God" was recognized, the word "Man" will be written into the target text and reversed if the word "man" was recognized, the word "god" will be written.
In the case of the SKIP alternative xState.copy() will be written into the output. xState represents the actual state of the transformation process, and xState.copy() delivers the last recognized section of text.
This page belongs to the TextTransformer Documentation
|Home Content German|