Esempio n. 1
0
        public override NLGElement realise(NLGElement element)
        {
            StringBuilder debug = new StringBuilder();

            if (this.debug)
            {
                Console.WriteLine("INITIAL TREE\n");                 //$NON-NLS-1$
                Console.WriteLine(element.printTree(null));
                debug.Append("INITIAL TREE<br/>");
                debug.Append(element.printTree("&nbsp;&nbsp;").Replace("\n", "<br/>"));
            }

            NLGElement postSyntax = syntax.realise(element);

            if (this.debug)
            {
                Console.WriteLine("<br/>POST-SYNTAX TREE<br/>");                 //$NON-NLS-1$
                Console.WriteLine(postSyntax.printTree(null));
                debug.Append("<br/>POST-SYNTAX TREE<br/>");
                debug.Append(postSyntax.printTree("&nbsp;&nbsp;").Replace("\n", "<br/>"));
            }

            NLGElement postMorphology = morphology.realise(postSyntax);

            if (this.debug)
            {
                Console.WriteLine("\nPOST-MORPHOLOGY TREE\n");                 //$NON-NLS-1$
                Console.WriteLine(postMorphology.printTree(null));
                debug.Append("<br/>POST-MORPHOLOGY TREE<br/>");
                debug.Append(postMorphology.printTree("&nbsp;&nbsp;").Replace("\n", "<br/>"));
            }

            NLGElement postOrthography = orthography.realise(postMorphology);

            if (this.debug)
            {
                Console.WriteLine("\nPOST-ORTHOGRAPHY TREE\n");                 //$NON-NLS-1$
                Console.WriteLine(postOrthography.printTree(null));
                debug.Append("<br/>POST-ORTHOGRAPHY TREE<br/>");
                debug.Append(postOrthography.printTree("&nbsp;&nbsp;").Replace("\n", "<br/>"));
            }

            NLGElement postFormatter = null;

            if (formatter != null)
            {
                postFormatter = formatter.realise(postOrthography);
                if (this.debug)
                {
                    Console.WriteLine("\nPOST-FORMATTER TREE\n");                     //$NON-NLS-1$
                    Console.WriteLine(postFormatter.printTree(null));
                    debug.Append("<br/>POST-FORMATTER TREE<br/>");
                    debug.Append(postFormatter.printTree("&nbsp;&nbsp;").Replace("\n", "<br/>"));
                }
            }
            else
            {
                postFormatter = postOrthography;
            }

            if (this.debug)
            {
                postFormatter.setFeature("debug", debug.ToString());
            }

            return(postFormatter);
        }