-
Notifications
You must be signed in to change notification settings - Fork 24
ctakes examples ctakes_cnlpt_py
This is an example piper file that will spin up a complete pbj pipeline.
$\textcolor{gray}{\textsf{\# }}$
$\textcolor{gray}{\textsf{\# This is an example piper file that will spin up a complete pbj pipeline. }}$
$\textcolor{gray}{\textsf{\# }}$
$\textcolor{gray}{\textsf{\# This piper will start the Apache Artemis broker pointed to by the -a parameter on the command line. }}$
$\textcolor{gray}{\textsf{\# It will pause for 5 seconds to allow Artemis to fully launch. }}$
$\textcolor{gray}{\textsf{\# }}$
$\textcolor{gray}{\textsf{\# This piper will then launch another instance of Apache cTAKES. }}$
$\textcolor{gray}{\textsf{\# That instance of cTAKES will run the third and final bit of the entire PBJ pipeline. }}$
$\textcolor{gray}{\textsf{\# }}$
$\textcolor{gray}{\textsf{\# This piper will then launch a python PBJ pipeline that runs the negation model from the external project }}$
$\textcolor{gray}{\textsf{\# Clinical NLP Transformers (cnlp\_transformers), which can be found at }}$
$\textcolor{gray}{\textsf{\# (http)s://github.com/Machine-Learning-for-Medical-Language/cnlp\_transformers }}$
$\textcolor{gray}{\textsf{\# }}$
$\textcolor{gray}{\textsf{\# }}$
$\textcolor{gray}{\textsf{\# To run this pipeline from the command line, use the parameters: }}$
$\textcolor{gray}{\textsf{\# -p CnlptNegation }}$
$\textcolor{gray}{\textsf{\# -v \{python environment Directory\} }}$
$\textcolor{gray}{\textsf{\# -a \{Artemis Broker Directory\} }}$
$\textcolor{gray}{\textsf{\# -i \{Input Document Directory\} }}$
$\textcolor{gray}{\textsf{\# -o \{Output Directory\} }}$
$\textcolor{gray}{\textsf{\# --key \{UMLS Key\} }}$
$\textcolor{gray}{\textsf{\# }}$
$\textcolor{gray}{\textsf{\# A standard command-line option is the specification of whether or not to pip the ctakes-pbj package. }}$
$\textcolor{gray}{\textsf{\# By default ctakes-pbj will be pip ed at the beginning of a run. You can turn this off with: }}$
$\textcolor{gray}{\textsf{\# --pipPbj no }}$
$\textcolor{gray}{\textsf{\# }}$
$\textcolor{gray}{\textsf{// Sets up required parameters, starts your Artemis Broker, pips the PBJ project. }}$
$\textcolor{magenta}{\textsf{load}}$ PbjStarter
$\textcolor{gray}{\textsf{// }}$
$\textcolor{gray}{\textsf{// Start another instance of cTAKES, running the pipeline in StartAllExample\_end.piper }}$
$\textcolor{gray}{\textsf{// \$OutputDirectory will substitute the value of this cTAKES pipeline's value for OutputDirectory. }}$
$\textcolor{gray}{\textsf{// \$ArtemisBroker will substitute the value of this cTAKES pipeline's value for ArtemisBroker. }}$
$\textcolor{gray}{\textsf{// }}$
$\textcolor{green}{\textsf{add}}$ CtakesRunner$\textcolor{purple}{\textsf{Pipeline}}$ =$\textcolor{violet}{\textsf{"-p}}$ PbjThirdStep -o $OutputDirectory -a $ArtemisBroker"
$\textcolor{gray}{\textsf{// }}$
$\textcolor{gray}{\textsf{// Start the python bit of the full pipeline. }}$
$\textcolor{gray}{\textsf{// }}$
$\textcolor{gray}{\textsf{// pip the cnlp\_transformers project and its dependencies. }}$
$\textcolor{gray}{\textsf{//add PythonRunner Command="-m pip install resources/org/apache/ctakes/examples/ctakes\_cnlpt\_py/" Wait=yes }}$
$\textcolor{green}{\textsf{add}}$ PythonPipper$\textcolor{purple}{\textsf{PipPackage}}$ =$\textcolor{violet}{\textsf{"resources/org/apache/ctakes/examples/ctakes_cnlpt_py/"}}$ $\textcolor{purple}{\textsf{Wait}}$ =$\textcolor{violet}{\textsf{yes}}$
$\textcolor{gray}{\textsf{// There is a fixed order to queue specification in python pipelines. }}$
$\textcolor{gray}{\textsf{// The incoming (receiver) queue is named first, the outgoing (sender) queue is named second. }}$
$\textcolor{gray}{\textsf{// TODO: Right now cnlpt isn't using --output\_dir. Need to figure out why. }}$
$\textcolor{green}{\textsf{add}}$ PythonRunner$\textcolor{purple}{\textsf{Command}}$ =$\textcolor{violet}{\textsf{"-m}}$ ctakes_cnlpt.negation_pipeline --receive_queue JavaToPy --send_queue PyToJava --output_dir$OutputDirectory" $ \textcolor{purple}{\textsf{LogFile}}$=$\textcolor{violet}{\textsf{negation_pipeline.log}}$
$\textcolor{gray}{\textsf{// }}$
$\textcolor{gray}{\textsf{// The pipeline run by this instance of cTAKES. }}$
$\textcolor{gray}{\textsf{// }}$
$\textcolor{gray}{\textsf{// Load a simple token processing pipeline from another pipeline file }}$
$\textcolor{magenta}{\textsf{load}}$ DefaultTokenizerPipeline
$\textcolor{magenta}{\textsf{load}}$ DictionarySubPipe
$\textcolor{gray}{\textsf{// Send CAS to Artemis at the specified queue. Send stop signal when processing has finished. }}$
$\textcolor{green}{\textsf{add}}$ PbjJmsSender$\textcolor{purple}{\textsf{SendQueue}}$ =$\textcolor{violet}{\textsf{JavaToPy}}$ $\textcolor{purple}{\textsf{SendStop}}$ =$\textcolor{violet}{\textsf{yes}}$
- Introduction to Pipelines
- Piper Files
- Running Pipelines
- Creating Pipelines
- Pipeline Components
- Creating Components
- Piper File Submitter
- UMLS Package Fetcher
- Dictionary Creator
- Simple Pipeline Fabricator
- Pipeline Installation Facility
- Module Basics
- Essential Modules
- for Basic Pipeline
- for Default Pipeline
- for Relations
- for Temporal Information
- for Coreferences
- Creating Modules
- Modules List
