Structure representing an extracted table from a document.
Matches the Rust Table struct with cells, markdown, page number, and optional bounding box.
Fields
:cells- Two-dimensional list of table cells [[cell1, cell2], ...]:markdown- Markdown representation of the table:page_number- Page number where table appears (0-indexed):bounding_box- Bounding box coordinates {x0, y0, x1, y1} if available, nil otherwise
Examples
iex> table = %Kreuzberg.Table{
...> cells: [["Name", "Age"], ["Alice", "30"]],
...> markdown: "| Name | Age |\n|------|-----|\n| Alice | 30 |",
...> page_number: 0
...> }
iex> table.cells
[["Name", "Age"], ["Alice", "30"]]
Summary
Functions
Returns the number of columns in the table.
Creates a Table struct from a map.
Returns the number of rows in the table.
Converts a Table struct to a map.
Types
@type t() :: %Kreuzberg.Table{ bounding_box: map() | nil, cells: [[String.t()]], markdown: String.t(), page_number: non_neg_integer() }
Functions
@spec column_count(t()) :: non_neg_integer()
Returns the number of columns in the table.
Examples
iex> table = %Kreuzberg.Table{cells: [["A", "B"], ["1", "2"]]}
iex> Kreuzberg.Table.column_count(table)
2
Creates a Table struct from a map.
Examples
iex> Kreuzberg.Table.from_map(%{"cells" => [["A", "B"]], "markdown" => "| A | B |", "page_number" => 0})
%Kreuzberg.Table{cells: [["A", "B"]], markdown: "| A | B |", page_number: 0}
@spec row_count(t()) :: non_neg_integer()
Returns the number of rows in the table.
Examples
iex> table = %Kreuzberg.Table{cells: [["A", "B"], ["1", "2"]]}
iex> Kreuzberg.Table.row_count(table)
2
Converts a Table struct to a map.