public virtual void testNoDoubledCommas() { NPPhraseSpec subject = phraseFactory.createNounPhrase("I"); NPPhraseSpec @object = phraseFactory.createNounPhrase("a bag"); SPhraseSpec _s1 = phraseFactory.createClause(subject, "carry", @object); PPPhraseSpec pp1 = phraseFactory.createPrepositionPhrase("on", phraseFactory.createNounPhrase("most", "Tuesdays")); _s1.addFrontModifier(pp1); PPPhraseSpec pp2 = phraseFactory.createPrepositionPhrase("since", phraseFactory.createNounPhrase("1991")); PPPhraseSpec pp3 = phraseFactory.createPrepositionPhrase("except", phraseFactory.createNounPhrase("yesterday")); pp2.setFeature(Feature.APPOSITIVE, true); pp3.setFeature(Feature.APPOSITIVE, true); pp1.addPostModifier(pp2); pp1.addPostModifier(pp3); realiser.CommaSepCuephrase = true; Assert.AreEqual("on most Tuesdays, since 1991, except yesterday, I carry a bag", realiser.realise(_s1).Realisation); // without my fix (that we're testing here), you'd end up with // "on most Tuesdays, since 1991,, except yesterday, I carry a bag" }
public virtual void testCommaSeparatedFrontModifiers() { NPPhraseSpec subject = phraseFactory.createNounPhrase("I"); NPPhraseSpec @object = phraseFactory.createNounPhrase("a bag"); SPhraseSpec _s1 = phraseFactory.createClause(subject, "carry", @object); // add a PP complement PPPhraseSpec pp1 = phraseFactory.createPrepositionPhrase("on", phraseFactory.createNounPhrase("most", "Tuesdays")); _s1.addFrontModifier(pp1); PPPhraseSpec pp2 = phraseFactory.createPrepositionPhrase("since", phraseFactory.createNounPhrase("1991")); _s1.addFrontModifier(pp2); pp1.setFeature(Feature.APPOSITIVE, true); pp2.setFeature(Feature.APPOSITIVE, true); //without setCommaSepCuephrase Assert.AreEqual("on most Tuesdays since 1991 I carry a bag", realiser.realise(_s1).Realisation); //with setCommaSepCuephrase realiser.CommaSepCuephrase = true; Assert.AreEqual("on most Tuesdays, since 1991, I carry a bag", realiser.realise(_s1).Realisation); }
public virtual void testPassiveWithPPCompl() { // passive with just complement NPPhraseSpec subject = phraseFactory.createNounPhrase("wave"); subject.setFeature(Feature.NUMBER, NumberAgreement.PLURAL); NPPhraseSpec @object = phraseFactory.createNounPhrase("surfer"); @object.setFeature(Feature.NUMBER, NumberAgreement.PLURAL); SPhraseSpec _s1 = phraseFactory.createClause(subject, "carry", @object); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ // add a PP complement PPPhraseSpec pp = phraseFactory.createPrepositionPhrase("to", phraseFactory.createNounPhrase("the", "shore")); pp.setFeature(InternalFeature.DISCOURSE_FUNCTION, DiscourseFunction.INDIRECT_OBJECT); _s1.addComplement(pp); _s1.setFeature(Feature.PASSIVE, true); Assert.AreEqual("surfers are carried to the shore by waves", realiser.realise(_s1).Realisation); //$NON-NLS-1$ }
public virtual void testAppositivePreModifiers() { NPPhraseSpec subject = phraseFactory.createNounPhrase("I"); NPPhraseSpec @object = phraseFactory.createNounPhrase("a bag"); SPhraseSpec _s1 = phraseFactory.createClause(subject, "carry", @object); // add a PP complement PPPhraseSpec pp = phraseFactory.createPrepositionPhrase("on", phraseFactory.createNounPhrase("most", "Tuesdays")); _s1.addPreModifier(pp); //without appositive feature on pp Assert.AreEqual("I on most Tuesdays carry a bag", realiser.realise(_s1).Realisation); //with appositive feature pp.setFeature(Feature.APPOSITIVE, true); Assert.AreEqual("I, on most Tuesdays, carry a bag", realiser.realise(_s1).Realisation); }