medkit.core.text.span#

Classes:

ModifiedSpan(length, replaced_spans)

Slice of text not present in the original text

Span(start, end)

Slice of text extracted from the original text

class Span(start, end)[source]#

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

Methods:

from_dict(span_dict)

Creates a Span from a dict

overlaps(other)

Test if 2 spans reference at least one character in common

overlaps(other)[source]#

Test if 2 spans reference at least one character in common

classmethod from_dict(span_dict)[source]#

Creates a Span from a dict

Parameters

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

Return type

Self

class ModifiedSpan(length, replaced_spans)[source]#

Slice of text not present in the original text

Parameters
  • length (int) – Number of characters

  • replaced_spans (List[medkit.core.text.span.Span]) – Slices of the original text that this span is replacing

Methods:

from_dict(modified_span_dict)

Creates a Modified from a dict

classmethod from_dict(modified_span_dict)[source]#

Creates a Modified from a dict

Parameters

modified_span_dict (dict) – A dictionary from a serialized ModifiedSpan as generated by to_dict()

Return type

Self