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(" ").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(" ").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(" ").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(" ").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(" ").Replace("\n", "<br/>")); } } else { postFormatter = postOrthography; } if (this.debug) { postFormatter.setFeature("debug", debug.ToString()); } return(postFormatter); }
public virtual NLGElement realise(NLGElement phrase1, NLGElement phrase2) { NLGElement result = null; if (phrase1 is PhraseElement && phrase2 is PhraseElement && phrase1.Category == PhraseCategory.PhraseCategoryEnum.CLAUSE && phrase2.Category == PhraseCategory.PhraseCategoryEnum.CLAUSE) { IList <FunctionalSet> funcSets = AggregationHelper.collectFunctionalPairs(_syntax.realise(phrase1), _syntax.realise(phrase2)); applyForwardConjunctionReduction(funcSets); applyBackwardConjunctionReduction(funcSets); result = _factory.createCoordinatedPhrase(phrase1, phrase2); } return(result); }