PiperFileReader - apache/ctakes GitHub Wiki

@SuppressWarnings( "unchecked" ) final public class PiperFileReader

Creates a pipeline (PipelineBuilder) from specifications in a flat plaintext file.

There are several basic commands: package user_package_name load path_to_another_pipeline_file set ae_parameter_name=ae_parameter_value e_parameter_name=ae_parameter_value ... cli ae_parameter_name=cli_parameter_char e_parameter_name=cli_parameter_char ... reader collection_reader_class_name readFiles input_directory input_directory can be empty if {@link org.apache.ctakes.core.config.ConfigParameterConstants#PARAM_INPUTDIR} ("InputDirectory") was specified add ae_or_cc_class_name ae_parameter_name=ae_parameter_value e_parameter_name<=ae_parameter_value ... addLogged ae_or_cc_class_name ae_parameter_name=ae_parameter_value e_parameter_name=ae_parameter_value ... addDescription ae_or_cc_class_name addLast ae_or_cc_class_name collectCuis collectEntities writeXmis output_directory output_directory can be empty if ("OutputDirectory") was specified // and # and ! may be used to mark line comments

class names must be fully-specified with package unless they are in standard ctakes cr ae or cc packages, or in a package specified by an earlier package command.

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

public PiperFileReader()

Create and empty PipelineReader

public PiperFileReader( final String filePath ) throws UIMAException

Create a PipelineReader and load a file with command parameter pairs for building a pipeline

  • Parameters:
    • filePath path to the pipeline command file
  • Exceptions:
    • UIMAException if the pipeline cannot be loaded

public PiperFileReader( final String filePath, final CliOptionals cliOptionals ) throws UIMAException

Create a PipelineReader and load a file with command parameter pairs for building a pipeline

  • Parameters:
    • filePath path to the pipeline command file
    • cliOptionals command line options pre-defined
  • Exceptions:
    • UIMAException if the pipeline cannot be loaded

public boolean loadPipelineFile( final String filePath ) throws UIMAException

Load a file with command parameter pairs for building a pipeline

  • Parameters:
    • filePath path to the pipeline command file

public PipelineBuilder getBuilder()

  • Returns: the PipelineBuilder with its current state set by this PipelineReader

private boolean addToPipeline( final String command, final String parameter ) throws UIMAException

  • Parameters:
    • command specified by first word in the file line
    • parameter specified by second word in the file line
  • Returns: true if the command and parameters are valid
  • Exceptions:
    • UIMAException if the command could not be executed

public InputStream getPiperStream( final String filePath )

  • Parameters:
    • filePath fully-specified or simple path of a piper file
  • Returns: discovered path for the piper file

static private boolean hasParameters( final String text )

  • Parameters:
    • text -
  • Returns: true if there is more than one word in the text

static private String[] splitFromParameters( final String text )

  • Parameters:
    • text text with more than one word
  • Returns: an array of two strings, [0]= the first word, [1]= the remaining words separated by spaces

static private Object[] splitParameters( final String text )

  • Parameters:
    • text -
  • Returns: array created by splitting text ' ' and then at '=' characters

private Object[] getCliParameters( final String text )

  • Parameters:
    • text -
  • Returns: array created by splitting text ' ' and then at '=' characters

static private Collection<String> getViewSpecs( final String text )

  • Parameters:
    • text -
  • Returns: any specifications of views

static private String removeViewSpecs( final String text, final Collection<String> viewSpecs )

  • Parameters:
    • text -
    • viewSpecs -
  • Returns: the text with all viewSpec texts removed

static private Collection<String> getViews( final Collection<String> viewSpecs )

  • Parameters:
    • viewSpecs -
  • Returns: views listed in view specs

static private Object attemptParseInt( final String value )

Since uimafit parameter values can be integers, check for an integer value

  • Parameters:
    • value String value parsed from file
  • Returns: the value as an Integer, or the original String if an Integer could not be resolved

static private Object attemptParseBoolean( final String value )

Since uimafit parameter values can be boolean, check for a boolean value

  • Parameters:
    • value String value parsed from file
  • Returns: the value as a Boolean, or the original String if it is not "true" or "false", case insensitive

static private boolean isCommaArray( final String value )

  • Parameters:
    • value String value parsed from file
  • Returns: true if there are any comma characters in the value, denoting an array

static private Object attemptParseArray( final String value )

  • Parameters:
    • value String value parsed from file
  • Returns: an array of String
⚠️ **GitHub.com Fallback** ⚠️