OnlinePunctuationModelConfig.java
1.7 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
62
63
64
65
66
67
68
// Copyright 2024 Xiaomi Corporation
package com.k2fsa.sherpa.onnx;
public class OnlinePunctuationModelConfig {
private final String cnnBilstm;
private final String bpeVocab;
private final int numThreads;
private final boolean debug;
private final String provider;
private OnlinePunctuationModelConfig(Builder builder) {
this.cnnBilstm = builder.cnnBilstm;
this.bpeVocab = builder.bpeVocab;
this.numThreads = builder.numThreads;
this.debug = builder.debug;
this.provider = builder.provider;
}
public static Builder builder() {
return new Builder();
}
public String getCnnBilstm() {
return cnnBilstm;
}
public String getBpeVocab() {
return bpeVocab;
}
public static class Builder {
private String cnnBilstm = "";
private String bpeVocab = "";
private int numThreads = 1;
private boolean debug = true;
private String provider = "cpu";
public OnlinePunctuationModelConfig build() {
return new OnlinePunctuationModelConfig(this);
}
public Builder setCnnBilstm(String cnnBilstm) {
this.cnnBilstm = cnnBilstm;
return this;
}
public Builder setBpeVocab(String bpeVocab) {
this.bpeVocab = bpeVocab;
return this;
}
public Builder setNumThreads(int numThreads) {
this.numThreads = numThreads;
return this;
}
public Builder setDebug(boolean debug) {
this.debug = debug;
return this;
}
public Builder setProvider(String provider) {
this.provider = provider;
return this;
}
}
}