Beispiel #1
0
        /**
         * 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>.
         */

        public static INLGElement realise(SyntaxProcessor parent, PhraseElement phrase)
        {
            ListElement realisedElement = null;

            if (phrase != null &&
                !phrase.getFeatureAsBoolean(Feature.ELIDED.ToString()))
            {
                realisedElement = new ListElement();

                if (phrase.getFeatureAsBoolean(Feature.PRONOMINAL.ToString()))
                {
                    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.ToString()),
                                             DiscourseFunction.COMPLEMENT);

                    PhraseHelper.realiseList(parent, realisedElement, phrase
                                             .getPostModifiers(), DiscourseFunction.POST_MODIFIER);
                }
            }

            return(realisedElement);
        }
Beispiel #2
0
        /**
         * The main method for realising verb 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>.
         */

        public static INLGElement realise(SyntaxProcessor parent, PhraseElement phrase)
        {
            ListElement realisedElement      = null;
            var         mainVerbRealisation  = new Stack <INLGElement>();
            var         auxiliaryRealisation = new Stack <INLGElement>();

            if (phrase != null)
            {
                var vgComponents = createVerbGroup(parent, phrase);
                splitVerbGroup(vgComponents, mainVerbRealisation,
                               auxiliaryRealisation);

                realisedElement = new ListElement();

                if (!phrase.hasFeature(InternalFeature.REALISE_AUXILIARY.ToString()) ||
                    phrase.getFeatureAsBoolean(
                        InternalFeature.REALISE_AUXILIARY.ToString()))
                {
                    realiseAuxiliaries(parent, realisedElement,
                                       auxiliaryRealisation);

                    PhraseHelper.realiseList(parent, realisedElement, phrase
                                             .getPreModifiers(), DiscourseFunction.PRE_MODIFIER);

                    realiseMainVerb(parent, phrase, mainVerbRealisation,
                                    realisedElement);
                }
                else if (isCopular(phrase.getHead()))
                {
                    realiseMainVerb(parent, phrase, mainVerbRealisation,
                                    realisedElement);
                    PhraseHelper.realiseList(parent, realisedElement, phrase
                                             .getPreModifiers(), DiscourseFunction.PRE_MODIFIER);
                }
                else
                {
                    PhraseHelper.realiseList(parent, realisedElement, phrase
                                             .getPreModifiers(), DiscourseFunction.PRE_MODIFIER);
                    realiseMainVerb(parent, phrase, mainVerbRealisation,
                                    realisedElement);
                }
                realiseComplements(parent, phrase, realisedElement);
                PhraseHelper.realiseList(parent, realisedElement, phrase
                                         .getPostModifiers(), DiscourseFunction.POST_MODIFIER);
            }

            return(realisedElement);
        }
Beispiel #3
0
        /**
         * The main method for realising 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>.
         */

        public static INLGElement realise(SyntaxProcessor parent, PhraseElement phrase)
        {
            ListElement realisedElement = null;

            if (phrase != null)
            {
                realisedElement = new ListElement();

                realiseList(parent, realisedElement, phrase.getPreModifiers(),
                            DiscourseFunction.PRE_MODIFIER);

                realiseHead(parent, phrase, realisedElement);
                realiseComplements(parent, phrase, realisedElement);

                PhraseHelper.realiseList(parent, realisedElement, phrase
                                         .getPostModifiers(), DiscourseFunction.POST_MODIFIER);
            }

            return(realisedElement);
        }