Package simplenlg.phrasespec

Examples of simplenlg.phrasespec.PPPhraseSpec


    vp1.addComplement(np1);

    // second VP
    VPPhraseSpec vp2 = this.phraseFactory.createVerbPhrase(this.lexicon
        .getWord("go", LexicalCategory.VERB));
    PPPhraseSpec pp = this.phraseFactory
        .createPrepositionPhrase("into", this.lexicon.getWord(
            "cardiogenic shock", LexicalCategory.NOUN));
    vp2.addComplement(pp);

    // coordinate
View Full Code Here


    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);

    SPhraseSpec johnGoToThePark = nlgFactory.createClause("John",      // create sentence
        "go", toThePark);
View Full Code Here

    NPPhraseSpec place = nlgFactory.createNounPhrase( "park" ) ;
    SPhraseSpec pB = nlgFactory.createClause( "Mary", "chase", "the monkey" ) ;
   
    // next line is depreciated ~ may be corrected in the API
    place.setDeterminer( "the" ) ;
    PPPhraseSpec pp = nlgFactory.createPrepositionPhrase( ) ;
    pp.addComplement( place ) ;
    pp.setPreposition( "in" ) ;
   
    pB.addComplement( pp ) ;
   
    String outputB = realiser.realiseSentence( pB ) ;   
    Assert.assertEquals( "Mary chases the monkey in park.", outputB ) // NB missing the determiner "the" !! 
View Full Code Here

        p.setFeature(Feature.IS_SUPERLATIVE, wp.isISSUPERLATIVE());
      }

      // Prepositional Phrase
      else if (wps instanceof simplenlg.xmlrealiser.wrapper.XmlPPPhraseSpec) {
        PPPhraseSpec p = factory.createPrepositionPhrase(head);
        hp = p;
      }

      // Adverb Phrase
      else if (wps instanceof simplenlg.xmlrealiser.wrapper.XmlAdvPhraseSpec) {
        simplenlg.xmlrealiser.wrapper.XmlAdvPhraseSpec wp = (simplenlg.xmlrealiser.wrapper.XmlAdvPhraseSpec) wps;
        AdvPhraseSpec p = factory.createAdverbPhrase();
        p.setHead(head);
        hp = p;
        p.setFeature(Feature.IS_COMPARATIVE, wp.isISCOMPARATIVE());
        p.setFeature(Feature.IS_SUPERLATIVE, wp.isISSUPERLATIVE());
      }

      // Verb Phrase
      else if (wps instanceof simplenlg.xmlrealiser.wrapper.XmlVPPhraseSpec) {
        simplenlg.xmlrealiser.wrapper.XmlVPPhraseSpec wp = (simplenlg.xmlrealiser.wrapper.XmlVPPhraseSpec) wps;
View Full Code Here

   * @return a <code>PPPhraseSpec</code> representing this phrase.
   */
  public PPPhraseSpec createPrepositionPhrase(Object preposition,
      Object complement) {

    PPPhraseSpec phraseElement = new PPPhraseSpec(this);

    NLGElement prepositionalElement = createNLGElement(preposition,
        LexicalCategory.PREPOSITION);
    setPhraseHead(phraseElement, prepositionalElement);

View Full Code Here

TOP

Related Classes of simplenlg.phrasespec.PPPhraseSpec

Copyright © 2018 www.massapicom. 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.