Skip to content

PipelineBuilder

Sean Finan edited this page Feb 9, 2026 · 1 revision

final public class PipelineBuilder

Creates a pipeline using a small set of simple methods.

Some methods are order-specific and calls will directly impact ordering within the pipeline.

  • Author: SPF , chip-nlp
  • Version: %I%
  • Since: 10/9/2016

public PipelineBuilder set( final Object... parameters )

Use of this method is order-specific

  • Parameters:
    • parameters add ae parameter name value pairs
  • Returns: this PipelineBuilder

public PipelineBuilder setIfEmpty( final Object... parameters )

Use of this method is order-specific. If any given parameter is already set it is ignored.

  • Parameters:
    • parameters add ae parameter name value pairs
  • Returns: this PipelineBuilder

public PipelineBuilder reader( final CollectionReaderDescription description )

Use of this method is not order-specific

  • Parameters:
    • description Collection Reader Description to place at the beginning of the pipeline
  • Returns: this PipelineBuilder

public PipelineBuilder reader( final Class<? extends CollectionReader> readerClass, final Object... parameters ) throws UIMAException

Use of this method is not order-specific

  • Parameters:
    • readerClass Collection Reader class to place at the beginning of the pipeline
    • parameters reader parameter name value pairs. May be empty.
  • Returns: this PipelineBuilder

public PipelineBuilder readFiles() throws UIMAException

