The Math Verbaliser's Design

The system’s architecture is a traditional NLG pipeline, adapted from (Reiter and Dale, 1997). It is designed with three distinct and well-defined modules.

The text planner module receives the input CMML expression and filters out the information that will be included in the text. The file is read line by line and a list of the expression’s tokens is produced. This token list is passed on to the sentence planner.

The sentence planner’s job is to organize the overall structure of the intended sentence. This module takes the list of tokens as input and arranges them into an Abstract Syntax Tree (AST). The root of each sub-tree is the operator, the child nodes are its operands. The completed AST is handed over to the linguistic realiser.  

The linguistic realiser module will take the output from the sentence planner and generate a grammatically correct and complete sentence using isiZulu templates. 
The received AST is depth-first traversed, fetching a template via the name of the operator and filling it in for each sub-tree. 
To use the templates, the realiser opens a text file where the data for each template is stored and loads the file line-by-line into template objects. These objects store all the information needed to create and change a template’s grammar depending on how its verb is used (as a primary, secondary or an adjoining verb).

The Template's Design