-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathTextAnalyzer.java
More file actions
61 lines (48 loc) · 1.51 KB
/
TextAnalyzer.java
File metadata and controls
61 lines (48 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package io.weaviate.client6.v1.api.collections;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import com.google.gson.annotations.SerializedName;
import io.weaviate.client6.v1.internal.ObjectBuilder;
public record TextAnalyzer(
@SerializedName("ascii_fold") Boolean foldAscii,
@SerializedName("ascii_fold_ignore") List<String> keepAscii,
@SerializedName("stopword_preset") String stopwordPreset) {
public static TextAnalyzer of() {
return null;
}
public static TextAnalyzer of(Function<Builder, ObjectBuilder<TextAnalyzer>> fn) {
return fn.apply(new Builder()).build();
}
public TextAnalyzer(Builder builder) {
this(
builder.foldAscii,
builder.keepAscii,
builder.stopwordPreset);
}
public static class Builder implements ObjectBuilder<TextAnalyzer> {
Boolean foldAscii = true;
List<String> keepAscii = new ArrayList<>();
String stopwordPreset;
public Builder foldAscii(boolean enable) {
this.foldAscii = enable;
return this;
}
public Builder keepAscii(String... keepAscii) {
return keepAscii(Arrays.asList(keepAscii));
}
public Builder keepAscii(List<String> keepAscii) {
this.keepAscii = keepAscii;
return this;
}
public Builder stopwordPreset(String stopwordPreset) {
this.stopwordPreset = stopwordPreset;
return this;
}
@Override
public TextAnalyzer build() {
return new TextAnalyzer(this);
}
}
}