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 2025/12/02 13:55:16 UTC

(ctakes) branch main updated: Added comments for the word finder example.

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 f2d879e  Added comments for the word finder example.
f2d879e is described below

commit f2d879e3307a20ac6b4e3c52ac4cda1d612f59a7
Author: Sean Finan <se...@childrens.harvard.edu>
AuthorDate: Tue Dec 2 08:55:03 2025 -0500

    Added comments for the word finder example.
---
 .../pbj/ctakes_pbj_py/src/ctakes_pbj/examples/word_finder.py       | 2 ++
 .../ctakes_pbj_py/src/ctakes_pbj/examples/word_finder_pipeline.py  | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ctakes-pbj/src/user/resources/org/apache/ctakes/pbj/ctakes_pbj_py/src/ctakes_pbj/examples/word_finder.py b/ctakes-pbj/src/user/resources/org/apache/ctakes/pbj/ctakes_pbj_py/src/ctakes_pbj/examples/word_finder.py
index 97b733d..0535b99 100644
--- a/ctakes-pbj/src/user/resources/org/apache/ctakes/pbj/ctakes_pbj_py/src/ctakes_pbj/examples/word_finder.py
+++ b/ctakes-pbj/src/user/resources/org/apache/ctakes/pbj/ctakes_pbj_py/src/ctakes_pbj/examples/word_finder.py
@@ -19,8 +19,10 @@ def process(self, cas):
         findings = ['hernia', 'pain', 'migraines', 'allergies']
         procedures = ['thyroidectomy', 'exam']
 
+        # Get segment types that are already in the CAS, discovered by some previous component.
         for segment in cas.select(Segment):
             text = segment.get_covered_text()
+            # Check the text in the segment for words in the lists declared above.
             for word in sites:
                 begin = text.find(word)
                 if begin > -1:
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 e7f8700..128b516 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
@@ -1,7 +1,7 @@
 # Should accept cmd line parameters such as: hostname, port, queue name for recieving cas, and queue name for
 # sending cas
 
-# These are the lines that ignore the typesystem errors
+# These are the lines that ignore the typesystem errors.
 import warnings
 
 from ctakes_pbj.pipeline.pbj_pipeline import PBJPipeline
@@ -15,10 +15,15 @@
 
 def main():
 
+    # Create a PBJ Pipeline.
     pipeline = PBJPipeline()
+    # Add the PBJReceiver component.  This connects to the Artemis broker and retrieves information.
     pipeline.reader(PBJReceiver())
+    # Add the WordFinder component.
     pipeline.add(WordFinder())
+    # Add the PBJSender component.  This sends information to the Artemis broker.
     pipeline.add(PBJSender())
+    # Start running the pipeline.  This will automatically initialize all components.
     pipeline.run()