medkit.core.text.operation
==========================

.. py:module:: medkit.core.text.operation


Classes
-------

.. autoapisummary::

   medkit.core.text.operation.ContextOperation
   medkit.core.text.operation.NEROperation
   medkit.core.text.operation.SegmentationOperation
   medkit.core.text.operation.CustomTextOpType


Functions
---------

.. autoapisummary::

   medkit.core.text.operation.create_text_operation


Module Contents
---------------

.. py:class:: ContextOperation(uid: str | None = None, name: str | None = None, **kwargs)

   Bases: :py:obj:`medkit.core.operation.Operation`


   
   Abstract operation for context detection.

   It uses a list of segments as input for running the operation and creates attributes
   that are directly appended to these segments.















   ..
       !! processed by numpydoc !!

   .. py:method:: run(segments: list[medkit.core.text.annotation.Segment]) -> None
      :abstractmethod:



.. py:class:: NEROperation(uid: str | None = None, name: str | None = None, **kwargs)

   Bases: :py:obj:`medkit.core.operation.Operation`


   
   Abstract operation for detecting entities.

   It uses a list of segments as input and produces a list of detected entities.















   ..
       !! processed by numpydoc !!

   .. py:method:: run(segments: list[medkit.core.text.annotation.Segment]) -> list[medkit.core.text.annotation.Entity]
      :abstractmethod:



.. py:class:: SegmentationOperation(uid: str | None = None, name: str | None = None, **kwargs)

   Bases: :py:obj:`medkit.core.operation.Operation`


   
   Abstract operation for segmenting text.

   It uses a list of segments as input and produces a list of new segments.















   ..
       !! processed by numpydoc !!

   .. py:method:: run(segments: list[medkit.core.text.annotation.Segment]) -> list[medkit.core.text.annotation.Segment]
      :abstractmethod:



.. py:class:: CustomTextOpType

   Bases: :py:obj:`enum.IntEnum`


   
   Supported function types for creating custom text operations.
















   ..
       !! processed by numpydoc !!

   .. py:attribute:: CREATE_ONE_TO_N
      :value: 1


      
      Take 1 data item, return N new data items.
















      ..
          !! processed by numpydoc !!


   .. py:attribute:: EXTRACT_ONE_TO_N
      :value: 2


      
      Take 1 data item, return N existing data items
















      ..
          !! processed by numpydoc !!


   .. py:attribute:: FILTER
      :value: 3


      
      Take 1 data item, return True or False.
















      ..
          !! processed by numpydoc !!


.. py:function:: create_text_operation(function: Callable, function_type: CustomTextOpType, name: str | None = None, args: dict | None = None) -> _CustomTextOperation

   
   Instantiate a custom text operation from a user-defined function.


   :Parameters:

       **function** : Callable
           User-defined function

       **function_type** : CustomTextOpType
           Type of function.
           Supported values are defined in :class:`~medkit.core.text.CustomTextOpType`

       **name** : str, optional
           Name of the operation used for provenance info (default: function name)

       **args** : str, optional
           Dictionary containing the arguments of the function if any.

   :Returns:

       _CustomTextOperation
           An instance of a custom text operation













   ..
       !! processed by numpydoc !!

