This commit is contained in:
71
packages/java/dev/kreuzberg/OcrConfidence.java
generated
Normal file
71
packages/java/dev/kreuzberg/OcrConfidence.java
generated
Normal file
@@ -0,0 +1,71 @@
|
||||
// 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;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Confidence scores for an OCR element.
|
||||
*
|
||||
* Separates detection confidence (how confident that text exists at this location)
|
||||
* from recognition confidence (how confident about the actual text content).
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_ABSENT)
|
||||
@JsonDeserialize(builder = OcrConfidence.Builder.class)
|
||||
public record OcrConfidence(
|
||||
/**
|
||||
* Detection confidence: how confident the OCR engine is that text exists here.
|
||||
*
|
||||
* PaddleOCR provides this as {@code box_score}, Tesseract doesn't have a direct equivalent.
|
||||
* Range: 0.0 to 1.0 (or null if not available).
|
||||
*/
|
||||
@Nullable @JsonProperty("detection") Double detection,
|
||||
/**
|
||||
* Recognition confidence: how confident about the text content.
|
||||
*
|
||||
* Range: 0.0 to 1.0.
|
||||
*/
|
||||
@JsonProperty("recognition") double recognition
|
||||
) {
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
// CPD-OFF
|
||||
@JsonPOJOBuilder(withPrefix = "with", buildMethodName = "build")
|
||||
public static final class Builder {
|
||||
|
||||
private Double detection = null;
|
||||
private double recognition = 0.0;
|
||||
|
||||
/** Sets the detection field. */
|
||||
@JsonProperty("detection")
|
||||
public Builder withDetection(final @Nullable Double value) {
|
||||
this.detection = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the recognition field. */
|
||||
@JsonProperty("recognition")
|
||||
public Builder withRecognition(final double value) {
|
||||
this.recognition = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Builds the OcrConfidence instance. */
|
||||
public OcrConfidence build() {
|
||||
return new OcrConfidence(
|
||||
detection,
|
||||
recognition
|
||||
);
|
||||
}
|
||||
}
|
||||
// CPD-ON
|
||||
}
|
||||
Reference in New Issue
Block a user