Package simplenlg.lexicon

Examples of simplenlg.lexicon.Lexicon


    // below is a simple complete example of using simplenlg V4
    // afterwards is an example of using simplenlg just for morphology
   
    // set up
    Lexicon lexicon = new XMLLexicon();                          // default simplenlg lexicon
    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


  /**
   * test section 3 code
   */
  @Test
  public void testSection3() {
    Lexicon lexicon = Lexicon.getDefaultLexicon();                         // default simplenlg lexicon
    NLGFactory nlgFactory = new NLGFactory(lexicon);             // factory based on lexicon

    NLGElement s1 = nlgFactory.createSentence("my dog is happy");
   
    Realiser r = new Realiser(lexicon);

  /**
   * test section 5 code
   */
  @Test
  public void testSection5() {
    Lexicon lexicon = Lexicon.getDefaultLexicon();                         // default simplenlg lexicon
    NLGFactory nlgFactory = new NLGFactory(lexicon);             // factory based on lexicon
    Realiser realiser = new Realiser(lexicon);
   
    SPhraseSpec p = nlgFactory.createClause();
    p.setSubject("my dog");

  /**
   * test section 6 code
   */
  @Test
  public void testSection6() {
    Lexicon lexicon = Lexicon.getDefaultLexicon();                         // default simplenlg lexicon
    NLGFactory nlgFactory = new NLGFactory(lexicon);             // factory based on lexicon
    Realiser realiser = new Realiser(lexicon);
   
    SPhraseSpec p = nlgFactory.createClause();
    p.setSubject("Mary");

  /**
   * test ability to use variant words
   */
  @Test
  public void testVariants() {
    Lexicon lexicon = Lexicon.getDefaultLexicon();                         // default simplenlg lexicon
    NLGFactory nlgFactory = new NLGFactory(lexicon);             // factory based on lexicon
    Realiser realiser = new Realiser(lexicon);
   
    SPhraseSpec p = nlgFactory.createClause();
    p.setSubject("my dog");

  /**
   * test section 5 to match simplenlg tutorial version 4's code
   */
  @Test
    public void testSection5A( ) {
      Lexicon lexicon = Lexicon.getDefaultLexicon( ) ;      // default simplenlg lexicon
      NLGFactory nlgFactory = new NLGFactory( lexicon ) // factory based on lexicon
      Realiser realiser = new Realiser( lexicon ) ;
     
      SPhraseSpec p = nlgFactory.createClause( ) ;
      p.setSubject( "Mary" ) ;

  /**
   * test section 6 to match simplenlg tutorial version 4' code
   */
  @Test
  public void testSection6A( ) {
    Lexicon lexicon = Lexicon.getDefaultLexicon( ) ;    // default simplenlg lexicon
    NLGFactory nlgFactory = new NLGFactory( lexicon ) // factory based on lexicon
    Realiser realiser = new Realiser( lexicon ) ;
 
    SPhraseSpec p = nlgFactory.createClause( ) ;
    p.setSubject( "Mary" ) ;

  /**
   * test section 7 code
   */
  @Test
    public void testSection7( ) {
      Lexicon lexicon = Lexicon.getDefaultLexicon( ) ;      // default simplenlg lexicon
      NLGFactory nlgFactory = new NLGFactory( lexicon ) // factory based on lexicon
      Realiser realiser = new Realiser( lexicon ) ;
     
      SPhraseSpec p = nlgFactory.createClause( ) ;
      p.setSubject( "Mary" ) ;

  /**
   * test section 8 code
   */
  @Test
    public void testSection8( ) {
      Lexicon lexicon = Lexicon.getDefaultLexicon( ) ;      // default simplenlg lexicon
      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" ) ;

  /**
   * test section 10 code
   */
  @Test
    public void testSection10( ) {
      Lexicon lexicon = Lexicon.getDefaultLexicon( ) ;      // default simplenlg lexicon
      NLGFactory nlgFactory = new NLGFactory( lexicon ) // factory based on lexicon
      Realiser realiser = new Realiser( lexicon ) ;
     
      NPPhraseSpec subject1 = nlgFactory.createNounPhrase( "Mary" ) ;
      NPPhraseSpec subject2 = nlgFactory.createNounPhrase( "your", "giraffe" ) ;

TOP

Related Classes of simplenlg.lexicon.Lexicon

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.