001 /** 002 * Paragraph.java 003 * jCOLIBRI2 framework. 004 * @author Juan A. Recio-García. 005 * GAIA - Group for Artificial Intelligence Applications 006 * http://gaia.fdi.ucm.es 007 * 15/06/2007 008 */ 009 package jcolibri.extensions.textual.IE.representation; 010 011 import java.util.ArrayList; 012 import java.util.List; 013 014 /** 015 * Represents a paragraph of the text. It is composed by sentences. 016 * @author Juan A. Recio-Garcia 017 * @version 1.0 018 * @see jcolibri.extensions.textual.IE.representation.Sentence 019 */ 020 public class Paragraph { 021 022 protected List<Sentence> sentences; 023 024 String text; 025 026 /** 027 * Creates a paragraph object that representes the text of the parameter. 028 */ 029 public Paragraph(String text) 030 { 031 this.text = text; 032 this.sentences = new ArrayList<Sentence>(); 033 } 034 035 /** 036 * Returns the original text of the paragraph 037 */ 038 public String getRawContent() 039 { 040 return text; 041 } 042 043 044 /** 045 * Returns the sentences 046 */ 047 public List<Sentence> getSentences() { 048 return sentences; 049 } 050 051 /** 052 * Adds sentences 053 */ 054 public void addSentences(List<Sentence> sentences) { 055 this.sentences.addAll(sentences); 056 } 057 058 /** 059 * Adds a sentence 060 */ 061 public void addSentence(Sentence sentence){ 062 this.sentences.add(sentence); 063 } 064 065 /** 066 * Prints the content and annotations. 067 */ 068 public String toString() 069 { 070 StringBuffer sb = new StringBuffer(); 071 sb.append("PARAGRAPH begin\n"); 072 for(Sentence sent: sentences) 073 sb.append(sent.toString()); 074 sb.append("PARAGRAPH end\n"); 075 return sb.toString(); 076 } 077 078 }