Package simplenlg.framework

Examples of simplenlg.framework.DocumentElement.addComponent()


  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


    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

  /**
   * Tests for lists and embedded lists
   */
  public void testListItems() {
    DocumentElement list = this.phraseFactory.createList();
    list.addComponent(this.phraseFactory.createListItem(p1));
    list.addComponent(this.phraseFactory.createListItem(p2));
    list.addComponent(this.phraseFactory.createListItem(this.phraseFactory
        .createCoordinatedPhrase(p1, p2)));
    String realisation = this.realiser.realise(list).getRealisation();
    Assert.assertEquals(
View Full Code Here

   * Tests for lists and embedded lists
   */
  public void testListItems() {
    DocumentElement list = this.phraseFactory.createList();
    list.addComponent(this.phraseFactory.createListItem(p1));
    list.addComponent(this.phraseFactory.createListItem(p2));
    list.addComponent(this.phraseFactory.createListItem(this.phraseFactory
        .createCoordinatedPhrase(p1, p2)));
    String realisation = this.realiser.realise(list).getRealisation();
    Assert.assertEquals(
        "* you are happy\n* I am sad\n* you are happy and I am sad\n",
View Full Code Here

   */
  public void testListItems() {
    DocumentElement list = this.phraseFactory.createList();
    list.addComponent(this.phraseFactory.createListItem(p1));
    list.addComponent(this.phraseFactory.createListItem(p2));
    list.addComponent(this.phraseFactory.createListItem(this.phraseFactory
        .createCoordinatedPhrase(p1, p2)));
    String realisation = this.realiser.realise(list).getRealisation();
    Assert.assertEquals(
        "* you are happy\n* I am sad\n* you are happy and I am sad\n",
        realisation);
View Full Code Here

    StringElement hePlayed = new StringElement("he played");       
    StringElement there = new StringElement("there");
    WordElement football = new WordElement("football");

    DocumentElement sentence2 = nlgFactory.createSentence();
    sentence2.addComponent(hePlayed);
    sentence2.addComponent(football);
    sentence2.addComponent(there);

    // now create a paragraph which contains these sentences
    DocumentElement paragraph = nlgFactory.createParagraph();
View Full Code Here

    StringElement there = new StringElement("there");
    WordElement football = new WordElement("football");

    DocumentElement sentence2 = nlgFactory.createSentence();
    sentence2.addComponent(hePlayed);
    sentence2.addComponent(football);
    sentence2.addComponent(there);

    // now create a paragraph which contains these sentences
    DocumentElement paragraph = nlgFactory.createParagraph();
    paragraph.addComponent(sentence);
View Full Code Here

    WordElement football = new WordElement("football");

    DocumentElement sentence2 = nlgFactory.createSentence();
    sentence2.addComponent(hePlayed);
    sentence2.addComponent(football);
    sentence2.addComponent(there);

    // now create a paragraph which contains these sentences
    DocumentElement paragraph = nlgFactory.createParagraph();
    paragraph.addComponent(sentence);
    paragraph.addComponent(sentence2);
View Full Code Here

    sentence2.addComponent(football);
    sentence2.addComponent(there);

    // now create a paragraph which contains these sentences
    DocumentElement paragraph = nlgFactory.createParagraph();
    paragraph.addComponent(sentence);
    paragraph.addComponent(sentence2);

    // create a realiser.  Note that a lexicon is specified, this should be
    // the same one used by the NLGFactory
    Realiser realiser = new Realiser(lexicon);
View Full Code Here

    sentence2.addComponent(there);

    // now create a paragraph which contains these sentences
    DocumentElement paragraph = nlgFactory.createParagraph();
    paragraph.addComponent(sentence);
    paragraph.addComponent(sentence2);

    // create a realiser.  Note that a lexicon is specified, this should be
    // the same one used by the NLGFactory
    Realiser realiser = new Realiser(lexicon);
    //realiser.setDebugMode(true);     // uncomment this to print out debug info during realisation
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.