Package simplenlg.phrasespec

Examples of simplenlg.phrasespec.NPPhraseSpec.addModifier()


    // create sentences
    //   "John did not go to the bigger park. He played football there."
    NPPhraseSpec thePark = nlgFactory.createNounPhrase("the", "park");   // create an NP
    AdjPhraseSpec bigp = nlgFactory.createAdjectivePhrase("big");        // create AdjP
    bigp.setFeature(Feature.IS_COMPARATIVE, true);                       // use comparative form ("bigger")
    thePark.addModifier(bigp);                                        // add adj as modifier in NP
    // above relies on default placement rules.  You can force placement as a premodifier
    // (before head) by using addPreModifier
    PPPhraseSpec toThePark = nlgFactory.createPrepositionPhrase("to");    // create a PP
    toThePark.setObject(thePark);                                     // set PP object
    // could also just say nlgFactory.createPrepositionPhrase("to", the Park);
View Full Code Here


   
    sentence = phraseFactory.createClause();
    sentence.setVerb("be");
    NPPhraseSpec object = phraseFactory.createNounPhrase("example");
    object.setPlural(true);
    object.addModifier("of jobs");
    sentence.setFeature(Feature.INTERROGATIVE_TYPE, InterrogativeType.WHAT_SUBJECT);
    sentence.setObject(object);
    Assert.assertEquals("What are examples of jobs?", realiser.realiseSentence(sentence));
   
    SPhraseSpec p = phraseFactory.createClause();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.