/** * Pushes the front verb onto the stack of verb components. * * @param phrase * the <code>PhraseElement</code> representing this noun phrase. * @param vgComponents * the stack of verb components in the verb group. * @param frontVG * the first verb in the verb group. * @param formValue * the <code>Form</code> of the phrase. * @param interrogative * <code>true</code> if the phrase is interrogative. */ private static void pushFrontVerb(PhraseElement phrase, Stack <INLGElement> vgComponents, INLGElement frontVG, object formValue, bool interrogative) { var interrogType = phrase.getFeature(Feature.INTERROGATIVE_TYPE.ToString()); if (Form.GERUND.Equals(formValue)) { frontVG.setFeature(Feature.FORM.ToString(), Form.PRESENT_PARTICIPLE); vgComponents.push(frontVG); } else if (Form.PAST_PARTICIPLE.Equals(formValue)) { frontVG.setFeature(Feature.FORM.ToString(), Form.PAST_PARTICIPLE); vgComponents.push(frontVG); } else if (Form.PRESENT_PARTICIPLE.Equals(formValue)) { frontVG.setFeature(Feature.FORM.ToString(), Form.PRESENT_PARTICIPLE); vgComponents.push(frontVG); } else if ((!(formValue == null || Form.NORMAL.Equals(formValue)) || interrogative) && !isCopular(phrase.getHead()) && vgComponents.isEmpty()) { // AG: fix below: if interrogative, only set non-morph feature in // case it's not WHO_SUBJECT OR WHAT_SUBJECT if (!(InterrogativeType.WHO_SUBJECT.Equals(interrogType) || InterrogativeType.WHAT_SUBJECT .Equals(interrogType))) { frontVG.setFeature(InternalFeature.NON_MORPH.ToString(), true); } vgComponents.push(frontVG); } else { var numToUse = determineNumber(phrase.getParent(), phrase); frontVG.setFeature(Feature.TENSE.ToString(), phrase.getFeatureTense(Feature.TENSE.ToString())); frontVG.setFeature(Feature.PERSON.ToString(), phrase .getFeature(Feature.PERSON.ToString())); frontVG.setFeature(Feature.NUMBER.ToString(), numToUse); //don't push the front VG if it's a negated interrogative WH object question if (!(phrase.getFeatureAsBoolean(Feature.NEGATED.ToString()) && (InterrogativeType.WHO_OBJECT .Equals(interrogType) || InterrogativeType.WHAT_OBJECT .Equals(interrogType)))) { vgComponents.push(frontVG); } } }
/** * This is the main controlling method for handling interrogative clauses. * The actual steps taken are dependent on the type of question being asked. * 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. * @return an <code>NLGElement</code> representing a subject that should * split the verb */ private static INLGElement realiseInterrogative(PhraseElement phrase, SyntaxProcessor parent, ListElement realisedElement, NLGFactory phraseFactory, INLGElement verbElement) { INLGElement splitVerb = null; if (phrase.getParent() != null) { phrase.getParent().setFeature(InternalFeature.INTERROGATIVE.ToString(), true); } var type = phrase.getFeature(Feature.INTERROGATIVE_TYPE.ToString()); if (type is InterrogativeType) { switch ((InterrogativeType)type) { case InterrogativeType.YES_NO: splitVerb = realiseYesNo(phrase, parent, verbElement, phraseFactory, realisedElement); break; case InterrogativeType.WHO_SUBJECT: case InterrogativeType.WHAT_SUBJECT: realiseInterrogativeKeyWord(((InterrogativeType)type).getString(), new LexicalCategory_PRONOUN(), parent, realisedElement, phraseFactory); phrase.removeFeature(InternalFeature.SUBJECTS.ToString()); break; case InterrogativeType.HOW_MANY: realiseInterrogativeKeyWord("how", new LexicalCategory_PRONOUN(), parent, realisedElement, phraseFactory); realiseInterrogativeKeyWord("many", new LexicalCategory_ADVERB(), parent, realisedElement, phraseFactory); break; case InterrogativeType.HOW: case InterrogativeType.WHY: case InterrogativeType.WHERE: case InterrogativeType.WHO_OBJECT: case InterrogativeType.WHO_INDIRECT_OBJECT: case InterrogativeType.WHAT_OBJECT: splitVerb = realiseObjectWHInterrogative(((InterrogativeType)type).getString(), phrase, parent, realisedElement, phraseFactory); break; case InterrogativeType.HOW_PREDICATE: splitVerb = realiseObjectWHInterrogative("how", phrase, parent, realisedElement, phraseFactory); break; default: break; } } return(splitVerb); }