97 lines
3.0 KiB
Java
97 lines
3.0 KiB
Java
|
|
// This file is auto-generated by alef — DO NOT EDIT.
|
|||
|
|
// alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
|
|||
|
|
// To regenerate: alef generate
|
|||
|
|
// To verify freshness: alef verify --exit-code
|
|||
|
|
// Issues & docs: https://github.com/kreuzberg-dev/alef
|
|||
|
|
package dev.kreuzberg;
|
|||
|
|
|
|||
|
|
import java.util.List;
|
|||
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
|
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
|||
|
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|||
|
|
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
|
|||
|
|
import org.jspecify.annotations.Nullable;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Extracted table structure.
|
|||
|
|
*
|
|||
|
|
* Represents a table detected and extracted from a document (PDF, image, etc.).
|
|||
|
|
* Tables are converted to both structured cell data and Markdown format.
|
|||
|
|
*/
|
|||
|
|
@JsonInclude(JsonInclude.Include.NON_ABSENT)
|
|||
|
|
@JsonDeserialize(builder = Table.Builder.class)
|
|||
|
|
public record Table(
|
|||
|
|
/**
|
|||
|
|
* Table cells as a 2D vector (rows × columns)
|
|||
|
|
*/
|
|||
|
|
@JsonProperty("cells") List<List<String>> cells,
|
|||
|
|
/**
|
|||
|
|
* Markdown representation of the table
|
|||
|
|
*/
|
|||
|
|
@JsonProperty("markdown") String markdown,
|
|||
|
|
/**
|
|||
|
|
* Page number where the table was found (1-indexed)
|
|||
|
|
*/
|
|||
|
|
@JsonProperty("page_number") int pageNumber,
|
|||
|
|
/**
|
|||
|
|
* Bounding box of the table on the page (PDF coordinates: x0=left, y0=bottom, x1=right, y1=top).
|
|||
|
|
* Only populated for PDF-extracted tables when position data is available.
|
|||
|
|
*/
|
|||
|
|
@Nullable @JsonProperty("bounding_box") BoundingBox boundingBox
|
|||
|
|
) {
|
|||
|
|
public static Builder builder() {
|
|||
|
|
return new Builder();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// CPD-OFF
|
|||
|
|
@JsonPOJOBuilder(withPrefix = "with", buildMethodName = "build")
|
|||
|
|
public static final class Builder {
|
|||
|
|
|
|||
|
|
private List<List<String>> cells = List.of();
|
|||
|
|
private String markdown = "";
|
|||
|
|
@JsonProperty("page_number")
|
|||
|
|
private int pageNumber = 0;
|
|||
|
|
@JsonProperty("bounding_box")
|
|||
|
|
@Nullable private BoundingBox boundingBox = null;
|
|||
|
|
|
|||
|
|
/** Sets the cells field. */
|
|||
|
|
@JsonProperty("cells")
|
|||
|
|
public Builder withCells(final List<List<String>> value) {
|
|||
|
|
this.cells = value;
|
|||
|
|
return this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/** Sets the markdown field. */
|
|||
|
|
@JsonProperty("markdown")
|
|||
|
|
public Builder withMarkdown(final String value) {
|
|||
|
|
this.markdown = value;
|
|||
|
|
return this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/** Sets the pageNumber field. */
|
|||
|
|
@JsonProperty("page_number")
|
|||
|
|
public Builder withPageNumber(final int value) {
|
|||
|
|
this.pageNumber = value;
|
|||
|
|
return this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/** Sets the boundingBox field. */
|
|||
|
|
@JsonProperty("bounding_box")
|
|||
|
|
public Builder withBoundingBox(final @Nullable BoundingBox value) {
|
|||
|
|
this.boundingBox = value;
|
|||
|
|
return this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/** Builds the Table instance. */
|
|||
|
|
public Table build() {
|
|||
|
|
return new Table(
|
|||
|
|
cells,
|
|||
|
|
markdown,
|
|||
|
|
pageNumber,
|
|||
|
|
boundingBox
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
// CPD-ON
|
|||
|
|
}
|