Example #1
0
        /**
         * Performs the realisation for YES/NO types of questions. This may involve
         * adding an optional <em>do</em> auxiliary verb to the beginning of the
         * clause. The method also determines if there is a subject that will split
         * the verb group of the clause. For example, the clause
         * <em>the man <b>should give</b> the woman the flower</em> has the verb
         * group indicated in <b>bold</b>. The phrase is rearranged as yes/no
         * question as
         * <em><b>should</b> the man <b>give</b> the woman the flower</em> with the
         * subject <em>the man</em> splitting the verb group.
         *
         *
         * @param phrase
         *            the <code>PhraseElement</code> representing this clause.
         * @param parent
         *            the parent <code>SyntaxProcessor</code> that will do the
         *            realisation of the complementiser.
         * @param realisedElement
         *            the current realisation of the clause.
         * @param phraseFactory
         *            the phrase factory to be used.
         * @param verbElement
         *            the <code>NLGElement</code> representing the verb phrase for
         *            this clause.
         * @param subjects
         *            the <code>List</code> of subjects in the clause.
         * @return an <code>NLGElement</code> representing a subject that should
         *         split the verb
         */
        private static NLGElement realiseYesNo(PhraseElement phrase, SyntaxProcessor parent, NLGElement verbElement, NLGFactory phraseFactory, ListElement realisedElement)
        {
            NLGElement splitVerb = null;

            if (!(verbElement is VPPhraseSpec && VerbPhraseHelper.isCopular(((VPPhraseSpec)verbElement).getVerb())) && !phrase.getFeatureAsBoolean(Feature.PROGRESSIVE) && !phrase.hasFeature(Feature.MODAL) && !Tense.FUTURE.Equals(phrase.getFeature(Feature.TENSE)) && !phrase.getFeatureAsBoolean(Feature.NEGATED) && !phrase.getFeatureAsBoolean(Feature.PASSIVE))
            {
                addDoAuxiliary(phrase, parent, phraseFactory, realisedElement);
            }
            else
            {
                splitVerb = realiseSubjects(phrase, parent);
            }
            return(splitVerb);
        }
Example #2
0
        /**
         * Controls the realisation of <em>wh</em> object questions.
         *
         * @param keyword
         *            the wh word
         * @param phrase
         *            the <code>PhraseElement</code> representing this clause.
         * @param parent
         *            the parent <code>SyntaxProcessor</code> that will do the
         *            realisation of the complementiser.
         * @param realisedElement
         *            the current realisation of the clause.
         * @param phraseFactory
         *            the phrase factory to be used.
         * @param subjects
         *            the <code>List</code> of subjects in the clause.
         * @return an <code>NLGElement</code> representing a subject that should
         *         split the verb
         */
        private static NLGElement realiseObjectWHInterrogative(string keyword, PhraseElement phrase, SyntaxProcessor parent, ListElement realisedElement, NLGFactory phraseFactory)
        {
            NLGElement splitVerb = null;

            realiseInterrogativeKeyWord(keyword, new LexicalCategory(LexicalCategory.LexicalCategoryEnum.PRONOUN), parent, realisedElement, phraseFactory);             //$NON-NLS-1$


            // if (!Tense.FUTURE.equals(phrase.getFeature(Feature.TENSE)) && !copular) {
            if (!hasAuxiliary(phrase) && !VerbPhraseHelper.isCopular(phrase))
            {
                addDoAuxiliary(phrase, parent, phraseFactory, realisedElement);
            }
            else if (!phrase.getFeatureAsBoolean(Feature.PASSIVE))
            {
                splitVerb = realiseSubjects(phrase, parent);
            }

            return(splitVerb);
        }
        /**
         * Realises a phrase element.
         *
         * @param phrase
         *            the element to be realised
         * @return the realised element.
         */
        private NLGElement realisePhraseElement(PhraseElement phrase)
        {
            NLGElement realisedElement = null;

            if (phrase != null)
            {
                ElementCategory category = phrase.Category;

                if (category is PhraseCategory)
                {
                    switch (((PhraseCategory)category).GetPhraseCategory())
                    {
                    case PhraseCategory.PhraseCategoryEnum.CLAUSE:
                        realisedElement = ClauseHelper.realise(this, phrase);
                        break;

                    case PhraseCategory.PhraseCategoryEnum.NOUN_PHRASE:
                        realisedElement = NounPhraseHelper.realise(this, phrase);
                        break;

                    case PhraseCategory.PhraseCategoryEnum.VERB_PHRASE:
                        realisedElement = VerbPhraseHelper.realise(this, phrase);
                        break;

                    case PhraseCategory.PhraseCategoryEnum.PREPOSITIONAL_PHRASE:
                    case PhraseCategory.PhraseCategoryEnum.ADJECTIVE_PHRASE:
                    case PhraseCategory.PhraseCategoryEnum.ADVERB_PHRASE:
                        realisedElement = PhraseHelper.realise(this, phrase);
                        break;

                    default:
                        realisedElement = phrase;
                        break;
                    }
                }
            }

            return(realisedElement);
        }