Package simplenlg.phrasespec

Examples of simplenlg.phrasespec.AdjPhraseSpec


    NLGFactory nlgFactory = new NLGFactory(lexicon);             // factory based on lexicon

    // 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
View Full Code Here


      }

      // Adjective Phrase
      else if (wps instanceof simplenlg.xmlrealiser.wrapper.XmlAdjPhraseSpec) {
        simplenlg.xmlrealiser.wrapper.XmlAdjPhraseSpec wp = (simplenlg.xmlrealiser.wrapper.XmlAdjPhraseSpec) wps;
        AdjPhraseSpec p = factory.createAdjectivePhrase(head);
        hp = p;

        p.setFeature(Feature.IS_COMPARATIVE, wp.isISCOMPARATIVE());
        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

   * @param adjective
   *            the main adjective for this phrase.
   * @return a <code>AdjPhraseSpec</code> representing this phrase.
   */
  public AdjPhraseSpec createAdjectivePhrase(Object adjective) {
    AdjPhraseSpec phraseElement = new AdjPhraseSpec(this);

    NLGElement adjectiveElement = createNLGElement(adjective,
        LexicalCategory.ADJECTIVE);
    setPhraseHead(phraseElement, adjectiveElement);

View Full Code Here

TOP

Related Classes of simplenlg.phrasespec.AdjPhraseSpec

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.