LeXtract.Extraction (lextract v0.1.2)

View Source

Represents a single extracted entity with alignment information.

Fields

  • :extraction_class - Type/category of extraction (e.g., "person", "medication")
  • :extraction_text - The actual extracted text
  • :char_interval - Character position in source text
  • :alignment_status - Quality of text alignment (see AlignmentStatus)
  • :extraction_index - Position in extraction sequence (0-based)
  • :group_index - Grouping identifier for related extractions
  • :description - Optional description of the extraction
  • :attributes - Additional structured attributes (e.g., dosage, frequency)
  • :token_interval - Token position in source text

Examples

iex> extraction = %LeXtract.Extraction{
...>   extraction_class: "medication",
...>   extraction_text: "aspirin 81mg",
...>   char_interval: %LeXtract.CharInterval{start_pos: 0, end_pos: 12}
...> }
iex> extraction.extraction_class
"medication"

Summary

Functions

Returns true if the extraction has alignment information.

Returns true if the extraction has attributes.

Types

t()

@type t() :: %LeXtract.Extraction{
  alignment_status: LeXtract.AlignmentStatus.t() | nil,
  attributes: map() | nil,
  char_interval: LeXtract.CharInterval.t() | nil,
  description: String.t() | nil,
  extraction_class: String.t(),
  extraction_index: non_neg_integer() | nil,
  extraction_text: String.t(),
  group_index: non_neg_integer() | nil,
  token_interval: LeXtract.TokenInterval.t() | nil
}

Functions

aligned?(extraction)

@spec aligned?(t()) :: boolean()

Returns true if the extraction has alignment information.

Examples

iex> extraction = %LeXtract.Extraction{extraction_class: "person", extraction_text: "John Doe"}
iex> LeXtract.Extraction.aligned?(extraction)
false

has_attributes?(extraction)

@spec has_attributes?(t()) :: boolean()

Returns true if the extraction has attributes.

Examples

iex> extraction = %LeXtract.Extraction{extraction_class: "person", extraction_text: "John Doe"}
iex> LeXtract.Extraction.has_attributes?(extraction)
false