Post Processing
In this step, final adjustments are applied to the Words-stack. If this step ends without an error then a post compress is done (empty entries are removed). The words in the Words-stack are marked with a Word-type character as follows,
<space> EMPTY
S SKIP
T SKIPCODE
I INITIAL
Y SELECT
C CODE
M MAJOR
N MAJCODE
B SUSPECT
D DELETED (used only by the TRACE service)
If the Word-stack is empty then end the Service with error response code 04.
Do post clean (every entry gets a final cleaning)
Do post compress (empty entries are removed)
Do code processing (entries are examined to see if they are words or codes and special rules are applied to codes).
Pick the MAJOR word if one is present. Each word in the stack is checked in the order of the nameformat:
If the word is a MAJOR then
If we already have a major then convert the word to SELECT, else pick the word as the major.
If the word is a MAJOR-CODE then
If we already have a major then convert the word to CODE, else pick the word as the major.
If a major was found then end the post-processing.
Pick one of the SELECT words. Each word in the stack is checked in the order of name-format:
If the word is a SELECT word then it is converted to MAJOR and the post-processing ends.
Pick one of the CODE words. Each word in the stack is checked in the order of name-format:
If the word is a CODE then convert it to MAJOR and end the post-processing.
Concatenate initials. Concatenate all the initials in the stack. If there were any then convert the result (which could still be one initial) to a MAJOR and end the post-processing. After concatenating, the generated word may be put anywhere in the stack; it is identified by the MAJOR type it has.
Pick one of the SKIP words. Each word in the stack is checked in the order of the name-format:
If the word is SKIP then convert it to MAJOR and end the post-processing.
If
Formatting option #7
is active and a street word was found during the Edit-list step then do street processing and end this step.
If we got here then we have no major, set response code to 04 and end the post-processing.
Post Clean
This stage cleans the stack words, one at a time, using a Character-set table.
If the entry is EMPTY then leave it alone.
Each position in the word is now examined:
If it is a BLANK, and the "break on blank" option (Formatting option #6) was selected then clear the rest of word.
If the replacement value for this position in Table 8 is BLANK then delete this character from the word.
Otherwise replace this position with the value in Table 8.
Post Compress
This process removes empty entries from the stack. The stack is thus compressed, all empty entries are now at the end and the words count reflects the number of non-empty entries.
Code Processing
This process handles words which are identified as ’codes’, that is words that represent values which are not a word of the language or a name. Table 2 of the character-set module is used to identify code-characters. This table categorizes each character as a code (usually the numeric characters), an ambiguous or suspect code (a character that may be a code for example, you may wish to have the letter O defined as an ambiguous code-character), or a letter.
First we want to identify codes and suspect codes in the stack. The words are processed in the order of the stack:
If the entry is EMPTY then leave it as is (nothing to do). If the word is marked as SKIP then leave alone.
Count the number of non blank characters into L Count the number of code-characters into C Count the number of ambiguous characters into A Add A to C (number of non-alpha) If C == 0 then Leave this entry as is If C >= 2 then mark this entry as CODE (2 or more digits in word) Now we know C == 1, that is ONE non-alpha was found. If L == 1 then mark word as CODE (word is one non-alpha alone) Else if A > 0 then leave the entry alone (non-initial contains one ambiguous character) Else mark the word as SUSPECT (non initial contains one code-character) Now we try to identify further suspects codes. Each entry is processed in turn. If entry is CODE or SUSPECT or EMPTY leave it alone. If entry is a short word (1 or 2 letters) and it is preceded or followed by a CODE mark it as SUSPECT Else leave the entry as is Next we concatenate adjacent codes, (if Formatting option #3 is active)
A run of
CODE
and
SUSPECT
words are concatenated into one word which is marked as
CODE
. An EMPTY entry does not break a run. Now process
CODE
and
SUSPECT
words according to the defined options. Each entry is processed one at a time.
If the word is
SUSPECT
then convert it according to the "suspect codes" option (Formatting option #2), Cmark as
CODE W
mark as
SELECT
Smark as
SKIP
Mmark as
MAJOR
Ddelete word elsemark as
SELECT
If the word is
CODE
then convert it according to the "codes" option (
Formatting option #1
), Cmark as
CODE W
mark as
SELECT S
mark as
SKIP M
mark as
MAJOR-CODE D
delete word elsemark as
CODE
Else leave the entry as is.