Adds a Collection reader to the beginning of the pipeline that will read files in a directory tree. Relies upon {@link org.apache.ctakes.core.config.ConfigParameterConstants#PARAM_INPUTDIR} having been specified Use of this method is not order-specific.

  • Returns: this PipelineBuilder
  • Exceptions:
    • UIMAException if the collection reader cannot be created

public PipelineBuilder readFiles( final String inputDirectory ) throws UIMAException

Adds a Collection reader to the beginning of the pipeline that will read files in a directory tree. Use of this method is not order-specific

  • Parameters:
    • inputDirectory directory with input files
  • Returns: this PipelineBuilder
  • Exceptions:
    • UIMAException if the collection reader cannot be created

public CollectionReaderDescription getReader()

  • Returns: the Collection Reader for the pipeline or null if none has been specified

public PipelineBuilder add( final Class<? extends AnalysisComponent> component ) throws ResourceInitializationException

Use of this method is order-specific.

  • Parameters:
    • component ae or cc component class to add to the pipeline
  • Returns: this PipelineBuilder
  • Exceptions:
    • ResourceInitializationException if the component cannot be created

public PipelineBuilder add( final Class<? extends AnalysisComponent> component, final Collection<String> views, final Object... parameters ) throws ResourceInitializationException

Use of this method is order-specific.

  • Parameters:
    • component ae or cc component class to add to the pipeline
    • views cas views to use for the component
    • parameters ae or cc parameter name value pairs. May be empty.
  • Returns: this PipelineBuilder
  • Exceptions:
    • ResourceInitializationException if the component cannot be created

public PipelineBuilder addLogged( final Class<? extends AnalysisComponent> component, final Collection<String> views, final Object... parameters ) throws ResourceInitializationException

Adds an ae or cc wrapped with "Starting processing" and "Finished processing" log messages Use of this method is order-specific.

  • Parameters:
    • component ae or cc component class to add to the pipeline
    • views cas views to use for the component
    • parameters ae or cc parameter name value pairs. May be empty.
  • Returns: this PipelineBuilder
  • Exceptions:
    • ResourceInitializationException if the component cannot be created

public PipelineBuilder addDescription( final AnalysisEngineDescription description )

Use of this method is order-specific.

  • Parameters:
    • description ae or cc component class description to add to the pipeline
  • Returns: this PipelineBuilder

public PipelineBuilder addDescription( final AnalysisEngineDescription description, final Collection<String> views )

Use of this method is order-specific.

  • Parameters:
    • description ae or cc component class description to add to the pipeline
    • views cas views to use for the component
  • Returns: this PipelineBuilder

public PipelineBuilder addLast( final Class<? extends AnalysisComponent> component, final Collection<String> views, final Object... parameters ) throws ResourceInitializationException

Adds an ae or cc component t othe very end of the pipeline. Use of this method is order-specific.

  • Parameters:
    • component ae or cc component class to add to the end of the pipeline
    • views cas views to use for the component
    • parameters ae or cc parameter name value pairs. May be empty.
  • Returns: this PipelineBuilder
  • Exceptions:
    • ResourceInitializationException if the component cannot be created

public List<String> getAeNames()

  • Returns: an ordered list of the annotation engines in the pipeline

public PipelineBuilder collectCuis() throws ResourceInitializationException

Adds ae that maintains CUI information throughout the run. CUI information can later be accessed using the {@link CuiCollector} singleton Use of this method is order-specific.

  • Returns: this PipelineBuilder
  • Exceptions:
    • ResourceInitializationException if the CuiCollector engine cannot be created

public PipelineBuilder collectEntities() throws ResourceInitializationException

Adds ae that maintains simple Entity information throughout the run. Entity information can later be accessed using the {@link EntityCollector} singleton Use of this method is order-specific.

  • Returns: this PipelineBuilder
  • Exceptions:
    • ResourceInitializationException if the EntityCollector engine cannot be created

public PipelineBuilder writeXMIs() throws ResourceInitializationException

Adds ae that writes an xmi file at the end of the pipeline. Relies upon {@link ConfigParameterConstants#PARAM_OUTPUTDIR} having been specified Use of this method is order-specific.

  • Returns: this PipelineBuilder
  • Exceptions:
    • ResourceInitializationException if the Xmi writer engine cannot be created

public PipelineBuilder writeXMIs( final String outputDirectory ) throws ResourceInitializationException

Adds ae that writes an xmi file at the end of the pipeline. Use of this method is order-specific.

  • Parameters:
    • outputDirectory directory in which xmi files should be written
  • Returns: this PipelineBuilder
  • Exceptions:
    • ResourceInitializationException if the Xmi writer engine cannot be created

public PipelineBuilder writeHtml() throws ResourceInitializationException

Adds ae that writes an html file at the end of the pipeline. Relies upon {@link ConfigParameterConstants#PARAM_OUTPUTDIR} having been specified Use of this method is order-specific.

  • Returns: this PipelineBuilder
  • Exceptions:
    • ResourceInitializationException if the html writer engine cannot be created

public PipelineBuilder writeHtml( final String outputDirectory ) throws ResourceInitializationException

Adds ae that writes an html file at the end of the pipeline. Use of this method is order-specific.

  • Parameters:
    • outputDirectory directory in which html files should be written
  • Returns: this PipelineBuilder
  • Exceptions:
    • ResourceInitializationException if the html writer engine cannot be created

public PipelineBuilder build() throws IOException, UIMAException

Initialize a pipeline that can be used repeatedly using {@link #run} and {@link #run(String)}. A pipeline can be extended between builds, but the full pipeline will be rebuilt on each call. Use of this method is order-specific.

  • Returns: this PipelineBuilder
  • Exceptions:
    • IOException if the pipeline could not be built
    • UIMAException if the pipeline could not be built

public PipelineBuilder run() throws IOException, UIMAException

Run the pipeline using some specified collection reader. Use of this method is order-specific. This method will call {@link #build()} if the pipeline has not already been initialized.

  • Returns: this PipelineBuilder
  • Exceptions:
    • IOException if the pipeline could not be run
    • UIMAException if the pipeline could not be run

public PipelineBuilder run( final String text ) throws IOException, UIMAException

Run the pipeline on the given text. Use of this method is order-specific. This method will call {@link #build()} if the pipeline has not already been initialized.

  • Parameters:
    • text text upon which to run this pipeline
  • Returns: this PipelineBuilder
  • Exceptions:
    • IOException if the pipeline could not be run
    • UIMAException if the pipeline could not be run

public PipelineBuilder run( final JCas jCas ) throws IOException, UIMAException

Run the pipeline on the given jcas. Use of this method is order-specific. This method will call {@link #build()} if the pipeline has not already been initialized.

  • Parameters:
    • jCas ye olde ...
  • Returns: this PipelineBuilder
  • Exceptions:
    • IOException if the pipeline could not be run
    • UIMAException if the pipeline could not be run

public AnalysisEngineDescription getAnalysisEngineDesc() throws IOException, UIMAException

  • Returns: an analysis engine description, for use in creating xml descriptor files, etc.
  • Exceptions:
    • IOException if the description could not be built
    • UIMAException if the description could not be built

Apache cTAKES

ctakes-core API

Python API

ctakes-core

patient
    AbstractPatientConsumer
    AbstractPatientFileWriter
    PatientNoteCollector
    PatientNoteStore
    PatientViewUtil
pipeline
    PipeBitLocator
    PipelineBuilder
    PiperFileReader
    PiperFileRunner
resource
    FileLocator
util
    CalendarUtil
    MutableUimaContext
    NumberedSuffixComparator
    Pair
    RelationArgumentUtil
    StringUtil
     annotation
         ConceptBuilder
         EssentialAnnotationUtil
         IdentifiedAnnotationBuilder
         IdentifiedAnnotationUtil
         OntologyConceptUtil
         SemanticGroup
         SemanticTui
     doc
         DocIdUtil
         JCasBuilder
         TextBySectionBuilder
         TextBySentenceBuilder
     log
         DotLogger
         FinishedLogger
     regex
         RegexSpanFinder
         TimeoutMatcher
     textspan
         DefaultAspanComparator
         DefaultTextSpanComparator
         DefaultTextSpan
         TextSpan



General

Clone this wiki locally