Class TextDocument

java.lang.Object
com.kohlschutter.boilerpipe.document.TextDocument
All Implemented Interfaces:
Cloneable

public class TextDocument extends Object implements Cloneable
A text document, consisting of one or more TextBlocks.
  • Field Details

  • Constructor Details

    • TextDocument

      public TextDocument(List<TextBlock> textBlocks)
      Creates a new TextDocument with given TextBlocks, and no title.
      Parameters:
      textBlocks - The text blocks of this document.
    • TextDocument

      public TextDocument(String title, List<TextBlock> textBlocks)
      Creates a new TextDocument with given TextBlocks and given title.
      Parameters:
      title - The "main" title for this text document.
      textBlocks - The text blocks of this document.
  • Method Details

    • getTextBlocks

      public List<TextBlock> getTextBlocks()
      Returns the TextBlocks of this document.
      Returns:
      A list of TextBlocks, in sequential order of appearance.
    • getTitle

      public String getTitle()
      Returns the "main" title for this document, or null if no such title has ben set.
      Returns:
      The "main" title.
    • setTitle

      public void setTitle(String title)
      Updates the "main" title for this document.
      Parameters:
      title -
    • getContent

      public String getContent()
      Returns the TextDocument's content.
      Returns:
      The content text.
    • getText

      public String getText(boolean includeContent, boolean includeNonContent)
      Returns the TextDocument's content, non-content or both
      Parameters:
      includeContent - Whether to include TextBlocks marked as "content".
      includeNonContent - Whether to include TextBlocks marked as "non-content".
      Returns:
      The text.
    • debugString

      public String debugString()
      Returns detailed debugging information about the contained TextBlocks.
      Returns:
      Debug information.
    • clone

      public TextDocument clone()
      Overrides:
      clone in class Object