This commit is contained in:
94
packages/java/dev/kreuzberg/OcrTable.java
generated
Normal file
94
packages/java/dev/kreuzberg/OcrTable.java
generated
Normal file
@@ -0,0 +1,94 @@
|
||||
// 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;
|
||||
|
||||
/**
|
||||
* Table detected via OCR.
|
||||
*
|
||||
* Represents a table structure recognized during OCR processing.
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_ABSENT)
|
||||
@JsonDeserialize(builder = OcrTable.Builder.class)
|
||||
public record OcrTable(
|
||||
/**
|
||||
* 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 in pixel coordinates (from OCR word positions).
|
||||
*/
|
||||
@Nullable @JsonProperty("bounding_box") OcrTableBoundingBox 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 OcrTableBoundingBox 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 OcrTableBoundingBox value) {
|
||||
this.boundingBox = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Builds the OcrTable instance. */
|
||||
public OcrTable build() {
|
||||
return new OcrTable(
|
||||
cells,
|
||||
markdown,
|
||||
pageNumber,
|
||||
boundingBox
|
||||
);
|
||||
}
|
||||
}
|
||||
// CPD-ON
|
||||
}
|
||||
Reference in New Issue
Block a user