:py:mod:`medkit.core.text.span`
===============================

.. py:module:: medkit.core.text.span


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

Classes
~~~~~~~

.. autoapisummary::

   medkit.core.text.span.AnySpan
   medkit.core.text.span.Span
   medkit.core.text.span.ModifiedSpan




.. py:class:: AnySpan


   Bases: :py:obj:`abc.ABC`, :py:obj:`medkit.core.dict_conv.SubclassMapping`

   
   Helper class that provides a standard way to create an ABC using
   inheritance.
















   ..
       !! processed by numpydoc !!
   .. py:attribute:: length
      :type: int

      

   .. py:method:: __init_subclass__()
      :classmethod:


   .. py:method:: from_dict(ann_dict: dict[str, Any]) -> typing_extensions.Self
      :classmethod:


   .. py:method:: to_dict() -> dict[str, Any]
      :abstractmethod:



.. py:class:: Span


   Bases: :py:obj:`AnySpan`

   
   Slice of text extracted from the original text.


   :Parameters:

       **start** : int
           Index of the first character in the original text

       **end** : int
           Index of the last character in the original text, plus one














   ..
       !! processed by numpydoc !!
   .. py:property:: length


   .. py:attribute:: start
      :type: int

      

   .. py:attribute:: end
      :type: int

      

   .. py:method:: to_dict() -> dict[str, Any]


   .. py:method:: overlaps(other: Span)

      
      Test if 2 spans reference at least one character in common.
















      ..
          !! processed by numpydoc !!

   .. py:method:: from_dict(span_dict: dict[str, Any]) -> typing_extensions.Self
      :classmethod:

      
      Create a Span from a dict.


      :Parameters:

          **span_dict: dict**
              A dictionary from a serialized span as generated by to_dict()














      ..
          !! processed by numpydoc !!


.. py:class:: ModifiedSpan


   Bases: :py:obj:`AnySpan`

   
   Slice of text not present in the original text.


   :Parameters:

       **length** : int
           Number of characters

       **replaced_spans** : list of Span
           Slices of the original text that this span is replacing














   ..
       !! processed by numpydoc !!
   .. py:attribute:: length
      :type: int

      

   .. py:attribute:: replaced_spans
      :type: list[Span]

      

   .. py:method:: to_dict() -> dict[str, Any]


   .. py:method:: from_dict(modified_span_dict: dict[str, Any]) -> typing_extensions.Self
      :classmethod:

      
      Create a Modified from a dict.


      :Parameters:

          **modified_span_dict** : dict of str to Any
              A dictionary from a serialized ModifiedSpan as generated by to_dict()














      ..
          !! processed by numpydoc !!


