Package simplenlg.framework

Examples of simplenlg.framework.DocumentElement


    // Set 'be' to 'was' as past tense
    clause.setFeature(Feature.TENSE,Tense.PAST);

    // Add the clause to a sentence.
    DocumentElement sentence1 = docFactory.createSentence(clause);

    // Realise the sentence
    NLGElement realised = this.realiser.realise(sentence1);

    // Retrieve the realisation and dump it to the console
View Full Code Here


    // Set 'be' to 'was' as past tense
    clause.setFeature(Feature.TENSE,Tense.PAST);
   
    // Add the clause to a sentence.
    DocumentElement sentence1 = docFactory.createSentence(clause);

    // Realise the sentence
    NLGElement realised = this.realiser.realise(sentence1);

    // Retrieve the realisation and dump it to the console
View Full Code Here

    PhraseElement theHouse = phraseFactory.createNounPhrase("the", "house");
    theHouse.addComplement(born);

    PhraseElement clause = phraseFactory.createClause(theHouse, "be", phraseFactory.createPrepositionPhrase("in", "Edinburgh"));
    DocumentElement sentence = docFactory.createSentence(clause);
    NLGElement realised = realiser.realise(sentence);
//    System.out.println(realised.getRealisation());

    // Retrieve the realisation and dump it to the console
    Assert.assertEquals("The house which Dave Bus was born in is in Edinburgh.",
View Full Code Here

    PhraseElement theHouse = phraseFactory.createNounPhrase("the", "house");
    theHouse.addComplement(born);

    PhraseElement clause = phraseFactory.createClause(theHouse, "be", phraseFactory.createPrepositionPhrase("in", "Edinburgh"));
    DocumentElement sentence = docFactory.createSentence(clause);
   
    NLGElement realised = realiser.realise(sentence);
//    System.out.println(realised.getRealisation());

    // Retrieve the realisation and dump it to the console
View Full Code Here

    // Possibly progressive as well not sure.
    outer.setFeature(Feature.PROGRESSIVE,true);
   
    //Outer clause postmodifier would be 'tomorrow'
    outer.addPostModifier("tomorrow");
    DocumentElement sentence = docFactory.createSentence(outer);
    NLGElement realised = realiser.realise(sentence);
//    System.out.println(realised.getRealisation());

    // Retrieve the realisation and dump it to the console
    Assert.assertEquals("The engineer whom I am making sentence for will be going to holidays tomorrow.",
View Full Code Here

    outer.addPostModifier("since 1986");
   
    outer.setFeature(Feature.PASSIVE, true);
    outer.setFeature(Feature.PERFECT, true);
   
    DocumentElement sentence = docFactory.createSentence(outer);
    NLGElement realised = realiser.realise(sentence);
//    System.out.println(realised.getRealisation());

    // Retrieve the realisation and dump it to the console
    Assert.assertEquals("The house where I played poker has been abandoned since 1986.",
View Full Code Here

    //
    second.setFeature(Feature.COMPLEMENTISER, "when");
   
    first.addComplement(second);
   
    DocumentElement sentence = docFactory.createSentence(first);
    NLGElement realised = realiser.realise(sentence);
//    System.out.println(realised.getRealisation());

    // Retrieve the realisation and dump it to the console
    Assert.assertEquals("I was making sandwiches when the mayonnaise ran out.",
View Full Code Here

  /**
   * Basic tests.
   */
  @Test
  public void testBasics() {
    DocumentElement s1 = this.phraseFactory.createSentence(p1);
    DocumentElement s2 = this.phraseFactory.createSentence(p2);
    DocumentElement s3 = this.phraseFactory.createSentence(p3);

    DocumentElement par1 = this.phraseFactory.createParagraph(Arrays
        .asList(s1, s2, s3));

    Assert.assertEquals("You are happy. I am sad. They are nervous.\n\n",
        this.realiser.realise(par1).getRealisation());

View Full Code Here

  /**
   * test whether sents can be embedded in a section without intervening paras
   */
  @Test
  public void testEmbedding() {
    DocumentElement sent = phraseFactory.createSentence("This is a test");
    DocumentElement sent2 = phraseFactory.createSentence(phraseFactory
        .createClause("John", "be", "missing"));
    DocumentElement section = phraseFactory.createSection("SECTION TITLE");
    section.addComponent(sent);
    section.addComponent(sent2);

    Assert.assertEquals(
        "SECTION TITLE\nThis is a test.\n\nJohn is missing.\n\n",
        this.realiser.realise(section).getRealisation());
  }
View Full Code Here

  }

  @Test
  public void testSections() {
    // doc which contains a section, and two paras
    DocumentElement doc = this.phraseFactory
        .createDocument("Test Document");

    DocumentElement section = this.phraseFactory
        .createSection("Test Section");
    doc.addComponent(section);

    DocumentElement para1 = this.phraseFactory.createParagraph();
    DocumentElement sent1 = this.phraseFactory
        .createSentence("This is the first test paragraph");
    para1.addComponent(sent1);
    section.addComponent(para1);

    DocumentElement para2 = this.phraseFactory.createParagraph();
    DocumentElement sent2 = this.phraseFactory
        .createSentence("This is the second test paragraph");
    para2.addComponent(sent2);
    section.addComponent(para2);

    Assert
View Full Code Here

TOP

Related Classes of simplenlg.framework.DocumentElement

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.