128 lines
4.1 KiB
Java
Generated
128 lines
4.1 KiB
Java
Generated
// 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 java.util.Map;
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
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;
|
|
|
|
/**
|
|
* OCR extraction result.
|
|
*
|
|
* Result of performing OCR on an image or scanned document,
|
|
* including recognized text and detected tables.
|
|
*/
|
|
@JsonInclude(JsonInclude.Include.NON_ABSENT)
|
|
@JsonDeserialize(builder = OcrExtractionResult.Builder.class)
|
|
public record OcrExtractionResult(
|
|
/**
|
|
* Recognized text content
|
|
*/
|
|
@JsonProperty("content") String content,
|
|
/**
|
|
* Original MIME type of the processed image
|
|
*/
|
|
@JsonProperty("mime_type") String mimeType,
|
|
/**
|
|
* OCR processing metadata (confidence scores, language, etc.)
|
|
*/
|
|
@JsonProperty("metadata") Map<String, JsonNode> metadata,
|
|
/**
|
|
* Tables detected and extracted via OCR
|
|
*/
|
|
@JsonProperty("tables") List<OcrTable> tables,
|
|
/**
|
|
* Structured OCR elements with bounding boxes and confidence scores.
|
|
* Available when TSV output is requested or table detection is enabled.
|
|
*/
|
|
@Nullable @JsonProperty("ocr_elements") List<OcrElement> ocrElements,
|
|
/**
|
|
* Structured document produced from hOCR parsing.
|
|
* Carries paragraph structure, bounding boxes, and confidence scores
|
|
* that the flattened {@code content} string discards.
|
|
*/
|
|
@Nullable @JsonProperty("internal_document") String internalDocument
|
|
) {
|
|
public static Builder builder() {
|
|
return new Builder();
|
|
}
|
|
|
|
// CPD-OFF
|
|
@JsonPOJOBuilder(withPrefix = "with", buildMethodName = "build")
|
|
public static final class Builder {
|
|
|
|
private String content = "";
|
|
@JsonProperty("mime_type")
|
|
private String mimeType = "";
|
|
private Map<String, JsonNode> metadata = Map.of();
|
|
private List<OcrTable> tables = List.of();
|
|
@JsonProperty("ocr_elements")
|
|
private List<OcrElement> ocrElements = null;
|
|
@JsonProperty("internal_document")
|
|
private String internalDocument = null;
|
|
|
|
/** Sets the content field. */
|
|
@JsonProperty("content")
|
|
public Builder withContent(final String value) {
|
|
this.content = value;
|
|
return this;
|
|
}
|
|
|
|
/** Sets the mimeType field. */
|
|
@JsonProperty("mime_type")
|
|
public Builder withMimeType(final String value) {
|
|
this.mimeType = value;
|
|
return this;
|
|
}
|
|
|
|
/** Sets the metadata field. */
|
|
@JsonProperty("metadata")
|
|
public Builder withMetadata(final Map<String, JsonNode> value) {
|
|
this.metadata = value;
|
|
return this;
|
|
}
|
|
|
|
/** Sets the tables field. */
|
|
@JsonProperty("tables")
|
|
public Builder withTables(final List<OcrTable> value) {
|
|
this.tables = value;
|
|
return this;
|
|
}
|
|
|
|
/** Sets the ocrElements field. */
|
|
@JsonProperty("ocr_elements")
|
|
public Builder withOcrElements(final @Nullable List<OcrElement> value) {
|
|
this.ocrElements = value;
|
|
return this;
|
|
}
|
|
|
|
/** Sets the internalDocument field. */
|
|
@JsonProperty("internal_document")
|
|
public Builder withInternalDocument(final @Nullable String value) {
|
|
this.internalDocument = value;
|
|
return this;
|
|
}
|
|
|
|
/** Builds the OcrExtractionResult instance. */
|
|
public OcrExtractionResult build() {
|
|
return new OcrExtractionResult(
|
|
content,
|
|
mimeType,
|
|
metadata,
|
|
tables,
|
|
ocrElements,
|
|
internalDocument
|
|
);
|
|
}
|
|
}
|
|
// CPD-ON
|
|
}
|