Files
fil/packages/java/dev/kreuzberg/HierarchicalBlock.java
Henrik Jess Nielsen b4c07d3693
All checks were successful
Deploy fil (kreuzberg) / deploy (push) Successful in 49s
Nomad changes
2026-06-01 23:40:55 +02:00

106 lines
3.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 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;
/**
* A text block with hierarchy level assignment.
*
* Represents a block of text with semantic heading information extracted from
* font size clustering and hierarchical analysis.
*/
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = HierarchicalBlock.Builder.class)
public record HierarchicalBlock(
/**
* The text content of this block
*/
@JsonProperty("text") String text,
/**
* The font size of the text in this block
*/
@JsonProperty("font_size") float fontSize,
/**
* The hierarchy level of this block (H1-H6 or Body)
*
* Levels correspond to HTML heading tags:
* - "h1": Top-level heading
* - "h2": Secondary heading
* - "h3": Tertiary heading
* - "h4": Quaternary heading
* - "h5": Quinary heading
* - "h6": Senary heading
* - "body": Body text (no heading level)
*/
@JsonProperty("level") String level,
/**
* Bounding box information for the block
*
* Contains coordinates as (left, top, right, bottom) in PDF units.
*/
@Nullable @JsonProperty("bbox") List<Float> bbox
) {
public static Builder builder() {
return new Builder();
}
// CPD-OFF
@JsonPOJOBuilder(withPrefix = "with", buildMethodName = "build")
public static final class Builder {
private String text = "";
@JsonProperty("font_size")
private float fontSize = 0.0f;
private String level = "";
private List<Float> bbox = null;
/** Sets the text field. */
@JsonProperty("text")
public Builder withText(final String value) {
this.text = value;
return this;
}
/** Sets the fontSize field. */
@JsonProperty("font_size")
public Builder withFontSize(final float value) {
this.fontSize = value;
return this;
}
/** Sets the level field. */
@JsonProperty("level")
public Builder withLevel(final String value) {
this.level = value;
return this;
}
/** Sets the bbox field. */
@JsonProperty("bbox")
public Builder withBbox(final @Nullable List<Float> value) {
this.bbox = value;
return this;
}
/** Builds the HierarchicalBlock instance. */
public HierarchicalBlock build() {
return new HierarchicalBlock(
text,
fontSize,
level,
bbox
);
}
}
// CPD-ON
}