160 lines
5.7 KiB
Java
160 lines
5.7 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 java.util.List;
|
||
|
|
import java.util.Map;
|
||
|
|
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;
|
||
|
|
|
||
|
|
@JsonInclude(JsonInclude.Include.NON_ABSENT)
|
||
|
|
@JsonDeserialize(builder = TokenReductionConfig.Builder.class)
|
||
|
|
public record TokenReductionConfig(
|
||
|
|
@JsonProperty("level") ReductionLevel level,
|
||
|
|
@Nullable @JsonProperty("language_hint") String languageHint,
|
||
|
|
@JsonProperty("preserve_markdown") boolean preserveMarkdown,
|
||
|
|
@JsonProperty("preserve_code") boolean preserveCode,
|
||
|
|
@JsonProperty("semantic_threshold") float semanticThreshold,
|
||
|
|
@JsonProperty("enable_parallel") boolean enableParallel,
|
||
|
|
@JsonProperty("use_simd") boolean useSimd,
|
||
|
|
@Nullable @JsonProperty("custom_stopwords") Map<String, List<String>> customStopwords,
|
||
|
|
@JsonProperty("preserve_patterns") List<String> preservePatterns,
|
||
|
|
@Nullable @JsonProperty("target_reduction") Float targetReduction,
|
||
|
|
@JsonProperty("enable_semantic_clustering") boolean enableSemanticClustering
|
||
|
|
) {
|
||
|
|
public static Builder builder() {
|
||
|
|
return new Builder();
|
||
|
|
}
|
||
|
|
|
||
|
|
// CPD-OFF
|
||
|
|
@JsonPOJOBuilder(withPrefix = "with", buildMethodName = "build")
|
||
|
|
public static final class Builder {
|
||
|
|
|
||
|
|
private ReductionLevel level = null;
|
||
|
|
@JsonProperty("language_hint")
|
||
|
|
private String languageHint = null;
|
||
|
|
@JsonProperty("preserve_markdown")
|
||
|
|
private boolean preserveMarkdown = false;
|
||
|
|
@JsonProperty("preserve_code")
|
||
|
|
private boolean preserveCode = true;
|
||
|
|
@JsonProperty("semantic_threshold")
|
||
|
|
private float semanticThreshold = 0.0f;
|
||
|
|
@JsonProperty("enable_parallel")
|
||
|
|
private boolean enableParallel = true;
|
||
|
|
@JsonProperty("use_simd")
|
||
|
|
private boolean useSimd = true;
|
||
|
|
@JsonProperty("custom_stopwords")
|
||
|
|
private Map<String, List<String>> customStopwords = null;
|
||
|
|
@JsonProperty("preserve_patterns")
|
||
|
|
private List<String> preservePatterns = List.of();
|
||
|
|
@JsonProperty("target_reduction")
|
||
|
|
private Float targetReduction = null;
|
||
|
|
@JsonProperty("enable_semantic_clustering")
|
||
|
|
private boolean enableSemanticClustering = false;
|
||
|
|
|
||
|
|
/** Sets the level field. */
|
||
|
|
@JsonProperty("level")
|
||
|
|
public Builder withLevel(final ReductionLevel value) {
|
||
|
|
this.level = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the languageHint field. */
|
||
|
|
@JsonProperty("language_hint")
|
||
|
|
public Builder withLanguageHint(final @Nullable String value) {
|
||
|
|
this.languageHint = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the preserveMarkdown field. */
|
||
|
|
@JsonProperty("preserve_markdown")
|
||
|
|
public Builder withPreserveMarkdown(final boolean value) {
|
||
|
|
this.preserveMarkdown = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the preserveCode field. */
|
||
|
|
@JsonProperty("preserve_code")
|
||
|
|
public Builder withPreserveCode(final boolean value) {
|
||
|
|
this.preserveCode = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the semanticThreshold field. */
|
||
|
|
@JsonProperty("semantic_threshold")
|
||
|
|
public Builder withSemanticThreshold(final float value) {
|
||
|
|
this.semanticThreshold = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the enableParallel field. */
|
||
|
|
@JsonProperty("enable_parallel")
|
||
|
|
public Builder withEnableParallel(final boolean value) {
|
||
|
|
this.enableParallel = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the useSimd field. */
|
||
|
|
@JsonProperty("use_simd")
|
||
|
|
public Builder withUseSimd(final boolean value) {
|
||
|
|
this.useSimd = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the customStopwords field. */
|
||
|
|
@JsonProperty("custom_stopwords")
|
||
|
|
public Builder withCustomStopwords(final @Nullable Map<String, List<String>> value) {
|
||
|
|
this.customStopwords = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the preservePatterns field. */
|
||
|
|
@JsonProperty("preserve_patterns")
|
||
|
|
public Builder withPreservePatterns(final List<String> value) {
|
||
|
|
this.preservePatterns = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the targetReduction field. */
|
||
|
|
@JsonProperty("target_reduction")
|
||
|
|
public Builder withTargetReduction(final @Nullable float value) {
|
||
|
|
this.targetReduction = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the enableSemanticClustering field. */
|
||
|
|
@JsonProperty("enable_semantic_clustering")
|
||
|
|
public Builder withEnableSemanticClustering(final boolean value) {
|
||
|
|
this.enableSemanticClustering = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Builds the TokenReductionConfig instance. */
|
||
|
|
public TokenReductionConfig build() {
|
||
|
|
return new TokenReductionConfig(
|
||
|
|
level,
|
||
|
|
languageHint,
|
||
|
|
preserveMarkdown,
|
||
|
|
preserveCode,
|
||
|
|
semanticThreshold,
|
||
|
|
enableParallel,
|
||
|
|
useSimd,
|
||
|
|
customStopwords,
|
||
|
|
preservePatterns,
|
||
|
|
targetReduction,
|
||
|
|
enableSemanticClustering
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
// CPD-ON
|
||
|
|
public static TokenReductionConfig defaultInstance() {
|
||
|
|
throw new UnsupportedOperationException("defaultInstance is not yet bridged via JNI; use the Builder instead.");
|
||
|
|
}
|
||
|
|
}
|