/** * 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 INLGElement realiseYesNo(PhraseElement phrase, SyntaxProcessor parent, INLGElement verbElement, NLGFactory phraseFactory, ListElement realisedElement) { INLGElement splitVerb = null; if (!(verbElement is VPPhraseSpec && VerbPhraseHelper.isCopular(((VPPhraseSpec)verbElement).getVerb())) && !phrase.getFeatureAsBoolean(Feature.PROGRESSIVE.ToString()) && !phrase.hasFeature(Feature.MODAL.ToString()) && !Tense.FUTURE.Equals(phrase.getFeatureTense(Feature.TENSE.ToString())) && !phrase.getFeatureAsBoolean(Feature.NEGATED.ToString()) && !phrase.getFeatureAsBoolean(Feature.PASSIVE.ToString())) { addDoAuxiliary(phrase, parent, phraseFactory, realisedElement); } else { splitVerb = realiseSubjects(phrase, parent); } return(splitVerb); }
/** * 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 INLGElement realiseObjectWHInterrogative(string keyword, PhraseElement phrase, SyntaxProcessor parent, ListElement realisedElement, NLGFactory phraseFactory) { INLGElement splitVerb = null; realiseInterrogativeKeyWord(keyword, new LexicalCategory_PRONOUN(), parent, realisedElement, phraseFactory); // 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.ToString())) { splitVerb = realiseSubjects(phrase, parent); } return(splitVerb); }
/** * Realises a phrase element. * * @param phrase * the element to be realised * @return the realised element. */ private INLGElement realisePhraseElement(PhraseElement phrase) { //Debug.WriteLine($"realise phrase element {phrase}"); INLGElement realisedElement = null; if (phrase != null) { var category = phrase.getCategory(); realisedElement = phrase; if (category is IPhraseCategory) { switch ((PhraseCategoryEnum)category.enumType) { case PhraseCategoryEnum.CLAUSE: realisedElement = ClauseHelper.realise(this, phrase); break; case PhraseCategoryEnum.NOUN_PHRASE: realisedElement = NounPhraseHelper.realise(this, phrase); break; case PhraseCategoryEnum.VERB_PHRASE: realisedElement = VerbPhraseHelper.realise(this, phrase); break; case PhraseCategoryEnum.PREPOSITIONAL_PHRASE: case PhraseCategoryEnum.ADJECTIVE_PHRASE: case PhraseCategoryEnum.ADVERB_PHRASE: realisedElement = PhraseHelper.realise(this, phrase); break; } } } return(realisedElement); }