Examples of VPPhraseSpec


Examples of simplenlg.phrasespec.VPPhraseSpec

  public void testMultipleAdvPremodifiers() { 
    AdvPhraseSpec adv1 =this.phraseFactory.createAdverbPhrase("slowly");
    AdvPhraseSpec adv2 =this.phraseFactory.createAdverbPhrase("discretely");

    //case 1: concatenated premods: should have comma
    VPPhraseSpec vp = this.phraseFactory.createVerbPhrase("run");
    vp.addPreModifier(adv1);
    vp.addPreModifier(adv2);
    Assert.assertEquals("slowly, discretely runs", this.realiser.realise(vp).getRealisation());
       
    //case 2: coordinated premods: no comma
    VPPhraseSpec vp2 = this.phraseFactory.createVerbPhrase("eat");
    vp2.addPreModifier(this.phraseFactory.createCoordinatedPhrase(adv1, adv2));
    Assert.assertEquals("slowly and discretely eats", this.realiser.realise(vp2).getRealisation());
  }
View Full Code Here

Examples of simplenlg.phrasespec.VPPhraseSpec

  }

  public void testParticipleModifier() {
   
    String verb = "associate";
    VPPhraseSpec adjP = this.phraseFactory.createVerbPhrase(verb);
    adjP.setFeature(Feature.TENSE, Tense.PAST);
   
    NPPhraseSpec np = this.phraseFactory.createNounPhrase("a", "thrombus");
    np.addPreModifier(adjP);
    String realised = this.realiser.realise(np).getRealisation();
    System.out.println(realised);
View Full Code Here

Examples of simplenlg.phrasespec.VPPhraseSpec

    SPhraseSpec s = this.phraseFactory.createClause();

    s.setSubject(this.phraseFactory.createNounPhrase("the", "patient"));

    // first VP
    VPPhraseSpec vp1 = this.phraseFactory.createVerbPhrase(this.lexicon
        .getWord("have", LexicalCategory.VERB));
    NPPhraseSpec np1 = this.phraseFactory.createNounPhrase("a",
        this.lexicon.getWord("contrast media reaction",
            LexicalCategory.NOUN));
    np1.addPreModifier(this.lexicon.getWord("adverse",
        LexicalCategory.ADJECTIVE));
    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
    CoordinatedPhraseElement coord = this.phraseFactory
        .createCoordinatedPhrase(vp1, vp2);
    coord.setFeature(Feature.TENSE, Tense.PAST);
View Full Code Here

Examples of simplenlg.phrasespec.VPPhraseSpec

      NLGFactory nlgFactory = new NLGFactory( lexicon ) // factory based on lexicon
      Realiser realiser = new Realiser( lexicon ) ;
     
      NPPhraseSpec subject = nlgFactory.createNounPhrase( "Mary" ) ;
      NPPhraseSpec object = nlgFactory.createNounPhrase( "the monkey" ) ;
      VPPhraseSpec verb = nlgFactory.createVerbPhrase( "chase" ) ; ;
      subject.addModifier( "fast" ) ;
     
      SPhraseSpec p = nlgFactory.createClause( ) ;
      p.setSubject( subject ) ;
      p.setVerb( verb ) ;
      p.setObject( object ) ;
     
      String outputA = realiser.realiseSentence( p ) ;
      Assert.assertEquals( "Fast Mary chases the monkey.", outputA ) ;
     
      verb.addModifier( "quickly" ) ;
     
      String outputB = realiser.realiseSentence( p ) ;
      Assert.assertEquals( "Fast Mary quickly chases the monkey.", outputB ) ;
     } // testSection8
View Full Code Here

Examples of simplenlg.phrasespec.VPPhraseSpec

      NPPhraseSpec subject2 = nlgFactory.createNounPhrase( "your", "giraffe" ) ;
     
      // next line is not correct ~ should be nlgFactory.createCoordinatedPhrase ~ may be corrected in the API
      CoordinatedPhraseElement subj = nlgFactory.createCoordinatedPhrase( subject1, subject2 ) ;
     
      VPPhraseSpec verb = nlgFactory.createVerbPhrase( "chase" ) ; ;

      SPhraseSpec p = nlgFactory.createClause( ) ;
      p.setSubject( subj ) ;
      p.setVerb( verb ) ;
      p.setObject( "the monkey" ) ;
View Full Code Here

Examples of simplenlg.phrasespec.VPPhraseSpec

   * Some tests to check for an early bug which resulted in reduplication of
   * verb particles in the past tense e.g. "fall down down" or "creep up up"
   */
  @Test
  public void testVerbParticle() {
    VPPhraseSpec v = this.phraseFactory.createVerbPhrase("fall down"); //$NON-NLS-1$

    Assert.assertEquals(
        "down", v.getFeatureAsString(Feature.PARTICLE)); //$NON-NLS-1$

    Assert.assertEquals(
        "fall", ((WordElement) v.getVerb()).getBaseForm()); //$NON-NLS-1$

    v.setFeature(Feature.TENSE,Tense.PAST);
    v.setFeature(Feature.PERSON, Person.THIRD);
    v.setFeature(Feature.NUMBER, NumberAgreement.PLURAL);

    Assert.assertEquals(
        "fell down", this.realiser.realise(v).getRealisation()); //$NON-NLS-1$

    v.setFeature(Feature.FORM, Form.PAST_PARTICIPLE);
    Assert.assertEquals(
        "fallen down", this.realiser.realise(v).getRealisation()); //$NON-NLS-1$
  }
View Full Code Here

Examples of simplenlg.phrasespec.VPPhraseSpec

      }

      // Verb Phrase
      else if (wps instanceof simplenlg.xmlrealiser.wrapper.XmlVPPhraseSpec) {
        simplenlg.xmlrealiser.wrapper.XmlVPPhraseSpec wp = (simplenlg.xmlrealiser.wrapper.XmlVPPhraseSpec) wps;
        VPPhraseSpec p = factory.createVerbPhrase(head);
        hp = p;
        setVPFeatures(wp, p);
      }

      // Common phrase components.
View Full Code Here

Examples of simplenlg.phrasespec.VPPhraseSpec

   * @param verb
   *            the verb to be wrapped.
   * @return a <code>VPPhraseSpec</code> representing this phrase.
   */
  public VPPhraseSpec createVerbPhrase(Object verb) {
    VPPhraseSpec phraseElement = new VPPhraseSpec(this);
    phraseElement.setVerb(verb);
    setPhraseHead(phraseElement, phraseElement.getVerb());
    return phraseElement;
  }
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.