You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by se...@apache.org on 2023/12/21 17:30:20 UTC
(ctakes) branch main updated: Bug fix in cnlpt negation example. code cleanup.
This is an automated email from the ASF dual-hosted git repository.
seanfinan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ctakes.git
The following commit(s) were added to refs/heads/main by this push:
new f302459 Bug fix in cnlpt negation example. code cleanup.
f302459 is described below
commit f3024591a46b77e137282e42394c7897b485e78a
Author: Sean Finan <se...@childrens.harvard.edu>
AuthorDate: Thu Dec 21 12:30:06 2023 -0500
Bug fix in cnlpt negation example. code cleanup.
---
.../examples/ctakes_cnlpt_py/pipeline/CnlptNegation.piper | 1 -
.../ctakes_cnlpt_py/src/ctakes_cnlpt/negation_pipeline.py | 11 ++++++-----
.../org/apache/ctakes/examples/pipeline/SentencePrinter.piper | 1 -
.../src/ctakes_pbj/examples/sentence_printer_pipeline.py | 4 ++--
.../src/ctakes_pbj/examples/word_finder_pipeline.py | 4 ++--
5 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/pipeline/CnlptNegation.piper b/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/pipeline/CnlptNegation.piper
index 51e9d2a..a7abb2b 100644
--- a/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/pipeline/CnlptNegation.piper
+++ b/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/pipeline/CnlptNegation.piper
@@ -62,4 +62,3 @@ load DictionarySubPipe
// Send CAS to Artemis at the specified queue. Send stop signal when processing has finished.
add PbjJmsSender SendQueue=JavaToPy SendStop=yes
-//add PbjStompSender SendQueue=JavaToPy SendStop=yes
diff --git a/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/src/ctakes_cnlpt/negation_pipeline.py b/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/src/ctakes_cnlpt/negation_pipeline.py
index 9937d75..d2a16b4 100644
--- a/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/src/ctakes_cnlpt/negation_pipeline.py
+++ b/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/src/ctakes_cnlpt/negation_pipeline.py
@@ -1,8 +1,8 @@
import warnings
-from ctakes_pbj.component.pbj_receiver import start_receiver
-from ctakes_pbj.component.pbj_sender import PBJSender
from ctakes_pbj.pipeline.pbj_pipeline import PBJPipeline
+from ctakes_pbj.component.pbj_receiver import PBJReceiver
+from ctakes_pbj.component.pbj_sender import PBJSender
from ctakes_cnlpt.ae.negation_delegator import NegationDelegator
@@ -11,14 +11,15 @@ warnings.filterwarnings("ignore")
def main():
+ print('If you are running this negation pipeline without a GPU then it may take several minutes to finish.')
+
# Create a new PBJ Pipeline, add a class that interacts with cNLPT to add Negation to Events.
pipeline = PBJPipeline()
+ pipeline.reader(PBJReceiver())
pipeline.add(NegationDelegator())
# Add a PBJ Sender to the end of the pipeline to send the processed cas back to cTAKES and initialize the pipeline.
pipeline.add(PBJSender())
- pipeline.initialize()
- # Start a PBJ receiver to accept cas objects from Artemis and process them in the pipeline.
- start_receiver(pipeline)
+ pipeline.run()
main()
diff --git a/ctakes-examples/src/user/resources/org/apache/ctakes/examples/pipeline/SentencePrinter.piper b/ctakes-examples/src/user/resources/org/apache/ctakes/examples/pipeline/SentencePrinter.piper
index f0d388e..fd39355 100644
--- a/ctakes-examples/src/user/resources/org/apache/ctakes/examples/pipeline/SentencePrinter.piper
+++ b/ctakes-examples/src/user/resources/org/apache/ctakes/examples/pipeline/SentencePrinter.piper
@@ -58,4 +58,3 @@ load DefaultTokenizerPipeline
// Send CAS to Artemis at the specified queue. Send stop signal when processing has finished.
add PbjJmsSender SendQueue=JavaToPy SendStop=yes
-//add PbjStompSender SendQueue=JavaToPy SendStop=yes
diff --git a/ctakes-pbj/src/user/resources/org/apache/ctakes/pbj/ctakes_pbj_py/src/ctakes_pbj/examples/sentence_printer_pipeline.py b/ctakes-pbj/src/user/resources/org/apache/ctakes/pbj/ctakes_pbj_py/src/ctakes_pbj/examples/sentence_printer_pipeline.py
index b53194a..7fee8eb 100644
--- a/ctakes-pbj/src/user/resources/org/apache/ctakes/pbj/ctakes_pbj_py/src/ctakes_pbj/examples/sentence_printer_pipeline.py
+++ b/ctakes-pbj/src/user/resources/org/apache/ctakes/pbj/ctakes_pbj_py/src/ctakes_pbj/examples/sentence_printer_pipeline.py
@@ -4,10 +4,11 @@
# These are the lines that ignore the typesystem errors
import warnings
+from ctakes_pbj.pipeline.pbj_pipeline import PBJPipeline
from ctakes_pbj.component.pbj_receiver import PBJReceiver
from ctakes_pbj.component.pbj_sender import PBJSender
+
from ctakes_pbj.examples.sentence_printer import SentencePrinter
-from ctakes_pbj.pipeline.pbj_pipeline import PBJPipeline
warnings.filterwarnings("ignore")
@@ -18,7 +19,6 @@ def main():
pipeline.reader(PBJReceiver())
pipeline.add(SentencePrinter())
pipeline.add(PBJSender())
- pipeline.initialize()
pipeline.run()
diff --git a/ctakes-pbj/src/user/resources/org/apache/ctakes/pbj/ctakes_pbj_py/src/ctakes_pbj/examples/word_finder_pipeline.py b/ctakes-pbj/src/user/resources/org/apache/ctakes/pbj/ctakes_pbj_py/src/ctakes_pbj/examples/word_finder_pipeline.py
index edf9bca..e7f8700 100644
--- a/ctakes-pbj/src/user/resources/org/apache/ctakes/pbj/ctakes_pbj_py/src/ctakes_pbj/examples/word_finder_pipeline.py
+++ b/ctakes-pbj/src/user/resources/org/apache/ctakes/pbj/ctakes_pbj_py/src/ctakes_pbj/examples/word_finder_pipeline.py
@@ -4,10 +4,11 @@
# These are the lines that ignore the typesystem errors
import warnings
+from ctakes_pbj.pipeline.pbj_pipeline import PBJPipeline
from ctakes_pbj.component.pbj_receiver import PBJReceiver
from ctakes_pbj.component.pbj_sender import PBJSender
+
from ctakes_pbj.examples.word_finder import WordFinder
-from ctakes_pbj.pipeline.pbj_pipeline import PBJPipeline
warnings.filterwarnings("ignore")
@@ -18,7 +19,6 @@ def main():
pipeline.reader(PBJReceiver())
pipeline.add(WordFinder())
pipeline.add(PBJSender())
- pipeline.initialize()
pipeline.run()