/** * The main method for realising noun phrases. * * @param parent the <code>SyntaxProcessor</code> that called this method. * @param phrase the <code>PhraseElement</code> to be realised. * @return the realised <code>NLGElement</code>. */ static NLGElement realise(SyntaxProcessor parent, PhraseElement phrase) { ListElement realisedElement = null; if (phrase != null && !phrase.getFeatureAsBoolean(Feature.ELIDED).booleanValue()) { realisedElement = new ListElement(); if (phrase.getFeatureAsBoolean(Feature.PRONOMINAL).booleanValue()) { realisedElement.addComponent(createPronoun(parent, phrase)); } else { realiseSpecifier(phrase, parent, realisedElement); realisePreModifiers(phrase, parent, realisedElement); realiseHeadNoun(phrase, parent, realisedElement); PhraseHelper.realiseList( parent, realisedElement, phrase.getFeatureAsElementList(InternalFeature.COMPLEMENTS), DiscourseFunction.COMPLEMENT); PhraseHelper.realiseList( parent, realisedElement, phrase.getPostModifiers(), DiscourseFunction.POST_MODIFIER); } } return realisedElement; }
/** * Realises the pre-modifiers of the noun phrase. Before being realised, pre-modifiers undergo * some basic sorting based on adjective ordering. * * @param phrase the <code>PhraseElement</code> representing this noun phrase. * @param parent the parent <code>SyntaxProcessor</code> that will do the realisation of the * complementiser. * @param realisedElement the current realisation of the noun phrase. */ private static void realisePreModifiers( PhraseElement phrase, SyntaxProcessor parent, ListElement realisedElement) { List<NLGElement> preModifiers = phrase.getPreModifiers(); if (phrase.getFeatureAsBoolean(Feature.ADJECTIVE_ORDERING).booleanValue()) { preModifiers = sortNPPreModifiers(preModifiers); } PhraseHelper.realiseList(parent, realisedElement, preModifiers, DiscourseFunction.PRE_MODIFIER); }