96 lines
3.0 KiB
Java
96 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 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;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* A detected layout region on a page.
|
||
|
|
*
|
||
|
|
* When layout detection is enabled, each page may have layout regions
|
||
|
|
* identifying different content types (text, pictures, tables, etc.)
|
||
|
|
* with confidence scores and spatial positions.
|
||
|
|
*/
|
||
|
|
@JsonInclude(JsonInclude.Include.NON_ABSENT)
|
||
|
|
@JsonDeserialize(builder = LayoutRegion.Builder.class)
|
||
|
|
public record LayoutRegion(
|
||
|
|
/**
|
||
|
|
* Layout class name (e.g. "picture", "table", "text", "section_header").
|
||
|
|
*/
|
||
|
|
@JsonProperty("class_name") String className,
|
||
|
|
/**
|
||
|
|
* Confidence score from the layout detection model (0.0 to 1.0).
|
||
|
|
*/
|
||
|
|
@JsonProperty("confidence") double confidence,
|
||
|
|
/**
|
||
|
|
* Bounding box in document coordinate space.
|
||
|
|
*/
|
||
|
|
@JsonProperty("bounding_box") BoundingBox boundingBox,
|
||
|
|
/**
|
||
|
|
* Fraction of the page area covered by this region (0.0 to 1.0).
|
||
|
|
*/
|
||
|
|
@JsonProperty("area_fraction") double areaFraction
|
||
|
|
) {
|
||
|
|
public static Builder builder() {
|
||
|
|
return new Builder();
|
||
|
|
}
|
||
|
|
|
||
|
|
// CPD-OFF
|
||
|
|
@JsonPOJOBuilder(withPrefix = "with", buildMethodName = "build")
|
||
|
|
public static final class Builder {
|
||
|
|
|
||
|
|
@JsonProperty("class_name")
|
||
|
|
private String className = "";
|
||
|
|
private double confidence = 0.0;
|
||
|
|
@JsonProperty("bounding_box")
|
||
|
|
private BoundingBox boundingBox = null;
|
||
|
|
@JsonProperty("area_fraction")
|
||
|
|
private double areaFraction = 0.0;
|
||
|
|
|
||
|
|
/** Sets the className field. */
|
||
|
|
@JsonProperty("class_name")
|
||
|
|
public Builder withClassName(final String value) {
|
||
|
|
this.className = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the confidence field. */
|
||
|
|
@JsonProperty("confidence")
|
||
|
|
public Builder withConfidence(final double value) {
|
||
|
|
this.confidence = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the boundingBox field. */
|
||
|
|
@JsonProperty("bounding_box")
|
||
|
|
public Builder withBoundingBox(final BoundingBox value) {
|
||
|
|
this.boundingBox = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the areaFraction field. */
|
||
|
|
@JsonProperty("area_fraction")
|
||
|
|
public Builder withAreaFraction(final double value) {
|
||
|
|
this.areaFraction = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Builds the LayoutRegion instance. */
|
||
|
|
public LayoutRegion build() {
|
||
|
|
return new LayoutRegion(
|
||
|
|
className,
|
||
|
|
confidence,
|
||
|
|
boundingBox,
|
||
|
|
areaFraction
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
// CPD-ON
|
||
|
|
}
|